More MAD decompilation

This commit is contained in:
Luciano Ciccariello 2022-01-25 00:01:48 +00:00
parent 1cb4efa81e
commit 48c40e82eb
5 changed files with 104 additions and 14 deletions

View File

@ -7,6 +7,7 @@ D_80180040 = 0x80180040;
D_801800B4 = 0x801800B4;
D_801801F8 = 0x801801F8;
g_pStTileset = 0x801802A4;
D_801809EC = 0x801809EC;
func_8018EC90 = 0x8018EC90;
func_8018E1D4 = 0x8018E1D4;
g_pStTilesetDebug = 0x80180290;
@ -32,4 +33,4 @@ g_pStrObjLayout17 = 0x80181A4E;
g_pStrObjLayout18 = 0x80181AF8;
g_pStrObjLayout19 = 0x80181BA2;
g_pStrObjLayout20 = 0x80181C4C;
g_pStrObjLayout21 = 0x80181CF6;
g_pStrObjLayout21 = 0x80181CF6;

View File

@ -65,9 +65,9 @@ typedef struct
s16 unk6;
} Unkstruct1;
typedef struct
typedef struct _Unkstruct2
{
struct Unkstruct2* next;
struct _Unkstruct2* next;
s16 unk4;
s8 unk6;
u8 unk7;
@ -80,15 +80,30 @@ typedef struct
s32 unk1c;
s32 unk20;
s32 unk24;
s32 unk28;
s32 unk2c;
s32 unk30;
s16 unk28;
s8 unk2A;
u8 unk2B;
u16 unk2C;
u16 unk2E;
u16 unk30;
u16 unk32;
} Unkstruct2;
typedef union
{
s32 data;
struct
{
s16 unk0;
s16 unk2;
} Data;
} Unkunion1; // big assumption here...
typedef struct
{
s32 unk0;
s32 unk4;
Unkunion1 unk0;
Unkunion1 unk4;
s32 unk8;
s32 unkC;
s32 unk10[7];
@ -122,6 +137,8 @@ extern s32 D_8006C39C;
extern s32 D_8006C3A0;
extern Unkstruct4 D_80072B34;
extern u16 D_80072B3E;
extern u16 D_80072E8A;
extern s16 D_80072E8E;
extern s32 D_80072F2C;
extern s32 D_80073060;
extern s32 D_80073080;

View File

@ -9,6 +9,8 @@
.macro li reg, num
.if \num < 0x8000 && \num > 0
ori \reg, $0, \num & 0xFFFF
.elseif \num > 0xFFFF
lui \reg, %hi(\num)
.elseif \num > 0
ori \reg, $0, \num & 0xFFFF
.elseif \num >= -0x8000

View File

@ -13,6 +13,7 @@ extern s32 D_8003CACC;
extern void func_80015238(s32 arg0);
int VSync(s32);
s32 func_800190AC(s32, s32);
extern unsigned char func_80019424();
extern unsigned char func_80019434();
extern unsigned char func_80019444();

View File

@ -10,6 +10,7 @@ typedef struct
s16 unk8;
} Unkstruct_mad_1;
extern s16 D_801809EC[];
extern RoomHeader g_rooms[];
extern Unkstruct_mad_1* D_801997DC;
@ -194,18 +195,31 @@ INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80191E6C);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80191F24);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_8019203C);
s32 func_8019203C(void) {
s16 value = D_8006C26C->unk0.Data.unk2 - D_80072E8A;
if (value < 0) {
value = -value;
}
return value;
}
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192078);
s32 func_80192078(void) {
s32 value = D_8006C26C->unk4.Data.unk2 - D_80072E8E;
return value < 0 ? -value : value;
}
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_801920AC);
void func_801920F0(void) {
D_8006C26C->unk0 = D_8006C26C->unk0 + D_8006C26C->unk8;
D_8006C26C->unk4 = D_8006C26C->unk4 + D_8006C26C->unkC;
D_8006C26C->unk0.data = D_8006C26C->unk0.data + D_8006C26C->unk8;
D_8006C26C->unk4.data = D_8006C26C->unk4.data + D_8006C26C->unkC;
}
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192120);
void func_80192120(void) {
if (D_8006C26C->unkC <= 0x5FFFF) {
D_8006C26C->unkC = D_8006C26C->unkC + 0x4000;
}
}
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_8019214C);
@ -219,11 +233,24 @@ INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192800);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192860);
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_8019288C);
#else
s16 func_8019288C(s32 arg0) {
return D_801809EC[arg0 & 0xFF];
}
#endif
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_801928A8);
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192914);
#else
s32 func_80192914(s16 arg0, s16 arg1) {
return ((func_800190AC(arg1, arg0) >> 4) + 0x40) & 0xFF;
}
#endif
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_8019294C);
@ -233,9 +260,30 @@ INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_801929DC);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192A34);
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192AC0);
#else
s32 func_80192AC0(s16 arg0, s16 arg1) {
return func_800190AC(arg1, arg0) & 0xFFFF;
}
#endif
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192AF0);
#else
typedef struct
{
s16 unk0;
s16 unk2;
s16 unk4;
s16 unk6;
s16 unk8;
} Unkstruct_mad_2;
s32 func_80192AF0(Unkstruct_mad_1* a, Unkstruct_mad_1* b) {
return func_800190AC(b->unk6 - a->unk6, b->unk2 - a->unk2) & 0xFFFF;
}
#endif
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80192B28);
@ -371,7 +419,22 @@ INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80198FA0);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80199388);
#ifndef NON_MATCHING
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_801994D8);
#else
Unkstruct2* func_801994D8(Unkstruct2* arg0) {
if (arg0 != NULL) {
loop_1:
if (arg0->unk2B != NULL) {
arg0 = arg0->next;
if (arg0 != NULL) {
goto loop_1;
}
}
}
return arg0;
}
#endif
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80199508);
@ -381,6 +444,12 @@ INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_8019960C);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_801996EC);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80199740);
void func_80199740(Unkstruct2* arg0) {
arg0->unk2B = 0;
arg0->unk32 = 8;
arg0->next->unk2B = 0;
arg0->next->unk7 = 4;
arg0->next->unk32 = 8;
}
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_8019976C);