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/field/berry.c | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 521 insertions(+) (limited to 'src/field/berry.c') diff --git a/src/field/berry.c b/src/field/berry.c index 088267ad0..7c6640dc8 100644 --- a/src/field/berry.c +++ b/src/field/berry.c @@ -999,6 +999,66 @@ extern u16 gSpecialVar_0x8006; static u8 CalcBerryYield(struct BerryTree *tree); static u16 GetStageDurationByBerryType(u8 berry); +#if DEBUG +__attribute__((naked)) +void debug_sub_80C2B04() +{ + asm( + " push {lr}\n" + " mov r0, #0x0\n" + " bl sub_80B47D8\n" + " lsl r0, r0, #0x18\n" + " lsr r0, r0, #0x18\n" + " ldr r2, ._1\n" + " lsl r1, r0, #0x2\n" + " add r1, r1, r0\n" + " lsl r1, r1, #0x3\n" + " add r1, r1, r2\n" + " ldrh r0, [r1, #0x10]\n" + " sub r0, r0, #0x1\n" + " strh r0, [r1, #0x10]\n" + " bl CloseMenu\n" + " mov r0, #0x1\n" + " pop {r1}\n" + " bx r1\n" + "._2:\n" + " .align 2, 0\n" + "._1:\n" + " .word gTasks\n" + "\n" + ); +} + +__attribute__((naked)) +void debug_sub_80C2B30() +{ + asm( + " push {lr}\n" + " mov r0, #0x1\n" + " bl sub_80B47D8\n" + " lsl r0, r0, #0x18\n" + " lsr r0, r0, #0x18\n" + " ldr r2, ._3\n" + " lsl r1, r0, #0x2\n" + " add r1, r1, r0\n" + " lsl r1, r1, #0x3\n" + " add r1, r1, r2\n" + " ldrh r0, [r1, #0x10]\n" + " sub r0, r0, #0x1\n" + " strh r0, [r1, #0x10]\n" + " bl CloseMenu\n" + " mov r0, #0x1\n" + " pop {r1}\n" + " bx r1\n" + "._4:\n" + " .align 2, 0\n" + "._3:\n" + " .word gTasks\n" + "\n" + ); +} +#endif + // unused // this could be static, but making it so causes a compile-time warning. void ClearEnigmaBerries(void) @@ -1022,6 +1082,180 @@ void SetEnigmaBerry(u8 *src) gSaveBlock1.enigmaBerry.berry.description2 = gSaveBlock1.enigmaBerry.description2; } +#if DEBUG +__attribute__((naked)) +void debug_sub_80C2BD0() +{ + asm( + " push {r4, r5, r6, r7, lr}\n" + " ldr r3, ._11\n" + " ldr r1, ._11 + 4\n" + " add r4, r3, r1\n" + " ldr r6, [r4]\n" + " add r1, r1, #0x4\n" + " add r2, r3, r1\n" + " ldr r7, [r2]\n" + " mov r1, #0x0\n" + " str r1, [r4]\n" + " str r1, [r2]\n" + " add r4, r0, #0\n" + " mov r2, #0x0\n" + " ldr r5, ._11 + 8\n" + "._10:\n" + " add r0, r4, r1\n" + " ldrb r0, [r0]\n" + " add r2, r2, r0\n" + " add r1, r1, #0x1\n" + " cmp r1, r5\n" + " bls ._10 @cond_branch\n" + " ldr r1, ._11 + 4\n" + " add r0, r3, r1\n" + " str r6, [r0]\n" + " add r1, r1, #0x4\n" + " add r0, r3, r1\n" + " str r7, [r0]\n" + " add r0, r2, #0\n" + " pop {r4, r5, r6, r7}\n" + " pop {r1}\n" + " bx r1\n" + "._12:\n" + " .align 2, 0\n" + "._11:\n" + " .word gSaveBlock1\n" + " .word 0x316c\n" + " .word 0x52b\n" + "\n" + ); +} +#endif + +#if DEBUG +__attribute__((naked)) +u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) +{ + asm( + " push {r4, r5, r6, r7, lr}\n" + " mov r7, r9\n" + " mov r6, r8\n" + " push {r6, r7}\n" + " add r3, r0, #0\n" + " lsl r1, r1, #0x18\n" + " lsr r1, r1, #0x18\n" + " mov r9, r1\n" + " lsl r2, r2, #0x18\n" + " lsr r2, r2, #0x18\n" + " mov r8, r2\n" + " ldr r4, ._16\n" + " ldr r1, ._16 + 4\n" + " add r0, r4, r1\n" + " add r2, r0, #0\n" + " ldr r1, ._16 + 8\n" + " ldmia r1!, {r5, r6, r7}\n" + " stmia r2!, {r5, r6, r7}\n" + " ldmia r1!, {r5, r6, r7}\n" + " stmia r2!, {r5, r6, r7}\n" + " ldr r1, [r1]\n" + " str r1, [r2]\n" + " add r1, r3, #0\n" + " bl StringCopy\n" + " ldr r0, ._16 + 12\n" + " add r6, r4, r0\n" + " ldr r1, ._16 + 16\n" + " add r0, r6, #0\n" + " bl StringCopy\n" + " ldr r1, ._16 + 20\n" + " add r5, r4, r1\n" + " ldr r1, ._16 + 24\n" + " add r0, r5, #0\n" + " bl StringCopy\n" + " ldr r2, ._16 + 28\n" + " add r0, r4, r2\n" + " str r6, [r0]\n" + " ldr r6, ._16 + 32\n" + " add r0, r4, r6\n" + " str r5, [r0]\n" + " mov r2, #0x0\n" + " ldr r6, ._16 + 36\n" + " ldr r7, ._16 + 40\n" + " add r5, r4, r7\n" + " ldr r3, ._16 + 44\n" + "._13:\n" + " add r0, r2, r5\n" + " add r1, r2, r3\n" + " ldrb r1, [r1]\n" + " strb r1, [r0]\n" + " add r2, r2, #0x1\n" + " cmp r2, r6\n" + " ble ._13 @cond_branch\n" + " ldr r0, ._16\n" + " ldr r3, ._16 + 48\n" + " ldr r2, ._16 + 52\n" + " add r1, r0, r2\n" + " mov r2, #0xf\n" + "._14:\n" + " ldrh r0, [r3]\n" + " strh r0, [r1]\n" + " add r3, r3, #0x2\n" + " add r1, r1, #0x2\n" + " sub r2, r2, #0x1\n" + " cmp r2, #0\n" + " bge ._14 @cond_branch\n" + " mov r2, #0x0\n" + " ldr r5, ._16 + 56\n" + " ldr r3, ._16 + 60\n" + "._15:\n" + " add r0, r2, r5\n" + " add r1, r2, r3\n" + " ldrb r1, [r1]\n" + " strb r1, [r0]\n" + " add r2, r2, #0x1\n" + " cmp r2, #0x11\n" + " ble ._15 @cond_branch\n" + " ldr r5, ._16 + 64\n" + " add r0, r4, r5\n" + " mov r6, r9\n" + " strb r6, [r0]\n" + " ldr r7, ._16 + 68\n" + " add r0, r4, r7\n" + " mov r1, r8\n" + " strb r1, [r0]\n" + " ldr r2, ._16 + 4\n" + " add r0, r4, r2\n" + " bl debug_sub_80C2BD0\n" + " add r5, r5, #0x4\n" + " add r1, r4, r5\n" + " str r0, [r1]\n" + " pop {r3, r4}\n" + " mov r8, r3\n" + " mov r9, r4\n" + " pop {r4, r5, r6, r7}\n" + " pop {r0}\n" + " bx r0\n" + "._17:\n" + " .align 2, 0\n" + "._16:\n" + " .word gSaveBlock1\n" + " .word 0x3160\n" + " .word gBerries\n" + " .word 0x361c\n" + " .word gUnknown_Debug_083F7F84\n" + " .word 0x3649\n" + " .word gUnknown_Debug_083F7F90\n" + " .word 0x316c\n" + " .word 0x3170\n" + " .word 0x47f\n" + " .word 0x317c\n" + " .word gSpriteImage_83C172C+0x80\n" + " .word gSpriteImage_83C172C+0x500\n" + " .word 0x35fc\n" + " .word gSaveBlock1+0x3676\n" + " .word gUnknown_Debug_839B6CE\n" + " .word 0x3688\n" + " .word 0x3689\n" + "\n" + ); +} +#else static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) { const u8 *description1; @@ -1051,9 +1285,110 @@ static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) return checksum; } +#endif + +#if DEBUG +__attribute__((naked)) +void debug_sub_80C2D24() +{ + asm( + " push {r4, r5, r6, r7, lr}\n" + " mov r7, r8\n" + " push {r7}\n" + " ldr r6, [sp, #0x18]\n" + " ldr r4, [sp, #0x1c]\n" + " mov r8, r4\n" + " ldr r5, ._18\n" + " ldr r7, ._18 + 4\n" + " add r4, r5, r7\n" + " strb r0, [r4]\n" + " ldr r4, ._18 + 8\n" + " add r0, r5, r4\n" + " strb r1, [r0]\n" + " add r7, r7, #0x2\n" + " add r0, r5, r7\n" + " strb r2, [r0]\n" + " ldr r1, ._18 + 12\n" + " add r0, r5, r1\n" + " strb r3, [r0]\n" + " add r4, r4, #0x3\n" + " add r0, r5, r4\n" + " strb r6, [r0]\n" + " add r7, r7, #0x3\n" + " add r0, r5, r7\n" + " mov r1, r8\n" + " strb r1, [r0]\n" + " sub r4, r4, #0x19\n" + " add r0, r5, r4\n" + " bl debug_sub_80C2BD0\n" + " ldr r7, ._18 + 16\n" + " add r5, r5, r7\n" + " str r0, [r5]\n" + " pop {r3}\n" + " mov r8, r3\n" + " pop {r4, r5, r6, r7}\n" + " pop {r0}\n" + " bx r0\n" + "._19:\n" + " .align 2, 0\n" + "._18:\n" + " .word gSaveBlock1\n" + " .word 0x3175\n" + " .word 0x3176\n" + " .word 0x3178\n" + " .word 0x368c\n" + "\n" + ); +} +#endif // due to e-reader scans being particularly volatile to failure, it is a requirement to check for // their integrity here due to scans possibly failing to produce the correct result. +#if DEBUG +__attribute__((naked)) +bool32 IsEnigmaBerryValid() +{ + asm( + " push {r4, lr}\n" + " ldr r4, ._24\n" + " ldr r1, ._24 + 4\n" + " add r0, r4, r1\n" + " ldrb r0, [r0]\n" + " cmp r0, #0\n" + " beq ._22 @cond_branch\n" + " ldr r2, ._24 + 8\n" + " add r0, r4, r2\n" + " ldrb r0, [r0]\n" + " cmp r0, #0\n" + " beq ._22 @cond_branch\n" + " ldr r1, ._24 + 12\n" + " add r0, r4, r1\n" + " bl debug_sub_80C2BD0\n" + " ldr r2, ._24 + 16\n" + " add r1, r4, r2\n" + " ldr r1, [r1]\n" + " cmp r0, r1\n" + " bne ._22 @cond_branch\n" + " mov r0, #0x1\n" + " b ._23\n" + "._25:\n" + " .align 2, 0\n" + "._24:\n" + " .word gSaveBlock1\n" + " .word 0x3174\n" + " .word 0x316a\n" + " .word 0x3160\n" + " .word 0x368c\n" + "._22:\n" + " mov r0, #0x0\n" + "._23:\n" + " pop {r4}\n" + " pop {r1}\n" + " bx r1\n" + "\n" + ); +} +#else bool32 IsEnigmaBerryValid(void) { if (gSaveBlock1.enigmaBerry.berry.stageDuration == 0) @@ -1064,6 +1399,7 @@ bool32 IsEnigmaBerryValid(void) return FALSE; return TRUE; } +#endif const struct Berry *GetBerryInfo(u8 berry) { @@ -1417,6 +1753,177 @@ bool8 PlayerHasBerries(void) return IsBagPocketNonEmpty(BAG_BERRIES); } +#if DEBUG +void debug_sub_80C33FC(u8 *buffer, s32 value, u8 n) +{ + StringAppend(gStringVar4, buffer); + ConvertIntToDecimalStringN(gStringVar1, value, STR_CONV_MODE_LEADING_ZEROS, n); + StringAppend(gStringVar4, gStringVar1); +} + +extern const u8 gUnknown_Debug_083F7F9D[]; +extern const u8 gUnknown_Debug_083F7FA2[]; +extern const u8 gUnknown_Debug_083F7FA9[]; +extern const u8 gUnknown_Debug_083F7FB0[]; +extern const u8 gUnknown_Debug_083F7FB7[]; +extern const u8 gUnknown_Debug_083F7FBE[]; +extern const u8 gUnknown_Debug_083F7FC5[]; +extern const u8 gUnknown_Debug_083F7FCC[]; +extern const u8 gUnknown_Debug_083F7FD3[]; +extern const u8 gUnknown_Debug_083F7FD3[]; +extern const u8 gUnknown_Debug_083F7FD3[]; + +#ifdef NONMATCHING +u8* DebugOpenBerryInfo(void) +{ + s32 i; + u8 berryTreeId; + struct BerryTree *berryTree; + + if (GetFieldObjectScriptPointerForComparison() != &BerryTreeScript) + return NULL; + + berryTreeId = FieldObjectGetBerryTreeId(gSelectedMapObject); + berryTree = GetBerryTreeInfo(berryTreeId); + + for (i = 0; i < 500; i++) + gStringVar4[i] |= 0xFF; + + debug_sub_80C33FC(gUnknown_Debug_083F7F9D, berryTreeId, 3); + debug_sub_80C33FC(gUnknown_Debug_083F7FA2, berryTree->berry, 2); + debug_sub_80C33FC(gUnknown_Debug_083F7FA9, berryTree->stage, 2); + debug_sub_80C33FC(gUnknown_Debug_083F7FB0, berryTree->secondsUntilNextStage, 5); + debug_sub_80C33FC(gUnknown_Debug_083F7FB7, berryTree->berryYield, 2); + debug_sub_80C33FC(gUnknown_Debug_083F7FBE, berryTree->regrowthCount, 3); + debug_sub_80C33FC(gUnknown_Debug_083F7FC5, berryTree->growthSparkle, 1); + debug_sub_80C33FC(gUnknown_Debug_083F7FCC, berryTree->watered1, 1); + debug_sub_80C33FC(gUnknown_Debug_083F7FD3, berryTree->watered2, 1); + debug_sub_80C33FC(gUnknown_Debug_083F7FD3, berryTree->watered3, 1); + debug_sub_80C33FC(gUnknown_Debug_083F7FD3, berryTree->watered4, 1); + + return gStringVar4; +} +#else +__attribute__((naked)) +void DebugOpenBerryInfo() +{ + asm( + " push {r4, r5, r6, r7, lr}\n" + " bl GetFieldObjectScriptPointerForComparison\n" + " ldr r1, ._138\n" + " cmp r0, r1\n" + " beq ._136 @cond_branch\n" + " mov r0, #0x0\n" + " b ._137\n" + "._139:\n" + " .align 2, 0\n" + "._138:\n" + " .word BerryTreeScript\n" + "._136:\n" + " ldr r0, ._141\n" + " ldrb r0, [r0]\n" + " bl FieldObjectGetBerryTreeId\n" + " lsl r0, r0, #0x18\n" + " lsr r6, r0, #0x18\n" + " add r0, r6, #0\n" + " bl GetBerryTreeInfo\n" + " add r5, r0, #0\n" + " mov r2, #0x0\n" + " ldr r7, ._141 + 4\n" + " ldr r4, ._141 + 8\n" + " mov r3, #0xff\n" + "._140:\n" + " add r1, r2, r4\n" + " ldrb r0, [r1]\n" + " orr r0, r0, r3\n" + " strb r0, [r1]\n" + " add r2, r2, #0x1\n" + " cmp r2, r7\n" + " ble ._140 @cond_branch\n" + " ldr r0, ._141 + 12\n" + " add r1, r6, #0\n" + " mov r2, #0x3\n" + " bl debug_sub_80C33FC\n" + " ldr r0, ._141 + 16\n" + " ldrb r1, [r5]\n" + " mov r2, #0x2\n" + " bl debug_sub_80C33FC\n" + " ldr r0, ._141 + 20\n" + " ldrb r1, [r5, #0x1]\n" + " lsl r1, r1, #0x19\n" + " lsr r1, r1, #0x19\n" + " mov r2, #0x2\n" + " bl debug_sub_80C33FC\n" + " ldr r0, ._141 + 24\n" + " ldrh r1, [r5, #0x2]\n" + " mov r2, #0x5\n" + " bl debug_sub_80C33FC\n" + " ldr r0, ._141 + 28\n" + " ldrb r1, [r5, #0x4]\n" + " mov r2, #0x2\n" + " bl debug_sub_80C33FC\n" + " ldr r0, ._141 + 32\n" + " ldrb r1, [r5, #0x5]\n" + " lsl r1, r1, #0x1c\n" + " lsr r1, r1, #0x1c\n" + " mov r2, #0x3\n" + " bl debug_sub_80C33FC\n" + " ldr r0, ._141 + 36\n" + " ldrb r1, [r5, #0x1]\n" + " lsr r1, r1, #0x7\n" + " mov r2, #0x1\n" + " bl debug_sub_80C33FC\n" + " ldr r0, ._141 + 40\n" + " ldrb r1, [r5, #0x5]\n" + " lsl r1, r1, #0x1b\n" + " lsr r1, r1, #0x1f\n" + " mov r2, #0x1\n" + " bl debug_sub_80C33FC\n" + " ldr r4, ._141 + 44\n" + " ldrb r1, [r5, #0x5]\n" + " lsl r1, r1, #0x1a\n" + " lsr r1, r1, #0x1f\n" + " add r0, r4, #0\n" + " mov r2, #0x1\n" + " bl debug_sub_80C33FC\n" + " ldrb r1, [r5, #0x5]\n" + " lsl r1, r1, #0x19\n" + " lsr r1, r1, #0x1f\n" + " add r0, r4, #0\n" + " mov r2, #0x1\n" + " bl debug_sub_80C33FC\n" + " ldrb r1, [r5, #0x5]\n" + " lsr r1, r1, #0x7\n" + " add r0, r4, #0\n" + " mov r2, #0x1\n" + " bl debug_sub_80C33FC\n" + " ldr r0, ._141 + 8\n" + "._137:\n" + " pop {r4, r5, r6, r7}\n" + " pop {r1}\n" + " bx r1\n" + "._142:\n" + " .align 2, 0\n" + "._141:\n" + " .word gSelectedMapObject\n" + " .word 0x1f3\n" + " .word gStringVar4\n" + " .word gUnknown_Debug_083F7F9D\n" + " .word gUnknown_Debug_083F7FA2\n" + " .word gUnknown_Debug_083F7FA9\n" + " .word gUnknown_Debug_083F7FB0\n" + " .word gUnknown_Debug_083F7FB7\n" + " .word gUnknown_Debug_083F7FBE\n" + " .word gUnknown_Debug_083F7FC5\n" + " .word gUnknown_Debug_083F7FCC\n" + " .word gUnknown_Debug_083F7FD3\n" + "\n" + ); +} +#endif + +#endif + // whenever the player is not within view of the berry tree during its sparkle state, the // sparkle state will be reset. void ResetBerryTreeSparkleFlags(void) @@ -1445,3 +1952,17 @@ void ResetBerryTreeSparkleFlags(void) } } } + +#if DEBUG +static const u8 gUnknown_Debug_083F7F84[] = _("そとから きた きのみ"); +static const u8 gUnknown_Debug_083F7F90[] = _("ただいま かいはつちゅう"); +static const u8 gUnknown_Debug_083F7F9D[] = _("POS:"); +static const u8 gUnknown_Debug_083F7FA2[] = _("\nTYPE:"); +static const u8 gUnknown_Debug_083F7FA9[] = _("\nGROW:"); +static const u8 gUnknown_Debug_083F7FB0[] = _("\nTIME:"); +static const u8 gUnknown_Debug_083F7FB7[] = _("\nFCNT:"); +static const u8 gUnknown_Debug_083F7FBE[] = _("\nSCNT:"); +static const u8 gUnknown_Debug_083F7FC5[] = _("\nHOOK:"); +static const u8 gUnknown_Debug_083F7FCC[] = _("\nWBIT:"); +static const u8 gUnknown_Debug_083F7FD3[] = _(""); +#endif -- cgit v1.2.3 From 73392181fe47fd0fe5ac3702978307926a442ef4 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Wed, 17 Jan 2018 18:08:02 -0600 Subject: resolve more undefined references --- src/field/berry.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/field/berry.c') diff --git a/src/field/berry.c b/src/field/berry.c index 7c6640dc8..d6982479e 100644 --- a/src/field/berry.c +++ b/src/field/berry.c @@ -1780,7 +1780,7 @@ u8* DebugOpenBerryInfo(void) u8 berryTreeId; struct BerryTree *berryTree; - if (GetFieldObjectScriptPointerForComparison() != &BerryTreeScript) + if (GetFieldObjectScriptPointerPlayerFacing() != &S_BerryTree) return NULL; berryTreeId = FieldObjectGetBerryTreeId(gSelectedMapObject); @@ -1809,7 +1809,7 @@ void DebugOpenBerryInfo() { asm( " push {r4, r5, r6, r7, lr}\n" - " bl GetFieldObjectScriptPointerForComparison\n" + " bl GetFieldObjectScriptPointerPlayerFacing\n" " ldr r1, ._138\n" " cmp r0, r1\n" " beq ._136 @cond_branch\n" @@ -1818,7 +1818,7 @@ void DebugOpenBerryInfo() "._139:\n" " .align 2, 0\n" "._138:\n" - " .word BerryTreeScript\n" + " .word S_BerryTree\n" "._136:\n" " ldr r0, ._141\n" " ldrb r0, [r0]\n" -- cgit v1.2.3 From e03633d6bc1e1cd155bc258edbb7783020b4bdb7 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Tue, 23 Jan 2018 16:55:48 -0600 Subject: fix more false offsets --- src/field/berry.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/field/berry.c') diff --git a/src/field/berry.c b/src/field/berry.c index d6982479e..5c1ecd699 100644 --- a/src/field/berry.c +++ b/src/field/berry.c @@ -1245,8 +1245,8 @@ u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) " .word 0x3170\n" " .word 0x47f\n" " .word 0x317c\n" - " .word gSpriteImage_83C172C+0x80\n" - " .word gSpriteImage_83C172C+0x500\n" + " .word gSpriteImage_UnusedCherry\n" + " .word gSpritePalette_UnusedCherry\n" " .word 0x35fc\n" " .word gSaveBlock1+0x3676\n" " .word gUnknown_Debug_839B6CE\n" -- 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/field/berry.c | 100 +++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'src/field/berry.c') diff --git a/src/field/berry.c b/src/field/berry.c index 5c1ecd699..588807755 100644 --- a/src/field/berry.c +++ b/src/field/berry.c @@ -1009,7 +1009,7 @@ void debug_sub_80C2B04() " bl sub_80B47D8\n" " lsl r0, r0, #0x18\n" " lsr r0, r0, #0x18\n" - " ldr r2, ._1\n" + " ldr r2, ._1 @ gTasks\n" " lsl r1, r0, #0x2\n" " add r1, r1, r0\n" " lsl r1, r1, #0x3\n" @@ -1038,7 +1038,7 @@ void debug_sub_80C2B30() " bl sub_80B47D8\n" " lsl r0, r0, #0x18\n" " lsr r0, r0, #0x18\n" - " ldr r2, ._3\n" + " ldr r2, ._3 @ gTasks\n" " lsl r1, r0, #0x2\n" " add r1, r1, r0\n" " lsl r1, r1, #0x3\n" @@ -1088,8 +1088,8 @@ void debug_sub_80C2BD0() { asm( " push {r4, r5, r6, r7, lr}\n" - " ldr r3, ._11\n" - " ldr r1, ._11 + 4\n" + " ldr r3, ._11 @ gSaveBlock1\n" + " ldr r1, ._11 + 4 @ 0x316c\n" " add r4, r3, r1\n" " ldr r6, [r4]\n" " add r1, r1, #0x4\n" @@ -1100,7 +1100,7 @@ void debug_sub_80C2BD0() " str r1, [r2]\n" " add r4, r0, #0\n" " mov r2, #0x0\n" - " ldr r5, ._11 + 8\n" + " ldr r5, ._11 + 8 @ 0x52b\n" "._10:\n" " add r0, r4, r1\n" " ldrb r0, [r0]\n" @@ -1108,7 +1108,7 @@ void debug_sub_80C2BD0() " add r1, r1, #0x1\n" " cmp r1, r5\n" " bls ._10 @cond_branch\n" - " ldr r1, ._11 + 4\n" + " ldr r1, ._11 + 4 @ 0x316c\n" " add r0, r3, r1\n" " str r6, [r0]\n" " add r1, r1, #0x4\n" @@ -1145,11 +1145,11 @@ u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) " lsl r2, r2, #0x18\n" " lsr r2, r2, #0x18\n" " mov r8, r2\n" - " ldr r4, ._16\n" - " ldr r1, ._16 + 4\n" + " ldr r4, ._16 @ gSaveBlock1\n" + " ldr r1, ._16 + 4 @ 0x3160\n" " add r0, r4, r1\n" " add r2, r0, #0\n" - " ldr r1, ._16 + 8\n" + " ldr r1, ._16 + 8 @ gBerries\n" " ldmia r1!, {r5, r6, r7}\n" " stmia r2!, {r5, r6, r7}\n" " ldmia r1!, {r5, r6, r7}\n" @@ -1158,27 +1158,27 @@ u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) " str r1, [r2]\n" " add r1, r3, #0\n" " bl StringCopy\n" - " ldr r0, ._16 + 12\n" + " ldr r0, ._16 + 12 @ 0x361c\n" " add r6, r4, r0\n" - " ldr r1, ._16 + 16\n" + " ldr r1, ._16 + 16 @ gUnknown_Debug_083F7F84\n" " add r0, r6, #0\n" " bl StringCopy\n" - " ldr r1, ._16 + 20\n" + " ldr r1, ._16 + 20 @ 0x3649\n" " add r5, r4, r1\n" - " ldr r1, ._16 + 24\n" + " ldr r1, ._16 + 24 @ gUnknown_Debug_083F7F90\n" " add r0, r5, #0\n" " bl StringCopy\n" - " ldr r2, ._16 + 28\n" + " ldr r2, ._16 + 28 @ 0x316c\n" " add r0, r4, r2\n" " str r6, [r0]\n" - " ldr r6, ._16 + 32\n" + " ldr r6, ._16 + 32 @ 0x3170\n" " add r0, r4, r6\n" " str r5, [r0]\n" " mov r2, #0x0\n" - " ldr r6, ._16 + 36\n" - " ldr r7, ._16 + 40\n" + " ldr r6, ._16 + 36 @ 0x47f\n" + " ldr r7, ._16 + 40 @ 0x317c\n" " add r5, r4, r7\n" - " ldr r3, ._16 + 44\n" + " ldr r3, ._16 + 44 @ gSpriteImage_UnusedCherry\n" "._13:\n" " add r0, r2, r5\n" " add r1, r2, r3\n" @@ -1187,9 +1187,9 @@ u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) " add r2, r2, #0x1\n" " cmp r2, r6\n" " ble ._13 @cond_branch\n" - " ldr r0, ._16\n" - " ldr r3, ._16 + 48\n" - " ldr r2, ._16 + 52\n" + " ldr r0, ._16 @ gSaveBlock1\n" + " ldr r3, ._16 + 48 @ gSpritePalette_UnusedCherry\n" + " ldr r2, ._16 + 52 @ 0x35fc\n" " add r1, r0, r2\n" " mov r2, #0xf\n" "._14:\n" @@ -1201,8 +1201,8 @@ u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) " cmp r2, #0\n" " bge ._14 @cond_branch\n" " mov r2, #0x0\n" - " ldr r5, ._16 + 56\n" - " ldr r3, ._16 + 60\n" + " ldr r5, ._16 + 56 @ gSaveBlock1\n" + " ldr r3, ._16 + 60 @ gUnknown_Debug_839B6CE\n" "._15:\n" " add r0, r2, r5\n" " add r1, r2, r3\n" @@ -1211,15 +1211,15 @@ u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) " add r2, r2, #0x1\n" " cmp r2, #0x11\n" " ble ._15 @cond_branch\n" - " ldr r5, ._16 + 64\n" + " ldr r5, ._16 + 64 @ 0x3688\n" " add r0, r4, r5\n" " mov r6, r9\n" " strb r6, [r0]\n" - " ldr r7, ._16 + 68\n" + " ldr r7, ._16 + 68 @ 0x3689\n" " add r0, r4, r7\n" " mov r1, r8\n" " strb r1, [r0]\n" - " ldr r2, ._16 + 4\n" + " ldr r2, ._16 + 4 @ 0x3160\n" " add r0, r4, r2\n" " bl debug_sub_80C2BD0\n" " add r5, r5, #0x4\n" @@ -1298,17 +1298,17 @@ void debug_sub_80C2D24() " ldr r6, [sp, #0x18]\n" " ldr r4, [sp, #0x1c]\n" " mov r8, r4\n" - " ldr r5, ._18\n" - " ldr r7, ._18 + 4\n" + " ldr r5, ._18 @ gSaveBlock1\n" + " ldr r7, ._18 + 4 @ 0x3175\n" " add r4, r5, r7\n" " strb r0, [r4]\n" - " ldr r4, ._18 + 8\n" + " ldr r4, ._18 + 8 @ 0x3176\n" " add r0, r5, r4\n" " strb r1, [r0]\n" " add r7, r7, #0x2\n" " add r0, r5, r7\n" " strb r2, [r0]\n" - " ldr r1, ._18 + 12\n" + " ldr r1, ._18 + 12 @ 0x3178\n" " add r0, r5, r1\n" " strb r3, [r0]\n" " add r4, r4, #0x3\n" @@ -1321,7 +1321,7 @@ void debug_sub_80C2D24() " sub r4, r4, #0x19\n" " add r0, r5, r4\n" " bl debug_sub_80C2BD0\n" - " ldr r7, ._18 + 16\n" + " ldr r7, ._18 + 16 @ 0x368c\n" " add r5, r5, r7\n" " str r0, [r5]\n" " pop {r3}\n" @@ -1350,21 +1350,21 @@ bool32 IsEnigmaBerryValid() { asm( " push {r4, lr}\n" - " ldr r4, ._24\n" - " ldr r1, ._24 + 4\n" + " ldr r4, ._24 @ gSaveBlock1\n" + " ldr r1, ._24 + 4 @ 0x3174\n" " add r0, r4, r1\n" " ldrb r0, [r0]\n" " cmp r0, #0\n" " beq ._22 @cond_branch\n" - " ldr r2, ._24 + 8\n" + " ldr r2, ._24 + 8 @ 0x316a\n" " add r0, r4, r2\n" " ldrb r0, [r0]\n" " cmp r0, #0\n" " beq ._22 @cond_branch\n" - " ldr r1, ._24 + 12\n" + " ldr r1, ._24 + 12 @ 0x3160\n" " add r0, r4, r1\n" " bl debug_sub_80C2BD0\n" - " ldr r2, ._24 + 16\n" + " ldr r2, ._24 + 16 @ 0x368c\n" " add r1, r4, r2\n" " ldr r1, [r1]\n" " cmp r0, r1\n" @@ -1810,7 +1810,7 @@ void DebugOpenBerryInfo() asm( " push {r4, r5, r6, r7, lr}\n" " bl GetFieldObjectScriptPointerPlayerFacing\n" - " ldr r1, ._138\n" + " ldr r1, ._138 @ S_BerryTree\n" " cmp r0, r1\n" " beq ._136 @cond_branch\n" " mov r0, #0x0\n" @@ -1820,7 +1820,7 @@ void DebugOpenBerryInfo() "._138:\n" " .word S_BerryTree\n" "._136:\n" - " ldr r0, ._141\n" + " ldr r0, ._141 @ gSelectedMapObject\n" " ldrb r0, [r0]\n" " bl FieldObjectGetBerryTreeId\n" " lsl r0, r0, #0x18\n" @@ -1829,8 +1829,8 @@ void DebugOpenBerryInfo() " bl GetBerryTreeInfo\n" " add r5, r0, #0\n" " mov r2, #0x0\n" - " ldr r7, ._141 + 4\n" - " ldr r4, ._141 + 8\n" + " ldr r7, ._141 + 4 @ 0x1f3\n" + " ldr r4, ._141 + 8 @ gStringVar4\n" " mov r3, #0xff\n" "._140:\n" " add r1, r2, r4\n" @@ -1840,46 +1840,46 @@ void DebugOpenBerryInfo() " add r2, r2, #0x1\n" " cmp r2, r7\n" " ble ._140 @cond_branch\n" - " ldr r0, ._141 + 12\n" + " ldr r0, ._141 + 12 @ gUnknown_Debug_083F7F9D\n" " add r1, r6, #0\n" " mov r2, #0x3\n" " bl debug_sub_80C33FC\n" - " ldr r0, ._141 + 16\n" + " ldr r0, ._141 + 16 @ gUnknown_Debug_083F7FA2\n" " ldrb r1, [r5]\n" " mov r2, #0x2\n" " bl debug_sub_80C33FC\n" - " ldr r0, ._141 + 20\n" + " ldr r0, ._141 + 20 @ gUnknown_Debug_083F7FA9\n" " ldrb r1, [r5, #0x1]\n" " lsl r1, r1, #0x19\n" " lsr r1, r1, #0x19\n" " mov r2, #0x2\n" " bl debug_sub_80C33FC\n" - " ldr r0, ._141 + 24\n" + " ldr r0, ._141 + 24 @ gUnknown_Debug_083F7FB0\n" " ldrh r1, [r5, #0x2]\n" " mov r2, #0x5\n" " bl debug_sub_80C33FC\n" - " ldr r0, ._141 + 28\n" + " ldr r0, ._141 + 28 @ gUnknown_Debug_083F7FB7\n" " ldrb r1, [r5, #0x4]\n" " mov r2, #0x2\n" " bl debug_sub_80C33FC\n" - " ldr r0, ._141 + 32\n" + " ldr r0, ._141 + 32 @ gUnknown_Debug_083F7FBE\n" " ldrb r1, [r5, #0x5]\n" " lsl r1, r1, #0x1c\n" " lsr r1, r1, #0x1c\n" " mov r2, #0x3\n" " bl debug_sub_80C33FC\n" - " ldr r0, ._141 + 36\n" + " ldr r0, ._141 + 36 @ gUnknown_Debug_083F7FC5\n" " ldrb r1, [r5, #0x1]\n" " lsr r1, r1, #0x7\n" " mov r2, #0x1\n" " bl debug_sub_80C33FC\n" - " ldr r0, ._141 + 40\n" + " ldr r0, ._141 + 40 @ gUnknown_Debug_083F7FCC\n" " ldrb r1, [r5, #0x5]\n" " lsl r1, r1, #0x1b\n" " lsr r1, r1, #0x1f\n" " mov r2, #0x1\n" " bl debug_sub_80C33FC\n" - " ldr r4, ._141 + 44\n" + " ldr r4, ._141 + 44 @ gUnknown_Debug_083F7FD3\n" " ldrb r1, [r5, #0x5]\n" " lsl r1, r1, #0x1a\n" " lsr r1, r1, #0x1f\n" @@ -1897,7 +1897,7 @@ void DebugOpenBerryInfo() " add r0, r4, #0\n" " mov r2, #0x1\n" " bl debug_sub_80C33FC\n" - " ldr r0, ._141 + 8\n" + " ldr r0, ._141 + 8 @ gStringVar4\n" "._137:\n" " pop {r4, r5, r6, r7}\n" " pop {r1}\n" -- cgit v1.2.3