From 91cfb6a564f73f02eb57792f8a0f4aa82e1867d1 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Tue, 16 Jan 2018 22:25:35 -0600 Subject: add debug ifdefs --- src/scene/cable_car.c | 218 +++++++++++++++++++++++++++++++++++++++++++++++ src/scene/new_game.c | 77 +++++++++++++++++ src/scene/title_screen.c | 17 ++++ 3 files changed, 312 insertions(+) (limited to 'src/scene') diff --git a/src/scene/cable_car.c b/src/scene/cable_car.c index d8e099130..4bf0cef09 100644 --- a/src/scene/cable_car.c +++ b/src/scene/cable_car.c @@ -6,6 +6,7 @@ #include "palette.h" #include "random.h" #include "main.h" +#include "menu.h" #include "script.h" #include "task.h" #include "sound.h" @@ -102,6 +103,31 @@ static void sub_81248AC(u8); // .rodata +#if DEBUG + +u8 debug_sub_8138D74(void); +u8 debug_sub_8138D8C(void); +u8 debug_sub_8138C14(void); +u8 debug_sub_8138C34(void); +u8 debug_sub_810CD9C(void); + +const u8 Str_842DBD0[] = _("CABLE CAR U"); +const u8 Str_842DBDC[] = _("CABLE CAR D"); +const u8 Str_842DBE8[] = _("ROULETTE1"); +const u8 Str_842DBF2[] = _("ROULETTE3"); +const u8 Str_842DBFC[] = _("View a MAIL"); + +const struct MenuAction gUnkDebug4Menu[] = +{ + {Str_842DBD0, debug_sub_8138D74}, + {Str_842DBDC, debug_sub_8138D8C}, + {Str_842DBE8, debug_sub_8138C14}, + {Str_842DBF2, debug_sub_8138C34}, + {Str_842DBFC, debug_sub_810CD9C}, +}; + +#endif + static const u8 gCableCarMtChimneyTilemap[] = INCBIN_U8("graphics/misc/cable_car_mt_chimney_map.bin.lz"); static const u8 gCableCarTreeTilemap[] = INCBIN_U8("graphics/misc/cable_car_tree_map.bin.lz"); @@ -182,6 +208,158 @@ static const struct SpriteTemplate gSpriteTemplate_8401D40[] = { // .text +#if DEBUG + +__attribute__((naked)) +u8 debug_sub_8138C14(void) +{ + asm("\n\ + push {lr}\n\ + ldr r0, ._1\n\ + mov r1, #0x1\n\ + strb r1, [r0]\n\ + ldr r0, ._1 + 4\n\ + bl ScriptContext1_SetupScript\n\ + bl CloseMenu\n\ + mov r0, #0x1\n\ + pop {r1}\n\ + bx r1\n\ +._2:\n\ + .align 2, 0\n\ +._1:\n\ + .word unk_203955C\n\ + .word MauvilleCity_GameCorner_EventScript_1C407E"); +} + +__attribute__((naked)) +u8 debug_sub_8138C34(void) +{ + asm("\n\ + push {lr}\n\ + ldr r0, ._3\n\ + mov r1, #0x1\n\ + strb r1, [r0]\n\ + ldr r0, ._3 + 4\n\ + bl ScriptContext1_SetupScript\n\ + bl CloseMenu\n\ + mov r0, #0x1\n\ + pop {r1}\n\ + bx r1\n\ +._4:\n\ + .align 2, 0\n\ +._3:\n\ + .word unk_203955C\n\ + .word MauvilleCity_GameCorner_EventScript_1C40AC"); +} + +__attribute__((naked)) +u8 debug_sub_8138C54(void) +{ + asm("\n\ + push {r4, lr}\n\ + ldr r4, ._10\n\ + ldrh r0, [r4, #0x2e]\n\ + cmp r0, #0x40\n\ + bne ._5 @cond_branch\n\ + mov r0, #0x1\n\ + neg r0, r0\n\ + bl Menu_MoveCursor\n\ +._5:\n\ + ldrh r0, [r4, #0x2e]\n\ + cmp r0, #0x80\n\ + bne ._6 @cond_branch\n\ + mov r0, #0x1\n\ + bl Menu_MoveCursor\n\ +._6:\n\ + ldrh r1, [r4, #0x2e]\n\ + cmp r1, #0x1\n\ + beq ._7 @cond_branch\n\ + ldr r0, ._10 + 4\n\ + cmp r1, r0\n\ + bne ._8 @cond_branch\n\ + ldr r1, ._10 + 8\n\ + mov r0, #0x1\n\ + strh r0, [r1]\n\ +._7:\n\ + ldr r4, ._10 + 12\n\ + bl Menu_GetCursorPos\n\ + lsl r0, r0, #0x18\n\ + lsr r0, r0, #0x15\n\ + add r4, r4, #0x4\n\ + add r0, r0, r4\n\ + ldr r0, [r0]\n\ + bl _call_via_r0\n\ + lsl r0, r0, #0x18\n\ + lsr r0, r0, #0x18\n\ + b ._13\n\ +._11:\n\ + .align 2, 0\n\ +._10:\n\ + .word gMain\n\ + .word 0x101\n\ + .word gSpecialVar_0x8004\n\ + .word gUnkDebug4Menu\n\ +._8:\n\ + cmp r1, #0x2\n\ + beq ._12 @cond_branch\n\ + mov r0, #0x0\n\ + b ._13\n\ +._12:\n\ + bl CloseMenu\n\ + mov r0, #0x1\n\ +._13:\n\ + pop {r4}\n\ + pop {r1}\n\ + bx r1"); +} + +__attribute__((naked)) +u8 debug_sub_8138CC4(void) +{ + asm("\n\ + push {lr}\n\ + add sp, sp, #0xfffffff8\n\ + ldr r1, ._14\n\ + mov r0, #0x0\n\ + strh r0, [r1]\n\ + bl Menu_EraseScreen\n\ + mov r0, #0x13\n\ + mov r1, #0x0\n\ + mov r2, #0x1d\n\ + mov r3, #0xc\n\ + bl Menu_DrawStdWindowFrame\n\ + ldr r3, ._14 + 4\n\ + mov r0, #0x14\n\ + mov r1, #0x1\n\ + mov r2, #0x5\n\ + bl Menu_PrintItems\n\ + mov r0, #0x0\n\ + str r0, [sp]\n\ + mov r0, #0x8\n\ + str r0, [sp, #0x4]\n\ + mov r0, #0x0\n\ + mov r1, #0x14\n\ + mov r2, #0x1\n\ + mov r3, #0x5\n\ + bl InitMenu\n\ + ldr r1, ._14 + 8\n\ + ldr r0, ._14 + 12\n\ + str r0, [r1]\n\ + mov r0, #0x0\n\ + add sp, sp, #0x8\n\ + pop {r1}\n\ + bx r1\n\ +._15:\n\ + .align 2, 0\n\ +._14:\n\ + .word gSpecialVar_0x8004\n\ + .word gUnkDebug4Menu\n\ + .word gCallback_03004AE8\n\ + .word debug_sub_8138C54+1"); +} + +#endif + static void CableCarTask1(u8 taskId) { if (!gPaletteFade.active) @@ -198,6 +376,46 @@ void CableCar(void) BeginNormalPaletteFade(-1, 0, 0, 16, 0); } +#if DEBUG + +__attribute__((naked)) +u8 debug_sub_8138D74(void) +{ + asm("\n\ + push {lr}\n\ + ldr r1, ._21\n\ + mov r0, #0x0\n\ + strh r0, [r1]\n\ + bl CloseMenu\n\ + bl CableCar\n\ + pop {r0}\n\ + bx r0\n\ +._22:\n\ + .align 2, 0\n\ +._21:\n\ + .word gSpecialVar_0x8004"); +} + +__attribute__((naked)) +u8 debug_sub_8138D8C(void) +{ + asm("\n\ + push {lr}\n\ + ldr r1, ._23\n\ + mov r0, #0x1\n\ + strh r0, [r1]\n\ + bl CloseMenu\n\ + bl CableCar\n\ + pop {r0}\n\ + bx r0\n\ +._24:\n\ + .align 2, 0\n\ +._23:\n\ + .word gSpecialVar_0x8004"); +} + +#endif + static void CableCarMainCallback_Setup(void) { u8 i; diff --git a/src/scene/new_game.c b/src/scene/new_game.c index 0279f99c6..d954fb3c8 100644 --- a/src/scene/new_game.c +++ b/src/scene/new_game.c @@ -1,4 +1,7 @@ #include "global.h" +#include "constants/maps.h" +#include "constants/species.h" +#include "clock.h" #include "new_game.h" #include "battle_records.h" #include "berry.h" @@ -20,6 +23,7 @@ #include "pokemon_storage_system.h" #include "random.h" #include "roamer.h" +#include "script_pokemon_80C4.h" #include "overworld.h" #include "rtc.h" #include "script.h" @@ -27,6 +31,10 @@ #include "text.h" #include "tv.h" +#ifdef DEBUG +extern u8 gUnknown_020297ED; +#endif + EWRAM_DATA u8 gDifferentSaveFile = 0; EWRAM_DATA u8 gUnknown_020297ED = 0; @@ -42,6 +50,18 @@ static const struct ContestWinner sEmptyMuseumPortrait = .trainerName = {EOS}, }; +#ifdef DEBUG +const s8 gUnknown_Debug_0823C788[][2] = +{ + { MAP_GROUP(INSIDE_OF_TRUCK), MAP_NUM(INSIDE_OF_TRUCK) }, + { MAP_GROUP(OLDALE_TOWN_POKEMON_CENTER_2F), MAP_NUM(OLDALE_TOWN_POKEMON_CENTER_2F) }, + { MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN) }, + { MAP_GROUP(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F), MAP_NUM(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F) } +}; + +const u8 gUnknown_Debug_0823C790[] = _("KRĂ–TE"); +#endif + void write_word_to_mem(u32 var, u8 *dataPtr) { dataPtr[0] = var; @@ -94,6 +114,30 @@ void ZeroBattleTowerData(void) CpuFill32(0, &gSaveBlock2.battleTower, sizeof(gSaveBlock2.battleTower)); } +#ifdef DEBUG +void debug_sub_8052E04() +{ + u8 i; + + for (i = 0; i < 4; i++) + { + if (gUnknown_Debug_0823C788[i][0] == gSaveBlock1.location.mapGroup && + gUnknown_Debug_0823C788[i][1] == gSaveBlock1.location.mapNum) + { + break; + } + } + + i++; + if (i >= 4) + { + i = 0; + } + + Overworld_SetWarpDestination(gUnknown_Debug_0823C788[i][0], gUnknown_Debug_0823C788[i][1], -1, -1, -1); +} +#endif + void WarpToTruck(void) { Overworld_SetWarpDestination(25, 40, -1, -1, -1); // inside of truck @@ -109,6 +153,9 @@ void ClearSav2(void) void sub_8052E4C(void) { gDifferentSaveFile = 0; +#ifdef DEBUG + gUnknown_020297ED = 0; +#endif sub_808C0A0(); ZeroPlayerPartyMons(); ZeroEnemyPartyMons(); @@ -161,3 +208,33 @@ void NewGameInitData(void) WarpToTruck(); ScriptContext2_RunNewScript(gUnknown_0819FA81); } + +#ifdef DEBUG +extern void debug_sub_80A3904(void); +extern void debug_sub_80A3714(void); +extern void debug_sub_8120F98(void); +extern void unref_sub_8070F90(void); + +void debug_sub_8057508(bool32 arg0) +{ + gUnknown_020297ED = 1; + NewGameInitData(); + gSaveBlock1.money = 999999; + FlagSet(FLAG_SYS_POKEMON_GET); + FlagSet(FLAG_SYS_POKEDEX_GET); + FlagSet(FLAG_SYS_POKENAV_GET); + FlagSet(FLAG_SYS_B_DASH); + ScriptGiveMon(SPECIES_TREECKO, 99, 0, 0, 0, 0); + + if (arg0 == TRUE) + SetMonData(&gPlayerParty[0], MON_DATA_NICKNAME, gUnknown_Debug_0823C790); + + debug_sub_80A3904(); + debug_sub_80A3714(); + debug_sub_8120F98(); + FlagSet(FLAG_SYS_HIPSTER_MEET); + sub_80EB8EC(); + unref_sub_8070F90(); + InitTimeBasedEvents(); +} +#endif diff --git a/src/scene/title_screen.c b/src/scene/title_screen.c index 202b752a6..8d5c4da13 100644 --- a/src/scene/title_screen.c +++ b/src/scene/title_screen.c @@ -8,6 +8,7 @@ #include "m4a.h" #include "main.h" #include "main_menu.h" +#include "overworld.h" #include "palette.h" #include "reset_rtc_screen.h" #include "sound.h" @@ -353,6 +354,7 @@ static void Task_TitleScreenPhase1(u8); static void Task_TitleScreenPhase2(u8); static void Task_TitleScreenPhase3(u8); static void CB2_GoToMainMenu(void); +static void CB2_GoToTestMenu(void); static void CB2_GoToClearSaveDataScreen(void); static void CB2_GoToResetRtcScreen(void); static void CB2_GoToCopyrightScreen(void); @@ -829,6 +831,13 @@ static void Task_TitleScreenPhase3(u8 taskId) BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); SetMainCallback2(CB2_GoToResetRtcScreen); } +#ifdef DEBUG + else if (gMain.heldKeys == SELECT_BUTTON) + { + BeginNormalPaletteFade(-1, 0, 0, 16, 0); + SetMainCallback2(CB2_GoToTestMenu); + } +#endif else { REG_BG2Y = 0; @@ -855,6 +864,14 @@ static void CB2_GoToMainMenu(void) SetMainCallback2(CB2_InitMainMenu); } +#ifdef DEBUG +static void CB2_GoToTestMenu(void) +{ + if (!UpdatePaletteFade()) + SetMainCallback2(CB2_InitTestMenu); +} +#endif + static void CB2_GoToCopyrightScreen(void) { if (!UpdatePaletteFade()) -- cgit v1.2.3 From d79f440b8d4c5af26a98011719807b05745533e1 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Wed, 17 Jan 2018 12:10:41 -0600 Subject: use 'if DEBUG' instead of 'ifdef DEBUG' --- src/scene/new_game.c | 10 +++++----- src/scene/title_screen.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/scene') diff --git a/src/scene/new_game.c b/src/scene/new_game.c index d954fb3c8..cec7134a3 100644 --- a/src/scene/new_game.c +++ b/src/scene/new_game.c @@ -31,7 +31,7 @@ #include "text.h" #include "tv.h" -#ifdef DEBUG +#if DEBUG extern u8 gUnknown_020297ED; #endif @@ -50,7 +50,7 @@ static const struct ContestWinner sEmptyMuseumPortrait = .trainerName = {EOS}, }; -#ifdef DEBUG +#if DEBUG const s8 gUnknown_Debug_0823C788[][2] = { { MAP_GROUP(INSIDE_OF_TRUCK), MAP_NUM(INSIDE_OF_TRUCK) }, @@ -114,7 +114,7 @@ void ZeroBattleTowerData(void) CpuFill32(0, &gSaveBlock2.battleTower, sizeof(gSaveBlock2.battleTower)); } -#ifdef DEBUG +#if DEBUG void debug_sub_8052E04() { u8 i; @@ -153,7 +153,7 @@ void ClearSav2(void) void sub_8052E4C(void) { gDifferentSaveFile = 0; -#ifdef DEBUG +#if DEBUG gUnknown_020297ED = 0; #endif sub_808C0A0(); @@ -209,7 +209,7 @@ void NewGameInitData(void) ScriptContext2_RunNewScript(gUnknown_0819FA81); } -#ifdef DEBUG +#if DEBUG extern void debug_sub_80A3904(void); extern void debug_sub_80A3714(void); extern void debug_sub_8120F98(void); diff --git a/src/scene/title_screen.c b/src/scene/title_screen.c index 8d5c4da13..4ff02d93c 100644 --- a/src/scene/title_screen.c +++ b/src/scene/title_screen.c @@ -831,7 +831,7 @@ static void Task_TitleScreenPhase3(u8 taskId) BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); SetMainCallback2(CB2_GoToResetRtcScreen); } -#ifdef DEBUG +#if DEBUG else if (gMain.heldKeys == SELECT_BUTTON) { BeginNormalPaletteFade(-1, 0, 0, 16, 0); @@ -864,7 +864,7 @@ static void CB2_GoToMainMenu(void) SetMainCallback2(CB2_InitMainMenu); } -#ifdef DEBUG +#if DEBUG static void CB2_GoToTestMenu(void) { if (!UpdatePaletteFade()) -- cgit v1.2.3 From ec84ae801985ac7f83397979bde6a15508eb02ed Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Thu, 18 Jan 2018 11:54:49 -0600 Subject: add more debug code --- src/scene/berry_blender.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/scene') diff --git a/src/scene/berry_blender.c b/src/scene/berry_blender.c index b59d02939..a93313e37 100644 --- a/src/scene/berry_blender.c +++ b/src/scene/berry_blender.c @@ -278,8 +278,8 @@ static bool8 Blender_PrintBlendingResults(void); static void sub_80510E8(void); static void sub_8050E30(void); static void sub_805197C(u16 a0, u16 a1); -static void Blender_PrintMadePokeblockString(struct Pokeblock* pokeblock, u8* dst); -static void sub_8052BD0(u8 taskID); +/*static*/ void Blender_PrintMadePokeblockString(struct Pokeblock* pokeblock, u8* dst); +/*static*/ void sub_8052BD0(u8 taskID); static void sub_8052AF8(void); static void sub_804F8C8(u8 taskID); static void sub_804F9F4(u8 taskID); @@ -2446,7 +2446,7 @@ static void BlenderDebug_CalculatePokeblock(struct BlenderBerry* berries, struct Blender_CalculatePokeblock(berries, pokeblock, playersNo, flavours, a4); } -static void sub_8050760(void) +/*static*/ void sub_8050760(void) { u32 frames = (u16)(gBerryBlenderData->gameFrameTime); u16 max_RPM = gBerryBlenderData->max_RPM; @@ -3305,12 +3305,20 @@ static void sub_8051C04(struct Sprite* sprite) sprite->pos2.y = -(gBerryBlenderData->field_146); } -static void Blender_TrySettingRecord(void) +/*static*/ void Blender_TrySettingRecord(void) { if (gSaveBlock1.berryBlenderRecords[gBerryBlenderData->playersNo - 2] < gBerryBlenderData->max_RPM) gSaveBlock1.berryBlenderRecords[gBerryBlenderData->playersNo - 2] = gBerryBlenderData->max_RPM; } +#if DEBUG +__attribute__((naked)) +static bool8 Blender_PrintBlendingResults(void) +{ + // TODO: disassemble this! + asm(".incbin \"baserom_de_debug.gba\", 0x56178, 0x5655C-0x56178"); +} +#else static bool8 Blender_PrintBlendingResults(void) { u16 i; @@ -3445,8 +3453,9 @@ static bool8 Blender_PrintBlendingResults(void) } return FALSE; } +#endif -static void Blender_PrintMadePokeblockString(struct Pokeblock* pokeblock, u8* dst) +/*static*/ void Blender_PrintMadePokeblockString(struct Pokeblock* pokeblock, u8* dst) { u8 text[12]; u8 flavourLvl, feel; @@ -3869,7 +3878,7 @@ void ShowBerryBlenderRecordWindow(void) } } -static void sub_8052BD0(u8 taskID) +/*static*/ void sub_8052BD0(u8 taskID) { if (gTasks[taskID].data[0] == 0) { -- cgit v1.2.3 From 9c2f7c88f0d7e57c99d548870e78185e05cc472a Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Thu, 18 Jan 2018 13:54:10 -0600 Subject: add more debug code --- src/scene/cute_sketch.c | 344 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 344 insertions(+) (limited to 'src/scene') diff --git a/src/scene/cute_sketch.c b/src/scene/cute_sketch.c index 5317bc334..c4d9463f5 100644 --- a/src/scene/cute_sketch.c +++ b/src/scene/cute_sketch.c @@ -29,6 +29,350 @@ void sub_80FD1C8(u16); u16 sub_80FD39C(u16*); u16 sub_80FD68C(u16*, u16*, u16*); +#if DEBUG + +__attribute__((naked)) +void debug_sub_8110CCC(void) +{ + asm("\ + push {r4, r5, r6, r7, lr}\n\ + mov r7, #0x0\n\ + mov r1, #0x0\n\ + ldr r2, ._5\n\ + ldr r6, ._5 + 4\n\ +._7:\n\ + lsl r0, r1, #0x3\n\ + add r4, r0, r2\n\ + ldrh r0, [r6, #0x1c]\n\ + ldrh r3, [r4, #0x4]\n\ + cmp r0, r3\n\ + bne ._1 @cond_branch\n\ + ldrh r0, [r4, #0x6]\n\ + bl FlagGet\n\ + lsl r0, r0, #0x18\n\ + cmp r0, #0\n\ + beq ._4 @cond_branch\n\ + ldrb r0, [r6, #0x1f]\n\ + ldr r1, [r4]\n\ + lsl r0, r0, #0x2\n\ + add r0, r0, r1\n\ + ldr r0, [r0]\n\ + bl StringLength\n\ + mov r1, #0xc\n\ + sub r1, r1, r0\n\ + lsl r1, r1, #0x10\n\ + lsr r5, r1, #0x10\n\ + cmp r1, #0\n\ + bge ._3 @cond_branch\n\ + mov r5, #0x0\n\ +._3:\n\ + mov r7, #0x1\n\ + mov r0, #0x10\n\ + mov r1, #0xe\n\ + mov r2, #0x1d\n\ + mov r3, #0x13\n\ + bl Menu_DrawStdWindowFrame\n\ + add r0, r6, #0\n\ + add r0, r0, #0x8\n\ + mov r1, #0x11\n\ + mov r2, #0xf\n\ + bl Menu_PrintText\n\ + ldrb r0, [r6, #0x1f]\n\ + ldr r1, [r4]\n\ + lsl r0, r0, #0x2\n\ + add r0, r0, r1\n\ + ldr r0, [r0]\n\ + add r1, r5, #0\n\ + add r1, r1, #0x11\n\ + lsl r1, r1, #0x18\n\ + lsr r1, r1, #0x18\n\ + mov r2, #0x11\n\ + bl Menu_PrintText\n\ + b ._4\n\ +._6:\n\ + .align 2, 0\n\ +._5:\n\ + .word gUnknown_083E79C0\n\ + .word +0x2000000\n\ +._1:\n\ + add r0, r1, #1\n\ + lsl r0, r0, #0x10\n\ + lsr r1, r0, #0x10\n\ + cmp r1, #0\n\ + beq ._7 @cond_branch\n\ +._4:\n\ + cmp r7, #0\n\ + bne ._8 @cond_branch\n\ + mov r0, #0x10\n\ + mov r1, #0x10\n\ + mov r2, #0x1d\n\ + mov r3, #0x13\n\ + bl Menu_DrawStdWindowFrame\n\ + ldr r0, ._9\n\ + mov r1, #0x11\n\ + mov r2, #0x11\n\ + bl Menu_PrintText\n\ + mov r0, #0x10\n\ + mov r1, #0xe\n\ + mov r2, #0x1d\n\ + mov r3, #0xf\n\ + bl Menu_EraseWindowRect\n\ +._8:\n\ + pop {r4, r5, r6, r7}\n\ + pop {r0}\n\ + bx r0\n\ +._10:\n\ + .align 2, 0\n\ +._9:\n\ + .word +0x2000008"); +} + +__attribute__((naked)) +void debug_sub_8110D84(void) +{ + asm("\ + push {r4, lr}\n\ + add sp, sp, #0xfffffffc\n\ + ldr r0, ._13\n\ + ldrh r0, [r0, #0x4]\n\ + cmp r0, #0x7\n\ + bls ._11 @cond_branch\n\ + b ._65\n\ +._11:\n\ + lsl r0, r0, #0x2\n\ + ldr r1, ._13 + 4\n\ + add r0, r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ +._14:\n\ + .align 2, 0\n\ +._13:\n\ + .word +0x2000000\n\ + .word ._15\n\ +._15:\n\ + .word ._16\n\ + .word ._17\n\ + .word ._18\n\ + .word ._19\n\ + .word ._20\n\ + .word ._21\n\ + .word ._22\n\ + .word ._23\n\ +._16:\n\ + mov r0, #0x1\n\ + neg r0, r0\n\ + mov r1, #0x0\n\ + str r1, [sp]\n\ + mov r2, #0x10\n\ + mov r3, #0x0\n\ + bl BeginNormalPaletteFade\n\ + ldr r1, ._25\n\ + ldrh r0, [r1, #0x4]\n\ + add r0, r0, #0x1\n\ + b ._62\n\ +._26:\n\ + .align 2, 0\n\ +._25:\n\ + .word +0x2000000\n\ +._17:\n\ + bl UpdatePaletteFade\n\ + lsl r0, r0, #0x18\n\ + cmp r0, #0\n\ + beq ._27 @cond_branch\n\ + b ._65\n\ +._27:\n\ + ldr r1, ._30\n\ + ldrh r0, [r1, #0x4]\n\ + add r0, r0, #0x1\n\ + b ._62\n\ +._31:\n\ + .align 2, 0\n\ +._30:\n\ + .word +0x2000000\n\ +._18:\n\ + bl sub_80FAB60\n\ + lsl r0, r0, #0x18\n\ + lsr r0, r0, #0x18\n\ + cmp r0, #0x3\n\ + beq ._32 @cond_branch\n\ + cmp r0, #0x3\n\ + bgt ._33 @cond_branch\n\ + b ._65\n\ +._33:\n\ + cmp r0, #0x4\n\ + beq ._35 @cond_branch\n\ + cmp r0, #0x5\n\ + beq ._36 @cond_branch\n\ + b ._65\n\ +._35:\n\ + ldr r4, ._41\n\ + ldrb r0, [r4, #0x1e]\n\ + cmp r0, #0\n\ + bne ._38 @cond_branch\n\ + b ._65\n\ +._38:\n\ + mov r0, #0x5\n\ + bl gMysteryEventScriptCmdTableEnd+0x13c0\n\ + ldr r1, ._41 + 4\n\ + add r0, r4, r1\n\ + mov r1, #0x1\n\ + strb r1, [r0]\n\ + ldr r0, ._41 + 8\n\ + bl sub_80FC244\n\ + b ._65\n\ +._42:\n\ + .align 2, 0\n\ +._41:\n\ + .word +0x2000000\n\ + .word 0xa6e\n\ + .word sub_80FC69C+1\n\ +._36:\n\ + mov r0, #0x5\n\ + bl gMysteryEventScriptCmdTableEnd+0x13c0\n\ + mov r0, #0x1\n\ + neg r0, r0\n\ + mov r1, #0x0\n\ + str r1, [sp]\n\ + mov r2, #0x0\n\ + mov r3, #0x10\n\ + bl BeginNormalPaletteFade\n\ + ldr r1, ._44\n\ + ldrh r0, [r1, #0x4]\n\ + add r0, r0, #0x1\n\ + b ._62\n\ +._45:\n\ + .align 2, 0\n\ +._44:\n\ + .word +0x2000000\n\ +._19:\n\ + bl UpdatePaletteFade\n\ + lsl r0, r0, #0x18\n\ + cmp r0, #0\n\ + bne ._65 @cond_branch\n\ + ldr r0, ._48\n\ + bl SetMainCallback2\n\ + b ._65\n\ +._49:\n\ + .align 2, 0\n\ +._48:\n\ + .word sub_805469C+1\n\ +._20:\n\ + bl sub_80FAB60\n\ + lsl r0, r0, #0x18\n\ + cmp r0, #0\n\ + beq ._50 @cond_branch\n\ +._32:\n\ + bl debug_sub_8110CCC\n\ + b ._65\n\ +._50:\n\ + ldr r0, ._54\n\ + ldrh r1, [r0, #0x2e]\n\ + mov r0, #0x1\n\ + and r0, r0, r1\n\ + cmp r0, #0\n\ + beq ._65 @cond_branch\n\ + bl sub_80FBCA0\n\ + bl sub_80FAEC4\n\ + ldr r1, ._54 + 4\n\ + ldrh r0, [r1, #0x4]\n\ + add r0, r0, #0x1\n\ + b ._62\n\ +._55:\n\ + .align 2, 0\n\ +._54:\n\ + .word gMain\n\ + .word +0x2000000\n\ +._21:\n\ + bl sub_80FAFC0\n\ + lsl r0, r0, #0x18\n\ + cmp r0, #0\n\ + bne ._65 @cond_branch\n\ + mov r0, #0x0\n\ + mov r1, #0x0\n\ + bl CreateRegionMapCursor\n\ + ldr r1, ._58\n\ + ldrh r0, [r1, #0x4]\n\ + add r0, r0, #0x1\n\ + b ._62\n\ +._59:\n\ + .align 2, 0\n\ +._58:\n\ + .word +0x2000000\n\ +._22:\n\ + bl sub_80FAB60\n\ + lsl r0, r0, #0x18\n\ + cmp r0, #0\n\ + beq ._60 @cond_branch\n\ + bl debug_sub_8110CCC\n\ +._60:\n\ + ldr r0, ._63\n\ + ldrh r1, [r0, #0x2e]\n\ + mov r0, #0x1\n\ + and r0, r0, r1\n\ + cmp r0, #0\n\ + beq ._65 @cond_branch\n\ + bl sub_80FBCA0\n\ + bl sub_80FAEC4\n\ + ldr r1, ._63 + 4\n\ + ldrh r0, [r1, #0x4]\n\ + add r0, r0, #0x1\n\ + b ._62\n\ +._64:\n\ + .align 2, 0\n\ +._63:\n\ + .word gMain\n\ + .word +0x2000000\n\ +._23:\n\ + bl sub_80FAFC0\n\ + lsl r0, r0, #0x18\n\ + cmp r0, #0\n\ + bne ._65 @cond_branch\n\ + mov r0, #0x0\n\ + mov r1, #0x0\n\ + bl CreateRegionMapCursor\n\ + ldr r1, ._66\n\ + mov r0, #0x3\n\ +._62:\n\ + strh r0, [r1, #0x4]\n\ +._65:\n\ + add sp, sp, #0x4\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ +._67:\n\ + .align 2, 0\n\ +._66:\n\ + .word +0x2000000"); +} + +__attribute__((naked)) +void debug_sub_8110F28(void) +{ + asm("\ + push {lr}\n\ + bl CB2_InitFlyRegionMap\n\ + ldr r0, ._69\n\ + ldr r1, [r0, #0x4]\n\ + ldr r0, ._69 + 4\n\ + cmp r1, r0\n\ + bne ._68 @cond_branch\n\ + bl sub_80FBF94\n\ + ldr r0, ._69 + 8\n\ + bl sub_80FC244\n\ + bl debug_sub_8110CCC\n\ +._68:\n\ + pop {r0}\n\ + bx r0\n\ +._70:\n\ + .align 2, 0\n\ +._69:\n\ + .word gMain\n\ + .word CB2_FlyRegionMap+1\n\ + .word debug_sub_8110D84+1"); +} + +#endif + void sub_80FC7A0(struct Unk03005E20* info) { gUnknown_03005DEC = info->var_4; -- cgit v1.2.3 From 608e06126acdc8b6d32a0aa71fdc57bc188b8d7b Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Sun, 21 Jan 2018 14:27:32 -0600 Subject: fix build of normal ROMs --- src/scene/title_screen.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/scene') diff --git a/src/scene/title_screen.c b/src/scene/title_screen.c index 4ff02d93c..a1c8e081d 100644 --- a/src/scene/title_screen.c +++ b/src/scene/title_screen.c @@ -354,7 +354,9 @@ static void Task_TitleScreenPhase1(u8); static void Task_TitleScreenPhase2(u8); static void Task_TitleScreenPhase3(u8); static void CB2_GoToMainMenu(void); +#if DEBUG static void CB2_GoToTestMenu(void); +#endif static void CB2_GoToClearSaveDataScreen(void); static void CB2_GoToResetRtcScreen(void); static void CB2_GoToCopyrightScreen(void); -- cgit v1.2.3 From bcba136599ff2cecf4eeb0e6d592186509a98a59 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Mon, 22 Jan 2018 19:33:29 -0600 Subject: disassemble debug Blender_PrintBlendingResults --- src/scene/berry_blender.c | 487 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 483 insertions(+), 4 deletions(-) (limited to 'src/scene') diff --git a/src/scene/berry_blender.c b/src/scene/berry_blender.c index 2535f02a6..5b013e8de 100644 --- a/src/scene/berry_blender.c +++ b/src/scene/berry_blender.c @@ -274,7 +274,7 @@ static void sub_8051B18(void); static void sub_805123C(void); static void sub_8050954(void); static bool8 Blender_PrintBlendingRanking(void); -static bool8 Blender_PrintBlendingResults(void); +bool8 Blender_PrintBlendingResults(void); static void sub_80510E8(void); static void sub_8050E30(void); static void sub_805197C(u16 a0, u16 a1); @@ -3278,10 +3278,489 @@ static void sub_8051C04(struct Sprite* sprite) #if DEBUG __attribute__((naked)) -static bool8 Blender_PrintBlendingResults(void) +bool8 Blender_PrintBlendingResults(void) { - // TODO: disassemble this! - asm(".incbin \"baserom_de_debug.gba\", 0x56178, 0x5655C-0x56178"); + asm(".syntax unified\n\ +loc_8056178:\n\ + PUSH {R4-R7,LR}\n\ + MOV R7, R10\n\ + MOV R6, R9\n\ + MOV R5, R8\n\ + PUSH {R5-R7}\n\ + SUB SP, SP, #0x34\n\ + LDR R1, off_805619C\n\ + LDR R0, [R1]\n\ + LDRB R0, [R0]\n\ + ADDS R2, R1, #0\n\ + CMP R0, #6 @ switch 7 cases\n\ + BLS loc_8056192\n\ + B def_805619A @ jumptable 0805619A default case\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_8056192:\n\ + LSLS R0, R0, #2\n\ + LDR R1, off_80561A0\n\ + ADDS R0, R0, R1\n\ + LDR R0, [R0]\n\ + MOV PC, R0 @ switch jump\n\ +@ ---------------------------------------------------------------------------\n\ +off_805619C: .4byte gBerryBlenderData\n\ +off_80561A0: .4byte jpt_805619A\n\ +jpt_805619A: .4byte loc_80561C0 @ jump table for switch statement\n\ + .4byte loc_80561D6 @ jumptable 0805619A case 1\n\ + .4byte loc_80561F0 @ jumptable 0805619A case 2\n\ + .4byte loc_8056240 @ jumptable 0805619A case 3\n\ + .4byte loc_805645C @ jumptable 0805619A case 4\n\ + .4byte loc_8056470 @ jumptable 0805619A case 5\n\ + .4byte loc_8056538 @ jumptable 0805619A case 6\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_80561C0: @ jumptable 0805619A case 0\n\ + LDR R1, [R2]\n\ + LDRB R0, [R1]\n\ + ADDS R0, #1\n\ + STRB R0, [R1]\n\ + LDR R0, [R2]\n\ + MOVS R1, #0x98\n\ + LSLS R1, R1, #1\n\ + ADDS R0, R0, R1\n\ + MOVS R1, #0x11\n\ + STR R1, [R0]\n\ + B def_805619A @ jumptable 0805619A default case\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_80561D6: @ jumptable 0805619A case 1\n\ + LDR R1, [R2]\n\ + MOVS R0, #0x98\n\ + LSLS R0, R0, #1\n\ + ADDS R2, R1, R0\n\ + LDR R0, [R2]\n\ + SUBS R0, #0xA\n\ + STR R0, [R2]\n\ + CMP R0, #0\n\ + BLT loc_80561EA\n\ + B def_805619A @ jumptable 0805619A default case\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_80561EA:\n\ + MOVS R0, #0\n\ + STR R0, [R2]\n\ + B loc_8056520\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_80561F0: @ jumptable 0805619A case 2\n\ + LDR R1, [R2]\n\ + MOVS R2, #0x98\n\ + LSLS R2, R2, #1\n\ + ADDS R1, R1, R2\n\ + LDR R0, [R1]\n\ + ADDS R0, #1\n\ + STR R0, [R1]\n\ + CMP R0, #0x14\n\ + BGT loc_8056204\n\ + B def_805619A @ jumptable 0805619A default case\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_8056204:\n\ + MOVS R6, #0\n\ +\n\ +loc_8056206:\n\ + LDR R4, off_8056238\n\ + LDR R0, [R4]\n\ + ADDS R0, #0x50\n\ + ADDS R0, R0, R6\n\ + LDRB R1, [R0]\n\ + LSLS R0, R1, #4\n\ + ADDS R0, R0, R1\n\ + LSLS R0, R0, #2\n\ + LDR R1, off_805623C\n\ + ADDS R0, R0, R1\n\ + BL DestroySprite\n\ + ADDS R0, R6, #1\n\ + LSLS R0, R0, #0x10\n\ + LSRS R6, R0, #0x10\n\ + CMP R6, #2\n\ + BLS loc_8056206\n\ + LDR R1, [R4]\n\ + MOVS R0, #0x98\n\ + LSLS R0, R0, #1\n\ + ADDS R2, R1, R0\n\ + MOVS R0, #0\n\ + STR R0, [R2]\n\ + B loc_8056520\n\ +@ ---------------------------------------------------------------------------\n\ + .align 2, 0\n\ +off_8056238: .4byte gBerryBlenderData\n\ +off_805623C: .4byte gSprites\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_8056240: @ jumptable 0805619A case 3\n\ + MOVS R0, #4\n\ + MOVS R1, #2\n\ + MOVS R2, #0x19\n\ + MOVS R3, #0x11\n\ + BL Menu_DrawStdWindowFrame\n\ + LDR R0, dword_805642C\n\ + MOVS R1, #5\n\ + MOVS R2, #3\n\ + MOVS R3, #0xA0\n\ + BL sub_8072BD8\n\ + MOVS R6, #0\n\ + LDR R1, off_8056430\n\ + LDR R0, [R1]\n\ + ADDS R0, #0x88\n\ + ADD R2, SP, #0xC\n\ + MOV R8, R2\n\ + MOV R2, SP\n\ + ADDS R2, #0x16\n\ + STR R2, [SP,#0x30]\n\ + LDRB R0, [R0]\n\ + CMP R6, R0\n\ + BCS loc_8056322\n\ + MOV R9, R1\n\ + LDR R0, off_8056434\n\ + MOV R10, R0\n\ +\n\ +loc_8056276:\n\ + MOV R1, R9\n\ + LDR R2, [R1]\n\ + MOVS R1, #0xB2\n\ + LSLS R1, R1, #1\n\ + ADDS R0, R2, R1\n\ + ADDS R0, R0, R6\n\ + LDRB R4, [R0]\n\ + LSLS R1, R4, #4\n\ + ADDS R1, R1, R2\n\ + MOVS R2, #0xBF\n\ + LSLS R2, R2, #1\n\ + ADDS R1, R1, R2\n\ + MOV R0, R8\n\ + BL StringCopy\n\ + LSLS R5, R4, #3\n\ + SUBS R5, R5, R4\n\ + LSLS R5, R5, #2\n\ + MOV R1, R10\n\ + ADDS R0, R5, R1\n\ + LDRB R1, [R0,#0x1A]\n\ + MOV R0, R8\n\ + BL ConvertInternationalString\n\ + MOV R0, R8\n\ + LDR R1, dword_8056438\n\ + BL de_sub_8073174\n\ + MOV R2, R9\n\ + LDR R0, [R2]\n\ + ADDS R7, R0, #0\n\ + ADDS R7, #0xAB\n\ + ADDS R4, R6, #1\n\ + ADDS R0, R7, #0\n\ + ADDS R1, R4, #0\n\ + BL ConvertIntToDecimalString\n\ + ADDS R7, R0, #0\n\ + MOVS R1, #0\n\ + STRB R1, [R7]\n\ + MOVS R0, #0xAD\n\ + STRB R0, [R7,#1]\n\ + STRB R1, [R7,#2]\n\ + ADDS R7, #3\n\ + LDR R0, off_805643C\n\ + ADDS R5, R5, R0\n\ + ADDS R0, R7, #0\n\ + ADDS R1, R5, #0\n\ + MOVS R2, #0x58\n\ + MOVS R3, #0\n\ + BL sub_8072C74\n\ + ADDS R7, R0, #0\n\ + ADD R1, SP, #0xC\n\ + MOVS R2, #0x9D\n\ + MOVS R3, #0\n\ + BL sub_8072C74\n\ + MOV R2, R9\n\ + LDR R1, [R2]\n\ + ADDS R0, R1, #0\n\ + ADDS R0, #0xAB\n\ + LDR R3, dword_8056440\n\ + ADDS R1, #0x88\n\ + LDRB R2, [R1]\n\ + ADDS R3, R2, R3\n\ + LDR R1, dword_8056444\n\ + ADDS R2, R2, R1\n\ + LDRB R1, [R2]\n\ + ADDS R2, R6, #0\n\ + MULS R2, R1\n\ + LDRB R3, [R3]\n\ + ADDS R2, R2, R3\n\ + LSLS R2, R2, #0x18\n\ + LSRS R2, R2, #0x18\n\ + MOVS R1, #5\n\ + BL Menu_PrintText\n\ + LSLS R4, R4, #0x10\n\ + LSRS R6, R4, #0x10\n\ + MOV R1, R9\n\ + LDR R0, [R1]\n\ + ADDS R0, #0x88\n\ + LDRB R0, [R0]\n\ + CMP R6, R0\n\ + BCC loc_8056276\n\ +\n\ +loc_8056322:\n\ + LDR R6, off_8056430\n\ + LDR R0, [R6]\n\ + ADDS R0, #0x5A\n\ + LDRH R0, [R0]\n\ + MOVS R1, #0x64\n\ + BL __umodsi3\n\ + ADDS R1, R0, #0\n\ + LSLS R1, R1, #0x10\n\ + LSRS R1, R1, #0x10\n\ + MOV R0, R8\n\ + MOVS R2, #2\n\ + MOVS R3, #2\n\ + BL ConvertIntToDecimalStringN\n\ + LDR R0, [R6]\n\ + ADDS R7, R0, #0\n\ + ADDS R7, #0xAB\n\ + LDR R1, dword_8056448\n\ + ADDS R0, R7, #0\n\ + BL StringCopy\n\ + ADDS R7, R0, #0\n\ + LDR R0, [R6]\n\ + ADDS R0, #0x5A\n\ + LDRH R0, [R0]\n\ + MOVS R1, #0x64\n\ + BL __udivsi3\n\ + ADDS R1, R0, #0\n\ + LSLS R1, R1, #0x10\n\ + LSRS R1, R1, #0x10\n\ + ADDS R0, R7, #0\n\ + MOVS R2, #0x79\n\ + MOVS R3, #1\n\ + BL sub_8072C14\n\ + ADDS R7, R0, #0\n\ + MOVS R0, #0xB8\n\ + STRB R0, [R7]\n\ + ADDS R7, #1\n\ + ADDS R0, R7, #0\n\ + MOV R1, R8\n\ + MOVS R2, #0x88\n\ + MOVS R3, #1\n\ + BL sub_8072C74\n\ + ADDS R7, R0, #0\n\ + LDR R1, off_805644C\n\ + BL StringCopy\n\ + LDR R0, [R6]\n\ + ADDS R0, #0xAB\n\ + MOVS R1, #5\n\ + MOVS R2, #0xD\n\ + BL Menu_PrintText\n\ + LDR R0, [R6]\n\ + MOVS R2, #0x96\n\ + LSLS R2, R2, #1\n\ + ADDS R0, R0, R2\n\ + LDR R0, [R0]\n\ + MOVS R1, #0x3C\n\ + BL __udivsi3\n\ + ADDS R4, R0, #0\n\ + LSLS R4, R4, #0x10\n\ + LSRS R4, R4, #0x10\n\ + ADDS R0, R4, #0\n\ + MOVS R1, #0x3C\n\ + BL __umodsi3\n\ + ADDS R5, R0, #0\n\ + LSLS R5, R5, #0x10\n\ + LSRS R5, R5, #0x10\n\ + ADDS R0, R4, #0\n\ + MOVS R1, #0x3C\n\ + BL __udivsi3\n\ + ADDS R1, R0, #0\n\ + LSLS R1, R1, #0x10\n\ + LSRS R1, R1, #0x10\n\ + MOV R0, R8\n\ + MOVS R2, #2\n\ + MOVS R3, #2\n\ + BL ConvertIntToDecimalStringN\n\ + LDR R0, [SP,#0x30]\n\ + ADDS R1, R5, #0\n\ + MOVS R2, #2\n\ + MOVS R3, #2\n\ + BL ConvertIntToDecimalStringN\n\ + LDR R0, [R6]\n\ + ADDS R7, R0, #0\n\ + ADDS R7, #0xAB\n\ + LDR R1, dword_8056450\n\ + ADDS R0, R7, #0\n\ + BL StringCopy\n\ + ADDS R7, R0, #0\n\ + MOV R1, R8\n\ + MOVS R2, #0x63\n\ + MOVS R3, #1\n\ + BL sub_8072C74\n\ + ADDS R7, R0, #0\n\ + LDR R1, dword_8056454\n\ + BL StringAppend\n\ + ADDS R7, R0, #0\n\ + LDR R1, [SP,#0x30]\n\ + MOVS R2, #0x88\n\ + MOVS R3, #1\n\ + BL sub_8072C74\n\ + ADDS R7, R0, #0\n\ + LDR R1, dword_8056458\n\ + BL StringCopy\n\ + LDR R0, [R6]\n\ + ADDS R0, #0xAB\n\ + MOVS R1, #5\n\ + MOVS R2, #0xF\n\ + BL Menu_PrintText\n\ + LDR R1, [R6]\n\ + MOVS R0, #0x98\n\ + LSLS R0, R0, #1\n\ + ADDS R2, R1, R0\n\ + MOVS R0, #0\n\ + STR R0, [R2]\n\ + B loc_8056520\n\ +@ ---------------------------------------------------------------------------\n\ +dword_805642C: .4byte gOtherText_ResultsOfBlending\n\ +off_8056430: .4byte gBerryBlenderData\n\ +off_8056434: .4byte gLinkPlayers\n\ +dword_8056438: .4byte gOtherText_Berry\n\ +off_805643C: .4byte gLinkPlayers+0x8\n\ +dword_8056440: .4byte gUnknown_082165E9\n\ +dword_8056444: .4byte gUnknown_082165EE\n\ +dword_8056448: .4byte gOtherText_MaxSpeed\n\ +off_805644C: .4byte gOtherText_RPM\n\ +dword_8056450: .4byte gOtherText_RequiredTime\n\ +dword_8056454: .4byte gOtherText_Min\n\ +dword_8056458: .4byte gOtherText_Sec\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_805645C: @ jumptable 0805619A case 4\n\ + LDR R0, off_805646C\n\ + LDRH R1, [R0,#0x2E]\n\ + MOVS R0, #1\n\ + ANDS R0, R1\n\ + CMP R0, #0\n\ + BEQ def_805619A @ jumptable 0805619A default case\n\ + LDR R1, [R2]\n\ + B loc_8056520\n\ +@ ---------------------------------------------------------------------------\n\ +off_805646C: .4byte gMain\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_8056470: @ jumptable 0805619A case 5\n\ + BL Menu_EraseScreen\n\ + MOVS R0, #0\n\ + MOVS R1, #0xE\n\ + MOVS R2, #0x1D\n\ + MOVS R3, #0x13\n\ + BL Menu_DrawStdWindowFrame\n\ + MOVS R6, #0\n\ + ADD R1, SP, #0xC\n\ + MOV R8, R1\n\ + ADD R5, SP, #0x28\n\ + LDR R0, off_8056528\n\ + LDR R0, [R0]\n\ + ADDS R3, R0, #0\n\ + ADDS R3, #0x80\n\ + ADD R2, SP, #0x20\n\ +\n\ +loc_8056492:\n\ + LSLS R1, R6, #1\n\ + ADDS R0, R3, R1\n\ + LDRH R0, [R0]\n\ + CMP R0, #0\n\ + BEQ loc_80564A2\n\ + ADDS R1, R2, R1\n\ + SUBS R0, #0x85\n\ + STRH R0, [R1]\n\ +\n\ +loc_80564A2:\n\ + ADDS R0, R6, #1\n\ + LSLS R0, R0, #0x10\n\ + LSRS R6, R0, #0x10\n\ + CMP R6, #3\n\ + BLS loc_8056492\n\ + BL sub_8050760\n\ + LDR R4, off_8056528\n\ + LDR R3, [R4]\n\ + MOVS R2, #0xBE\n\ + LSLS R2, R2, #1\n\ + ADDS R0, R3, R2\n\ + ADDS R1, R3, #0\n\ + ADDS R1, #0x88\n\ + LDRB R2, [R1]\n\ + SUBS R1, #0x2E\n\ + LDRH R1, [R1]\n\ + STR R1, [SP]\n\ + ADDS R1, R5, #0\n\ + ADD R3, SP, #4\n\ + BL Blender_CalculatePokeblock\n\ + LDR R1, [R4]\n\ + ADDS R1, #0xAB\n\ + ADDS R0, R5, #0\n\ + BL Blender_PrintMadePokeblockString\n\ + LDR R0, off_805652C\n\ + MOVS R1, #6\n\ + BL CreateTask\n\ + BL sub_8007E40\n\ + ADDS R1, R0, #0\n\ + MOV R0, R8\n\ + MOVS R2, #0\n\ + MOVS R3, #4\n\ + BL ConvertIntToHexStringN\n\ + LDR R1, dword_8056530\n\ + MOV R0, R8\n\ + BL StringAppend\n\ + LDR R0, [R4]\n\ + ADDS R0, #0xAB\n\ + MOV R1, R8\n\ + BL StringAppend\n\ + LDR R0, [R4]\n\ + ADDS R0, #0xAB\n\ + MOVS R1, #1\n\ + MOVS R2, #0xF\n\ + BL MenuPrintMessage\n\ + LDR R0, off_8056534\n\ + LDRH R0, [R0]\n\ + MOVS R1, #1\n\ + BL RemoveBagItem\n\ + ADDS R0, R5, #0\n\ + BL sub_810CA34\n\ + LDR R1, [R4]\n\ +\n\ +loc_8056520:\n\ + LDRB R0, [R1]\n\ + ADDS R0, #1\n\ + STRB R0, [R1]\n\ + B def_805619A @ jumptable 0805619A default case\n\ +@ ---------------------------------------------------------------------------\n\ +off_8056528: .4byte gBerryBlenderData\n\ +off_805652C: .4byte sub_8052BD0+1\n\ +dword_8056530: .4byte gUnknown_08216249\n\ +off_8056534: .4byte gSpecialVar_ItemId\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +loc_8056538: @ jumptable 0805619A case 6\n\ + BL Menu_UpdateWindowText\n\ + LSLS R0, R0, #0x18\n\ + CMP R0, #0\n\ + BEQ def_805619A @ jumptable 0805619A default case\n\ + BL Blender_TrySettingRecord\n\ + MOVS R0, #1\n\ + B loc_805654C\n\ +@ ---------------------------------------------------------------------------\n\ +\n\ +def_805619A: @ jumptable 0805619A default case\n\ + MOVS R0, #0\n\ +\n\ +loc_805654C:\n\ + ADD SP, SP, #0x34\n\ + POP {R3-R5}\n\ + MOV R8, R3\n\ + MOV R9, R4\n\ + MOV R10, R5\n\ + POP {R4-R7}\n\ + POP {R1}\n\ + BX R1\n\ + .syntax divided\n"); } #else static bool8 Blender_PrintBlendingResults(void) -- cgit v1.2.3 From 0f09d2e7046a54c95e2ed4a7ff759d4cd1db87f7 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Mon, 22 Jan 2018 22:35:27 -0600 Subject: fix false gMysteryEventScriptCmdTableEnd offsets --- src/scene/cute_sketch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/scene') diff --git a/src/scene/cute_sketch.c b/src/scene/cute_sketch.c index c4d9463f5..848249528 100644 --- a/src/scene/cute_sketch.c +++ b/src/scene/cute_sketch.c @@ -212,7 +212,7 @@ void debug_sub_8110D84(void) b ._65\n\ ._38:\n\ mov r0, #0x5\n\ - bl gMysteryEventScriptCmdTableEnd+0x13c0\n\ + bl m4aSongNumStart\n\ ldr r1, ._41 + 4\n\ add r0, r4, r1\n\ mov r1, #0x1\n\ @@ -228,7 +228,7 @@ void debug_sub_8110D84(void) .word sub_80FC69C+1\n\ ._36:\n\ mov r0, #0x5\n\ - bl gMysteryEventScriptCmdTableEnd+0x13c0\n\ + bl m4aSongNumStart\n\ mov r0, #0x1\n\ neg r0, r0\n\ mov r1, #0x0\n\ -- cgit v1.2.3 From f2885be7da921ef0a5058b2b36d4473481db1022 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Tue, 23 Jan 2018 17:03:59 -0600 Subject: remove some unnecessary DEBUG conditionals in symbol files --- src/scene/berry_blender.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/scene') diff --git a/src/scene/berry_blender.c b/src/scene/berry_blender.c index 5b013e8de..0799531cd 100644 --- a/src/scene/berry_blender.c +++ b/src/scene/berry_blender.c @@ -3763,7 +3763,7 @@ loc_805654C:\n\ .syntax divided\n"); } #else -static bool8 Blender_PrintBlendingResults(void) +bool8 Blender_PrintBlendingResults(void) { u16 i; -- cgit v1.2.3 From d125e9b461204d0f80ae25d35a1569613ee3aa6e Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Wed, 24 Jan 2018 01:35:05 -0600 Subject: integrate debug Blender_PrintBlendingResults --- src/scene/berry_blender.c | 493 +--------------------------------------------- 1 file changed, 5 insertions(+), 488 deletions(-) (limited to 'src/scene') diff --git a/src/scene/berry_blender.c b/src/scene/berry_blender.c index 0799531cd..c636e245c 100644 --- a/src/scene/berry_blender.c +++ b/src/scene/berry_blender.c @@ -3276,493 +3276,6 @@ static void sub_8051C04(struct Sprite* sprite) gSaveBlock1.berryBlenderRecords[gBerryBlenderData->playersNo - 2] = gBerryBlenderData->max_RPM; } -#if DEBUG -__attribute__((naked)) -bool8 Blender_PrintBlendingResults(void) -{ - asm(".syntax unified\n\ -loc_8056178:\n\ - PUSH {R4-R7,LR}\n\ - MOV R7, R10\n\ - MOV R6, R9\n\ - MOV R5, R8\n\ - PUSH {R5-R7}\n\ - SUB SP, SP, #0x34\n\ - LDR R1, off_805619C\n\ - LDR R0, [R1]\n\ - LDRB R0, [R0]\n\ - ADDS R2, R1, #0\n\ - CMP R0, #6 @ switch 7 cases\n\ - BLS loc_8056192\n\ - B def_805619A @ jumptable 0805619A default case\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_8056192:\n\ - LSLS R0, R0, #2\n\ - LDR R1, off_80561A0\n\ - ADDS R0, R0, R1\n\ - LDR R0, [R0]\n\ - MOV PC, R0 @ switch jump\n\ -@ ---------------------------------------------------------------------------\n\ -off_805619C: .4byte gBerryBlenderData\n\ -off_80561A0: .4byte jpt_805619A\n\ -jpt_805619A: .4byte loc_80561C0 @ jump table for switch statement\n\ - .4byte loc_80561D6 @ jumptable 0805619A case 1\n\ - .4byte loc_80561F0 @ jumptable 0805619A case 2\n\ - .4byte loc_8056240 @ jumptable 0805619A case 3\n\ - .4byte loc_805645C @ jumptable 0805619A case 4\n\ - .4byte loc_8056470 @ jumptable 0805619A case 5\n\ - .4byte loc_8056538 @ jumptable 0805619A case 6\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_80561C0: @ jumptable 0805619A case 0\n\ - LDR R1, [R2]\n\ - LDRB R0, [R1]\n\ - ADDS R0, #1\n\ - STRB R0, [R1]\n\ - LDR R0, [R2]\n\ - MOVS R1, #0x98\n\ - LSLS R1, R1, #1\n\ - ADDS R0, R0, R1\n\ - MOVS R1, #0x11\n\ - STR R1, [R0]\n\ - B def_805619A @ jumptable 0805619A default case\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_80561D6: @ jumptable 0805619A case 1\n\ - LDR R1, [R2]\n\ - MOVS R0, #0x98\n\ - LSLS R0, R0, #1\n\ - ADDS R2, R1, R0\n\ - LDR R0, [R2]\n\ - SUBS R0, #0xA\n\ - STR R0, [R2]\n\ - CMP R0, #0\n\ - BLT loc_80561EA\n\ - B def_805619A @ jumptable 0805619A default case\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_80561EA:\n\ - MOVS R0, #0\n\ - STR R0, [R2]\n\ - B loc_8056520\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_80561F0: @ jumptable 0805619A case 2\n\ - LDR R1, [R2]\n\ - MOVS R2, #0x98\n\ - LSLS R2, R2, #1\n\ - ADDS R1, R1, R2\n\ - LDR R0, [R1]\n\ - ADDS R0, #1\n\ - STR R0, [R1]\n\ - CMP R0, #0x14\n\ - BGT loc_8056204\n\ - B def_805619A @ jumptable 0805619A default case\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_8056204:\n\ - MOVS R6, #0\n\ -\n\ -loc_8056206:\n\ - LDR R4, off_8056238\n\ - LDR R0, [R4]\n\ - ADDS R0, #0x50\n\ - ADDS R0, R0, R6\n\ - LDRB R1, [R0]\n\ - LSLS R0, R1, #4\n\ - ADDS R0, R0, R1\n\ - LSLS R0, R0, #2\n\ - LDR R1, off_805623C\n\ - ADDS R0, R0, R1\n\ - BL DestroySprite\n\ - ADDS R0, R6, #1\n\ - LSLS R0, R0, #0x10\n\ - LSRS R6, R0, #0x10\n\ - CMP R6, #2\n\ - BLS loc_8056206\n\ - LDR R1, [R4]\n\ - MOVS R0, #0x98\n\ - LSLS R0, R0, #1\n\ - ADDS R2, R1, R0\n\ - MOVS R0, #0\n\ - STR R0, [R2]\n\ - B loc_8056520\n\ -@ ---------------------------------------------------------------------------\n\ - .align 2, 0\n\ -off_8056238: .4byte gBerryBlenderData\n\ -off_805623C: .4byte gSprites\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_8056240: @ jumptable 0805619A case 3\n\ - MOVS R0, #4\n\ - MOVS R1, #2\n\ - MOVS R2, #0x19\n\ - MOVS R3, #0x11\n\ - BL Menu_DrawStdWindowFrame\n\ - LDR R0, dword_805642C\n\ - MOVS R1, #5\n\ - MOVS R2, #3\n\ - MOVS R3, #0xA0\n\ - BL sub_8072BD8\n\ - MOVS R6, #0\n\ - LDR R1, off_8056430\n\ - LDR R0, [R1]\n\ - ADDS R0, #0x88\n\ - ADD R2, SP, #0xC\n\ - MOV R8, R2\n\ - MOV R2, SP\n\ - ADDS R2, #0x16\n\ - STR R2, [SP,#0x30]\n\ - LDRB R0, [R0]\n\ - CMP R6, R0\n\ - BCS loc_8056322\n\ - MOV R9, R1\n\ - LDR R0, off_8056434\n\ - MOV R10, R0\n\ -\n\ -loc_8056276:\n\ - MOV R1, R9\n\ - LDR R2, [R1]\n\ - MOVS R1, #0xB2\n\ - LSLS R1, R1, #1\n\ - ADDS R0, R2, R1\n\ - ADDS R0, R0, R6\n\ - LDRB R4, [R0]\n\ - LSLS R1, R4, #4\n\ - ADDS R1, R1, R2\n\ - MOVS R2, #0xBF\n\ - LSLS R2, R2, #1\n\ - ADDS R1, R1, R2\n\ - MOV R0, R8\n\ - BL StringCopy\n\ - LSLS R5, R4, #3\n\ - SUBS R5, R5, R4\n\ - LSLS R5, R5, #2\n\ - MOV R1, R10\n\ - ADDS R0, R5, R1\n\ - LDRB R1, [R0,#0x1A]\n\ - MOV R0, R8\n\ - BL ConvertInternationalString\n\ - MOV R0, R8\n\ - LDR R1, dword_8056438\n\ - BL de_sub_8073174\n\ - MOV R2, R9\n\ - LDR R0, [R2]\n\ - ADDS R7, R0, #0\n\ - ADDS R7, #0xAB\n\ - ADDS R4, R6, #1\n\ - ADDS R0, R7, #0\n\ - ADDS R1, R4, #0\n\ - BL ConvertIntToDecimalString\n\ - ADDS R7, R0, #0\n\ - MOVS R1, #0\n\ - STRB R1, [R7]\n\ - MOVS R0, #0xAD\n\ - STRB R0, [R7,#1]\n\ - STRB R1, [R7,#2]\n\ - ADDS R7, #3\n\ - LDR R0, off_805643C\n\ - ADDS R5, R5, R0\n\ - ADDS R0, R7, #0\n\ - ADDS R1, R5, #0\n\ - MOVS R2, #0x58\n\ - MOVS R3, #0\n\ - BL sub_8072C74\n\ - ADDS R7, R0, #0\n\ - ADD R1, SP, #0xC\n\ - MOVS R2, #0x9D\n\ - MOVS R3, #0\n\ - BL sub_8072C74\n\ - MOV R2, R9\n\ - LDR R1, [R2]\n\ - ADDS R0, R1, #0\n\ - ADDS R0, #0xAB\n\ - LDR R3, dword_8056440\n\ - ADDS R1, #0x88\n\ - LDRB R2, [R1]\n\ - ADDS R3, R2, R3\n\ - LDR R1, dword_8056444\n\ - ADDS R2, R2, R1\n\ - LDRB R1, [R2]\n\ - ADDS R2, R6, #0\n\ - MULS R2, R1\n\ - LDRB R3, [R3]\n\ - ADDS R2, R2, R3\n\ - LSLS R2, R2, #0x18\n\ - LSRS R2, R2, #0x18\n\ - MOVS R1, #5\n\ - BL Menu_PrintText\n\ - LSLS R4, R4, #0x10\n\ - LSRS R6, R4, #0x10\n\ - MOV R1, R9\n\ - LDR R0, [R1]\n\ - ADDS R0, #0x88\n\ - LDRB R0, [R0]\n\ - CMP R6, R0\n\ - BCC loc_8056276\n\ -\n\ -loc_8056322:\n\ - LDR R6, off_8056430\n\ - LDR R0, [R6]\n\ - ADDS R0, #0x5A\n\ - LDRH R0, [R0]\n\ - MOVS R1, #0x64\n\ - BL __umodsi3\n\ - ADDS R1, R0, #0\n\ - LSLS R1, R1, #0x10\n\ - LSRS R1, R1, #0x10\n\ - MOV R0, R8\n\ - MOVS R2, #2\n\ - MOVS R3, #2\n\ - BL ConvertIntToDecimalStringN\n\ - LDR R0, [R6]\n\ - ADDS R7, R0, #0\n\ - ADDS R7, #0xAB\n\ - LDR R1, dword_8056448\n\ - ADDS R0, R7, #0\n\ - BL StringCopy\n\ - ADDS R7, R0, #0\n\ - LDR R0, [R6]\n\ - ADDS R0, #0x5A\n\ - LDRH R0, [R0]\n\ - MOVS R1, #0x64\n\ - BL __udivsi3\n\ - ADDS R1, R0, #0\n\ - LSLS R1, R1, #0x10\n\ - LSRS R1, R1, #0x10\n\ - ADDS R0, R7, #0\n\ - MOVS R2, #0x79\n\ - MOVS R3, #1\n\ - BL sub_8072C14\n\ - ADDS R7, R0, #0\n\ - MOVS R0, #0xB8\n\ - STRB R0, [R7]\n\ - ADDS R7, #1\n\ - ADDS R0, R7, #0\n\ - MOV R1, R8\n\ - MOVS R2, #0x88\n\ - MOVS R3, #1\n\ - BL sub_8072C74\n\ - ADDS R7, R0, #0\n\ - LDR R1, off_805644C\n\ - BL StringCopy\n\ - LDR R0, [R6]\n\ - ADDS R0, #0xAB\n\ - MOVS R1, #5\n\ - MOVS R2, #0xD\n\ - BL Menu_PrintText\n\ - LDR R0, [R6]\n\ - MOVS R2, #0x96\n\ - LSLS R2, R2, #1\n\ - ADDS R0, R0, R2\n\ - LDR R0, [R0]\n\ - MOVS R1, #0x3C\n\ - BL __udivsi3\n\ - ADDS R4, R0, #0\n\ - LSLS R4, R4, #0x10\n\ - LSRS R4, R4, #0x10\n\ - ADDS R0, R4, #0\n\ - MOVS R1, #0x3C\n\ - BL __umodsi3\n\ - ADDS R5, R0, #0\n\ - LSLS R5, R5, #0x10\n\ - LSRS R5, R5, #0x10\n\ - ADDS R0, R4, #0\n\ - MOVS R1, #0x3C\n\ - BL __udivsi3\n\ - ADDS R1, R0, #0\n\ - LSLS R1, R1, #0x10\n\ - LSRS R1, R1, #0x10\n\ - MOV R0, R8\n\ - MOVS R2, #2\n\ - MOVS R3, #2\n\ - BL ConvertIntToDecimalStringN\n\ - LDR R0, [SP,#0x30]\n\ - ADDS R1, R5, #0\n\ - MOVS R2, #2\n\ - MOVS R3, #2\n\ - BL ConvertIntToDecimalStringN\n\ - LDR R0, [R6]\n\ - ADDS R7, R0, #0\n\ - ADDS R7, #0xAB\n\ - LDR R1, dword_8056450\n\ - ADDS R0, R7, #0\n\ - BL StringCopy\n\ - ADDS R7, R0, #0\n\ - MOV R1, R8\n\ - MOVS R2, #0x63\n\ - MOVS R3, #1\n\ - BL sub_8072C74\n\ - ADDS R7, R0, #0\n\ - LDR R1, dword_8056454\n\ - BL StringAppend\n\ - ADDS R7, R0, #0\n\ - LDR R1, [SP,#0x30]\n\ - MOVS R2, #0x88\n\ - MOVS R3, #1\n\ - BL sub_8072C74\n\ - ADDS R7, R0, #0\n\ - LDR R1, dword_8056458\n\ - BL StringCopy\n\ - LDR R0, [R6]\n\ - ADDS R0, #0xAB\n\ - MOVS R1, #5\n\ - MOVS R2, #0xF\n\ - BL Menu_PrintText\n\ - LDR R1, [R6]\n\ - MOVS R0, #0x98\n\ - LSLS R0, R0, #1\n\ - ADDS R2, R1, R0\n\ - MOVS R0, #0\n\ - STR R0, [R2]\n\ - B loc_8056520\n\ -@ ---------------------------------------------------------------------------\n\ -dword_805642C: .4byte gOtherText_ResultsOfBlending\n\ -off_8056430: .4byte gBerryBlenderData\n\ -off_8056434: .4byte gLinkPlayers\n\ -dword_8056438: .4byte gOtherText_Berry\n\ -off_805643C: .4byte gLinkPlayers+0x8\n\ -dword_8056440: .4byte gUnknown_082165E9\n\ -dword_8056444: .4byte gUnknown_082165EE\n\ -dword_8056448: .4byte gOtherText_MaxSpeed\n\ -off_805644C: .4byte gOtherText_RPM\n\ -dword_8056450: .4byte gOtherText_RequiredTime\n\ -dword_8056454: .4byte gOtherText_Min\n\ -dword_8056458: .4byte gOtherText_Sec\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_805645C: @ jumptable 0805619A case 4\n\ - LDR R0, off_805646C\n\ - LDRH R1, [R0,#0x2E]\n\ - MOVS R0, #1\n\ - ANDS R0, R1\n\ - CMP R0, #0\n\ - BEQ def_805619A @ jumptable 0805619A default case\n\ - LDR R1, [R2]\n\ - B loc_8056520\n\ -@ ---------------------------------------------------------------------------\n\ -off_805646C: .4byte gMain\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_8056470: @ jumptable 0805619A case 5\n\ - BL Menu_EraseScreen\n\ - MOVS R0, #0\n\ - MOVS R1, #0xE\n\ - MOVS R2, #0x1D\n\ - MOVS R3, #0x13\n\ - BL Menu_DrawStdWindowFrame\n\ - MOVS R6, #0\n\ - ADD R1, SP, #0xC\n\ - MOV R8, R1\n\ - ADD R5, SP, #0x28\n\ - LDR R0, off_8056528\n\ - LDR R0, [R0]\n\ - ADDS R3, R0, #0\n\ - ADDS R3, #0x80\n\ - ADD R2, SP, #0x20\n\ -\n\ -loc_8056492:\n\ - LSLS R1, R6, #1\n\ - ADDS R0, R3, R1\n\ - LDRH R0, [R0]\n\ - CMP R0, #0\n\ - BEQ loc_80564A2\n\ - ADDS R1, R2, R1\n\ - SUBS R0, #0x85\n\ - STRH R0, [R1]\n\ -\n\ -loc_80564A2:\n\ - ADDS R0, R6, #1\n\ - LSLS R0, R0, #0x10\n\ - LSRS R6, R0, #0x10\n\ - CMP R6, #3\n\ - BLS loc_8056492\n\ - BL sub_8050760\n\ - LDR R4, off_8056528\n\ - LDR R3, [R4]\n\ - MOVS R2, #0xBE\n\ - LSLS R2, R2, #1\n\ - ADDS R0, R3, R2\n\ - ADDS R1, R3, #0\n\ - ADDS R1, #0x88\n\ - LDRB R2, [R1]\n\ - SUBS R1, #0x2E\n\ - LDRH R1, [R1]\n\ - STR R1, [SP]\n\ - ADDS R1, R5, #0\n\ - ADD R3, SP, #4\n\ - BL Blender_CalculatePokeblock\n\ - LDR R1, [R4]\n\ - ADDS R1, #0xAB\n\ - ADDS R0, R5, #0\n\ - BL Blender_PrintMadePokeblockString\n\ - LDR R0, off_805652C\n\ - MOVS R1, #6\n\ - BL CreateTask\n\ - BL sub_8007E40\n\ - ADDS R1, R0, #0\n\ - MOV R0, R8\n\ - MOVS R2, #0\n\ - MOVS R3, #4\n\ - BL ConvertIntToHexStringN\n\ - LDR R1, dword_8056530\n\ - MOV R0, R8\n\ - BL StringAppend\n\ - LDR R0, [R4]\n\ - ADDS R0, #0xAB\n\ - MOV R1, R8\n\ - BL StringAppend\n\ - LDR R0, [R4]\n\ - ADDS R0, #0xAB\n\ - MOVS R1, #1\n\ - MOVS R2, #0xF\n\ - BL MenuPrintMessage\n\ - LDR R0, off_8056534\n\ - LDRH R0, [R0]\n\ - MOVS R1, #1\n\ - BL RemoveBagItem\n\ - ADDS R0, R5, #0\n\ - BL sub_810CA34\n\ - LDR R1, [R4]\n\ -\n\ -loc_8056520:\n\ - LDRB R0, [R1]\n\ - ADDS R0, #1\n\ - STRB R0, [R1]\n\ - B def_805619A @ jumptable 0805619A default case\n\ -@ ---------------------------------------------------------------------------\n\ -off_8056528: .4byte gBerryBlenderData\n\ -off_805652C: .4byte sub_8052BD0+1\n\ -dword_8056530: .4byte gUnknown_08216249\n\ -off_8056534: .4byte gSpecialVar_ItemId\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -loc_8056538: @ jumptable 0805619A case 6\n\ - BL Menu_UpdateWindowText\n\ - LSLS R0, R0, #0x18\n\ - CMP R0, #0\n\ - BEQ def_805619A @ jumptable 0805619A default case\n\ - BL Blender_TrySettingRecord\n\ - MOVS R0, #1\n\ - B loc_805654C\n\ -@ ---------------------------------------------------------------------------\n\ -\n\ -def_805619A: @ jumptable 0805619A default case\n\ - MOVS R0, #0\n\ -\n\ -loc_805654C:\n\ - ADD SP, SP, #0x34\n\ - POP {R3-R5}\n\ - MOV R8, R3\n\ - MOV R9, R4\n\ - MOV R10, R5\n\ - POP {R4-R7}\n\ - POP {R1}\n\ - BX R1\n\ - .syntax divided\n"); -} -#else bool8 Blender_PrintBlendingResults(void) { u16 i; @@ -3882,6 +3395,11 @@ bool8 Blender_PrintBlendingResults(void) Blender_CalculatePokeblock(gBerryBlenderData->blendedBerries, &pokeblock, gBerryBlenderData->playersNo, flavours, gBerryBlenderData->max_RPM); Blender_PrintMadePokeblockString(&pokeblock, gBerryBlenderData->stringVar); CreateTask(sub_8052BD0, 6); +#if DEBUG + ConvertIntToHexStringN(text[0], sub_8007E40(), 0, 4); + StringAppend(text[0], gUnknown_08216249); + StringAppend(gBerryBlenderData->stringVar, text[0]); +#endif MenuPrintMessage(gBerryBlenderData->stringVar, 1, 15); RemoveBagItem(gSpecialVar_ItemId, 1); sub_810CA34(&pokeblock); @@ -3897,7 +3415,6 @@ bool8 Blender_PrintBlendingResults(void) } return FALSE; } -#endif /*static*/ void Blender_PrintMadePokeblockString(struct Pokeblock* pokeblock, u8* dst) { -- cgit v1.2.3 From 8cce68537704adb0d1d34a96fa977675ad1a0340 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Wed, 24 Jan 2018 20:11:06 -0600 Subject: integrate debug functions in field_control_avatar.c --- src/scene/new_game.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/scene') diff --git a/src/scene/new_game.c b/src/scene/new_game.c index cec7134a3..e64dc91e3 100644 --- a/src/scene/new_game.c +++ b/src/scene/new_game.c @@ -31,10 +31,6 @@ #include "text.h" #include "tv.h" -#if DEBUG -extern u8 gUnknown_020297ED; -#endif - EWRAM_DATA u8 gDifferentSaveFile = 0; EWRAM_DATA u8 gUnknown_020297ED = 0; -- cgit v1.2.3 From fe400f60b6609d37d2b8a0c2aec75321adc3e95f Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Sat, 27 Jan 2018 17:03:40 -0600 Subject: add comments for pool loads in C files --- src/scene/cable_car.c | 28 ++++++++++++++-------------- src/scene/cute_sketch.c | 42 +++++++++++++++++++++--------------------- 2 files changed, 35 insertions(+), 35 deletions(-) (limited to 'src/scene') diff --git a/src/scene/cable_car.c b/src/scene/cable_car.c index d81263f87..114505e4d 100644 --- a/src/scene/cable_car.c +++ b/src/scene/cable_car.c @@ -216,10 +216,10 @@ u8 debug_sub_8138C14(void) { asm("\n\ push {lr}\n\ - ldr r0, ._1\n\ + ldr r0, ._1 @ unk_203955C\n\ mov r1, #0x1\n\ strb r1, [r0]\n\ - ldr r0, ._1 + 4\n\ + ldr r0, ._1 + 4 @ MauvilleCity_GameCorner_EventScript_1C407E\n\ bl ScriptContext1_SetupScript\n\ bl CloseMenu\n\ mov r0, #0x1\n\ @@ -237,10 +237,10 @@ u8 debug_sub_8138C34(void) { asm("\n\ push {lr}\n\ - ldr r0, ._3\n\ + ldr r0, ._3 @ unk_203955C\n\ mov r1, #0x1\n\ strb r1, [r0]\n\ - ldr r0, ._3 + 4\n\ + ldr r0, ._3 + 4 @ MauvilleCity_GameCorner_EventScript_1C40AC\n\ bl ScriptContext1_SetupScript\n\ bl CloseMenu\n\ mov r0, #0x1\n\ @@ -258,7 +258,7 @@ u8 debug_sub_8138C54(void) { asm("\n\ push {r4, lr}\n\ - ldr r4, ._10\n\ + ldr r4, ._10 @ gMain\n\ ldrh r0, [r4, #0x2e]\n\ cmp r0, #0x40\n\ bne ._5 @cond_branch\n\ @@ -275,14 +275,14 @@ u8 debug_sub_8138C54(void) ldrh r1, [r4, #0x2e]\n\ cmp r1, #0x1\n\ beq ._7 @cond_branch\n\ - ldr r0, ._10 + 4\n\ + ldr r0, ._10 + 4 @ 0x101\n\ cmp r1, r0\n\ bne ._8 @cond_branch\n\ - ldr r1, ._10 + 8\n\ + ldr r1, ._10 + 8 @ gSpecialVar_0x8004\n\ mov r0, #0x1\n\ strh r0, [r1]\n\ ._7:\n\ - ldr r4, ._10 + 12\n\ + ldr r4, ._10 + 12 @ gUnkDebug4Menu\n\ bl Menu_GetCursorPos\n\ lsl r0, r0, #0x18\n\ lsr r0, r0, #0x15\n\ @@ -320,7 +320,7 @@ u8 debug_sub_8138CC4(void) asm("\n\ push {lr}\n\ add sp, sp, #0xfffffff8\n\ - ldr r1, ._14\n\ + ldr r1, ._14 @ gSpecialVar_0x8004\n\ mov r0, #0x0\n\ strh r0, [r1]\n\ bl Menu_EraseScreen\n\ @@ -329,7 +329,7 @@ u8 debug_sub_8138CC4(void) mov r2, #0x1d\n\ mov r3, #0xc\n\ bl Menu_DrawStdWindowFrame\n\ - ldr r3, ._14 + 4\n\ + ldr r3, ._14 + 4 @ gUnkDebug4Menu\n\ mov r0, #0x14\n\ mov r1, #0x1\n\ mov r2, #0x5\n\ @@ -343,8 +343,8 @@ u8 debug_sub_8138CC4(void) mov r2, #0x1\n\ mov r3, #0x5\n\ bl InitMenu\n\ - ldr r1, ._14 + 8\n\ - ldr r0, ._14 + 12\n\ + ldr r1, ._14 + 8 @ gMenuCallback\n\ + ldr r0, ._14 + 12 @ debug_sub_8138C54\n\ str r0, [r1]\n\ mov r0, #0x0\n\ add sp, sp, #0x8\n\ @@ -384,7 +384,7 @@ u8 debug_sub_8138D74(void) { asm("\n\ push {lr}\n\ - ldr r1, ._21\n\ + ldr r1, ._21 @ gSpecialVar_0x8004\n\ mov r0, #0x0\n\ strh r0, [r1]\n\ bl CloseMenu\n\ @@ -402,7 +402,7 @@ u8 debug_sub_8138D8C(void) { asm("\n\ push {lr}\n\ - ldr r1, ._23\n\ + ldr r1, ._23 @ gSpecialVar_0x8004\n\ mov r0, #0x1\n\ strh r0, [r1]\n\ bl CloseMenu\n\ diff --git a/src/scene/cute_sketch.c b/src/scene/cute_sketch.c index 848249528..2af990290 100644 --- a/src/scene/cute_sketch.c +++ b/src/scene/cute_sketch.c @@ -38,8 +38,8 @@ void debug_sub_8110CCC(void) push {r4, r5, r6, r7, lr}\n\ mov r7, #0x0\n\ mov r1, #0x0\n\ - ldr r2, ._5\n\ - ldr r6, ._5 + 4\n\ + ldr r2, ._5 @ gUnknown_083E79C0\n\ + ldr r6, ._5 + 4 @ \n\ ._7:\n\ lsl r0, r1, #0x3\n\ add r4, r0, r2\n\ @@ -108,7 +108,7 @@ void debug_sub_8110CCC(void) mov r2, #0x1d\n\ mov r3, #0x13\n\ bl Menu_DrawStdWindowFrame\n\ - ldr r0, ._9\n\ + ldr r0, ._9 @ \n\ mov r1, #0x11\n\ mov r2, #0x11\n\ bl Menu_PrintText\n\ @@ -133,14 +133,14 @@ void debug_sub_8110D84(void) asm("\ push {r4, lr}\n\ add sp, sp, #0xfffffffc\n\ - ldr r0, ._13\n\ + ldr r0, ._13 @ \n\ ldrh r0, [r0, #0x4]\n\ cmp r0, #0x7\n\ bls ._11 @cond_branch\n\ b ._65\n\ ._11:\n\ lsl r0, r0, #0x2\n\ - ldr r1, ._13 + 4\n\ + ldr r1, ._13 + 4 @ \n\ add r0, r0, r1\n\ ldr r0, [r0]\n\ mov pc, r0\n\ @@ -166,7 +166,7 @@ void debug_sub_8110D84(void) mov r2, #0x10\n\ mov r3, #0x0\n\ bl BeginNormalPaletteFade\n\ - ldr r1, ._25\n\ + ldr r1, ._25 @ \n\ ldrh r0, [r1, #0x4]\n\ add r0, r0, #0x1\n\ b ._62\n\ @@ -181,7 +181,7 @@ void debug_sub_8110D84(void) beq ._27 @cond_branch\n\ b ._65\n\ ._27:\n\ - ldr r1, ._30\n\ + ldr r1, ._30 @ \n\ ldrh r0, [r1, #0x4]\n\ add r0, r0, #0x1\n\ b ._62\n\ @@ -205,7 +205,7 @@ void debug_sub_8110D84(void) beq ._36 @cond_branch\n\ b ._65\n\ ._35:\n\ - ldr r4, ._41\n\ + ldr r4, ._41 @ \n\ ldrb r0, [r4, #0x1e]\n\ cmp r0, #0\n\ bne ._38 @cond_branch\n\ @@ -213,11 +213,11 @@ void debug_sub_8110D84(void) ._38:\n\ mov r0, #0x5\n\ bl m4aSongNumStart\n\ - ldr r1, ._41 + 4\n\ + ldr r1, ._41 + 4 @ \n\ add r0, r4, r1\n\ mov r1, #0x1\n\ strb r1, [r0]\n\ - ldr r0, ._41 + 8\n\ + ldr r0, ._41 + 8 @ \n\ bl sub_80FC244\n\ b ._65\n\ ._42:\n\ @@ -236,7 +236,7 @@ void debug_sub_8110D84(void) mov r2, #0x0\n\ mov r3, #0x10\n\ bl BeginNormalPaletteFade\n\ - ldr r1, ._44\n\ + ldr r1, ._44 @ \n\ ldrh r0, [r1, #0x4]\n\ add r0, r0, #0x1\n\ b ._62\n\ @@ -249,7 +249,7 @@ void debug_sub_8110D84(void) lsl r0, r0, #0x18\n\ cmp r0, #0\n\ bne ._65 @cond_branch\n\ - ldr r0, ._48\n\ + ldr r0, ._48 @ sub_805469C\n\ bl SetMainCallback2\n\ b ._65\n\ ._49:\n\ @@ -265,7 +265,7 @@ void debug_sub_8110D84(void) bl debug_sub_8110CCC\n\ b ._65\n\ ._50:\n\ - ldr r0, ._54\n\ + ldr r0, ._54 @ gMain\n\ ldrh r1, [r0, #0x2e]\n\ mov r0, #0x1\n\ and r0, r0, r1\n\ @@ -273,7 +273,7 @@ void debug_sub_8110D84(void) beq ._65 @cond_branch\n\ bl sub_80FBCA0\n\ bl sub_80FAEC4\n\ - ldr r1, ._54 + 4\n\ + ldr r1, ._54 + 4 @ \n\ ldrh r0, [r1, #0x4]\n\ add r0, r0, #0x1\n\ b ._62\n\ @@ -290,7 +290,7 @@ void debug_sub_8110D84(void) mov r0, #0x0\n\ mov r1, #0x0\n\ bl CreateRegionMapCursor\n\ - ldr r1, ._58\n\ + ldr r1, ._58 @ \n\ ldrh r0, [r1, #0x4]\n\ add r0, r0, #0x1\n\ b ._62\n\ @@ -305,7 +305,7 @@ void debug_sub_8110D84(void) beq ._60 @cond_branch\n\ bl debug_sub_8110CCC\n\ ._60:\n\ - ldr r0, ._63\n\ + ldr r0, ._63 @ gMain\n\ ldrh r1, [r0, #0x2e]\n\ mov r0, #0x1\n\ and r0, r0, r1\n\ @@ -313,7 +313,7 @@ void debug_sub_8110D84(void) beq ._65 @cond_branch\n\ bl sub_80FBCA0\n\ bl sub_80FAEC4\n\ - ldr r1, ._63 + 4\n\ + ldr r1, ._63 + 4 @ \n\ ldrh r0, [r1, #0x4]\n\ add r0, r0, #0x1\n\ b ._62\n\ @@ -330,7 +330,7 @@ void debug_sub_8110D84(void) mov r0, #0x0\n\ mov r1, #0x0\n\ bl CreateRegionMapCursor\n\ - ldr r1, ._66\n\ + ldr r1, ._66 @ \n\ mov r0, #0x3\n\ ._62:\n\ strh r0, [r1, #0x4]\n\ @@ -351,13 +351,13 @@ void debug_sub_8110F28(void) asm("\ push {lr}\n\ bl CB2_InitFlyRegionMap\n\ - ldr r0, ._69\n\ + ldr r0, ._69 @ gMain\n\ ldr r1, [r0, #0x4]\n\ - ldr r0, ._69 + 4\n\ + ldr r0, ._69 + 4 @ CB2_FlyRegionMap\n\ cmp r1, r0\n\ bne ._68 @cond_branch\n\ bl sub_80FBF94\n\ - ldr r0, ._69 + 8\n\ + ldr r0, ._69 + 8 @ debug_sub_8110D84\n\ bl sub_80FC244\n\ bl debug_sub_8110CCC\n\ ._68:\n\ -- cgit v1.2.3