RedrawPartnerSelectionMenu won for now...

This commit is contained in:
DizzyEggg 2024-07-13 17:57:00 +02:00
parent 9eec35694f
commit 439bbbc57c
6 changed files with 126 additions and 270 deletions

View File

@ -3,6 +3,7 @@
#include "structs/menu.h" #include "structs/menu.h"
#include "structs/str_text.h" #include "structs/str_text.h"
#include "structs/struct_sub80095e4.h"
// size: 0x3FC // size: 0x3FC
typedef struct unkStruct_3001B5C typedef struct unkStruct_3001B5C
@ -15,11 +16,7 @@ typedef struct unkStruct_3001B5C
u8 fill14[0x354 - 0x14]; u8 fill14[0x354 - 0x14];
u8 unk354; u8 unk354;
u8 fill355[0x35C - 0x355]; u8 fill355[0x35C - 0x355];
/* 0x35C */ MenuInputStruct input; /* 0x35C */ struct_Sub80095E4_2 s35C;
u32 unk390;
UnkTextStruct2 *unk394;
UnkTextStruct2 unk398[4];
u8 unk3F8[4];
} unkStruct_3001B5C; } unkStruct_3001B5C;
bool8 sub_8023144(s32, s32 index, UnkTextStruct2_sub *sub, u32); bool8 sub_8023144(s32, s32 index, UnkTextStruct2_sub *sub, u32);

View File

@ -4,6 +4,7 @@
#include "constants/personality_test.h" #include "constants/personality_test.h"
#include "structs/menu.h" #include "structs/menu.h"
#include "structs/str_text.h" #include "structs/str_text.h"
#include "structs/struct_sub80095e4.h"
// Size: 0xB8 // Size: 0xB8
struct PersonalityStruct_203B404 struct PersonalityStruct_203B404
@ -11,11 +12,7 @@ struct PersonalityStruct_203B404
/* 0x0 */ s16 StarterID; /* 0x0 */ s16 StarterID;
/* 0x2 */ s16 PartnerArray[NUM_PARTNERS]; /* 0x2 */ s16 PartnerArray[NUM_PARTNERS];
u8 unk16; u8 unk16;
/* 0x18 */ MenuInputStruct input; /* 0x18 */ struct_Sub80095E4_2 s18;
u32 unk4C;
UnkTextStruct2 *unk50;
UnkTextStruct2 unk54[4];
u8 unkb4[4];
}; };
void CreatePartnerSelectionMenu(s16 starterID); void CreatePartnerSelectionMenu(s16 starterID);

View File

@ -41,7 +41,7 @@ typedef struct struct_Sub80095E4_2
sub_800641C((ptr).unk3C, TRUE, TRUE); \ sub_800641C((ptr).unk3C, TRUE, TRUE); \
} }
// For sub_801C440 where unkE and unk10 are the same. // For sub_801C440 and sub_8023420 where unkE and unk10 are the same.
#define SUB_80095E4_CALL_2(ptr) \ #define SUB_80095E4_CALL_2(ptr) \
{ \ { \
s32 a0 = sub_80095E4((ptr).input.unk1A, 12) + 2; \ s32 a0 = sub_80095E4((ptr).input.unk1A, 12) + 2; \

View File

@ -43,23 +43,23 @@ bool8 sub_8023144(s32 a0, s32 index, UnkTextStruct2_sub *sub, u32 a3)
gUnknown_3001B5C->unk0 = param_1_u8; gUnknown_3001B5C->unk0 = param_1_u8;
gUnknown_3001B5C->unk4 = gUnknown_203B298; gUnknown_3001B5C->unk4 = gUnknown_203B298;
gUnknown_3001B5C->unk390 = index; gUnknown_3001B5C->s35C.s0.unk34 = index;
gUnknown_3001B5C->unk394 = &gUnknown_3001B5C->unk398[index]; gUnknown_3001B5C->s35C.s0.unk38 = &gUnknown_3001B5C->s35C.s0.unk3C[index];
sub_8006518(gUnknown_3001B5C->unk398); sub_8006518(gUnknown_3001B5C->s35C.s0.unk3C);
gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390] = sUnknown_80DC91C; gUnknown_3001B5C->s35C.s0.unk3C[gUnknown_3001B5C->s35C.s0.unk34] = sUnknown_80DC91C;
gUnknown_3001B5C->unk394->unk14 = gUnknown_3001B5C->unk3F8; gUnknown_3001B5C->s35C.s0.unk38->unk14 = gUnknown_3001B5C->s35C.unk9C;
if (sub != NULL) if (sub != NULL)
gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390].unk8 = *sub; gUnknown_3001B5C->s35C.s0.unk3C[gUnknown_3001B5C->s35C.s0.unk34].unk8 = *sub;
sub_8012D08(gUnknown_3001B5C->unk394, a3); sub_8012D08(gUnknown_3001B5C->s35C.s0.unk38, a3);
ResetUnusedInputStruct(); ResetUnusedInputStruct();
sub_800641C(gUnknown_3001B5C->unk398, TRUE, TRUE); sub_800641C(gUnknown_3001B5C->s35C.s0.unk3C, TRUE, TRUE);
sub_8013818(&gUnknown_3001B5C->input, sub_80236A4(), a3, index); sub_8013818(&gUnknown_3001B5C->s35C.s0.input, sub_80236A4(), a3, index);
gUnknown_3001B5C->input.menuIndex = gUnknown_203B29C; gUnknown_3001B5C->s35C.s0.input.menuIndex = gUnknown_203B29C;
gUnknown_3001B5C->input.unk1E = gUnknown_203B29E; gUnknown_3001B5C->s35C.s0.input.unk1E = gUnknown_203B29E;
sub_8013984(&gUnknown_3001B5C->input); sub_8013984(&gUnknown_3001B5C->s35C.s0.input);
sub_8023420(); sub_8023420();
sub_80234BC(); sub_80234BC();
return TRUE; return TRUE;
@ -71,11 +71,11 @@ u32 sub_8023278(bool8 a0)
u32 temp; u32 temp;
if (!a0) { if (!a0) {
sub_8013660(&gUnknown_3001B5C->input); sub_8013660(&gUnknown_3001B5C->s35C.s0.input);
return 0; return 0;
} }
switch (GetKeyPress(&gUnknown_3001B5C->input)) { switch (GetKeyPress(&gUnknown_3001B5C->s35C.s0.input)) {
case INPUT_B_BUTTON: case INPUT_B_BUTTON:
PlayMenuSoundEffect(1); PlayMenuSoundEffect(1);
return 2; return 2;
@ -91,7 +91,7 @@ u32 sub_8023278(bool8 a0)
sub_80236A4(); sub_80236A4();
break; break;
default: default:
if (sub_80138B8(&gUnknown_3001B5C->input, 1) == 0) if (sub_80138B8(&gUnknown_3001B5C->s35C.s0.input, 1) == 0)
return 0; return 0;
break; break;
} }
@ -103,109 +103,43 @@ u32 sub_8023278(bool8 a0)
s16 sub_802331C(void) s16 sub_802331C(void)
{ {
return gUnknown_3001B5C->unkC[(gUnknown_3001B5C->input.unk1E * gUnknown_3001B5C->input.unk1C) + gUnknown_3001B5C->input.menuIndex]; return gUnknown_3001B5C->unkC[(gUnknown_3001B5C->s35C.s0.input.unk1E * gUnknown_3001B5C->s35C.s0.input.unk1C) + gUnknown_3001B5C->s35C.s0.input.menuIndex];
} }
void sub_8023354(bool8 cursorSprite) void sub_8023354(bool8 cursorSprite)
{ {
ResetUnusedInputStruct(); ResetUnusedInputStruct();
sub_800641C(gUnknown_3001B5C->unk398, FALSE, FALSE); sub_800641C(gUnknown_3001B5C->s35C.s0.unk3C, FALSE, FALSE);
sub_8013984(&gUnknown_3001B5C->input); sub_8013984(&gUnknown_3001B5C->s35C.s0.input);
sub_8023420(); sub_8023420();
sub_80234BC(); sub_80234BC();
if (cursorSprite) if (cursorSprite)
AddMenuCursorSprite(&gUnknown_3001B5C->input); AddMenuCursorSprite(&gUnknown_3001B5C->s35C.s0.input);
} }
void sub_80233A0(void) void sub_80233A0(void)
{ {
if (gUnknown_3001B5C != NULL) { if (gUnknown_3001B5C != NULL) {
gUnknown_203B298 = gUnknown_3001B5C->unk4; gUnknown_203B298 = gUnknown_3001B5C->unk4;
gUnknown_203B29C = gUnknown_3001B5C->input.menuIndex; gUnknown_203B29C = gUnknown_3001B5C->s35C.s0.input.menuIndex;
gUnknown_203B29E = gUnknown_3001B5C->input.unk1E; gUnknown_203B29E = gUnknown_3001B5C->s35C.s0.input.unk1E;
gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390] = sUnknown_80DC904; gUnknown_3001B5C->s35C.s0.unk3C[gUnknown_3001B5C->s35C.s0.unk34] = sUnknown_80DC904;
ResetUnusedInputStruct(); ResetUnusedInputStruct();
sub_800641C(gUnknown_3001B5C->unk398, TRUE, TRUE); sub_800641C(gUnknown_3001B5C->s35C.s0.unk3C, TRUE, TRUE);
MemoryFree(gUnknown_3001B5C); MemoryFree(gUnknown_3001B5C);
gUnknown_3001B5C = NULL; gUnknown_3001B5C = NULL;
} }
} }
NAKED // sub_80095E4 memes
static void sub_8023420(void) static void sub_8023420(void)
{ {
asm_unified( gUnknown_3001B5C->s35C.unk9C[0] = 1;
"\tpush {r4,r5,lr}\n" gUnknown_3001B5C->s35C.unk9C[1] = 0;
"\tldr r4, _080234A8\n" gUnknown_3001B5C->s35C.unk9C[2] = 12;
"\tldr r0, [r4]\n" gUnknown_3001B5C->s35C.unk9C[3] = 0;
"\tmovs r1, 0xFE\n"
"\tlsls r1, 2\n" SUB_80095E4_CALL_2(gUnknown_3001B5C->s35C.s0);
"\tadds r0, r1\n"
"\tmovs r2, 0\n"
"\tmovs r1, 0x1\n"
"\tstrb r1, [r0]\n"
"\tldr r0, [r4]\n"
"\tldr r1, _080234AC\n"
"\tadds r0, r1\n"
"\tstrb r2, [r0]\n"
"\tldr r0, [r4]\n"
"\tadds r1, 0x1\n"
"\tadds r0, r1\n"
"\tmovs r1, 0xC\n"
"\tstrb r1, [r0]\n"
"\tldr r0, [r4]\n"
"\tldr r1, _080234B0\n"
"\tadds r0, r1\n"
"\tstrb r2, [r0]\n"
"\tldr r0, [r4]\n"
"\tldr r2, _080234B4\n"
"\tadds r0, r2\n"
"\tmovs r1, 0\n"
"\tldrsh r0, [r0, r1]\n"
"\tmovs r1, 0xC\n"
"\tbl sub_80095E4\n"
"\tadds r0, 0x2\n"
"\tldr r3, [r4]\n"
"\tmovs r2, 0xE4\n"
"\tlsls r2, 2\n"
"\tadds r5, r3, r2\n"
"\tldr r2, [r5]\n"
"\tlsls r1, r2, 1\n"
"\tadds r1, r2\n"
"\tlsls r1, 3\n"
"\tadds r1, r3, r1\n"
"\tldr r2, _080234B8\n"
"\tadds r1, r2\n"
"\tlsls r0, 16\n"
"\tlsrs r0, 16\n"
"\tstrh r0, [r1]\n"
"\tldr r2, [r5]\n"
"\tlsls r1, r2, 1\n"
"\tadds r1, r2\n"
"\tlsls r1, 3\n"
"\tadds r3, r1\n"
"\tmovs r1, 0xEA\n"
"\tlsls r1, 2\n"
"\tadds r3, r1\n"
"\tstrh r0, [r3]\n"
"\tbl ResetUnusedInputStruct\n"
"\tldr r0, [r4]\n"
"\tmovs r2, 0xE6\n"
"\tlsls r2, 2\n"
"\tadds r0, r2\n"
"\tmovs r1, 0x1\n"
"\tmovs r2, 0x1\n"
"\tbl sub_800641C\n"
"\tpop {r4,r5}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
"_080234A8: .4byte gUnknown_3001B5C\n"
"_080234AC: .4byte 0x000003f9\n"
"_080234B0: .4byte 0x000003fb\n"
"_080234B4: .4byte 0x00000376\n"
"_080234B8: .4byte 0x000003a6");
} }
static void sub_80234BC(void) static void sub_80234BC(void)
@ -221,15 +155,15 @@ static void sub_80234BC(void)
u8 buffer1[100]; u8 buffer1[100];
unkStruct_8092638 auStack_2c; unkStruct_8092638 auStack_2c;
sub_8008C54(gUnknown_3001B5C->unk390); sub_8008C54(gUnknown_3001B5C->s35C.s0.unk34);
sub_80073B8(gUnknown_3001B5C->unk390); sub_80073B8(gUnknown_3001B5C->s35C.s0.unk34);
xxx_call_draw_string(10, 0, sPokemon, gUnknown_3001B5C->unk390, 0); xxx_call_draw_string(10, 0, sPokemon, gUnknown_3001B5C->s35C.s0.unk34, 0);
sub_8012BC4((gUnknown_3001B5C->unk3F8[2] * 8) + 4, 0, gUnknown_3001B5C->input.unk1E + 1, 2, 7, gUnknown_3001B5C->unk390); sub_8012BC4((gUnknown_3001B5C->s35C.unk9C[2] * 8) + 4, 0, gUnknown_3001B5C->s35C.s0.input.unk1E + 1, 2, 7, gUnknown_3001B5C->s35C.s0.unk34);
for (i = 0; i < gUnknown_3001B5C->input.unk1A; i++) { for (i = 0; i < gUnknown_3001B5C->s35C.s0.input.unk1A; i++) {
y = sub_8013800(&gUnknown_3001B5C->input, i); y = sub_8013800(&gUnknown_3001B5C->s35C.s0.input, i);
species = gUnknown_3001B5C->unkC[(gUnknown_3001B5C->input.unk1E * gUnknown_3001B5C->input.unk1C) + i]; species = gUnknown_3001B5C->unkC[(gUnknown_3001B5C->s35C.s0.input.unk1E * gUnknown_3001B5C->s35C.s0.input.unk1C) + i];
sub_8092638(GetFriendArea(species), &auStack_2c, FALSE, FALSE); sub_8092638(GetFriendArea(species), &auStack_2c, FALSE, FALSE);
color = COLOR_WHITE_2; color = COLOR_WHITE_2;
if (auStack_2c.hasFriendArea) if (auStack_2c.hasFriendArea)
@ -237,26 +171,26 @@ static void sub_80234BC(void)
iVar4 = GetDexInternalNo(species, 0); iVar4 = GetDexInternalNo(species, 0);
cVar2 = (iVar4 % 10) + 48; cVar2 = (iVar4 % 10) + 48;
sub_8012C60(20, y, cVar2, color, gUnknown_3001B5C->unk390); sub_8012C60(20, y, cVar2, color, gUnknown_3001B5C->s35C.s0.unk34);
if (9 < iVar4) { if (9 < iVar4) {
iVar4 /= 10; iVar4 /= 10;
cVar2 = (iVar4 % 10) + 48; cVar2 = (iVar4 % 10) + 48;
sub_8012C60(13, y, cVar2, color, gUnknown_3001B5C->unk390); sub_8012C60(13, y, cVar2, color, gUnknown_3001B5C->s35C.s0.unk34);
if (9 < iVar4) { if (9 < iVar4) {
uVar3 = iVar4 / 10; uVar3 = iVar4 / 10;
cVar2 = (uVar3 % 10) + 48; cVar2 = (uVar3 % 10) + 48;
sub_8012C60(6, y, cVar2, color, gUnknown_3001B5C->unk390); sub_8012C60(6, y, cVar2, color, gUnknown_3001B5C->s35C.s0.unk34);
} }
} }
sub_808D930(buffer1,species); sub_808D930(buffer1,species);
sprintfStatic(buffer2, sFmtColoredString, color, buffer1); sprintfStatic(buffer2, sFmtColoredString, color, buffer1);
xxx_call_draw_string(36, y, buffer2, gUnknown_3001B5C->unk390, 0); xxx_call_draw_string(36, y, buffer2, gUnknown_3001B5C->s35C.s0.unk34, 0);
} }
sub_80073E0(gUnknown_3001B5C->unk390); sub_80073E0(gUnknown_3001B5C->s35C.s0.unk34);
} }
static u32 sub_80236A4(void) static u32 sub_80236A4(void)

