diff --git a/asm/text.s b/asm/text.s index 2afc5070a..06954f8fc 100644 --- a/asm/text.s +++ b/asm/text.s @@ -6975,45 +6975,4 @@ _080097A8: .4byte 0x06017e00 _080097AC: .4byte gUnknown_80B88C0 thumb_func_end InitGraphics - thumb_func_start sub_80097B0 -sub_80097B0: - push {r4-r6,lr} - ldr r0, _080097F8 - ldr r1, _080097FC - bl OpenFileAndGetFileDataPtr - adds r6, r0, 0 - ldr r4, _08009800 - ldr r1, [r6, 0x4] - movs r2, 0x80 - lsls r2, 2 - adds r0, r4, 0 - bl CpuCopy - bl sub_80063B0 - adds r5, r4, 0 - adds r5, 0x40 - cmp r0, 0x1 - bne _080097D8 - adds r5, r4, 0 -_080097D8: - movs r4, 0 -_080097DA: - adds r0, r4, 0 - adds r0, 0xF0 - adds r1, r5, 0 - bl SetBGPaletteBufferColorArray - adds r5, 0x4 - adds r4, 0x1 - cmp r4, 0xF - ble _080097DA - adds r0, r6, 0 - bl CloseFile - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_080097F8: .4byte gUnknown_80B88CC -_080097FC: .4byte gSystemFileArchive -_08009800: .4byte gUnknown_202D038 - thumb_func_end sub_80097B0 - .align 2, 0 @ Don't pad with nop. diff --git a/src/code_8009804.c b/src/code_8009804.c index d06bf6949..ac7c81aee 100644 --- a/src/code_8009804.c +++ b/src/code_8009804.c @@ -1,9 +1,11 @@ #include "global.h" +#include "file_system.h" extern u8 gUnknown_202D238[4]; - extern s32 gUnknown_202D23C; extern u16 gUnknown_202B038[4][32][32]; +extern u8 gUnknown_80B88CC[]; +struct FileArchive gSystemFileArchive; struct unkStruct_202D240 { @@ -16,16 +18,37 @@ extern struct unkStruct_202D240 gUnknown_202D240[8]; struct unkStruct_202D038 { // size: 0x40 - u32 unk0; - u32 unk4; - u8 fill[0x40 - 0x8]; + u32 unk0[0x10]; }; extern struct unkStruct_202D038 gUnknown_202D038[8]; extern void CpuCopy(void* dest, void *src, s32 size); +extern void SetBGPaletteBufferColorArray(s32 index, void *colorArray); extern void sub_8009A1C(u32); +u32 sub_80063B0(void); +void sub_80097B0(void) +{ + struct OpenedFile *fontpalFile; + s32 index; + u32 *ptr; + + fontpalFile = OpenFileAndGetFileDataPtr(gUnknown_80B88CC,&gSystemFileArchive); // fontpal + CpuCopy(gUnknown_202D038, fontpalFile->data, sizeof(gUnknown_202D038)); + if (sub_80063B0() == 1) { + ptr = &gUnknown_202D038[0].unk0[0]; + } + else + { + ptr = &gUnknown_202D038[1].unk0[0]; + } + for(index = 0; index < 0x10; ptr++, index++) + { + SetBGPaletteBufferColorArray(index + 0xf0, ptr); + } + CloseFile(fontpalFile); +} void vram_related_8009804(void) { @@ -131,7 +154,7 @@ void sub_80099F0(u32 r0) s32 iVar2; for(iVar2 = 0; iVar2 < 8; iVar2++) { - gUnknown_202D038[iVar2].unk4 = r0; + gUnknown_202D038[iVar2].unk0[1] = r0; } }