pmd-red/include/structs/struct_sub80095e4.h
Mateusz Naściszewski ae3c563713
Mega rename
2024-09-15 20:29:02 +02:00

71 lines
3.7 KiB
C

#ifndef GUARD_struct_sub80095e4_H
#define GUARD_struct_sub80095e4_H
#include "structs/menu.h"
#include "structs/str_text.h"
s32 sub_80095E4(s32 a0, s32 a1);
s32 sub_8009614(s32 a0, s32 a1);
// Struct related with sub_80095E4
typedef struct struct_Sub80095E4
{
/* 0x0 */ MenuInputStruct input;
u32 unk34;
UnkTextStruct2 *unk38;
UnkTextStruct2 unk3C[4];
// size: 0x9C
} struct_Sub80095E4;
// Has 1 additional array.
// size: 0xA0
typedef struct struct_Sub80095E4_2
{
/* 0x0 */ struct_Sub80095E4 s0; // s as in 'struct' ; decided to go against unk as to not have `->unk0->unk3C`
UnkTextStruct2_sub2 unk9C;
} struct_Sub80095E4_2;
// Note: In order to get matching ASM, this macro had to be created.
// It's probable the code below is not exactly how it was originally written, but it generates the same asm.
#define SUB_8009_MATCH(ptr, _a0) \
{ \
s16 a0 = (_a0); \
UNUSED s32 a0_ = a0; \
UNUSED s16 oldE = (ptr).unk3C[(ptr).unk34].unkE; \
UNUSED s32 new10 = a0 + 2; \
s16 newE = a0; \
\
(ptr).unk3C[(ptr).unk34].unkE = newE; \
(ptr).unk3C[(ptr).unk34].unk10 = a0 + 2; \
\
ResetUnusedInputStruct(); \
xxx_call_save_unk_text_struct_800641C((ptr).unk3C, TRUE, TRUE); \
}
#define SUB_80095E4_CALL(ptr) \
{ \
SUB_8009_MATCH(ptr, sub_80095E4((ptr).input.unk1A, 12) + 2) \
}
// For sub_801C440 and sub_8023420 where unkE and unk10 are the same.
#define SUB_80095E4_CALL_2(ptr) \
{ \
s32 a0 = sub_80095E4((ptr).input.unk1A, 12) + 2; \
UNUSED s16 oldE = (ptr).unk3C[(ptr).unk34].unkE; \
s16 newE = a0; \
\
(ptr).unk3C[(ptr).unk34].unkE = newE; \
(ptr).unk3C[(ptr).unk34].unk10 = newE; \
\
ResetUnusedInputStruct(); \
xxx_call_save_unk_text_struct_800641C((ptr).unk3C, TRUE, TRUE); \
}
// 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) \
}
#endif // GUARD_struct_sub80095e4_H