Decompile 5 more functions from MAD

This commit is contained in:
Luciano Ciccariello 2022-02-02 01:28:07 +00:00
parent 28746a0c1f
commit c48ffb2c94
3 changed files with 102 additions and 23 deletions

View File

@ -72,7 +72,10 @@ typedef struct
Unkunion1 unk4;
s32 unk8;
s32 unkC;
s32 unk10[7];
s32 unk10[5];
s16 unk24;
u16 unk26;
s32 unk28;
u16 unk2C;
s16 unk2E;
s16 unk30;
@ -87,6 +90,32 @@ typedef struct
s32 unk4C;
s16 unk50;
s16 unk52;
s32 unk54;
s32 unk58;
s32 unk5C;
s32 unk60;
s32 unk64;
s32 unk68;
s32 unk6C;
s32 unk70;
s32 unk74;
s32 unk78;
s32 unk7C;
s32 unk80;
s32 unk84;
s32 unk88;
s32 unk8C;
s32 unk90;
s32 unk94;
s32 unk98;
s32 unk9C;
s32 unkA0;
s32 unkA4;
s32 unkA8;
s32 unkAC;
s32 unkB0;
s32 unkB4;
s32 unkB8;
} Unkstruct3;
typedef struct
@ -106,17 +135,8 @@ typedef struct
u16 y;
} ObjectInit;
typedef struct
{
s32 unk0;
char unk4[0x30];
s32 unk34;
char unk38[0x2C];
s32 unk64;
char unk68[0x54];
} Unkstruct5;
// main
extern void (*D_8003C6B0)(s32);
extern void (*D_8003C6D8)(s32);
extern u16 D_8003C708;
extern s32 D_8003C734;
@ -150,7 +170,7 @@ extern s32 D_800730C0;
extern s32 D_800730C4;
extern s32 g_CurrentRoomWidth;
extern s32 g_CurrentRoomHeight;
extern Unkstruct5 D_800733D8[];
extern Unkstruct3 D_800733D8[];
extern s16 D_80073404;
extern s16 D_80073406;
extern s8 D_80073510;
@ -331,7 +351,7 @@ void func_800FDE00(void);
void func_800FF0A0(s32 arg0);
void func_80102DEC(s32 arg0);
void func_80103EAC(void);
void func_80106590(Unkstruct5*);
void func_80106590(Unkstruct3*);
void func_801065F4(s16 startIndex);
void func_801071CC(s32, u8, s32);
void func_80107250(s32 arg0, s32 arg1);

View File

@ -1351,8 +1351,8 @@ INCLUDE_ASM("asm/dra/nonmatchings/42398", func_80105408);
INCLUDE_ASM("asm/dra/nonmatchings/42398", func_80105428);
void func_80106590(Unkstruct5* item) {
int i, size;
void func_80106590(Unkstruct3* item) {
int i, length;
u32* ptr;
if (item->unk34 & 0x800000) {
@ -1360,13 +1360,13 @@ void func_80106590(Unkstruct5* item) {
}
ptr = item;
size = sizeof(Unkstruct5) / sizeof(u32);
for (i = 0; i < size; i++)
length = sizeof(Unkstruct3) / sizeof(u32);
for (i = 0; i < length; i++)
*ptr++ = 0;
}
void func_801065F4(s16 startIndex) {
Unkstruct5* pItem;
Unkstruct3* pItem;
for (pItem = &D_800733D8[startIndex]; pItem < &D_8007EFD8; pItem++)
func_80106590(pItem);
}

View File

@ -354,7 +354,19 @@ INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_801910A8);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80191120);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80191D3C);
void func_80191D3C(Unkstruct3* item) {
int i, length;
u32* ptr;
if (item->unk34 & 0x800000) {
D_8003C6B0(item->unk64);
}
ptr = item;
length = sizeof(Unkstruct3) / sizeof(s32);
for (i = 0; i < length; i++)
*ptr++ = 0;
}
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80191DA8);
@ -420,9 +432,27 @@ INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192408);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192618);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192800);
Unkstruct3* func_80192800(Unkstruct3* arg0, Unkstruct3* arg1) {
while (arg0 < arg1)
{
if (arg0->unk26 == 0)
{
func_80191D3C(arg0);
return arg0;
}
arg0++;
}
return NULL;
}
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192860);
#else
s32 func_80192860(s32 arg0, s16 arg1) {
return D_801809EC[arg0 & 0xFF] * arg1;
}
#endif
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_8019288C);
@ -432,8 +462,10 @@ s16 func_8019288C(s32 arg0) {
}
#endif
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_801928A8);
void func_801928A8(s32 arg0, s16 arg1) {
D_8006C26C->unk8 = func_80192860(arg0 & 0xFF, arg1);
D_8006C26C->unkC = func_80192860((arg0 - 0x40) & 0xFF, arg1);
}
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192914);
@ -463,8 +495,21 @@ u32 func_80192994(s32 arg0, s32 arg1) {
}
#endif
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_801929DC);
#else
u8 func_801929DC(s32 arg0, s32 arg1, s32 arg2) {
u32 temp_a2 = (arg2 - arg1) << 0x18;
u8 phi_v0 = temp_a2 ? -temp_a2 : temp_a2;
if ((u8)arg0 < phi_v0) {
s32 phi_v0_2 = temp_a2 << 0x18 ? (arg1 - arg0) : (arg1 + arg0);
return phi_v0_2;
}
return arg2;
}
#endif
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192A34);
@ -496,7 +541,21 @@ u16 func_80192B28(s32 arg0, s32 arg1) {
}
#endif
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192B70);
#else
u16 func_80192B70(s32 arg0, s32 arg1, s32 arg2) {
u32 temp_a2 = arg2 - arg1;
u16 phi_v0 = temp_a2 & 0x800 ? (0x800 - temp_a2) & 0x7FF : temp_a2;
if ((u16)arg0 < phi_v0) {
u16 ret = temp_a2 & 0x800 ? (arg1 - arg0) : (arg1 + arg0);
return ret;
}
return arg2;
}
#endif
void func_80192BD0(s32 arg0) {
D_8006C26C->unk2C = (s16) (arg0 & 0xFF);