From d759d991f724a96934f236438086edc9c5cfb261 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Thu, 30 Nov 2023 16:44:13 -0600 Subject: [PATCH] Split and Label gamework.c --- config/GMPE01_00/splits.txt | 5 +++ config/GMPE01_00/symbols.txt | 68 ++++++++++++++--------------- configure.py | 1 + include/common_structs.h | 8 ++-- include/variables.h | 6 +-- src/REL/subchrselDll/subchrselDll.c | 4 +- src/REL/w10Dll/w10Dll.c | 4 +- src/REL/w10Dll/w10Dll3.c | 2 +- src/REL/w10Dll/w10Dll4.c | 26 +++++------ 9 files changed, 65 insertions(+), 59 deletions(-) diff --git a/config/GMPE01_00/splits.txt b/config/GMPE01_00/splits.txt index 576c126e..3941a51c 100644 --- a/config/GMPE01_00/splits.txt +++ b/config/GMPE01_00/splits.txt @@ -159,6 +159,11 @@ game/fault.c: .sdata start:0x801D34A0 end:0x801D34B0 .sbss start:0x801D3CF0 end:0x801D3D00 +game/gamework.c: + .text start:0x800308B8 end:0x800315BC + .rodata start:0x8011DD30 end:0x8011DD50 + .bss start:0x8018FC10 end:0x80190008 + game/ovllist.c: .data start:0x8012F790 end:0x80130100 diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 7afc4488..a79ef745 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -543,36 +543,36 @@ XFB_puts = .text:0x800302D0; // type:function size:0xF4 XFB_putcS = .text:0x800303C4; // type:function size:0x150 XFB_putcProgressive = .text:0x80030514; // type:function size:0x1F0 XFB_putcInterlace = .text:0x80030704; // type:function size:0x1B4 -fn_800308B8 = .text:0x800308B8; // type:function size:0x14C -fn_80030A04 = .text:0x80030A04; // type:function size:0x318 -fn_80030D1C = .text:0x80030D1C; // type:function size:0x4C -fn_80030D68 = .text:0x80030D68; // type:function size:0x54 -fn_80030DBC = .text:0x80030DBC; // type:function size:0x18 -fn_80030DD4 = .text:0x80030DD4; // type:function size:0x140 -fn_80030F14 = .text:0x80030F14; // type:function size:0x24 -fn_80030F38 = .text:0x80030F38; // type:function size:0x38 -fn_80030F70 = .text:0x80030F70; // type:function size:0x14 -fn_80030F84 = .text:0x80030F84; // type:function size:0x1C -fn_80030FA0 = .text:0x80030FA0; // type:function size:0x18 -fn_80030FB8 = .text:0x80030FB8; // type:function size:0x1C -fn_80030FD4 = .text:0x80030FD4; // type:function size:0x18 -fn_80030FEC = .text:0x80030FEC; // type:function size:0x5C -fn_80031048 = .text:0x80031048; // type:function size:0x1C -fn_80031064 = .text:0x80031064; // type:function size:0x20 -fn_80031084 = .text:0x80031084; // type:function size:0x6C -fn_800310F0 = .text:0x800310F0; // type:function size:0x5C -fn_8003114C = .text:0x8003114C; // type:function size:0x6C -fn_800311B8 = .text:0x800311B8; // type:function size:0x5C -fn_80031214 = .text:0x80031214; // type:function size:0x60 -fn_80031274 = .text:0x80031274; // type:function size:0x18 -fn_8003128C = .text:0x8003128C; // type:function size:0xB0 -fn_8003133C = .text:0x8003133C; // type:function size:0xD0 -fn_8003140C = .text:0x8003140C; // type:function size:0x6C -fn_80031478 = .text:0x80031478; // type:function size:0x94 -fn_8003150C = .text:0x8003150C; // type:function size:0x18 -fn_80031524 = .text:0x80031524; // type:function size:0x34 -fn_80031558 = .text:0x80031558; // type:function size:0x54 -fn_800315AC = .text:0x800315AC; // type:function size:0x10 +GWInit = .text:0x800308B8; // type:function size:0x14C +GWInitGameStat = .text:0x80030A04; // type:function size:0x318 +GWGetMessSpeed = .text:0x80030D1C; // type:function size:0x4C +GWSetMGRecord = .text:0x80030D68; // type:function size:0x54 +GWGetMGRecord = .text:0x80030DBC; // type:function size:0x18 +GWGetCharColor = .text:0x80030DD4; // type:function size:0x140 +GWSetBoardPlayCount = .text:0x80030F14; // type:function size:0x24 +GWAddBoardPlayCount = .text:0x80030F38; // type:function size:0x38 +GWGetBoardPlayCount = .text:0x80030F70; // type:function size:0x14 +GWSetBoardMaxStars = .text:0x80030F84; // type:function size:0x1C +GWGetBoardMaxStars = .text:0x80030FA0; // type:function size:0x18 +GWSetBoardMaxCoins = .text:0x80030FB8; // type:function size:0x1C +GWGetBoardMaxCoins = .text:0x80030FD4; // type:function size:0x18 +GWIncBoardWinCount = .text:0x80030FEC; // type:function size:0x5C +GWGetBoardWinCount = .text:0x80031048; // type:function size:0x1C +GWSetBoardWinCount = .text:0x80031064; // type:function size:0x20 +GWGetMGAvail = .text:0x80031084; // type:function size:0x6C +GWSetMGAvail = .text:0x800310F0; // type:function size:0x5C +GWGetMGMark = .text:0x8003114C; // type:function size:0x6C +GWSetMGMark = .text:0x800311B8; // type:function size:0x5C +GWResetMGMark = .text:0x80031214; // type:function size:0x60 +GWGetCoins = .text:0x80031274; // type:function size:0x18 +GWSetCoins = .text:0x8003128C; // type:function size:0xB0 +GWAddCoins = .text:0x8003133C; // type:function size:0xD0 +GWSetStars = .text:0x8003140C; // type:function size:0x6C +GWAddStars = .text:0x80031478; // type:function size:0x94 +GWGetStars = .text:0x8003150C; // type:function size:0x18 +GWSetTotalStars = .text:0x80031524; // type:function size:0x34 +GWAddTotalStars = .text:0x80031558; // type:function size:0x54 +GWGetTotalStars = .text:0x800315AC; // type:function size:0x10 omOutView = .text:0x800315BC; // type:function size:0x238 omOutViewMulti = .text:0x800317F4; // type:function size:0x2C4 omSystemKeyCheckSetup = .text:0x80031AB8; // type:function size:0x74 @@ -5414,10 +5414,10 @@ perf = .bss:0x8018F790; // type:object size:0x370 scope:local Ssw = .bss:0x8018FB00; // type:object size:0x38 scope:local omovlhis = .bss:0x8018FB38; // type:object size:0xC0 scope:local XFB_Geometry = .bss:0x8018FBF8; // type:object size:0x18 scope:local -gPlayerConfig = .bss:0x8018FC10; // type:object size:0x28 -gPlayerData = .bss:0x8018FC38; // type:object size:0xC0 data:byte -lbl_8018FCF8 = .bss:0x8018FCF8; // type:object size:0xE0 data:byte -lbl_8018FDD8 = .bss:0x8018FDD8; // type:object size:0x230 +GWPlayerCfg = .bss:0x8018FC10; // type:object size:0x28 +GWPlayer = .bss:0x8018FC38; // type:object size:0xC0 data:byte +GWSystem = .bss:0x8018FCF8; // type:object size:0xE0 data:byte +GWGameStat = .bss:0x8018FDD8; // type:object size:0x230 lbl_80190008 = .bss:0x80190008; // type:object size:0xC data:float lbl_80190014 = .bss:0x80190014; // type:object size:0xC data:float lbl_80190020 = .bss:0x80190020; // type:object size:0xC0 diff --git a/configure.py b/configure.py index 3191e330..2514bbe8 100755 --- a/configure.py +++ b/configure.py @@ -253,6 +253,7 @@ config.libs = [ Object(NonMatching, "game/perf.c"), Object(Matching, "game/objmain.c"), Object(NonMatching, "game/fault.c"), + Object(NonMatching, "game/gamework.c"), Object(Matching, "game/frand.c"), Object(Matching, "game/ovllist.c"), Object(NonMatching, "game/window.c"), diff --git a/include/common_structs.h b/include/common_structs.h index 1fc3eeaf..1525241d 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -88,7 +88,7 @@ typedef struct BoardStateSubStruct { /* 0x08 */ s16 unk8; } BoardStateSubStruct; -typedef struct BoardState { +typedef struct system_work { /* 0x00 */ char unk00[0x04]; /* 0x04 */ s8 curTurnCount; /* 0x05 */ s8 maxTurnCount; @@ -99,13 +99,13 @@ typedef struct BoardState { /* 0x0C */ char unk0C[4]; /* 0x10 */ BoardStateSubStruct unk10; /* 0x1A */ char unk1A[0xC6]; -} BoardState; //8018fcf8, sizeof 0xE0 +} SystemState; //8018fcf8, sizeof 0xE0 typedef struct { u8 unk0 : 2; } PlayerFlags; -typedef struct Player { +typedef struct player_state { /* 0x00 */ u8 characterID; /* 0x01 */ s8 unk01; /* 0x02 */ s8 unk02; @@ -133,7 +133,7 @@ typedef struct Player { /* 0x24 */ char unk_24[6]; /* 0x2A */ s16 stars; /* 0x2C */ char unk_2C[4]; -} Player; //size of 0x30 +} PlayerState; //size of 0x30 typedef struct om_obj_data { u16 stat; diff --git a/include/variables.h b/include/variables.h index cdebbfe0..7192a6a7 100644 --- a/include/variables.h +++ b/include/variables.h @@ -20,7 +20,7 @@ extern u32 procfunc; extern WipeState wipeData; -extern PlayerConfig gPlayerConfig[4]; +extern PlayerConfig GWPlayerCfg[4]; extern FileListEntry _ovltbl[]; @@ -43,7 +43,7 @@ extern s16 omSysExitReq; extern s16 omdispinfo; extern char omSysPauseEnableFlag; extern OverlayID omprevovl; -extern Player gPlayerData[4]; -extern BoardState lbl_8018FCF8; +extern PlayerState GWPlayer[4]; +extern SystemState GWSystem; #endif diff --git a/src/REL/subchrselDll/subchrselDll.c b/src/REL/subchrselDll/subchrselDll.c index 83eb7716..a63820c0 100644 --- a/src/REL/subchrselDll/subchrselDll.c +++ b/src/REL/subchrselDll/subchrselDll.c @@ -61,7 +61,7 @@ static void SubchrMain() int ext_character[4]; int i, cursor_pos; for(i=0; i<4; i++) { - character[i] = gPlayerConfig[i].character; + character[i] = GWPlayerCfg[i].character; ext_character[i] = 0; cur_direction[i] = 0; } @@ -90,7 +90,7 @@ static void SubchrMain() if(GetBtns() & 0x1000) { for(i=0; i<4; i++) { if(ext_character[i] != 0) { - gPlayerConfig[i].character = ext_character[i]+7; + GWPlayerCfg[i].character = ext_character[i]+7; } } fn_80032A58(30); diff --git a/src/REL/w10Dll/w10Dll.c b/src/REL/w10Dll/w10Dll.c index 23ab3eb4..0c2e780a 100644 --- a/src/REL/w10Dll/w10Dll.c +++ b/src/REL/w10Dll/w10Dll.c @@ -64,7 +64,7 @@ const double _three = 3.0; // function is probably global. only inlined in rels? inline s32 get_current_board(void) { - return lbl_8018FCF8.unk08 & 0x1F; + return GWSystem.unk08 & 0x1F; } void fn_1_E0(void) { @@ -78,7 +78,7 @@ void fn_1_E0(void) { s32 temp2; temp2 = get_current_board(); - lbl_1_bss_0 = &lbl_8018FCF8.unk10; + lbl_1_bss_0 = &GWSystem.unk10; lbl_1_bss_0->unk0 = 0; lbl_1_bss_0->unk4 = 0; lbl_1_bss_0->unk6 = 0; diff --git a/src/REL/w10Dll/w10Dll3.c b/src/REL/w10Dll/w10Dll3.c index a9aac6c7..6623b54e 100644 --- a/src/REL/w10Dll/w10Dll3.c +++ b/src/REL/w10Dll/w10Dll3.c @@ -174,7 +174,7 @@ void fn_1_13A4(void) { fn_1_BA0(0x2E0023); for (i = 0; i < 4; i++) { - gPlayerData[i].flags.unk0 = 1; + GWPlayer[i].flags.unk0 = 1; } fn_800A4C88(); fn_800884F4(0); diff --git a/src/REL/w10Dll/w10Dll4.c b/src/REL/w10Dll/w10Dll4.c index 89e8bcbd..81894b5f 100644 --- a/src/REL/w10Dll/w10Dll4.c +++ b/src/REL/w10Dll/w10Dll4.c @@ -84,21 +84,21 @@ void fn_1_176C(void) { void fn_1_179C(void) { fn_1_BA0(0x2E0025); - gPlayerData[1].flags.unk0 = 2; - gPlayerData[3].flags.unk0 = 2; + GWPlayer[1].flags.unk0 = 2; + GWPlayer[3].flags.unk0 = 2; } void fn_1_17F4(void) { fn_1_BA0(0x2E0026); - gPlayerData[0].flags.unk0 = 2; + GWPlayer[0].flags.unk0 = 2; } void fn_1_1834(void) { fn_1_BA0(0x2E0027); - gPlayerData[0].flags.unk0 = 1; - gPlayerData[1].flags.unk0 = 1; - gPlayerData[2].flags.unk0 = 1; - gPlayerData[3].flags.unk0 = 2; + GWPlayer[0].flags.unk0 = 1; + GWPlayer[1].flags.unk0 = 1; + GWPlayer[2].flags.unk0 = 1; + GWPlayer[3].flags.unk0 = 2; } void fn_1_18BC(void) { @@ -137,8 +137,8 @@ void fn_1_1984(void) { if (fn_8005B6A8() != 0) { return; } - for (i = 0; i < ARRAY_COUNT(gPlayerData); i++) { - contPortIndex = gPlayerData[i].controllerPort; + for (i = 0; i < ARRAY_COUNT(GWPlayer); i++) { + contPortIndex = GWPlayer[i].controllerPort; if (contPortIndex == -1) { continue; } @@ -166,8 +166,8 @@ int fn_1_1AAC(s16 arg0, s32 arg1) { HuWinDispOn(lbl_1_bss_E); if (fn_8005B6A8() == 0) { s32 contPortIndex; - for (i = 0; i < ARRAY_COUNT(gPlayerData); i++) { - contPortIndex = gPlayerData[i].controllerPort; + for (i = 0; i < ARRAY_COUNT(GWPlayer); i++) { + contPortIndex = GWPlayer[i].controllerPort; if (contPortIndex == -1) { continue; } @@ -189,8 +189,8 @@ int fn_1_1AAC(s16 arg0, s32 arg1) { } if (arg0 != 0x1D) { OSReport(lbl_1_data_258, - (gPlayerData[0].characterID >> 5) & 1, (gPlayerData[1].characterID >> 5) & 1, - (gPlayerData[2].characterID >> 5) & 1, (gPlayerData[3].characterID >> 5) & 1, + (GWPlayer[0].characterID >> 5) & 1, (GWPlayer[1].characterID >> 5) & 1, + (GWPlayer[2].characterID >> 5) & 1, (GWPlayer[3].characterID >> 5) & 1, lbl_1_bss_0->unk0, arg0, arg1, lbl_1_bss_0->unk4, lbl_1_bss_0->unk6); if (lbl_1_data_108[lbl_1_bss_0->unk0].unk0 != -1) { if (arg0 == 5) {