From 0fb42698f554eb6b2c68f08e59a52f382fe2f462 Mon Sep 17 00:00:00 2001 From: CreateSource Date: Mon, 20 May 2024 23:30:05 -0400 Subject: [PATCH] card.c looks good in objdiff, doesnt match checksum --- config/GMPE01_00/rels/m446dll/symbols.txt | 36 +-- configure.py | 2 +- include/REL/m446Dll.h | 66 ++++-- src/REL/m446Dll/card.c | 274 ++++++++++++++++++---- 4 files changed, 298 insertions(+), 80 deletions(-) diff --git a/config/GMPE01_00/rels/m446dll/symbols.txt b/config/GMPE01_00/rels/m446dll/symbols.txt index 498cf2fe..7e0435f7 100644 --- a/config/GMPE01_00/rels/m446dll/symbols.txt +++ b/config/GMPE01_00/rels/m446dll/symbols.txt @@ -133,23 +133,23 @@ lbl_1_rodata_18 = .rodata:0x00000018; // type:object size:0x30 data:4byte lbl_1_rodata_48 = .rodata:0x00000048; // type:object size:0x4 data:float lbl_1_rodata_4C = .rodata:0x0000004C; // type:object size:0x4 data:float lbl_1_rodata_50 = .rodata:0x00000050; // type:object size:0x8 data:float -lbl_1_rodata_58 = .rodata:0x00000058; // type:object size:0x14 -lbl_1_rodata_6C = .rodata:0x0000006C; // type:object size:0x14 -lbl_1_rodata_80 = .rodata:0x00000080; // type:object size:0x8 data:double -lbl_1_rodata_88 = .rodata:0x00000088; // type:object size:0x4 data:float -lbl_1_rodata_90 = .rodata:0x00000090; // type:object size:0x8 data:double -lbl_1_rodata_98 = .rodata:0x00000098; // type:object size:0x4 data:float -lbl_1_rodata_9C = .rodata:0x0000009C; // type:object size:0x4 data:float -lbl_1_rodata_A0 = .rodata:0x000000A0; // type:object size:0x4 data:float -lbl_1_rodata_A8 = .rodata:0x000000A8; // type:object size:0x8 data:double -lbl_1_rodata_B0 = .rodata:0x000000B0; // type:object size:0x4 data:float -lbl_1_rodata_B4 = .rodata:0x000000B4; // type:object size:0x4 data:float -lbl_1_rodata_B8 = .rodata:0x000000B8; // type:object size:0x4 data:float -lbl_1_rodata_BC = .rodata:0x000000BC; // type:object size:0x4 data:float -lbl_1_rodata_C0 = .rodata:0x000000C0; // type:object size:0x4 data:float -lbl_1_rodata_C4 = .rodata:0x000000C4; // type:object size:0x4 data:float -lbl_1_rodata_C8 = .rodata:0x000000C8; // type:object size:0x4 data:float -lbl_1_rodata_CC = .rodata:0x000000CC; // type:object size:0x4 data:float +lbl_1_rodata_58 = .rodata:0x00000058; // type:object size:0x14 scope:local +lbl_1_rodata_6C = .rodata:0x0000006C; // type:object size:0x14 scope:local +lbl_1_rodata_80 = .rodata:0x00000080; // type:object size:0x8 scope:local data:double +lbl_1_rodata_88 = .rodata:0x00000088; // type:object size:0x4 scope:local data:float +lbl_1_rodata_90 = .rodata:0x00000090; // type:object size:0x8 scope:local data:double +lbl_1_rodata_98 = .rodata:0x00000098; // type:object size:0x4 scope:local data:float +lbl_1_rodata_9C = .rodata:0x0000009C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_A0 = .rodata:0x000000A0; // type:object size:0x4 scope:local data:float +lbl_1_rodata_A8 = .rodata:0x000000A8; // type:object size:0x8 scope:local data:double +lbl_1_rodata_B0 = .rodata:0x000000B0; // type:object size:0x4 scope:local data:float +lbl_1_rodata_B4 = .rodata:0x000000B4; // type:object size:0x4 scope:local data:float +lbl_1_rodata_B8 = .rodata:0x000000B8; // type:object size:0x4 scope:local data:float +lbl_1_rodata_BC = .rodata:0x000000BC; // type:object size:0x4 scope:local data:float +lbl_1_rodata_C0 = .rodata:0x000000C0; // type:object size:0x4 scope:local data:float +lbl_1_rodata_C4 = .rodata:0x000000C4; // type:object size:0x4 scope:local data:float +lbl_1_rodata_C8 = .rodata:0x000000C8; // type:object size:0x4 scope:local data:float +lbl_1_rodata_CC = .rodata:0x000000CC; // type:object size:0x4 scope:local data:float lbl_1_rodata_D0 = .rodata:0x000000D0; // type:object size:0x28 lbl_1_rodata_F8 = .rodata:0x000000F8; // type:object size:0x4 data:float lbl_1_rodata_FC = .rodata:0x000000FC; // type:object size:0x4 data:float @@ -257,7 +257,7 @@ lbl_1_data_A0 = .data:0x000000A0; // type:object size:0x14 jumptable_1_data_B4 = .data:0x000000B4; // type:object size:0x30 scope:local jumptable_1_data_E4 = .data:0x000000E4; // type:object size:0x68 scope:local lbl_1_data_150 = .data:0x00000150; // type:object size:0xC -lbl_1_data_15C = .data:0x0000015C; // type:object size:0x20 +lbl_1_data_15C = .data:0x0000015C; // type:object size:0x20 scope:local jumptable_1_data_17C = .data:0x0000017C; // type:object size:0x2C scope:local lbl_1_data_1A8 = .data:0x000001A8; // type:object size:0x1F data:string lbl_1_data_1C7 = .data:0x000001C7; // type:object size:0x1F diff --git a/configure.py b/configure.py index 881991ca..1c18740d 100644 --- a/configure.py +++ b/configure.py @@ -1116,7 +1116,7 @@ config.libs = [ objects = { Object(Matching, "REL/executor.c"), Object(NonMatching, "REL/m446dll/main.c"), - Object(NonMatching, "REL/m446dll/card.c"), + Object(Matching, "REL/m446dll/card.c"), Object(NonMatching, "REL/m446dll/deck.c"), Object(NonMatching, "REL/m446dll/table.c"), Object(NonMatching, "REL/m446dll/player.c"), diff --git a/include/REL/m446Dll.h b/include/REL/m446Dll.h index 3ff403e9..0b6c014d 100644 --- a/include/REL/m446Dll.h +++ b/include/REL/m446Dll.h @@ -50,16 +50,17 @@ typedef struct _unkStruct2 { s32 unk8; } unkStruct2; -typedef struct _unkStruct4 { - struct _unkStruct5 *unk0; - struct _unkStruct4 *unk4; - struct _unkStruct4 *unk8; -} unkStruct4; +typedef struct _unkStruct3 { + struct _unkStruct4 *unk0; + struct _unkStruct3 *unk4; + struct _unkStruct3 *unk8; +} unkStruct3; -typedef struct _unkStruct5 { +typedef struct _unkStruct4 { s32 unk0; s32 unk4; - s16 unk8; + u8 unk8; + u8 unk9; s16 unkA; s16 unkC; s16 unkE; @@ -85,19 +86,13 @@ typedef struct _unkStruct5 { f32 unk8C; f32 unk90; f32 unk94; -} unkStruct5; - -typedef struct _unkStruct3 { - unkStruct5 *unk0; - s32 unk4; - s32 unk8; -} unkStruct3; +} unkStruct4; typedef void (*m446Func1)(unkStruct *); -typedef void (*m446Func5)(unkStruct5 *); +typedef void (*m446Func4)(unkStruct4 *); // bss -extern unkStruct4* lbl_1_bss_18; +extern unkStruct3* lbl_1_bss_18; extern s32 lbl_1_bss_14; extern s32 lbl_1_bss_10; extern Process* lbl_1_bss_C; @@ -116,7 +111,7 @@ extern Vec lbl_1_data_38[2]; extern Vec lbl_1_data_50[2]; extern f32 lbl_1_data_68[2]; extern m446Func1 lbl_1_data_A0[5]; -extern m446Func5 lbl_1_data_150[3]; +extern m446Func4 lbl_1_data_150[3]; // prototypes extern void ModuleProlog(void); @@ -133,4 +128,39 @@ extern s32 fn_1_17FC(unkStruct*); extern void fn_1_183C(unkStruct*); extern void fn_1_1874(unkStruct*); extern void fn_1_18B0(unkStruct*); -extern void fn_1_19D4(void); \ No newline at end of file +extern void fn_1_19D4(void); +extern unkStruct2* fn_1_1C64(s32); +extern void fn_1_1CF8(unkStruct2*); +extern s32 fn_1_1D30(unkStruct2*, s32); +extern s32 fn_1_1D6C(unkStruct2*, s32*); +extern s32 fn_1_1DA8(unkStruct2*, s32*); +extern BOOL fn_1_1DDC(unkStruct2*); +extern s32 fn_1_1DEC(unkStruct2*); +extern unkStruct3* fn_1_1DF4(unkStruct4*); +extern void fn_1_1E5C(unkStruct3*); +extern void fn_1_1E84(unkStruct3**); +extern void fn_1_1EC8(unkStruct3*, unkStruct3*); +extern void fn_1_1F04(unkStruct3*); +extern void fn_1_1F38(u8*, u8*, s32); +extern void fn_1_1F84(u8*, s8, s32); +extern void fn_1_1FC0(u8*, s32); +extern s32 fn_1_1FFC(s8*, s8*, s32); +extern s32 fn_1_2064(void); +extern void fn_1_207C(void); +extern void fn_1_20D4(void); +extern unkStruct4* fn_1_240C(s32); +extern void fn_1_2688(unkStruct4*); +extern void fn_1_272C(unkStruct4*); +extern void fn_1_2794(unkStruct4*); +extern void fn_1_27FC(unkStruct4*, Vec*, s32); +extern void fn_1_2890(unkStruct4*, Vec*, s32, s32); +extern void fn_1_2928(unkStruct4*, Vec*, s32); +extern void fn_1_29B4(unkStruct4*, s32, f32); +extern void fn_1_2A1C(unkStruct4*); +extern void fn_1_2A58(unkStruct4*); +extern void fn_1_2A94(unkStruct4*); +extern void fn_1_2AA8(unkStruct4*); +extern void fn_1_2D94(unkStruct4*); +extern void fn_1_2DA8(unkStruct4*); +extern void fn_1_2EC0(unkStruct4*, s32); +extern void fn_1_2F64(unkStruct4*); \ No newline at end of file diff --git a/src/REL/m446Dll/card.c b/src/REL/m446Dll/card.c index 3a4824b5..85d1c15f 100644 --- a/src/REL/m446Dll/card.c +++ b/src/REL/m446Dll/card.c @@ -4,34 +4,12 @@ #include "math.h" // data -m446Func5 lbl_1_data_150[3] = {0}; -const s32 lbl_1_rodata_58[5] = {0x4D0001, 0x4D0002, 0x4D0003, 0x4D0004, 0x4D0000}; -const s32 lbl_1_rodata_6C[5] = {0x4D001B, 0x4D001C, 0x4D001D, 0x4D001E, 0x4D001E}; +m446Func4 lbl_1_data_150[3] = {NULL, NULL, NULL}; +static const s32 lbl_1_rodata_58[5] = {0x4D0001, 0x4D0002, 0x4D0003, 0x4D0004, 0x4D0000}; +static const s32 lbl_1_rodata_6C[5] = {0x4D001B, 0x4D001C, 0x4D001D, 0x4D001E, 0x4D001E}; // bss -unkStruct4* lbl_1_bss_18; - -// prototype -unkStruct2* fn_1_1C64(s32); -void fn_1_1CF8(unkStruct2*); -s32 fn_1_1D30(unkStruct2*, s32); -s32 fn_1_1D6C(unkStruct2*, s32*); -s32 fn_1_1DA8(unkStruct2*, s32*); -BOOL fn_1_1DDC(unkStruct2*); -s32 fn_1_1DEC(unkStruct2*); -unkStruct4* fn_1_1DF4(unkStruct5*); -void fn_1_1E5C(unkStruct4*); -void fn_1_1E84(unkStruct3**); -void fn_1_1EC8(unkStruct4*, unkStruct4*); -void fn_1_1F04(unkStruct4*); -void fn_1_1F38(u8*, u8*, s32); -void fn_1_1F84(u8*, s8, s32); -void fn_1_1FC0(u8*, s32); -s32 fn_1_1FFC(s8*, s8*, s32); -s32 fn_1_2064(void); -void fn_1_207C(void); -// ... -void fn_1_2688(unkStruct5*); +unkStruct3* lbl_1_bss_18; unkStruct2* fn_1_1C64(s32 arg0) { unkStruct2* temp_r3; @@ -94,8 +72,8 @@ s32 fn_1_1DEC(unkStruct2* arg0) { #pragma dont_inline on -unkStruct4* fn_1_1DF4(unkStruct5* arg0) { - unkStruct4* temp_r3; +unkStruct3* fn_1_1DF4(unkStruct4* arg0) { + unkStruct3* temp_r3; temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, 0xC, 0x10000000); if (!temp_r3) { @@ -107,7 +85,7 @@ unkStruct4* fn_1_1DF4(unkStruct5* arg0) { return temp_r3; } -void fn_1_1E5C(unkStruct4* arg0) { +void fn_1_1E5C(unkStruct3* arg0) { HuMemDirectFree(arg0); } @@ -117,7 +95,7 @@ void fn_1_1E84(unkStruct3** arg0) { *arg0 = NULL; } -void fn_1_1EC8(unkStruct4* arg0, unkStruct4* arg1) { +void fn_1_1EC8(unkStruct3* arg0, unkStruct3* arg1) { if (arg0) { arg1->unk8 = arg0->unk8; arg1->unk4 = arg0; @@ -131,7 +109,7 @@ void fn_1_1EC8(unkStruct4* arg0, unkStruct4* arg1) { } } -void fn_1_1F04(unkStruct4* arg0) { +void fn_1_1F04(unkStruct3* arg0) { if (arg0->unk8) { arg0->unk8->unk4 = arg0->unk4; } @@ -196,8 +174,8 @@ s32 fn_1_2064(void) { } void fn_1_207C(void) { - unkStruct5* var_r30; - unkStruct4* var_r31; + unkStruct4* var_r30; + unkStruct3* var_r31; var_r31 = lbl_1_bss_18; if (var_r31) { @@ -213,8 +191,8 @@ void fn_1_20D4(void) { m446Func1 *temp_r4; f32 temp_f31; s32 temp_r5; - unkStruct5* temp_r31; - unkStruct4* var_r30; + unkStruct4* temp_r31; + unkStruct3* var_r30; var_r30 = lbl_1_bss_18; if (var_r30) { @@ -268,13 +246,13 @@ void fn_1_20D4(void) { } } -unkStruct5* fn_1_240C(s32 arg0) { - unkStruct5* temp_r31; - unkStruct4* temp_r30; +unkStruct4* fn_1_240C(s32 arg0) { + unkStruct4* temp_r31; + unkStruct3* temp_r30; temp_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x98, 0x10000000U); if (!temp_r31) { - OSReport("[!] m446CardCreate ERROR\n"); + OSReport("[!] m446CardCreate ERROR...\n"); return NULL; } temp_r31->unk0 = arg0; @@ -305,20 +283,20 @@ unkStruct5* fn_1_240C(s32 arg0) { fn_1_2EC0(temp_r31, 1); temp_r30 = fn_1_1DF4(temp_r31); if (!temp_r30) { - OSReport("[!] m446CardCreate ERROR\n"); + OSReport("[!] m446CardCreate ERROR...\n"); HuMemDirectFree(temp_r31); return NULL; } if (lbl_1_bss_18) { fn_1_1EC8(lbl_1_bss_18, temp_r30); } else { - lbl_1_bss_18 = (unkStruct4*)temp_r30; + lbl_1_bss_18 = temp_r30; } return temp_r31; } -void fn_1_2688(unkStruct5* arg0) { - unkStruct4* var_r31 = lbl_1_bss_18; +void fn_1_2688(unkStruct4* arg0) { + unkStruct3* var_r31 = lbl_1_bss_18; loop_1: if (arg0 == var_r31->unk0) { if (var_r31 == lbl_1_bss_18) { @@ -335,4 +313,214 @@ loop_1: if (var_r31) { goto loop_1; } +} + +void fn_1_272C(unkStruct4* arg0) { + Vec sp8; + + sp8 = arg0->unk34; + sp8.z = 0.0f; + arg0->unk64 = 1; + fn_1_2928(arg0, &sp8, 0x1E); +} + +void fn_1_2794(unkStruct4* arg0) { + Vec sp8; + + sp8 = arg0->unk34; + sp8.z = 180.0f; + arg0->unk64 = 0; + fn_1_2928(arg0, &sp8, 0x3C); +} + +void fn_1_27FC(unkStruct4* arg0, Vec* arg1, s32 arg2) { + arg0->unk7C = 0; + arg0->unk28 = *arg1; + arg0->unk1C = arg0->unk10; + arg0->unk80 = 0.0f; + arg0->unk84 = (1.0f / arg2); + arg0->unk70 = 1; +} + +void fn_1_2890(unkStruct4* arg0, Vec* arg1, s32 arg2, s32 arg3) { + arg0->unk7C = 0; + arg0->unk28 = *arg1; + arg0->unk1C = arg0->unk10; + arg0->unk80 = 0.0f; + arg0->unk84 = (1.0f / arg2); + arg0->unk70 = 1; + arg0->unk7C = arg3; +} + +void fn_1_2928(unkStruct4* arg0, Vec* arg1, s32 arg2) { + arg0->unk4C = *arg1; + arg0->unk40 = arg0->unk34; + arg0->unk88 = 0.0f; + arg0->unk8C = (1.0f / arg2); + arg0->unk74 = 1; +} + +void fn_1_29B4(unkStruct4* arg0, s32 arg1, f32 arg8) { + arg0->unk60 = arg8; + arg0->unk5C = arg0->unk58; + arg0->unk90 = 0.0f; + arg0->unk94 = (1.0f / arg1); + arg0->unk78 = 1; +} + +void fn_1_2A1C(unkStruct4* arg0) { + Hu3DModelAttrReset(arg0->unkC, 1); + arg0->unk6C = 1; +} + +void fn_1_2A58(unkStruct4* arg0) { + Hu3DModelAttrSet(arg0->unkC, 1); + arg0->unk6C = 0; +} + +void fn_1_2A94(unkStruct4* arg0) { + arg0->unk4 = 1; + arg0->unk8 = 0; +} + +void fn_1_2AA8(unkStruct4* arg0) { + Vec sp8; + + switch (arg0->unk8) { + case 0: + arg0->unk8 = 1; + Hu3DModelAttrReset(arg0->unkC, 1); + arg0->unk6C = 1; + arg0->unk8 = 1; // ? + case 1: + arg0->unk60 = 2.5f; + arg0->unk5C = arg0->unk58; + arg0->unk90 = 0.0f; + arg0->unk94 = 0.055555556f; + arg0->unk78 = 1; + arg0->unk8 = 2; // ????? + break; + + case 2: + if (arg0->unk78 != 0) break; + arg0->unk8 = 3; // ?????????? + case 3: + arg0->unk60 = 1.5f; + arg0->unk5C = arg0->unk58; + arg0->unk90 = 0.0f; + arg0->unk94 = 0.055555556f; + arg0->unk78 = 1; + arg0->unk8 = 4; + break; + + case 4: + if (arg0->unk78 != 0) break; + arg0->unk8 = 5; + case 5: + arg0->unk60 = 2.5f; + arg0->unk5C = arg0->unk58; + arg0->unk90 = 0.0f; + arg0->unk94 = 0.055555556f; + arg0->unk78 = 1; + arg0->unk8 = 6; + break; + + case 6: + if (arg0->unk78 != 0) break; + arg0->unk8 = 8; + case 7: + arg0->unk60 = 1.5f; + arg0->unk5C = arg0->unk58; + arg0->unk90 = 0.0f; + arg0->unk94 = 0.055555556f; + arg0->unk78 = 1; + arg0->unk8 = 8; + case 8: + if (arg0->unk78 != 0) break; + arg0->unk8 = 9; + case 9: + sp8 = arg0->unk34; + sp8.y = 720.0f; + arg0->unk4C = sp8; + arg0->unk40 = arg0->unk34; + arg0->unk88 = 0.0f; + arg0->unk8C = 0.016666668f; + arg0->unk74 = 1; + arg0->unk60 = 0.0f; + arg0->unk5C = arg0->unk58; + arg0->unk90 = 0.0f; + arg0->unk94 = 0.016666668f; + arg0->unk78 = 1; + arg0->unk8 = 10; + break; + case 10: + if (arg0->unk78 != 0) break; + arg0->unk4 = 0; + arg0->unk8 = 0; + Hu3DModelAttrSet(arg0->unkC, 1); + arg0->unk6C = 0; + return; // ??? + } +} + +void fn_1_2D94(unkStruct4* arg0) { + arg0->unk4 = 2; + arg0->unk8 = 0; +} + +void fn_1_2DA8(unkStruct4* arg0) { + f32 var_f31; + f32 var_f30; + + switch (arg0->unk8) { + case 0: + arg0->unk8 = 1; + case 1: + if (arg0->unk78 == 0) { + var_f31 = arg0->unk58 + 0.25f; + arg0->unk60 = var_f31; + arg0->unk5C = arg0->unk58; + arg0->unk90 = 0.0f; + arg0->unk94 = 0.033333335f; + arg0->unk78 = 1; + arg0->unk8 = 2U; + } + break; + case 2: + if (arg0->unk78 == 0) { + var_f30 = arg0->unk58 - 0.25f; + arg0->unk60 = var_f30; + arg0->unk5C = arg0->unk58; + arg0->unk90 = 0.0f; + arg0->unk94 = 0.033333335f; + arg0->unk78 = 1; + arg0->unk8 = 1; + } + break; + } +} + +void fn_1_2EC0(unkStruct4* arg0, s32 arg1) { + if (arg1 != 0) { + Hu3DModelShadowDispOn(arg0->unkA); + Hu3DModelAmbSet(arg0->unkA, 0.0f, 0.0f, 0.0f); + return; + } + Hu3DModelShadowDispOff(arg0->unkA); + Hu3DModelAmbSet(arg0->unkA, 1.0f, 1.0f, 1.0f); +} + +void fn_1_2F64(unkStruct4* arg0) { + if ((arg0->unk58 > 1.0f) || (arg0->unk58 < 1.0f)) { + Hu3DModelLayerSet(arg0->unkA, 1); + Hu3DModelLayerSet(arg0->unkC, 1); + } else { + Hu3DModelLayerSet(arg0->unkA, 0); + Hu3DModelLayerSet(arg0->unkC, 0); + } + Hu3DModelPosSet(arg0->unkA, arg0->unk10.x, arg0->unk10.y, arg0->unk10.z); + Hu3DModelPosSet(arg0->unkC, arg0->unk10.x, 0.1f + arg0->unk10.y, arg0->unk10.z); + Hu3DModelScaleSet(arg0->unkA, arg0->unk58, arg0->unk58, arg0->unk58); + Hu3DModelScaleSet(arg0->unkC, arg0->unk58, arg0->unk58, arg0->unk58); + Hu3DModelRotSet(arg0->unkA, arg0->unk34.x, arg0->unk34.y, arg0->unk34.z); } \ No newline at end of file