From f383cb8354223de3d8a630800ebeffc470737960 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 6 Oct 2017 19:48:18 -0400 Subject: [PATCH] update labels --- asm/credits.s | 6 +- asm/starter_choose.s | 8 +- data/data4.s | 13 +-- data/save_failed_screen.s | 8 +- src/save_failed_screen.c | 210 +++++++++++++++++++------------------- sym_ewram.txt | 6 +- 6 files changed, 124 insertions(+), 127 deletions(-) diff --git a/asm/credits.s b/asm/credits.s index 0a568a3ae..0b2da16b8 100644 --- a/asm/credits.s +++ b/asm/credits.s @@ -491,14 +491,14 @@ _08175906: ldr r1, =gReservedSpritePaletteCount movs r0, 0x8 strb r0, [r1] - ldr r0, =gUnknown_085B0E04 + ldr r0, =gBirchHelpGfx movs r1, 0xC0 lsls r1, 19 bl LZ77UnCompVram - ldr r0, =gUnknown_085B0C0C + ldr r0, =gBirchGrassTilemap ldr r1, =0x06003800 bl LZ77UnCompVram - ldr r0, =gUnknown_085B0A02 + ldr r0, =gBirchBagGrassPal + 0x2 movs r1, 0x1 movs r2, 0x3E bl LoadPalette diff --git a/asm/starter_choose.s b/asm/starter_choose.s index 7e998c45f..da42959ea 100644 --- a/asm/starter_choose.s +++ b/asm/starter_choose.s @@ -122,12 +122,12 @@ set_256color_bg_bg0: @ 8133F0C ldr r0, =0x81000200 str r0, [r2, 0x8] ldr r0, [r2, 0x8] - ldr r0, =gUnknown_085B0E04 + ldr r0, =gBirchHelpGfx bl LZ77UnCompVram - ldr r0, =gUnknown_085B0A80 + ldr r0, =gBirchBagTilemap ldr r1, =0x06003000 bl LZ77UnCompVram - ldr r0, =gUnknown_085B0C0C + ldr r0, =gBirchGrassTilemap ldr r1, =0x06003800 bl LZ77UnCompVram movs r0, 0 @@ -155,7 +155,7 @@ set_256color_bg_bg0: @ 8133F0C movs r1, 0xE0 movs r2, 0x20 bl LoadPalette - ldr r0, =gUnknown_085B0A00 + ldr r0, =gBirchBagGrassPal movs r1, 0 movs r2, 0x40 bl LoadPalette diff --git a/data/data4.s b/data/data4.s index 202b1ffe7..d99336e87 100644 --- a/data/data4.s +++ b/data/data4.s @@ -14,19 +14,16 @@ gUnknown_085B09F4:: @ 85B09F4 gUnknown_085B09F8:: @ 85B09F8 .incbin "baserom.gba", 0x5b09f8, 0x8 -gUnknown_085B0A00:: @ 85B0A00 - .incbin "baserom.gba", 0x5b0a00, 0x2 +gBirchBagGrassPal:: @ 85B0A00 + .incbin "baserom.gba", 0x5b0a00, 0x80 -gUnknown_085B0A02:: @ 85B0A02 - .incbin "baserom.gba", 0x5b0a02, 0x7e - -gUnknown_085B0A80:: @ 85B0A80 +gBirchBagTilemap:: @ 85B0A80 .incbin "baserom.gba", 0x5b0a80, 0x18c -gUnknown_085B0C0C:: @ 85B0C0C +gBirchGrassTilemap:: @ 85B0C0C .incbin "baserom.gba", 0x5b0c0c, 0x1f8 -gUnknown_085B0E04:: @ 85B0E04 +gBirchHelpGfx:: @ 85B0E04 .incbin "baserom.gba", 0x5b0e04, 0xfc8 gUnknown_085B1DCC:: @ 85B1DCC diff --git a/data/save_failed_screen.s b/data/save_failed_screen.s index 446eee2d2..1b9fb7ed1 100644 --- a/data/save_failed_screen.s +++ b/data/save_failed_screen.s @@ -3,7 +3,7 @@ .section .rodata -gUnknown_085EFD80:: @ 85EFD80 +gClockOamData:: @ 85EFD80 .incbin "baserom.gba", 0x5efd80, 0x8 gUnknown_085EFD88:: @ 85EFD88 @@ -18,11 +18,11 @@ gUnknown_085EFD9C:: @ 85EFD9C gUnknown_085EFDA4:: @ 85EFDA4 .incbin "baserom.gba", 0x5efda4, 0x8 -gUnknown_085EFDAC:: @ 85EFDAC +gClockFrames:: @ 85EFDAC .incbin "baserom.gba", 0x5efdac, 0x18 -gUnknown_085EFDC4:: @ 85EFDC4 +gSaveFailedClockPal:: @ 85EFDC4 .incbin "baserom.gba", 0x5efdc4, 0x20 -gUnknown_085EFDE4:: @ 85EFDE4 +gSaveFailedClockGfx:: @ 85EFDE4 .incbin "baserom.gba", 0x5efde4, 0x90 diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 546342b9d..666de5c95 100755 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -19,14 +19,14 @@ extern void (*gGameContinueCallback)(void); extern u32 gDamagedSaveSectors; -extern u16 gUnknown_0203BCFC; -extern const u8 gUnknown_085B0E04[]; -extern const u8 gUnknown_085B0A80[]; -extern const u8 gUnknown_085B0C0C[]; -extern const u8 gUnknown_085EFDE4[]; +extern u16 gSaveFailedType; +extern const u8 gBirchHelpGfx[]; +extern const u8 gBirchBagTilemap[]; +extern const u8 gBirchGrassTilemap[]; +extern const u8 gSaveFailedClockGfx[]; -extern const struct OamData gUnknown_085EFD80; // sClockOamData -extern const u8 gUnknown_085EFDAC[8][3]; // sClockFrames +extern const struct OamData gClockOamData; // sClockOamData +extern const u8 gClockFrames[8][3]; // sClockFrames extern const struct BgTemplate gUnknown_085EFD88[]; extern const struct WindowTemplate gUnknown_085EFD94[]; @@ -35,8 +35,8 @@ extern struct WindowTemplate gUnknown_085EFDA4; extern struct SaveSection gSaveDataBuffer; extern const u32 gUnknown_0850E87C[]; -extern const u16 gUnknown_085B0A00[]; -extern const u16 gUnknown_085EFDC4[]; +extern const u16 gBirchBagGrassPal[]; +extern const u16 gSaveFailedClockPal[]; extern const u16 gUnknown_0850FEFC[]; extern const u16 gUnknown_0860F074[]; @@ -47,64 +47,64 @@ extern u8 gText_SaveCompleteGameCannotContinue[]; extern u8 gText_SaveCompletePressA[]; extern u8 gText_GamePlayCannotBeContinued[]; -extern void sub_8179454(void); - extern u8 gDecompressionBuffer[]; -struct Unk203BCFC +struct ClockInfo { - u16 unk0; - u16 unk2; + bool16 clockRunning; + u16 debugTimer; // appears to be unused; it's only set to 0 and never used within the game. perhaps it was a volatile-like timer expected to be modified by an external tool? }; -extern struct Unk203BCFC gUnknown_0203BCFE; +extern struct ClockInfo gSaveFailedClockInfo; -struct Unk203BD0E +struct WindowIds { - u8 unk0; - u8 unk1; + u8 textWindowId; + u8 clockWindowId; }; -extern struct Unk203BD0E gUnknown_0203BD0E; +extern struct WindowIds gSaveFailedWindowIds; -void sub_8178FDC(void); -void sub_8179288(void); -void sub_8179390(void); -void sub_81793E0(void); -bool8 sub_81795AC(u32); -void sub_8179428(void); -bool8 sub_8179514(u16 sector); +static void CB2_SaveFailedScreen(void); +static void CB2_WipeSave(void); +static void CB2_GameplayCannotBeContinued(void); +static void CB2_FadeAndReturnToTitleScreen(void); +static void CB2_ReturnToTitleScreen(void); +static void VBlankCB_UpdateClockGraphics(void); +static bool8 VerifySectorWipe(u16 sector); +static bool8 WipeSectors(u32); -void sub_8178F44(u8 *text, u8 var1, u8 var2) +// although this is a general text printer, it's only used in this file. +static void SaveFailedScreenTextPrint(u8 *text, u8 var1, u8 var2) { struct TextColor color; color.fgColor = 0; color.bgColor = 15; color.shadowColor = 3; - AddTextPrinterParametrized2(gUnknown_0203BD0E.unk0, 1, var1 * 8, var2 * 8 + 1, 0, 0, &color, 0, text); + AddTextPrinterParametrized2(gSaveFailedWindowIds.textWindowId, 1, var1 * 8, var2 * 8 + 1, 0, 0, &color, 0, text); } void DoSaveFailedScreen(u8 saveType) { - SetMainCallback2(sub_8178FDC); - gUnknown_0203BCFC = saveType; - gUnknown_0203BCFE.unk0 = 0; - gUnknown_0203BCFE.unk2 = 0; - gUnknown_0203BD0E.unk0 = 0; - gUnknown_0203BD0E.unk1 = 0; + SetMainCallback2(CB2_SaveFailedScreen); + gSaveFailedType = saveType; + gSaveFailedClockInfo.clockRunning = FALSE; + gSaveFailedClockInfo.debugTimer = 0; + gSaveFailedWindowIds.textWindowId = 0; + gSaveFailedWindowIds.clockWindowId = 0; } -void sub_8178FC8(void) +static void VBlankCB(void) { LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); } -void sub_8178FDC(void) +static void CB2_SaveFailedScreen(void) { - switch(gMain.state) + switch (gMain.state) { case 0: default: @@ -126,10 +126,10 @@ void sub_8178FDC(void) DmaFill16(3, 0, VRAM, VRAM_SIZE); DmaFill32(3, 0, OAM, OAM_SIZE); DmaFill16(3, 0, PLTT, PLTT_SIZE); - LZ77UnCompVram(gUnknown_085B0E04, (void *)VRAM); - LZ77UnCompVram(gUnknown_085B0A80, (void *)(VRAM + 0x7000)); - LZ77UnCompVram(gUnknown_085B0C0C, (void *)(VRAM + 0x7800)); - LZ77UnCompVram(gUnknown_085EFDE4, (void *)(VRAM + 0x10020)); + LZ77UnCompVram(gBirchHelpGfx, (void *)VRAM); + LZ77UnCompVram(gBirchBagTilemap, (void *)(VRAM + 0x7000)); + LZ77UnCompVram(gBirchGrassTilemap, (void *)(VRAM + 0x7800)); + LZ77UnCompVram(gSaveFailedClockGfx, (void *)(VRAM + 0x10020)); ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, gUnknown_085EFD88, 3); SetBgTilemapBuffer(0, (void *)&gDecompressionBuffer[0x2000]); @@ -137,28 +137,28 @@ void sub_8178FDC(void) LoadBgTiles(0, gUnknown_0850E87C, 0x120, 0x214); InitWindows(gUnknown_085EFD94); // AddWindowWithoutTileMap returns a u16/integer, but the info is clobbered into a u8 here resulting in lost info. Bug? - gUnknown_0203BD0E.unk0 = AddWindowWithoutTileMap(&gUnknown_085EFD9C); - SetWindowAttribute(gUnknown_0203BD0E.unk0, 7, (u32)&gDecompressionBuffer[0x2800]); - gUnknown_0203BD0E.unk1 = AddWindowWithoutTileMap(&gUnknown_085EFDA4); - SetWindowAttribute(gUnknown_0203BD0E.unk1, 7, (u32)&gDecompressionBuffer[0x3D00]); + gSaveFailedWindowIds.textWindowId = AddWindowWithoutTileMap(&gUnknown_085EFD9C); + SetWindowAttribute(gSaveFailedWindowIds.textWindowId, 7, (u32)&gDecompressionBuffer[0x2800]); + gSaveFailedWindowIds.clockWindowId = AddWindowWithoutTileMap(&gUnknown_085EFDA4); + SetWindowAttribute(gSaveFailedWindowIds.clockWindowId, 7, (u32)&gDecompressionBuffer[0x3D00]); DeactivateAllTextPrinters(); ResetSpriteData(); ResetTasks(); ResetPaletteFade(); - LoadPalette(gUnknown_085B0A00, 0, 0x40); - LoadPalette(gUnknown_085EFDC4, 0x100, 0x20); + LoadPalette(gBirchBagGrassPal, 0, 0x40); + LoadPalette(gSaveFailedClockPal, 0x100, 0x20); LoadPalette(gUnknown_0850FEFC, 0xE0, 0x20); LoadPalette(gUnknown_0860F074, 0xF0, 0x20); - SetWindowBorderStyle(gUnknown_0203BD0E.unk0, FALSE, 0x214, 0xE); - SetWindowBorderStyle(gUnknown_0203BD0E.unk1, FALSE, 0x214, 0xE); - FillWindowPixelBuffer(gUnknown_0203BD0E.unk1, 0x11); // backwards? - FillWindowPixelBuffer(gUnknown_0203BD0E.unk0, 0x11); - CopyWindowToVram(gUnknown_0203BD0E.unk1, 2); // again? - CopyWindowToVram(gUnknown_0203BD0E.unk0, 1); - sub_8178F44(gText_SaveFailedCheckingBackup, 1, 0); + SetWindowBorderStyle(gSaveFailedWindowIds.textWindowId, FALSE, 0x214, 0xE); + SetWindowBorderStyle(gSaveFailedWindowIds.clockWindowId, FALSE, 0x214, 0xE); + FillWindowPixelBuffer(gSaveFailedWindowIds.clockWindowId, 0x11); // backwards? + FillWindowPixelBuffer(gSaveFailedWindowIds.textWindowId, 0x11); + CopyWindowToVram(gSaveFailedWindowIds.clockWindowId, 2); // again? + CopyWindowToVram(gSaveFailedWindowIds.textWindowId, 1); + SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); EnableInterrupts(1); - SetVBlankCallback(sub_8178FC8); + SetVBlankCallback(VBlankCB); SetGpuReg(0, 0x1040); ShowBg(0); ShowBg(2); @@ -166,92 +166,92 @@ void sub_8178FDC(void) gMain.state++; break; case 1: - if(!UpdatePaletteFade()) + if (!UpdatePaletteFade()) { - SetMainCallback2(sub_8179288); - SetVBlankCallback(sub_8179454); + SetMainCallback2(CB2_WipeSave); + SetVBlankCallback(VBlankCB_UpdateClockGraphics); } break; } } -void sub_8179288(void) +static void CB2_WipeSave(void) { u8 wipeTries = 0; - gUnknown_0203BCFE.unk0 = TRUE; + gSaveFailedClockInfo.clockRunning = TRUE; while (gDamagedSaveSectors != 0 && wipeTries < 3) { - if (sub_81795AC(gDamagedSaveSectors) != FALSE) + if (WipeSectors(gDamagedSaveSectors) != FALSE) { - FillWindowPixelBuffer(gUnknown_0203BD0E.unk0, 0x11); - sub_8178F44(gText_BackupMemoryDamaged, 1, 0); - SetMainCallback2(sub_8179390); + FillWindowPixelBuffer(gSaveFailedWindowIds.textWindowId, 0x11); + SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); + SetMainCallback2(CB2_GameplayCannotBeContinued); return; } - FillWindowPixelBuffer(gUnknown_0203BD0E.unk0, 0x11); - sub_8178F44(gText_CheckCompleted, 1, 0); - HandleSavingData(gUnknown_0203BCFC); + FillWindowPixelBuffer(gSaveFailedWindowIds.textWindowId, 0x11); + SaveFailedScreenTextPrint(gText_CheckCompleted, 1, 0); + HandleSavingData(gSaveFailedType); - if(gDamagedSaveSectors != 0) + if (gDamagedSaveSectors != 0) { - FillWindowPixelBuffer(gUnknown_0203BD0E.unk0, 0x11); - sub_8178F44(gText_SaveFailedCheckingBackup, 1, 0); + FillWindowPixelBuffer(gSaveFailedWindowIds.textWindowId, 0x11); + SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); } wipeTries++; } - if(wipeTries == 3) + if (wipeTries == 3) { - FillWindowPixelBuffer(gUnknown_0203BD0E.unk0, 0x11); - sub_8178F44(gText_BackupMemoryDamaged, 1, 0); + FillWindowPixelBuffer(gSaveFailedWindowIds.textWindowId, 0x11); + SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); } else { - FillWindowPixelBuffer(gUnknown_0203BD0E.unk0, 0x11); + FillWindowPixelBuffer(gSaveFailedWindowIds.textWindowId, 0x11); - if(gGameContinueCallback == NULL) - sub_8178F44(gText_SaveCompleteGameCannotContinue, 1, 0); + if (gGameContinueCallback == NULL) + SaveFailedScreenTextPrint(gText_SaveCompleteGameCannotContinue, 1, 0); else - sub_8178F44(gText_SaveCompletePressA, 1, 0); + SaveFailedScreenTextPrint(gText_SaveCompletePressA, 1, 0); } - SetMainCallback2(sub_81793E0); + SetMainCallback2(CB2_FadeAndReturnToTitleScreen); } -void sub_8179390(void) +static void CB2_GameplayCannotBeContinued(void) { - gUnknown_0203BCFE.unk0 = FALSE; + gSaveFailedClockInfo.clockRunning = FALSE; - if(gMain.newKeys & A_BUTTON) + if (gMain.newKeys & A_BUTTON) { - FillWindowPixelBuffer(gUnknown_0203BD0E.unk0, 0x11); - sub_8178F44(gText_GamePlayCannotBeContinued, 1, 0); - SetVBlankCallback(sub_8178FC8); - SetMainCallback2(sub_81793E0); + FillWindowPixelBuffer(gSaveFailedWindowIds.textWindowId, 0x11); + SaveFailedScreenTextPrint(gText_GamePlayCannotBeContinued, 1, 0); + SetVBlankCallback(VBlankCB); + SetMainCallback2(CB2_FadeAndReturnToTitleScreen); } } -void sub_81793E0(void) +static void CB2_FadeAndReturnToTitleScreen(void) { - gUnknown_0203BCFE.unk0 = FALSE; + gSaveFailedClockInfo.clockRunning = FALSE; - if(gMain.newKeys & A_BUTTON) + if (gMain.newKeys & A_BUTTON) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); - SetVBlankCallback(sub_8178FC8); - SetMainCallback2(sub_8179428); + SetVBlankCallback(VBlankCB); + SetMainCallback2(CB2_ReturnToTitleScreen); } } -void sub_8179428(void) +void CB2_ReturnToTitleScreen(void) { - if(!UpdatePaletteFade()) + if (!UpdatePaletteFade()) { - if(gGameContinueCallback == NULL) // no callback exists, so do a soft reset. + if (gGameContinueCallback == NULL) // no callback exists, so do a soft reset. { DoSoftReset(); } @@ -263,18 +263,18 @@ void sub_8179428(void) } } -void sub_8179454(void) +static void VBlankCB_UpdateClockGraphics(void) { unsigned int n = (gMain.vblankCounter2 >> 3) & 7; - gMain.oamBuffer[0] = gUnknown_085EFD80; + gMain.oamBuffer[0] = gClockOamData; gMain.oamBuffer[0].x = 112; gMain.oamBuffer[0].y = (CLOCK_WIN_TOP + 1) * 8;; - if(gUnknown_0203BCFE.unk0 != FALSE) + if (gSaveFailedClockInfo.clockRunning != FALSE) { - gMain.oamBuffer[0].tileNum = gUnknown_085EFDAC[n][0]; - gMain.oamBuffer[0].matrixNum = (gUnknown_085EFDAC[n][2] << 4) | (gUnknown_085EFDAC[n][1] << 3); + gMain.oamBuffer[0].tileNum = gClockFrames[n][0]; + gMain.oamBuffer[0].matrixNum = (gClockFrames[n][2] << 4) | (gClockFrames[n][1] << 3); } else { @@ -283,11 +283,11 @@ void sub_8179454(void) CpuFastCopy(gMain.oamBuffer, (void *)OAM, 4); - if(gUnknown_0203BCFE.unk2) - gUnknown_0203BCFE.unk2--; + if (gSaveFailedClockInfo.debugTimer) + gSaveFailedClockInfo.debugTimer--; } -bool8 sub_8179514(u16 sector) +static bool8 VerifySectorWipe(u16 sector) { u32 *ptr = (u32 *)&gSaveDataBuffer; u16 i; @@ -301,7 +301,7 @@ bool8 sub_8179514(u16 sector) return FALSE; } -bool8 sub_8179554(u16 sector) +static bool8 WipeSector(u16 sector) { u16 i, j; bool8 failed = TRUE; @@ -311,18 +311,18 @@ bool8 sub_8179554(u16 sector) for (j = 0; j < 0x1000; j++) ProgramFlashByte(sector, j, 0); - failed = sub_8179514(sector); + failed = VerifySectorWipe(sector); } return failed; } -bool8 sub_81795AC(u32 sectorBits) +static bool8 WipeSectors(u32 sectorBits) { u16 i; for (i = 0; i < 0x20; i++) - if ((sectorBits & (1 << i)) && !sub_8179554(i)) + if ((sectorBits & (1 << i)) && !WipeSector(i)) sectorBits &= ~(1 << i); if (sectorBits == 0) diff --git a/sym_ewram.txt b/sym_ewram.txt index b7807e8a3..6331eb565 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1639,13 +1639,13 @@ gUnknown_0203BCF4: @ 203BCF4 gUnknown_0203BCF8: @ 203BCF8 .space 0x4 -gUnknown_0203BCFC: @ 203BCFC +gSaveFailedType: @ 203BCFC .space 0x2 -gUnknown_0203BCFE: @ 203BCFE +gSaveFailedClockInfo: @ 203BCFE .space 0x10 -gUnknown_0203BD0E: @ 203BD0E +gSaveFailedWindowIds: @ 203BD0E .space 0x6 gBraillePuzzleCallbackFlag: @ 203BD14