From c3594f982ddd0839aa7b97cb5a54087e198b0326 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 5 Mar 2019 20:32:14 -0500 Subject: [PATCH] Decompiling pokeblock ui stuff --- asm/menu_unknown.s | 93 ------------------------------------------ include/menu_unknown.h | 26 ++++++++++++ include/pokenav.h | 8 ---- src/menu_unknown.c | 35 ++++++++++++++++ src/use_pokeblock.c | 18 ++++---- 5 files changed, 71 insertions(+), 109 deletions(-) diff --git a/asm/menu_unknown.s b/asm/menu_unknown.s index 52f4dbee0..6b782f5c4 100644 --- a/asm/menu_unknown.s +++ b/asm/menu_unknown.s @@ -6,99 +6,6 @@ .text - thumb_func_start sub_81D1ED4 -sub_81D1ED4: @ 81D1ED4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r3, r0, 0 - movs r6, 0 - movs r7, 0 -_081D1EE6: - movs r2, 0 - lsls r5, r6, 2 - adds r0, r6, 0x1 - mov r10, r0 - adds r4, r5, 0 -_081D1EF0: - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 2 - adds r0, r4, r0 - adds r0, r3, r0 - adds r1, r0, 0 - adds r1, 0x64 - strh r7, [r1] - adds r0, 0x66 - strh r7, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x9 - bls _081D1EF0 - movs r2, 0 - mov r9, r2 - str r5, [sp] - movs r1, 0x9B - mov r8, r1 - movs r4, 0x5B - mov r12, r4 -_081D1F1C: - lsls r0, r2, 2 - adds r0, r2 - adds r1, r6, r0 - adds r1, r3, r1 - mov r4, r9 - strb r4, [r1] - lsls r0, 2 - ldr r1, [sp] - adds r0, r1, r0 - adds r0, r3, r0 - mov r4, r8 - strh r4, [r0, 0x14] - mov r1, r12 - strh r1, [r0, 0x16] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _081D1F1C - adds r1, r3, r5 - movs r2, 0x96 - lsls r2, 1 - adds r0, r1, r2 - strh r7, [r0] - movs r4, 0x97 - lsls r4, 1 - adds r0, r1, r4 - strh r7, [r0] - mov r1, r10 - lsls r0, r1, 24 - lsrs r6, r0, 24 - cmp r6, 0x4 - bls _081D1EE6 - movs r2, 0xD5 - lsls r2, 2 - adds r0, r3, r2 - movs r1, 0 - strb r1, [r0] - ldr r4, =0x00000352 - adds r0, r3, r4 - strh r1, [r0] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D1ED4 - thumb_func_start sub_81D1F84 sub_81D1F84: @ 81D1F84 push {r4-r7,lr} diff --git a/include/menu_unknown.h b/include/menu_unknown.h index b4c161dad..9d398e2b0 100644 --- a/include/menu_unknown.h +++ b/include/menu_unknown.h @@ -3,6 +3,24 @@ #include "player_pc.h" +struct UnknownSubStruct_81D1ED4 +{ + u16 unk0; + u16 unk2; +}; + +struct UnknownStruct_81D1ED4 +{ + u8 unk0[4][5]; + struct UnknownSubStruct_81D1ED4 unk14[4][5]; + struct UnknownSubStruct_81D1ED4 unk64[10][5]; + struct UnknownSubStruct_81D1ED4 unk12C[4]; + u8 unk13C[0x216]; + u16 unk352; + u8 unk354; + u8 unk355[0x23]; +}; + bool8 sub_81D1C44(u8 a0); u8 sub_81D1C84(u8 a0); u8 sub_81D1DC0(struct PlayerPCItemPageStruct *a0); @@ -11,5 +29,13 @@ void sub_81D1EC0(void); void sub_81D1D04(u8 a0); void DrawLevelUpWindowPg1(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); void DrawLevelUpWindowPg2(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); +void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0); +void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0); +void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0); +void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0); +void sub_81D3464(void *arg0); +void sub_81D3480(void *arg0, u8 arg1); +void sub_81D2754(struct UnknownStruct_81D1ED4 *arg0, void *arg1); +void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 arg1[4][5], struct UnknownSubStruct_81D1ED4 arg2[4][5]); #endif // GUARD_MENU_UNKNOWN_H \ No newline at end of file diff --git a/include/pokenav.h b/include/pokenav.h index a1f311944..10f042225 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -4,14 +4,6 @@ bool8 sub_81D20BC(void *arg0); bool8 sub_81D312C(void *arg0); -void sub_81D1ED4(void *arg0); -void sub_81D2108(void *arg0); -void sub_81D20AC(void *arg0); -void sub_81D2230(void *arg0); -void sub_81D3464(void *arg0); -void sub_81D3480(void *arg0, u8 arg1); -void sub_81D2754(void *arg0, void *arg1); -void sub_81D1F84(void *arg0, void *arg1, void *arg2); bool8 sub_81D4A58(struct EventObject*); void MoveRelearnerPrintText(u8 *); u16 MoveRelearnerRunTextPrinters(void); diff --git a/src/menu_unknown.c b/src/menu_unknown.c index 21f42d264..303bb7c82 100644 --- a/src/menu_unknown.c +++ b/src/menu_unknown.c @@ -183,4 +183,39 @@ void sub_81D1E90(struct PlayerPCItemPageStruct *page) void sub_81D1EC0(void) { Free(gUnknown_0203CF4C); +} + +void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0) +{ + u8 j; + u8 i; + u8 v1; + for (j = 0; j < 5; j++) + { + for (i = 0; i < 10; i++) + { + // u16 + a0->unk64[i][j].unk0 = 0; + a0->unk64[i][j].unk2 = 0; + } + for (i = 0; i < 4; i++) + { + // u8 + a0->unk0[i][j] = 0; + + // u16 + a0->unk14[i][j].unk0 = 0x9B; + a0->unk14[i][j].unk2 = 0x5B; + } + + // u16 + a0->unk12C[j].unk0 = 0; + a0->unk12C[j].unk2 = 0; + } + + // u8 + a0->unk354 = 0; + + // u16 + a0->unk352 = 0; } \ No newline at end of file diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index 762019ecd..8b4738608 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -4,6 +4,7 @@ #include "alloc.h" #include "palette.h" #include "pokenav.h" +#include "menu_unknown.h" #include "scanline_effect.h" #include "text.h" #include "bg.h" @@ -33,7 +34,8 @@ struct UsePokeblockSubStruct struct UsePokeblockStruct { u8 field_0[0x7C58]; - u8 field_7C58[0x378]; + //u8 field_7C58[0x378]; + struct UnknownStruct_81D1ED4 field_7C58; struct UsePokeblockSubStruct info; }; @@ -130,7 +132,7 @@ void sub_8166340(void) LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); - sub_81D2108(gUnknown_0203BCAC->field_7C58); + sub_81D2108(&gUnknown_0203BCAC->field_7C58); ScanlineEffect_InitHBlankDmaTransfer(); } @@ -146,7 +148,7 @@ void sub_8166380(void) { case 0: gUnknown_0203BCAC->field_0[0x7B10] = 0xFF; - sub_81D1ED4(gUnknown_0203BCAC->field_7C58); + sub_81D1ED4(&gUnknown_0203BCAC->field_7C58); gUnknown_0203BC90->field_50++; break; case 1: @@ -202,19 +204,19 @@ void sub_8166380(void) gUnknown_0203BC90->field_50++; break; case 11: - sub_81D2754(gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_0[0x7C6C]); - sub_81D20AC(gUnknown_0203BCAC->field_7C58); + sub_81D2754(&gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_0[0x7C6C]); + sub_81D20AC(&gUnknown_0203BCAC->field_7C58); gUnknown_0203BC90->field_50++; break; case 12: - if (!sub_81D20BC(gUnknown_0203BCAC->field_7C58)) + if (!sub_81D20BC(&gUnknown_0203BCAC->field_7C58)) { - sub_81D1F84(gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_7C58[0x14], &gUnknown_0203BCAC->field_7C58[0x14]); + sub_81D1F84(&gUnknown_0203BCAC->field_7C58, gUnknown_0203BCAC->field_7C58.unk14, gUnknown_0203BCAC->field_7C58.unk14); gUnknown_0203BC90->field_50++; } break; case 13: - sub_81D2230(gUnknown_0203BCAC->field_7C58); + sub_81D2230(&gUnknown_0203BCAC->field_7C58); gUnknown_0203BC90->field_50++; break; case 14: