match wonder mail - sub_802C328

This commit is contained in:
DizzyEggg 2024-07-27 10:40:44 +02:00
parent 762a4c5c2c
commit 58fe051d1e
5 changed files with 43 additions and 99 deletions

View File

@ -6,7 +6,6 @@
#include "structs/struct_sub80095e4.h"
// size: 0xF4
// TODO: UNIFY
typedef struct unkStruct_203B224
{
u32 unk0;

View File

@ -64,7 +64,7 @@ typedef struct UnkTextStruct2
s16 unkE;
s16 unk10;
s16 unk12;
const UnkTextStruct2_sub2 *unk14; // Pointer to 4 bytes which may be x-coord related
const UnkTextStruct2_sub2 *unk14; // Pointer to 4 bytes which may be x-coord related. Could be window's header?
} UnkTextStruct2;
#endif // GUARD_STR_TEXT_H

View File

@ -61,7 +61,7 @@ typedef struct struct_Sub80095E4_2
sub_800641C((ptr).unk3C, TRUE, TRUE); \
}
// sub_802BF30 uses a different function call, and 24 instead of 12
// sub_802BF30 and sub_802C328 use a different function call, and 24 instead of 12
#define SUB_8009614_CALL(ptr) \
{ \
SUB_8009_MATCH(ptr, sub_8009614((ptr).input.unk1A, 24) + 2) \

View File

@ -3,18 +3,13 @@
#include "constants/mailbox.h"
#include "structs/menu.h"
#include "structs/str_text.h"
#include "structs/struct_sub80095e4.h"
// TODO: UNIFY
// size: 0xA8
struct unkStruct_203B2E0
{
u8 pelipperBoardSlots[MAX_ACCEPTED_JOBS];
/* 0x8 */ MenuInputStruct input;
s32 unk3C;
UnkTextStruct2 *unk40;
UnkTextStruct2 unk44[4];
UnkTextStruct2_sub2 unkA4;
/* 0x8 */ struct_Sub80095E4_2 unk8;
};
void DrawPelipperBoardJobMenu(void);

View File

@ -29,22 +29,22 @@ bool8 sub_802C10C(s32 a0, UnkTextStruct2_sub *a1, s32 a2)
if (gUnknown_203B2E0 == NULL)
gUnknown_203B2E0 = MemoryAlloc(sizeof(struct unkStruct_203B2E0), 8);
gUnknown_203B2E0->unk3C = a0;
gUnknown_203B2E0->unk40 = &gUnknown_203B2E0->unk44[a0];
sub_8006518(gUnknown_203B2E0->unk44);
gUnknown_203B2E0->unk8.s0.unk34 = a0;
gUnknown_203B2E0->unk8.s0.unk38 = &gUnknown_203B2E0->unk8.s0.unk3C[a0];
sub_8006518(gUnknown_203B2E0->unk8.s0.unk3C);
gUnknown_203B2E0->unk44[gUnknown_203B2E0->unk3C] = sUnknown_80DFCB4;
gUnknown_203B2E0->unk40->unk14 = &gUnknown_203B2E0->unkA4;
gUnknown_203B2E0->unk8.s0.unk3C[gUnknown_203B2E0->unk8.s0.unk34] = sUnknown_80DFCB4;
gUnknown_203B2E0->unk8.s0.unk38->unk14 = &gUnknown_203B2E0->unk8.unk9C;
if (a1 != NULL)
gUnknown_203B2E0->unk44[gUnknown_203B2E0->unk3C].unk8 = *a1;
gUnknown_203B2E0->unk8.s0.unk3C[gUnknown_203B2E0->unk8.s0.unk34].unk8 = *a1;
sub_8012D34(gUnknown_203B2E0->unk40, a2);
sub_8012D34(gUnknown_203B2E0->unk8.s0.unk38, a2);
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2E0->unk44, TRUE, TRUE);
sub_8013848(&gUnknown_203B2E0->input, CountPelipperBoardSlots(), a2, a0);
gUnknown_203B2E0->input.menuIndex = gUnknown_203B2E4;
sub_8013984(&gUnknown_203B2E0->input);
sub_800641C(gUnknown_203B2E0->unk8.s0.unk3C, TRUE, TRUE);
sub_8013848(&gUnknown_203B2E0->unk8.s0.input, CountPelipperBoardSlots(), a2, a0);
gUnknown_203B2E0->unk8.s0.input.menuIndex = gUnknown_203B2E4;
sub_8013984(&gUnknown_203B2E0->unk8.s0.input);
sub_802C328();
DrawPelipperBoardJobMenu();
return TRUE;
@ -53,11 +53,11 @@ bool8 sub_802C10C(s32 a0, UnkTextStruct2_sub *a1, s32 a2)
u32 sub_802C1E4(bool8 a0)
{
if (!a0) {
sub_8013660(&gUnknown_203B2E0->input);
sub_8013660(&gUnknown_203B2E0->unk8.s0.input);
return 0;
}
switch (GetKeyPress(&gUnknown_203B2E0->input)) {
switch (GetKeyPress(&gUnknown_203B2E0->unk8.s0.input)) {
case INPUT_B_BUTTON:
PlayMenuSoundEffect(1);
return 2;
@ -68,7 +68,7 @@ u32 sub_802C1E4(bool8 a0)
PlayMenuSoundEffect(4);
return 4;
default:
if (sub_80138B8(&gUnknown_203B2E0->input, 1)) {
if (sub_80138B8(&gUnknown_203B2E0->unk8.s0.input, 1)) {
sub_802C328();
DrawPelipperBoardJobMenu();
return 1;
@ -79,92 +79,42 @@ u32 sub_802C1E4(bool8 a0)
u8 sub_802C26C(void)
{
return gUnknown_203B2E0->pelipperBoardSlots[(gUnknown_203B2E0->input.unk1E * gUnknown_203B2E0->input.unk1C) + gUnknown_203B2E0->input.menuIndex];
return gUnknown_203B2E0->pelipperBoardSlots[(gUnknown_203B2E0->unk8.s0.input.unk1E * gUnknown_203B2E0->unk8.s0.input.unk1C) + gUnknown_203B2E0->unk8.s0.input.menuIndex];
}
void sub_802C28C(bool8 cursorSprite)
{
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2E0->unk44, FALSE, FALSE);
gUnknown_203B2E0->input.unk22 = CountPelipperBoardSlots();
sub_8013984(&gUnknown_203B2E0->input);
sub_800641C(gUnknown_203B2E0->unk8.s0.unk3C, FALSE, FALSE);
gUnknown_203B2E0->unk8.s0.input.unk22 = CountPelipperBoardSlots();
sub_8013984(&gUnknown_203B2E0->unk8.s0.input);
sub_802C328();
DrawPelipperBoardJobMenu();
if (cursorSprite)
AddMenuCursorSprite(&gUnknown_203B2E0->input);
AddMenuCursorSprite(&gUnknown_203B2E0->unk8.s0.input);
}
void sub_802C2D4(void)
{
if (gUnknown_203B2E0 != NULL) {
gUnknown_203B2E4 = gUnknown_203B2E0->input.menuIndex;
gUnknown_203B2E0->unk44[gUnknown_203B2E0->unk3C] = sUnknown_80DFC9C;
gUnknown_203B2E4 = gUnknown_203B2E0->unk8.s0.input.menuIndex;
gUnknown_203B2E0->unk8.s0.unk3C[gUnknown_203B2E0->unk8.s0.unk34] = sUnknown_80DFC9C;
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2E0->unk44, TRUE, TRUE);
sub_800641C(gUnknown_203B2E0->unk8.s0.unk3C, TRUE, TRUE);
MemoryFree(gUnknown_203B2E0);
gUnknown_203B2E0 = NULL;
}
}
NAKED
static void sub_802C328(void)
{
asm_unified(
"\tpush {r4,lr}\n"
"\tldr r4, _0802C398\n"
"\tldr r0, [r4]\n"
"\tldrh r1, [r0, 0x28]\n"
"\tadds r0, 0xA4\n"
"\tmovs r2, 0\n"
"\tstrb r1, [r0]\n"
"\tldr r0, [r4]\n"
"\tldrh r1, [r0, 0x26]\n"
"\tadds r0, 0xA5\n"
"\tstrb r1, [r0]\n"
"\tldr r0, [r4]\n"
"\tadds r0, 0xA6\n"
"\tmovs r1, 0xC\n"
"\tstrb r1, [r0]\n"
"\tldr r0, [r4]\n"
"\tadds r0, 0xA7\n"
"\tstrb r2, [r0]\n"
"\tldr r0, [r4]\n"
"\tmovs r1, 0x22\n"
"\tldrsh r0, [r0, r1]\n"
"\tmovs r1, 0x18\n"
"\tbl sub_8009614\n"
"\tadds r0, 0x2\n"
"\tlsls r0, 16\n"
"\tldr r2, [r4]\n"
"\tldr r3, [r2, 0x3C]\n"
"\tlsls r1, r3, 1\n"
"\tadds r1, r3\n"
"\tlsls r1, 3\n"
"\tadds r1, r2, r1\n"
"\tadds r1, 0x52\n"
"\tasrs r3, r0, 16\n"
"\tlsrs r0, 16\n"
"\tstrh r0, [r1]\n"
"\tldr r1, [r2, 0x3C]\n"
"\tlsls r0, r1, 1\n"
"\tadds r0, r1\n"
"\tlsls r0, 3\n"
"\tadds r2, r0\n"
"\tadds r3, 0x2\n"
"\tadds r2, 0x54\n"
"\tstrh r3, [r2]\n"
"\tbl ResetUnusedInputStruct\n"
"\tldr r0, [r4]\n"
"\tadds r0, 0x44\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"
"_0802C398: .4byte gUnknown_203B2E0");
gUnknown_203B2E0->unk8.unk9C.f0 = gUnknown_203B2E0->unk8.s0.input.unk20;
gUnknown_203B2E0->unk8.unk9C.f1 = gUnknown_203B2E0->unk8.s0.input.unk1E;
gUnknown_203B2E0->unk8.unk9C.f2 = 12;
gUnknown_203B2E0->unk8.unk9C.f3 = 0;
SUB_8009614_CALL(gUnknown_203B2E0->unk8.s0);
}
void DrawPelipperBoardJobMenu(void)
@ -176,22 +126,22 @@ void DrawPelipperBoardJobMenu(void)
s32 i;
unkStruct_802C39C local;
sub_8008C54(gUnknown_203B2E0->unk3C);
sub_80073B8(gUnknown_203B2E0->unk3C);
iVar4 = gUnknown_203B2E0->input.unk1E * 8;
sub_8008C54(gUnknown_203B2E0->unk8.s0.unk34);
sub_80073B8(gUnknown_203B2E0->unk8.s0.unk34);
iVar4 = gUnknown_203B2E0->unk8.s0.input.unk1E * 8;
x = iVar4;
x += 10;
PrintStringOnWindow(x, 0, sBulletinBoard, gUnknown_203B2E0->unk3C, 0);
PrintStringOnWindow(x, 0, sBulletinBoard, gUnknown_203B2E0->unk8.s0.unk34, 0);
iVar4 += 4;
x = iVar4 + (gUnknown_203B2E0->unkA4.f2 * 8);
sub_8012BC4(x, 0, gUnknown_203B2E0->input.unk1E + 1, 2, 7, gUnknown_203B2E0->unk3C);
x = iVar4 + (gUnknown_203B2E0->unk8.unk9C.f2 * 8);
sub_8012BC4(x, 0, gUnknown_203B2E0->unk8.s0.input.unk1E + 1, 2, 7, gUnknown_203B2E0->unk8.s0.unk34);
for (i = 0; i < gUnknown_203B2E0->input.unk1A; i++) {
slotIndex = (gUnknown_203B2E0->pelipperBoardSlots[(gUnknown_203B2E0->input.unk1E * gUnknown_203B2E0->input.unk1C) + i]);
for (i = 0; i < gUnknown_203B2E0->unk8.s0.input.unk1A; i++) {
slotIndex = (gUnknown_203B2E0->pelipperBoardSlots[(gUnknown_203B2E0->unk8.s0.input.unk1E * gUnknown_203B2E0->unk8.s0.input.unk1C) + i]);
mail = GetPelipperBoardSlotInfo(slotIndex);
local.unk0[0] = gUnknown_203B2E0->unk3C;
local.y = sub_8013800(&gUnknown_203B2E0->input, i);
local.unk0[0] = gUnknown_203B2E0->unk8.s0.unk34;
local.y = sub_8013800(&gUnknown_203B2E0->unk8.s0.input, i);
sub_803B35C(mail, &local);
if (IsMailinJobSlot(GetPelipperBoardSlotInfo(slotIndex)))
@ -200,7 +150,7 @@ void DrawPelipperBoardJobMenu(void)
CreateRescueTitle(&local);
}
sub_80073E0(gUnknown_203B2E0->unk3C);
sub_80073E0(gUnknown_203B2E0->unk8.s0.unk34);
}
static s32 CountPelipperBoardSlots(void)