View File

@ -32,23 +32,23 @@ void CreatePartnerSelectionMenu(s16 starterID)
sub_803CEAC(); sub_803CEAC();
gUnknown_203B404->StarterID = starterID_s32; gUnknown_203B404->StarterID = starterID_s32;
gUnknown_203B404->unk4C = 0; gUnknown_203B404->s18.s0.unk34 = 0;
gUnknown_203B404->unk50 = gUnknown_203B404->unk54; gUnknown_203B404->s18.s0.unk38 = gUnknown_203B404->s18.s0.unk3C;
gUnknown_203B404->unk54[0] = gUnknown_80F4290; gUnknown_203B404->s18.s0.unk3C[0] = gUnknown_80F4290;
gUnknown_203B404->unk54[1] = gUnknown_80F42A8; gUnknown_203B404->s18.s0.unk3C[1] = gUnknown_80F42A8;
gUnknown_203B404->unk54[2] = gUnknown_80F4278; gUnknown_203B404->s18.s0.unk3C[2] = gUnknown_80F4278;
gUnknown_203B404->unk54[3] = gUnknown_80F4278; gUnknown_203B404->s18.s0.unk3C[3] = gUnknown_80F4278;
gUnknown_203B404->unk50->unk14 = gUnknown_203B404->unkb4; gUnknown_203B404->s18.s0.unk38->unk14 = gUnknown_203B404->s18.unk9C;
gUnknown_203B404->unkb4[0] = 1; gUnknown_203B404->s18.unk9C[0] = 1;
gUnknown_203B404->unkb4[1] = 0; gUnknown_203B404->s18.unk9C[1] = 0;
gUnknown_203B404->unkb4[2] = 6; gUnknown_203B404->s18.unk9C[2] = 6;
gUnknown_203B404->unkb4[3] = 0; gUnknown_203B404->s18.unk9C[3] = 0;
ResetUnusedInputStruct(); ResetUnusedInputStruct();
sub_800641C(gUnknown_203B404->unk54, TRUE, TRUE); sub_800641C(gUnknown_203B404->s18.s0.unk3C, TRUE, TRUE);
sub_8013818(&gUnknown_203B404->input, GetValidPartners(), 10, gUnknown_203B404->unk4C); sub_8013818(&gUnknown_203B404->s18.s0.input, GetValidPartners(), 10, gUnknown_203B404->s18.s0.unk34);
RedrawPartnerSelectionMenu(); RedrawPartnerSelectionMenu();
PersonalityTest_DisplayPartnerSprite(); PersonalityTest_DisplayPartnerSprite();
} }
@ -57,18 +57,18 @@ u16 HandlePartnerSelectionInput(void)
{ {
s32 partnerID; s32 partnerID;
partnerID = gUnknown_203B404->input.menuIndex; partnerID = gUnknown_203B404->s18.s0.input.menuIndex;
gUnknown_203B404->unk16 = 0; gUnknown_203B404->unk16 = 0;
if (GetKeyPress(&gUnknown_203B404->input) == INPUT_A_BUTTON) { if (GetKeyPress(&gUnknown_203B404->s18.s0.input) == INPUT_A_BUTTON) {
PlayMenuSoundEffect(0); PlayMenuSoundEffect(0);
return gUnknown_203B404->PartnerArray[gUnknown_203B404->input.menuIndex]; return gUnknown_203B404->PartnerArray[gUnknown_203B404->s18.s0.input.menuIndex];
} }
if (sub_80138B8(&gUnknown_203B404->input, TRUE)) if (sub_80138B8(&gUnknown_203B404->s18.s0.input, TRUE))
RedrawPartnerSelectionMenu(); RedrawPartnerSelectionMenu();
if (partnerID != gUnknown_203B404->input.menuIndex) if (partnerID != gUnknown_203B404->s18.s0.input.menuIndex)
PersonalityTest_DisplayPartnerSprite(); PersonalityTest_DisplayPartnerSprite();
if (gUnknown_203B404->unk16 != 0) { if (gUnknown_203B404->unk16 != 0) {
@ -79,20 +79,20 @@ u16 HandlePartnerSelectionInput(void)
UNUSED static void sub_803CE34(bool8 cursorSprite) UNUSED static void sub_803CE34(bool8 cursorSprite)
{ {
gUnknown_203B404->input.unk22 = GetValidPartners(); gUnknown_203B404->s18.s0.input.unk22 = GetValidPartners();
sub_8013984(&gUnknown_203B404->input); sub_8013984(&gUnknown_203B404->s18.s0.input);
RedrawPartnerSelectionMenu(); RedrawPartnerSelectionMenu();
PersonalityTest_DisplayPartnerSprite(); PersonalityTest_DisplayPartnerSprite();
if (cursorSprite) if (cursorSprite)
AddMenuCursorSprite(&gUnknown_203B404->input); AddMenuCursorSprite(&gUnknown_203B404->s18.s0.input);
} }
void sub_803CE6C(void) void sub_803CE6C(void)
{ {
gUnknown_203B404->unk54[gUnknown_203B404->unk4C] = gUnknown_80F4278; gUnknown_203B404->s18.s0.unk3C[gUnknown_203B404->s18.s0.unk34] = gUnknown_80F4278;
ResetUnusedInputStruct(); ResetUnusedInputStruct();
sub_800641C(gUnknown_203B404->unk54, TRUE, TRUE); sub_800641C(gUnknown_203B404->s18.s0.unk3C, TRUE, TRUE);
sub_803CECC(); sub_803CECC();
} }
@ -116,38 +116,27 @@ static void sub_803CECC(void)
} }
#ifdef NONMATCHING // sub_80095E4 memes #ifdef NONMATCHING // sub_80095E4 memes
// Unfortunately `SUB_80095E4_CALL` doesn't work in this case, because of a `mov r4, #0` instruction put 2 instructions too late...
static void RedrawPartnerSelectionMenu(void) static void RedrawPartnerSelectionMenu(void)
{ {
s32 sVar1;
u32 yCoord; u32 yCoord;
const u8 *monName; const u8 *monName;
s32 monCounter; s32 monCounter;
sVar1 = sub_80095E4(gUnknown_203B404->unk32, 12); SUB_80095E4_CALL(gUnknown_203B404->s18.s0);
// Have a feeling this is some graphical thing but sub_8008C54(gUnknown_203B404->s18.s0.unk34);
// still not sure structure so it's not matching yet bc of that sub_80073B8(gUnknown_203B404->s18.s0.unk34);
// and some casting stuff xxx_call_draw_string(12, 0, gPartnerSelectionHeaderText, gUnknown_203B404->s18.s0.unk34, 0);
sVar1 += 2;
sVar1 <<= 16;
gUnknown_203B404->unk54[gUnknown_203B404->unk4C].unk0[7] = sVar1;
gUnknown_203B404->unk54[gUnknown_203B404->unk4C].unk0[8] = sVar1 + 2;
// Everything after this matches
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B404->unk54, TRUE, TRUE);
sub_8008C54(gUnknown_203B404->unk4C);
sub_80073B8(gUnknown_203B404->unk4C);
xxx_call_draw_string(12, 0, gPartnerSelectionHeaderText, gUnknown_203B404->unk4C, 0);
monCounter = 0; monCounter = 0;
while (monCounter < gUnknown_203B404->unk32) { while (monCounter < gUnknown_203B404->s18.s0.input.unk1A) {
yCoord = sub_8013800(&gUnknown_203B404->unk18, monCounter); yCoord = sub_8013800(&gUnknown_203B404->s18.s0.input, monCounter);
monName = GetMonSpecies(gUnknown_203B404->PartnerArray[monCounter]); monName = GetMonSpecies(gUnknown_203B404->PartnerArray[monCounter]);
xxx_call_draw_string(8, yCoord, monName, gUnknown_203B404->unk4C, 0); xxx_call_draw_string(8, yCoord, monName, gUnknown_203B404->s18.s0.unk34, 0);
monCounter++; monCounter++;
} }
sub_80073E0(gUnknown_203B404->unk4C); sub_80073E0(gUnknown_203B404->s18.s0.unk34);
gUnknown_203B404->unk16 = 1; gUnknown_203B404->unk16 = 1;
} }
#else #else
@ -259,7 +248,7 @@ static void PersonalityTest_DisplayPartnerSprite(void)
u8 *r6; u8 *r6;
u32 faceIndex; u32 faceIndex;
partnerID = gUnknown_203B404->PartnerArray[gUnknown_203B404->input.menuIndex]; partnerID = gUnknown_203B404->PartnerArray[gUnknown_203B404->s18.s0.input.menuIndex];
sub_8008C54(1); sub_8008C54(1);
sub_80073B8(1); sub_80073B8(1);
faceFile = GetDialogueSpriteDataPtr(partnerID); faceFile = GetDialogueSpriteDataPtr(partnerID);

View File

@ -13,17 +13,14 @@
#include "structs/str_802C39C.h" #include "structs/str_802C39C.h"
#include "text1.h" #include "text1.h"
#include "text2.h" #include "text2.h"
#include "structs/struct_sub80095e4.h"
struct unkStruct_203B320 struct unkStruct_203B320
{ {
// size: 0xC4 // size: 0xC4
u8 unk0[0x20]; u8 unk0[0x20];
u32 wonderMailType; u32 wonderMailType;
MenuInputStruct input; struct_Sub80095E4_2 s28;
u32 unk58;
UnkTextStruct2 *unk5C;
UnkTextStruct2 unk60[4];
u8 unkC0[4];
}; };
static EWRAM_DATA_2 struct unkStruct_203B320 *gUnknown_203B320 = {0}; static EWRAM_DATA_2 struct unkStruct_203B320 *gUnknown_203B320 = {0};
@ -89,21 +86,21 @@ u32 sub_80306A8(u32 wonderMailType, u32 r1, UnkTextStruct2_sub *r2, u32 r3)
gUnknown_203B320 = MemoryAlloc(sizeof(struct unkStruct_203B320), 8); gUnknown_203B320 = MemoryAlloc(sizeof(struct unkStruct_203B320), 8);
gUnknown_203B320->wonderMailType = wonderMailType; gUnknown_203B320->wonderMailType = wonderMailType;
gUnknown_203B320->unk58 = r1; gUnknown_203B320->s28.s0.unk34 = r1;
gUnknown_203B320->unk5C = &gUnknown_203B320->unk60[gUnknown_203B320->unk58]; gUnknown_203B320->s28.s0.unk38 = &gUnknown_203B320->s28.s0.unk3C[gUnknown_203B320->s28.s0.unk34];
sub_8006518(gUnknown_203B320->unk60); sub_8006518(gUnknown_203B320->s28.s0.unk3C);
gUnknown_203B320->unk60[gUnknown_203B320->unk58] = gUnknown_80E0854; gUnknown_203B320->s28.s0.unk3C[gUnknown_203B320->s28.s0.unk34] = gUnknown_80E0854;
gUnknown_203B320->unk5C->unk14 = gUnknown_203B320->unkC0; gUnknown_203B320->s28.s0.unk38->unk14 = gUnknown_203B320->s28.unk9C;
if (r2 != 0) if (r2 != 0)
gUnknown_203B320->unk60[gUnknown_203B320->unk58].unk8 = *r2; gUnknown_203B320->s28.s0.unk3C[gUnknown_203B320->s28.s0.unk34].unk8 = *r2;
sub_8012D08(gUnknown_203B320->unk5C, r3); sub_8012D08(gUnknown_203B320->s28.s0.unk38, r3);
ResetUnusedInputStruct(); ResetUnusedInputStruct();
sub_800641C(gUnknown_203B320->unk60, TRUE, TRUE); sub_800641C(gUnknown_203B320->s28.s0.unk3C, TRUE, TRUE);
sub_8013818(&gUnknown_203B320->input, sub_8030A74(), r3, r1); sub_8013818(&gUnknown_203B320->s28.s0.input, sub_8030A74(), r3, r1);
sub_80308A0(); sub_80308A0();
sub_803092C(); sub_803092C();
return 1; return 1;
@ -113,10 +110,10 @@ u32 sub_8030768(u8 r0)
{ {
if(r0 == 0) if(r0 == 0)
{ {
sub_8013660(&gUnknown_203B320->input); sub_8013660(&gUnknown_203B320->s28.s0.input);
return 0; return 0;
} }
switch(GetKeyPress(&gUnknown_203B320->input)) switch(GetKeyPress(&gUnknown_203B320->s28.s0.input))
{ {
case INPUT_START_BUTTON: case INPUT_START_BUTTON:
PlayMenuSoundEffect(4); PlayMenuSoundEffect(4);
@ -128,7 +125,7 @@ u32 sub_8030768(u8 r0)
PlayMenuSoundEffect(0); PlayMenuSoundEffect(0);
return 3; return 3;
default: default:
if(sub_80138B8(&gUnknown_203B320->input, 1) != 0) if(sub_80138B8(&gUnknown_203B320->s28.s0.input, 1) != 0)
{ {
sub_80308A0(); sub_80308A0();
sub_803092C(); sub_803092C();
@ -141,27 +138,27 @@ u32 sub_8030768(u8 r0)
u8 sub_80307EC(void) u8 sub_80307EC(void)
{ {
return gUnknown_203B320->unk0[(gUnknown_203B320->input.unk1E * gUnknown_203B320->input.unk1C) + gUnknown_203B320->input.menuIndex]; return gUnknown_203B320->unk0[(gUnknown_203B320->s28.s0.input.unk1E * gUnknown_203B320->s28.s0.input.unk1C) + gUnknown_203B320->s28.s0.input.menuIndex];
} }
void sub_8030810(u8 r0) void sub_8030810(u8 r0)
{ {
gUnknown_203B320->input.unk22 = sub_8030A74(); gUnknown_203B320->s28.s0.input.unk22 = sub_8030A74();
sub_8013984(&gUnknown_203B320->input); sub_8013984(&gUnknown_203B320->s28.s0.input);
sub_80308A0(); sub_80308A0();
sub_803092C(); sub_803092C();
if(r0 != 0) if(r0 != 0)
AddMenuCursorSprite(&gUnknown_203B320->input); AddMenuCursorSprite(&gUnknown_203B320->s28.s0.input);
} }
void sub_803084C() void sub_803084C()
{ {
if(gUnknown_203B320 != NULL) if(gUnknown_203B320 != NULL)
{ {
gUnknown_203B320->unk60[gUnknown_203B320->unk58] = gUnknown_80E083C; gUnknown_203B320->s28.s0.unk3C[gUnknown_203B320->s28.s0.unk34] = gUnknown_80E083C;
ResetUnusedInputStruct(); ResetUnusedInputStruct();
sub_800641C(gUnknown_203B320->unk60, TRUE, TRUE); sub_800641C(gUnknown_203B320->s28.s0.unk3C, TRUE, TRUE);
MemoryFree(gUnknown_203B320); MemoryFree(gUnknown_203B320);
gUnknown_203B320 = NULL; gUnknown_203B320 = NULL;
} }
@ -172,74 +169,16 @@ u8 *sub_8030894()
return gUnknown_203B320->unk0; return gUnknown_203B320->unk0;
} }
NAKED // sub_80095E4 memes
void sub_80308A0(void) void sub_80308A0(void)
{ {
asm_unified( gUnknown_203B320->s28.unk9C[0] = gUnknown_203B320->s28.s0.input.unk20;
"\tpush {r4,lr}\n" gUnknown_203B320->s28.unk9C[1] = gUnknown_203B320->s28.s0.input.unk1E;
"\tldr r4, _08030928\n" gUnknown_203B320->s28.unk9C[2] = 12;
"\tldr r0, [r4]\n" gUnknown_203B320->s28.unk9C[3] = 0;
"\tadds r1, r0, 0\n" ResetUnusedInputStruct();
"\tadds r1, 0x44\n" sub_800641C(gUnknown_203B320->s28.s0.unk3C, TRUE, TRUE);
"\tldrh r1, [r1]\n"
"\tadds r0, 0xC0\n" SUB_80095E4_CALL(gUnknown_203B320->s28.s0);
"\tmovs r2, 0\n"
"\tstrb r1, [r0]\n"
"\tldr r0, [r4]\n"
"\tadds r1, r0, 0\n"
"\tadds r1, 0x42\n"
"\tldrh r1, [r1]\n"
"\tadds r0, 0xC1\n"
"\tstrb r1, [r0]\n"
"\tldr r0, [r4]\n"
"\tadds r0, 0xC2\n"
"\tmovs r1, 0xC\n"
"\tstrb r1, [r0]\n"
"\tldr r0, [r4]\n"
"\tadds r0, 0xC3\n"
"\tstrb r2, [r0]\n"
"\tbl ResetUnusedInputStruct\n"
"\tldr r0, [r4]\n"
"\tadds r0, 0x60\n"
"\tmovs r1, 0x1\n"
"\tmovs r2, 0x1\n"
"\tbl sub_800641C\n"
"\tldr r0, [r4]\n"
"\tmovs r1, 0x3E\n"
"\tldrsh r0, [r0, r1]\n"
"\tmovs r1, 0xC\n"
"\tbl sub_80095E4\n"
"\tadds r0, 0x2\n"
"\tlsls r0, 16\n"
"\tldr r2, [r4]\n"
"\tldr r3, [r2, 0x58]\n"
"\tlsls r1, r3, 1\n"
"\tadds r1, r3\n"
"\tlsls r1, 3\n"
"\tadds r1, r2, r1\n"
"\tadds r1, 0x6E\n"
"\tasrs r3, r0, 16\n"
"\tlsrs r0, 16\n"
"\tstrh r0, [r1]\n"
"\tldr r1, [r2, 0x58]\n"
"\tlsls r0, r1, 1\n"
"\tadds r0, r1\n"
"\tlsls r0, 3\n"
"\tadds r2, r0\n"
"\tadds r3, 0x2\n"
"\tadds r2, 0x70\n"
"\tstrh r3, [r2]\n"
"\tbl ResetUnusedInputStruct\n"
"\tldr r0, [r4]\n"
"\tadds r0, 0x60\n"
"\tmovs r1, 0x1\n"
"\tmovs r2, 0x1\n"
"\tbl sub_800641C\n"
"\tpop {r4}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
"_08030928: .4byte gUnknown_203B320");
} }
void sub_803092C(void) void sub_803092C(void)
@ -250,20 +189,20 @@ void sub_803092C(void)
s32 index; s32 index;
unkStruct_802C39C local; unkStruct_802C39C local;
sub_8008C54(gUnknown_203B320->unk58); sub_8008C54(gUnknown_203B320->s28.s0.unk34);
sub_80073B8(gUnknown_203B320->unk58); sub_80073B8(gUnknown_203B320->s28.s0.unk34);
r4 = gUnknown_203B320->input.unk1E * 8; r4 = gUnknown_203B320->s28.s0.input.unk1E * 8;
r5 = r4; r5 = r4;
r5 += 10; r5 += 10;
xxx_call_draw_string(r5,0,gUnknown_80E086C[gUnknown_203B320->wonderMailType],gUnknown_203B320->unk58,0); xxx_call_draw_string(r5,0,gUnknown_80E086C[gUnknown_203B320->wonderMailType],gUnknown_203B320->s28.s0.unk34,0);
r4 += 4; r4 += 4;
r5 = r4 + gUnknown_203B320->unkC0[2] * 8; r5 = r4 + gUnknown_203B320->s28.unk9C[2] * 8;
sub_8012BC4(r5,0,gUnknown_203B320->input.unk1E + 1,1,7,gUnknown_203B320->unk58); sub_8012BC4(r5,0,gUnknown_203B320->s28.s0.input.unk1E + 1,1,7,gUnknown_203B320->s28.s0.unk34);
for (index = 0; index < gUnknown_203B320->input.unk1A; index++) { for (index = 0; index < gUnknown_203B320->s28.s0.input.unk1A; index++) {
mail = GetMailatIndex(gUnknown_203B320->unk0[(gUnknown_203B320->input.unk1E * gUnknown_203B320->input.unk1C) + index]); mail = GetMailatIndex(gUnknown_203B320->unk0[(gUnknown_203B320->s28.s0.input.unk1E * gUnknown_203B320->s28.s0.input.unk1C) + index]);
local.unk0[0] = gUnknown_203B320->unk58; local.unk0[0] = gUnknown_203B320->s28.s0.unk34;
local.y = sub_8013800(&gUnknown_203B320->input,index); local.y = sub_8013800(&gUnknown_203B320->s28.s0.input,index);
local.mailTitleType = 7; local.mailTitleType = 7;
local.mailMissionType = MISSION_TYPE_FRIEND_RESCUE; local.mailMissionType = MISSION_TYPE_FRIEND_RESCUE;
local.mailStatus = MAIL_STATUS_SUSPENDED; local.mailStatus = MAIL_STATUS_SUSPENDED;
@ -294,7 +233,7 @@ void sub_803092C(void)
} }
CreateRescueTitle(&local); CreateRescueTitle(&local);
} }
sub_80073E0(gUnknown_203B320->unk58); sub_80073E0(gUnknown_203B320->s28.s0.unk34);
} }
s32 sub_8030A74(void) s32 sub_8030A74(void)