mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
sub_81BF5A4
This commit is contained in:
parent
8604291b0f
commit
c5dddf41f5
@ -5,211 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_81BF5A4
|
||||
sub_81BF5A4: @ 81BF5A4
|
||||
push {r4-r6,lr}
|
||||
mov r6, r8
|
||||
push {r6}
|
||||
sub sp, 0x10
|
||||
movs r0, 0x8
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0xA
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x10
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x12
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x14
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x16
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x50
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r1, 0
|
||||
str r1, [sp, 0xC]
|
||||
ldr r4, =0x040000d4
|
||||
add r0, sp, 0xC
|
||||
str r0, [r4]
|
||||
movs r0, 0xC0
|
||||
lsls r0, 19
|
||||
str r0, [r4, 0x4]
|
||||
ldr r0, =0x85006000
|
||||
str r0, [r4, 0x8]
|
||||
ldr r0, [r4, 0x8]
|
||||
str r1, [sp, 0xC]
|
||||
add r0, sp, 0xC
|
||||
str r0, [r4]
|
||||
movs r0, 0xE0
|
||||
lsls r0, 19
|
||||
str r0, [r4, 0x4]
|
||||
ldr r2, =0x85000100
|
||||
str r2, [r4, 0x8]
|
||||
ldr r0, [r4, 0x8]
|
||||
str r1, [sp, 0xC]
|
||||
add r0, sp, 0xC
|
||||
str r0, [r4]
|
||||
movs r0, 0xA0
|
||||
lsls r0, 19
|
||||
str r0, [r4, 0x4]
|
||||
str r2, [r4, 0x8]
|
||||
ldr r0, [r4, 0x8]
|
||||
movs r0, 0
|
||||
bl ResetBgsAndClearDma3BusyFlags
|
||||
ldr r1, =gUnknown_08618108
|
||||
movs r0, 0
|
||||
movs r2, 0x2
|
||||
bl InitBgsFromTemplates
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgX
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgY
|
||||
movs r0, 0x1
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgX
|
||||
movs r0, 0x1
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgY
|
||||
ldr r0, =gUnknown_08618110
|
||||
bl InitWindows
|
||||
bl DeactivateAllTextPrinters
|
||||
ldr r0, =gUnknown_08618138
|
||||
str r0, [r4]
|
||||
ldr r0, =0x050001e0
|
||||
str r0, [r4, 0x4]
|
||||
ldr r0, =0x84000008
|
||||
str r0, [r4, 0x8]
|
||||
ldr r0, [r4, 0x8]
|
||||
movs r0, 0
|
||||
movs r1, 0x40
|
||||
bl SetGpuReg
|
||||
movs r0, 0x2
|
||||
movs r1, 0
|
||||
bl FillWindowPixelBuffer
|
||||
movs r0, 0x3
|
||||
movs r1, 0
|
||||
bl FillWindowPixelBuffer
|
||||
movs r0, 0
|
||||
movs r1, 0xAA
|
||||
bl FillWindowPixelBuffer
|
||||
ldr r5, =gUnknown_08617E9B
|
||||
movs r0, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0
|
||||
bl GetStringWidth
|
||||
adds r1, r0, 0
|
||||
movs r4, 0x78
|
||||
subs r0, r4, r1
|
||||
lsrs r1, r0, 31
|
||||
adds r0, r1
|
||||
asrs r0, 1
|
||||
lsls r2, r0, 24
|
||||
lsrs r2, 24
|
||||
ldr r6, =gUnknown_0861815B
|
||||
str r6, [sp]
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
mov r8, r0
|
||||
str r0, [sp, 0x4]
|
||||
str r5, [sp, 0x8]
|
||||
movs r0, 0x2
|
||||
movs r1, 0
|
||||
movs r3, 0x3
|
||||
bl box_print
|
||||
ldr r5, =gUnknown_08617E8D
|
||||
movs r0, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0
|
||||
bl GetStringWidth
|
||||
adds r1, r0, 0
|
||||
subs r4, r1
|
||||
lsrs r0, r4, 31
|
||||
adds r4, r0
|
||||
asrs r4, 1
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x78
|
||||
lsls r2, r0, 24
|
||||
lsrs r2, 24
|
||||
str r6, [sp]
|
||||
mov r0, r8
|
||||
str r0, [sp, 0x4]
|
||||
str r5, [sp, 0x8]
|
||||
movs r0, 0x2
|
||||
movs r1, 0
|
||||
movs r3, 0x3
|
||||
bl box_print
|
||||
movs r0, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0
|
||||
bl GetStringWidth
|
||||
adds r1, r0, 0
|
||||
movs r0, 0x70
|
||||
subs r0, r1
|
||||
lsrs r1, r0, 31
|
||||
adds r0, r1
|
||||
asrs r0, 1
|
||||
lsls r2, r0, 24
|
||||
lsrs r2, 24
|
||||
str r6, [sp]
|
||||
mov r0, r8
|
||||
str r0, [sp, 0x4]
|
||||
str r5, [sp, 0x8]
|
||||
movs r0, 0x3
|
||||
movs r1, 0
|
||||
movs r3, 0
|
||||
bl box_print
|
||||
ldr r4, =gUnknown_08617E78
|
||||
movs r0, 0x1
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
bl GetStringWidth
|
||||
adds r1, r0, 0
|
||||
movs r0, 0xD0
|
||||
subs r0, r1
|
||||
lsrs r1, r0, 31
|
||||
adds r0, r1
|
||||
asrs r0, 1
|
||||
lsls r2, r0, 24
|
||||
lsrs r2, 24
|
||||
ldr r0, =gUnknown_08618158
|
||||
str r0, [sp]
|
||||
mov r0, r8
|
||||
str r0, [sp, 0x4]
|
||||
str r4, [sp, 0x8]
|
||||
movs r0, 0
|
||||
movs r1, 0x1
|
||||
movs r3, 0x2
|
||||
bl box_print
|
||||
movs r0, 0x2
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
movs r0, 0x3
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
movs r0, 0
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
add sp, 0x10
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81BF5A4
|
||||
|
||||
thumb_func_start sub_81BF7A4
|
||||
sub_81BF7A4: @ 81BF7A4
|
||||
push {r4,r5,lr}
|
||||
|
19
include/bg.h
Normal file
19
include/bg.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef GUARD_bg_H
|
||||
#define GUARD_bg_H
|
||||
|
||||
struct BgTemplate {
|
||||
u32 bg:2;
|
||||
u32 charBaseIndex:2;
|
||||
u32 mapBaseIndex:5;
|
||||
u32 screenSize:2;
|
||||
u32 paletteMode:1;
|
||||
u32 priority:2;
|
||||
u32 baseTile:10;
|
||||
};
|
||||
|
||||
void ResetBgsAndClearDma3BusyFlags(u32);
|
||||
void InitBgsFromTemplates(u8, const struct BgTemplate *, u8);
|
||||
u32 ChangeBgX(u8, u32, u8);
|
||||
u32 ChangeBgY(u8, u32, u8);
|
||||
|
||||
#endif //GUARD_bg_H
|
@ -18,8 +18,8 @@ struct MultiBootParam
|
||||
u8 response_bit; // 1d
|
||||
u8 client_bit; // 1e
|
||||
u8 reserved1; // 1f
|
||||
u8 *boot_srcp; // 20
|
||||
u8 *boot_endp; // 24
|
||||
const u8 *boot_srcp; // 20
|
||||
const u8 *boot_endp; // 24
|
||||
const u8 *masterp;
|
||||
u8 *reserved2[MULTIBOOT_NCHILD];
|
||||
u32 system_work2[4];
|
||||
|
@ -15,4 +15,6 @@ struct MenuAction2
|
||||
void (*func)(u8);
|
||||
};
|
||||
|
||||
void box_print(u8, u8, u8, u8, const void *, s8, const u8 *);
|
||||
|
||||
#endif // GUARD_MENU_H
|
||||
|
@ -186,9 +186,9 @@ bool8 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter);
|
||||
bool8 TextPrinterWait(struct TextPrinter *textPrinter);
|
||||
void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *counter, u8 *yCoordIndex);
|
||||
u16 RenderText(struct TextPrinter *textPrinter);
|
||||
u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing);
|
||||
u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing);
|
||||
u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32);
|
||||
s32 GetStringWidth(u8 fontId, u8 *str, s16 letterSpacing);
|
||||
u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing);
|
||||
u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str);
|
||||
u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y);
|
||||
u8 GetKeypadIconTileOffset(u8 keypadIconId);
|
||||
|
@ -30,7 +30,7 @@ struct Window
|
||||
u8 *tileData;
|
||||
};
|
||||
|
||||
bool16 InitWindows(struct WindowTemplate *templates);
|
||||
bool16 InitWindows(const struct WindowTemplate *templates);
|
||||
u16 AddWindow(const struct WindowTemplate *template);
|
||||
int AddWindowWithoutTileMap(struct WindowTemplate *template);
|
||||
void RemoveWindow(u8 windowId);
|
||||
|
@ -1,13 +1,16 @@
|
||||
|
||||
// Includes
|
||||
#include "global.h"
|
||||
#include "multiboot.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "multiboot.h"
|
||||
#include "malloc.h"
|
||||
#include "bg.h"
|
||||
#include "main.h"
|
||||
#include "sprite.h"
|
||||
#include "task.h"
|
||||
#include "unknown_task.h"
|
||||
#include "malloc.h"
|
||||
#include "window.h"
|
||||
#include "menu.h"
|
||||
#include "m4a.h"
|
||||
|
||||
// Static type declarations
|
||||
@ -26,7 +29,7 @@ extern berryfix_t *gUnknown_030012B8;
|
||||
// Static ROM declarations
|
||||
|
||||
static void sub_81BF3DC(void);
|
||||
void sub_81BF5A4(void);
|
||||
static void sub_81BF5A4(void);
|
||||
u32 sub_81BF7A4(u8);
|
||||
|
||||
// .rodata
|
||||
@ -35,6 +38,14 @@ extern const u8 gUnknown_089A6550[0xC0];
|
||||
extern const u8 gMultiBootProgram_BerryGlitchFix_Script[0x3b34];
|
||||
extern const u8 gMultiBootProgram_BerryGlitchFix_Start[];
|
||||
extern const u8 gMultiBootProgram_BerryGlitchFix_End[];
|
||||
extern const u8 gUnknown_08617E78[];
|
||||
extern const u8 gUnknown_08617E8D[];
|
||||
extern const u8 gUnknown_08617E9B[];
|
||||
extern const struct BgTemplate gUnknown_08618108[2];
|
||||
extern const struct WindowTemplate gUnknown_08618110[7];
|
||||
extern const u16 gUnknown_08618138[16];
|
||||
extern const u8 gUnknown_08618158[3];
|
||||
extern const u8 gUnknown_0861815B[3];
|
||||
|
||||
// .text
|
||||
|
||||
@ -121,3 +132,258 @@ static void sub_81BF3DC(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
static void sub_81BF5A4(void)
|
||||
{
|
||||
s32 width;
|
||||
|
||||
SetGpuReg(REG_OFFSET_BG0CNT, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG0HOFS, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG0VOFS, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG1HOFS, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG1VOFS, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0x0000);
|
||||
|
||||
DmaFill32(3, 0, VRAM, VRAM_SIZE);
|
||||
DmaFill32(3, 0, OAM, OAM_SIZE);
|
||||
DmaFill32(3, 0, PLTT, PLTT_SIZE);
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
|
||||
InitBgsFromTemplates(0, gUnknown_08618108, ARRAY_COUNT(gUnknown_08618108));
|
||||
ChangeBgX(0, 0, 0);
|
||||
ChangeBgY(0, 0, 0);
|
||||
ChangeBgX(1, 0, 0);
|
||||
ChangeBgY(1, 0, 0);
|
||||
InitWindows(gUnknown_08618110);
|
||||
DeactivateAllTextPrinters();
|
||||
|
||||
DmaCopy32(3, gUnknown_08618138, BG_PLTT + 0x1E0, 0x20);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP);
|
||||
FillWindowPixelBuffer(2, 0);
|
||||
FillWindowPixelBuffer(3, 0);
|
||||
FillWindowPixelBuffer(0, 0xAA);
|
||||
|
||||
// This block is a meme among memes
|
||||
width = (0x78 - GetStringWidth(0, gUnknown_08617E9B, 0)) / 2;
|
||||
box_print(2, 0, width, 3, gUnknown_0861815B, -1, gUnknown_08617E9B);
|
||||
width = (s32)(0x78 - GetStringWidth(0, gUnknown_08617E9B, 0)) / 2 + 0x78;
|
||||
box_print(2, 0, width, 3, gUnknown_0861815B, -1, gUnknown_08617E8D);
|
||||
width = (0x70 - GetStringWidth(0, gUnknown_08617E8D, 0)) / 2;
|
||||
box_print(3, 0, width, 0, gUnknown_0861815B, -1, gUnknown_08617E8D);
|
||||
width = (0xd0 - GetStringWidth(1, gUnknown_08617E78, 0)) / 2;
|
||||
box_print(0, 1, width, 2, gUnknown_08618158, -1, gUnknown_08617E78);
|
||||
|
||||
CopyWindowToVram(2, 2);
|
||||
CopyWindowToVram(3, 2);
|
||||
CopyWindowToVram(0, 2);
|
||||
}
|
||||
#else
|
||||
__attribute__((naked)) static void sub_81BF5A4(void)
|
||||
{
|
||||
asm(".syntax unified\n"
|
||||
"\tpush {r4-r6,lr}\n"
|
||||
"\tmov r6, r8\n"
|
||||
"\tpush {r6}\n"
|
||||
"\tsub sp, 0x10\n"
|
||||
"\tmovs r0, 0x8\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0xA\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x10\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x12\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x14\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x16\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x50\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tstr r1, [sp, 0xC]\n"
|
||||
"\tldr r4, =0x040000d4\n"
|
||||
"\tadd r0, sp, 0xC\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"\tmovs r0, 0xC0\n"
|
||||
"\tlsls r0, 19\n"
|
||||
"\tstr r0, [r4, 0x4]\n"
|
||||
"\tldr r0, =0x85006000\n"
|
||||
"\tstr r0, [r4, 0x8]\n"
|
||||
"\tldr r0, [r4, 0x8]\n"
|
||||
"\tstr r1, [sp, 0xC]\n"
|
||||
"\tadd r0, sp, 0xC\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"\tmovs r0, 0xE0\n"
|
||||
"\tlsls r0, 19\n"
|
||||
"\tstr r0, [r4, 0x4]\n"
|
||||
"\tldr r2, =0x85000100\n"
|
||||
"\tstr r2, [r4, 0x8]\n"
|
||||
"\tldr r0, [r4, 0x8]\n"
|
||||
"\tstr r1, [sp, 0xC]\n"
|
||||
"\tadd r0, sp, 0xC\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"\tmovs r0, 0xA0\n"
|
||||
"\tlsls r0, 19\n"
|
||||
"\tstr r0, [r4, 0x4]\n"
|
||||
"\tstr r2, [r4, 0x8]\n"
|
||||
"\tldr r0, [r4, 0x8]\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tbl ResetBgsAndClearDma3BusyFlags\n"
|
||||
"\tldr r1, =gUnknown_08618108\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r2, 0x2\n"
|
||||
"\tbl InitBgsFromTemplates\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl ChangeBgX\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl ChangeBgY\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl ChangeBgX\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl ChangeBgY\n"
|
||||
"\tldr r0, =gUnknown_08618110\n"
|
||||
"\tbl InitWindows\n"
|
||||
"\tbl DeactivateAllTextPrinters\n"
|
||||
"\tldr r0, =gUnknown_08618138\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"\tldr r0, =0x050001e0\n"
|
||||
"\tstr r0, [r4, 0x4]\n"
|
||||
"\tldr r0, =0x84000008\n"
|
||||
"\tstr r0, [r4, 0x8]\n"
|
||||
"\tldr r0, [r4, 0x8]\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0x40\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl FillWindowPixelBuffer\n"
|
||||
"\tmovs r0, 0x3\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl FillWindowPixelBuffer\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0xAA\n"
|
||||
"\tbl FillWindowPixelBuffer\n"
|
||||
"\tldr r5, =gUnknown_08617E9B\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tadds r1, r5, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl GetStringWidth\n"
|
||||
"\tadds r1, r0, 0\n"
|
||||
"\tmovs r4, 0x78\n"
|
||||
"\tsubs r0, r4, r1\n"
|
||||
"\tlsrs r1, r0, 31\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tasrs r0, 1\n"
|
||||
"\tlsls r2, r0, 24\n"
|
||||
"\tlsrs r2, 24\n"
|
||||
"\tldr r6, =gUnknown_0861815B\n"
|
||||
"\tstr r6, [sp]\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tnegs r0, r0\n"
|
||||
"\tmov r8, r0\n"
|
||||
"\tstr r0, [sp, 0x4]\n"
|
||||
"\tstr r5, [sp, 0x8]\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r3, 0x3\n"
|
||||
"\tbl box_print\n"
|
||||
"\tldr r5, =gUnknown_08617E8D\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tadds r1, r5, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl GetStringWidth\n"
|
||||
"\tadds r1, r0, 0\n"
|
||||
"\tsubs r4, r1\n"
|
||||
"\tlsrs r0, r4, 31\n"
|
||||
"\tadds r4, r0\n"
|
||||
"\tasrs r4, 1\n"
|
||||
"\tadds r0, r4, 0\n"
|
||||
"\tadds r0, 0x78\n"
|
||||
"\tlsls r2, r0, 24\n"
|
||||
"\tlsrs r2, 24\n"
|
||||
"\tstr r6, [sp]\n"
|
||||
"\tmov r0, r8\n"
|
||||
"\tstr r0, [sp, 0x4]\n"
|
||||
"\tstr r5, [sp, 0x8]\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r3, 0x3\n"
|
||||
"\tbl box_print\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tadds r1, r5, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl GetStringWidth\n"
|
||||
"\tadds r1, r0, 0\n"
|
||||
"\tmovs r0, 0x70\n"
|
||||
"\tsubs r0, r1\n"
|
||||
"\tlsrs r1, r0, 31\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tasrs r0, 1\n"
|
||||
"\tlsls r2, r0, 24\n"
|
||||
"\tlsrs r2, 24\n"
|
||||
"\tstr r6, [sp]\n"
|
||||
"\tmov r0, r8\n"
|
||||
"\tstr r0, [sp, 0x4]\n"
|
||||
"\tstr r5, [sp, 0x8]\n"
|
||||
"\tmovs r0, 0x3\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r3, 0\n"
|
||||
"\tbl box_print\n"
|
||||
"\tldr r4, =gUnknown_08617E78\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tadds r1, r4, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl GetStringWidth\n"
|
||||
"\tadds r1, r0, 0\n"
|
||||
"\tmovs r0, 0xD0\n"
|
||||
"\tsubs r0, r1\n"
|
||||
"\tlsrs r1, r0, 31\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tasrs r0, 1\n"
|
||||
"\tlsls r2, r0, 24\n"
|
||||
"\tlsrs r2, 24\n"
|
||||
"\tldr r0, =gUnknown_08618158\n"
|
||||
"\tstr r0, [sp]\n"
|
||||
"\tmov r0, r8\n"
|
||||
"\tstr r0, [sp, 0x4]\n"
|
||||
"\tstr r4, [sp, 0x8]\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0x1\n"
|
||||
"\tmovs r3, 0x2\n"
|
||||
"\tbl box_print\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tbl CopyWindowToVram\n"
|
||||
"\tmovs r0, 0x3\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tbl CopyWindowToVram\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tbl CopyWindowToVram\n"
|
||||
"\tadd sp, 0x10\n"
|
||||
"\tpop {r3}\n"
|
||||
"\tmov r8, r3\n"
|
||||
"\tpop {r4-r6}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.pool\n"
|
||||
".syntax divided");
|
||||
}
|
||||
#endif
|
||||
|
15
src/bg.c
15
src/bg.c
@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "dma3.h"
|
||||
#include "bg.h"
|
||||
|
||||
#define DISPCNT_ALL_BG_AND_MODE_BITS 0x0F07
|
||||
|
||||
@ -34,16 +35,6 @@ struct BgControl {
|
||||
u16 bgVisibilityAndMode;
|
||||
};
|
||||
|
||||
struct BgTemplate {
|
||||
u32 bg:2;
|
||||
u32 charBaseIndex:2;
|
||||
u32 mapBaseIndex:5;
|
||||
u32 screenSize:2;
|
||||
u32 paletteMode:1;
|
||||
u32 priority:2;
|
||||
u32 baseTile:10;
|
||||
};
|
||||
|
||||
struct BgConfig2 {
|
||||
u32 baseTile:10;
|
||||
u32 basePalette:4;
|
||||
@ -335,7 +326,7 @@ void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable)
|
||||
gUnneededFireRedVariable = leftoverFireRedLeafGreenVariable;
|
||||
}
|
||||
|
||||
void InitBgsFromTemplates(u8 bgMode, struct BgTemplate *templates, u8 numTemplates)
|
||||
void InitBgsFromTemplates(u8 bgMode, const struct BgTemplate *templates, u8 numTemplates)
|
||||
{
|
||||
int i;
|
||||
u8 bg;
|
||||
@ -367,7 +358,7 @@ void InitBgsFromTemplates(u8 bgMode, struct BgTemplate *templates, u8 numTemplat
|
||||
}
|
||||
}
|
||||
|
||||
void InitBgFromTemplate(struct BgTemplate *template)
|
||||
void InitBgFromTemplate(const struct BgTemplate *template)
|
||||
{
|
||||
u8 bg = template->bg;
|
||||
|
||||
|
@ -316,7 +316,7 @@ void MultiBootStartProbe(struct MultiBootParam *mp)
|
||||
mp->probe_count = 1;
|
||||
}
|
||||
|
||||
void MultiBootStartMaster(struct MultiBootParam *mp, u8 *srcp, int length, u8 palette_color, s8 palette_speed)
|
||||
void MultiBootStartMaster(struct MultiBootParam *mp, const u8 *srcp, int length, u8 palette_color, s8 palette_speed)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -2779,7 +2779,7 @@ _08005D6E:\n\
|
||||
bx r1");
|
||||
}
|
||||
|
||||
u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing)
|
||||
u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing)
|
||||
{
|
||||
int i;
|
||||
u8 width;
|
||||
@ -2788,7 +2788,7 @@ u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing)
|
||||
u8 line;
|
||||
int strPos;
|
||||
u8 lineWidths[8];
|
||||
u8 *strLocal;
|
||||
const u8 *strLocal;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
@ -2883,7 +2883,7 @@ u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 GetStringWidth(u8 fontId, u8 *str, s16 letterSpacing)
|
||||
u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
|
||||
{
|
||||
bool8 isJapanese;
|
||||
int minGlyphWidth;
|
||||
|
@ -35,7 +35,7 @@ static void nullsub_8(void)
|
||||
|
||||
}
|
||||
|
||||
bool16 InitWindows(struct WindowTemplate *templates)
|
||||
bool16 InitWindows(const struct WindowTemplate *templates)
|
||||
{
|
||||
int i;
|
||||
void *bgTilemapBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user