From eafb1b3728013f666377b0692fd74f1af66f86d6 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Sat, 25 Nov 2023 21:53:01 -0600 Subject: [PATCH 1/2] Decompile objmain.c --- config/GMPE01_00/splits.txt | 8 + config/GMPE01_00/symbols.txt | 180 ++++++----- configure.py | 1 + include/common_enums.h | 1 + include/common_structs.h | 33 +- include/functions.h | 12 +- src/game/objmain.c | 594 +++++++++++++++++++++++++++++++++++ 7 files changed, 728 insertions(+), 101 deletions(-) create mode 100644 src/game/objmain.c diff --git a/config/GMPE01_00/splits.txt b/config/GMPE01_00/splits.txt index 9b3e9788..f852caa0 100644 --- a/config/GMPE01_00/splits.txt +++ b/config/GMPE01_00/splits.txt @@ -120,6 +120,14 @@ game/hsfman.c: .sdata2 start:0x801D4AB0 end:0x801D4B10 .sbss2 start:0x801D6BE0 end:0x801D6BE8 +game/objmain.c: + .text start:0x8002EBD8 end:0x8002FF4C + .data start:0x8012D918 end:0x8012DCC8 + .bss start:0x8018FB38 end:0x8018FBF8 + .sdata start:0x801D3498 end:0x801D34A0 + .sbss start:0x801D3CC0 end:0x801D3CF0 + .sdata2 start:0x801D4C78 end:0x801D4CA0 + game/fault.c: .text start:0x8002FF4C end:0x800308B8 .data start:0x8012DCC8 end:0x8012E4F0 diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 63c0c778..4fc0f67c 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -507,33 +507,33 @@ HuPerfCreate = .text:0x8002E7E0; // type:function size:0x130 HuPerfZero = .text:0x8002E910; // type:function size:0x40 HuPerfBegin = .text:0x8002E950; // type:function size:0x7C HuPerfEnd = .text:0x8002E9CC; // type:function size:0xA0 -fn_8002EA6C = .text:0x8002EA6C; // type:function size:0x16C -fn_8002EBD8 = .text:0x8002EBD8; // type:function size:0x90 -fn_8002EC68 = .text:0x8002EC68; // type:function size:0x170 -fn_8002EDD8 = .text:0x8002EDD8; // type:function size:0xE8 +DSCallbackFunc = .text:0x8002EA6C; // type:function size:0x16C scope:local +omMasterInit = .text:0x8002EBD8; // type:function size:0x90 +omWatchOverlayProc = .text:0x8002EC68; // type:function size:0x170 scope:local +omOvlCallEx = .text:0x8002EDD8; // type:function size:0xE8 omOvlGotoEx = .text:0x8002EEC0; // type:function size:0x60 omOvlReturnEx = .text:0x8002EF20; // type:function size:0xF4 -fn_8002F014 = .text:0x8002F014; // type:function size:0xB8 +omOvlKill = .text:0x8002F014; // type:function size:0xB8 omOvlHisChg = .text:0x8002F0CC; // type:function size:0xA0 omOvlHisGet = .text:0x8002F16C; // type:function size:0x78 omInitObjMan = .text:0x8002F1E4; // type:function size:0x220 -fn_8002F404 = .text:0x8002F404; // type:function size:0x50 -fn_8002F454 = .text:0x8002F454; // type:function size:0x1DC -fn_8002F630 = .text:0x8002F630; // type:function size:0xF8 -fn_8002F728 = .text:0x8002F728; // type:function size:0x84 -fn_8002F7AC = .text:0x8002F7AC; // type:function size:0x190 -fn_8002F93C = .text:0x8002F93C; // type:function size:0x88 -fn_8002F9C4 = .text:0x8002F9C4; // type:function size:0xFC -fn_8002FAC0 = .text:0x8002FAC0; // type:function size:0x2C -fn_8002FAEC = .text:0x8002FAEC; // type:function size:0x10 -fn_8002FAFC = .text:0x8002FAFC; // type:function size:0x14 -fn_8002FB10 = .text:0x8002FB10; // type:function size:0x10 -fn_8002FB20 = .text:0x8002FB20; // type:function size:0x10 -fn_8002FB30 = .text:0x8002FB30; // type:function size:0x10 -fn_8002FB40 = .text:0x8002FB40; // type:function size:0x2F8 -fn_8002FE38 = .text:0x8002FE38; // type:function size:0xE0 -fn_8002FF18 = .text:0x8002FF18; // type:function size:0x2C -fn_8002FF44 = .text:0x8002FF44; // type:function size:0x8 +omDestroyObjMan = .text:0x8002F404; // type:function size:0x50 +omAddObjEx = .text:0x8002F454; // type:function size:0x1DC +omInsertObj = .text:0x8002F630; // type:function size:0xF8 +omAddMember = .text:0x8002F728; // type:function size:0x84 +omDelObjEx = .text:0x8002F7AC; // type:function size:0x190 +omDelMember = .text:0x8002F93C; // type:function size:0x88 +omMakeGroupEx = .text:0x8002F9C4; // type:function size:0xFC +omGetGroupMemberListEx = .text:0x8002FAC0; // type:function size:0x2C +omSetStatBit = .text:0x8002FAEC; // type:function size:0x10 +omResetStatBit = .text:0x8002FAFC; // type:function size:0x14 +omSetTra = .text:0x8002FB10; // type:function size:0x10 +omSetRot = .text:0x8002FB20; // type:function size:0x10 +omSetSca = .text:0x8002FB30; // type:function size:0x10 +omMain = .text:0x8002FB40; // type:function size:0x2F8 +omAllPause = .text:0x8002FE38; // type:function size:0xE0 +omPauseChk = .text:0x8002FF18; // type:function size:0x2C +omCurrentOvlGet = .text:0x8002FF44; // type:function size:0x8 OSPanic = .text:0x8002FF4C; // type:function size:0x150 HuFaultInitXfbDirectDraw = .text:0x8003009C; // type:function size:0x118 HuFaultSetXfbAddress = .text:0x800301B4; // type:function size:0x34 @@ -573,22 +573,22 @@ 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 -fn_800315BC = .text:0x800315BC; // type:function size:0x238 -fn_800317F4 = .text:0x800317F4; // type:function size:0x2C4 -fn_80031AB8 = .text:0x80031AB8; // type:function size:0x74 -fn_80031B2C = .text:0x80031B2C; // type:function size:0x230 -fn_80031D5C = .text:0x80031D5C; // type:function size:0x8 -fn_80031D64 = .text:0x80031D64; // type:function size:0x50 -fn_80031DB4 = .text:0x80031DB4; // type:function size:0x2C -fn_80031DE0 = .text:0x80031DE0; // type:function size:0x6C -fn_80031E4C = .text:0x80031E4C; // type:function size:0x154 -fn_80031FA0 = .text:0x80031FA0; // type:function size:0xB4 -fn_80032054 = .text:0x80032054; // type:function size:0x13C -fn_80032190 = .text:0x80032190; // type:function size:0x138 -fn_800322C8 = .text:0x800322C8; // type:function size:0xB4 -fn_8003237C = .text:0x8003237C; // type:function size:0xC8 -fn_80032444 = .text:0x80032444; // type:function size:0xD0 -fn_80032514 = .text:0x80032514; // type:function size:0xE0 +omOutView = .text:0x800315BC; // type:function size:0x238 +omOutViewMulti = .text:0x800317F4; // type:function size:0x2C4 +omSystemKeyCheckSetup = .text:0x80031AB8; // type:function size:0x74 +omSystemKeyCheck = .text:0x80031B2C; // type:function size:0x230 +omSysPauseEnable = .text:0x80031D5C; // type:function size:0x8 +omSysPauseCtrl = .text:0x80031D64; // type:function size:0x50 +omDLLDBGOut = .text:0x80031DB4; // type:function size:0x2C +omDLLInit = .text:0x80031DE0; // type:function size:0x6C +omDLLStart = .text:0x80031E4C; // type:function size:0x154 +omDLLNumEnd = .text:0x80031FA0; // type:function size:0xB4 +omDLLEnd = .text:0x80032054; // type:function size:0x13C +omDLLLink = .text:0x80032190; // type:function size:0x138 +omDLLUnlink = .text:0x800322C8; // type:function size:0xB4 +omDLLSearch = .text:0x8003237C; // type:function size:0xC8 +omDLLInfoDump = .text:0x80032444; // type:function size:0xD0 +omDLLHeaderDump = .text:0x80032514; // type:function size:0xE0 frand = .text:0x800325F4; // type:function size:0xAC frandf = .text:0x800326A0; // type:function size:0xD8 frandmod = .text:0x80032778; // type:function size:0xB8 @@ -612,7 +612,7 @@ fn_80032D3C = .text:0x80032D3C; // type:function size:0x134 fn_80032E70 = .text:0x80032E70; // type:function size:0x3C fn_80032EAC = .text:0x80032EAC; // type:function size:0x6C fn_80032F18 = .text:0x80032F18; // type:function size:0x64 -fn_80032F7C = .text:0x80032F7C; // type:function size:0x20 +HuAudFXListnerKill = .text:0x80032F7C; // type:function size:0x20 fn_80032F9C = .text:0x80032F9C; // type:function size:0x2C fn_80032FC8 = .text:0x80032FC8; // type:function size:0x28 fn_80032FF0 = .text:0x80032FF0; // type:function size:0x54 @@ -631,12 +631,12 @@ fn_8003337C = .text:0x8003337C; // type:function size:0x3C fn_800333B8 = .text:0x800333B8; // type:function size:0x28 fn_800333E0 = .text:0x800333E0; // type:function size:0x24 fn_80033404 = .text:0x80033404; // type:function size:0x28 -fn_8003342C = .text:0x8003342C; // type:function size:0x104 -fn_80033530 = .text:0x80033530; // type:function size:0x1A4 -fn_800336D4 = .text:0x800336D4; // type:function size:0x60 -fn_80033734 = .text:0x80033734; // type:function size:0x154 -fn_80033888 = .text:0x80033888; // type:function size:0x58 -fn_800338E0 = .text:0x800338E0; // type:function size:0xC +HuAudDllSndGrpSet = .text:0x8003342C; // type:function size:0x104 +HuAudSndGrpSetSet = .text:0x80033530; // type:function size:0x1A4 +HuAudSndGrpSet = .text:0x800336D4; // type:function size:0x60 +HuAudSndCommonGrpSet = .text:0x80033734; // type:function size:0x154 +HuAudAUXSet = .text:0x80033888; // type:function size:0x58 +HuAudAUXVolSet = .text:0x800338E0; // type:function size:0xC fn_800338EC = .text:0x800338EC; // type:function size:0x294 fn_80033B80 = .text:0x80033B80; // type:function size:0x50 fn_80033BD0 = .text:0x80033BD0; // type:function size:0x58 @@ -697,23 +697,23 @@ fn_8003F3AC = .text:0x8003F3AC; // type:function size:0xDC fn_8003F488 = .text:0x8003F488; // type:function size:0x234 fn_8003F6BC = .text:0x8003F6BC; // type:function size:0xD4 fn_8003F790 = .text:0x8003F790; // type:function size:0x128 -fn_8003F8B8 = .text:0x8003F8B8; // type:function size:0xA0 -fn_8003F958 = .text:0x8003F958; // type:function size:0x1B0 -fn_8003FB08 = .text:0x8003FB08; // type:function size:0x98 -fn_8003FBA0 = .text:0x8003FBA0; // type:function size:0x8 -fn_8003FBA8 = .text:0x8003FBA8; // type:function size:0x44 -fn_8003FBEC = .text:0x8003FBEC; // type:function size:0x44 -fn_8003FC30 = .text:0x8003FC30; // type:function size:0x48 -fn_8003FC78 = .text:0x8003FC78; // type:function size:0x48 -fn_8003FCC0 = .text:0x8003FCC0; // type:function size:0x50 -fn_8003FD10 = .text:0x8003FD10; // type:function size:0x50 -fn_8003FD60 = .text:0x8003FD60; // type:function size:0x48 -fn_8003FDA8 = .text:0x8003FDA8; // type:function size:0x48 -fn_8003FDF0 = .text:0x8003FDF0; // type:function size:0x58 -fn_8003FE48 = .text:0x8003FE48; // type:function size:0x48 -fn_8003FE90 = .text:0x8003FE90; // type:function size:0x48 -fn_8003FED8 = .text:0x8003FED8; // type:function size:0x48 -fn_8003FF20 = .text:0x8003FF20; // type:function size:0x48 +espInit = .text:0x8003F8B8; // type:function size:0xA0 +espEntry = .text:0x8003F958; // type:function size:0x1B0 +espKill = .text:0x8003FB08; // type:function size:0x98 +espGrpIDGet = .text:0x8003FBA0; // type:function size:0x8 +espDispOn = .text:0x8003FBA8; // type:function size:0x44 +espDispOff = .text:0x8003FBEC; // type:function size:0x44 +espAttrSet = .text:0x8003FC30; // type:function size:0x48 +espAttrReset = .text:0x8003FC78; // type:function size:0x48 +espPosSet = .text:0x8003FCC0; // type:function size:0x50 +espScaleSet = .text:0x8003FD10; // type:function size:0x50 +espZRotSet = .text:0x8003FD60; // type:function size:0x48 +espTPLvlSet = .text:0x8003FDA8; // type:function size:0x48 +espColorSet = .text:0x8003FDF0; // type:function size:0x58 +espSpeedSet = .text:0x8003FE48; // type:function size:0x48 +espBankSet = .text:0x8003FE90; // type:function size:0x48 +espDrawNoSet = .text:0x8003FED8; // type:function size:0x48 +espPriSet = .text:0x8003FF20; // type:function size:0x48 fn_8003FF68 = .text:0x8003FF68; // type:function size:0x268 fn_800401D0 = .text:0x800401D0; // type:function size:0x12C fn_800402FC = .text:0x800402FC; // type:function size:0x78 @@ -955,10 +955,10 @@ fn_80057DD8 = .text:0x80057DD8; // type:function size:0x4C fn_80057E24 = .text:0x80057E24; // type:function size:0x5C fn_80057E80 = .text:0x80057E80; // type:function size:0xF4 fn_80057F74 = .text:0x80057F74; // type:function size:0x9C -fn_80058010 = .text:0x80058010; // type:function size:0xA0 -fn_800580B0 = .text:0x800580B0; // type:function size:0xA4 -fn_80058154 = .text:0x80058154; // type:function size:0xA4 -fn_800581F8 = .text:0x800581F8; // type:function size:0x30 +_CheckFlag = .text:0x80058010; // type:function size:0xA0 +_SetFlag = .text:0x800580B0; // type:function size:0xA4 +_ClearFlag = .text:0x80058154; // type:function size:0xA4 +_InitFlag = .text:0x800581F8; // type:function size:0x30 fn_80058228 = .text:0x80058228; // type:function size:0x140 fn_80058368 = .text:0x80058368; // type:function size:0x2B0 fn_80058618 = .text:0x80058618; // type:function size:0x11C @@ -5402,8 +5402,8 @@ lbl_8018EFD0 = .bss:0x8018EFD0; // type:object size:0x6C0 data:2byte lbl_8018F690 = .bss:0x8018F690; // type:object size:0x100 lbl_8018F790 = .bss:0x8018F790; // type:object size:0x370 lbl_8018FB00 = .bss:0x8018FB00; // type:object size:0x38 -lbl_8018FB38 = .bss:0x8018FB38; // type:object size:0xC0 -lbl_8018FBF8 = .bss:0x8018FBF8; // type:object size:0x18 +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 @@ -5635,8 +5635,8 @@ secondTev = .sdata:0x801D3476; // type:object size:0x4 scope:local lbl_801D347A = .sdata:0x801D347A; // type:object size:0xE lbl_801D3488 = .sdata:0x801D3488; // type:object size:0x4 data:string lbl_801D348C = .sdata:0x801D348C; // type:object size:0xC -lbl_801D3498 = .sdata:0x801D3498; // type:object size:0x1 data:byte -lbl_801D349C = .sdata:0x801D349C; // type:object size:0x4 data:4byte +omSysPauseEnableFlag = .sdata:0x801D3498; // type:object size:0x1 data:byte +omprevovl = .sdata:0x801D349C; // type:object size:0x4 data:4byte lbl_801D34A0 = .sdata:0x801D34A0; // type:object size:0x4 data:4byte lbl_801D34A4 = .sdata:0x801D34A4; // type:object size:0xC lbl_801D34B0 = .sdata:0x801D34B0; // type:object size:0x1 @@ -6007,7 +6007,7 @@ totalTexCnted = .sbss:0x801D3BD0; // type:object size:0x4 scope:local data:4byte totalTexCnt = .sbss:0x801D3BD4; // type:object size:0x4 scope:local data:4byte totalMatCnted = .sbss:0x801D3BD8; // type:object size:0x4 scope:local data:4byte totalMatCnt = .sbss:0x801D3BDC; // type:object size:0x4 scope:local data:4byte -totalPolyCnted = .sbss:0x801D3BE0; // type:object size:0x4 scope:local data:4byte +totalPolyCnted = .sbss:0x801D3BE0; // type:object size:0x4 data:4byte totalPolyCnt = .sbss:0x801D3BE4; // type:object size:0x4 scope:local data:4byte hookIdx = .sbss:0x801D3BE8; // type:object size:0x2 scope:local data:2byte kColorIdx = .sbss:0x801D3BEC; // type:object size:0x4 scope:local data:4byte @@ -6068,30 +6068,28 @@ lbl_801D3CB0 = .sbss:0x801D3CB0; // type:object size:0x4 lbl_801D3CB4 = .sbss:0x801D3CB4; // type:object size:0x4 lbl_801D3CB8 = .sbss:0x801D3CB8; // type:object size:0x4 lbl_801D3CBC = .sbss:0x801D3CBC; // type:object size:0x4 -drawDebugBoxBool = .sbss:0x801D3CC0; // type:object size:0x2 data:2byte -lbl_801D3CC2 = .sbss:0x801D3CC2; // type:object size:0x2 data:2byte -lbl_801D3CC4 = .sbss:0x801D3CC4; // type:object size:0x1 data:byte -lbl_801D3CC8 = .sbss:0x801D3CC8; // type:object size:0x4 data:4byte -lbl_801D3CCC = .sbss:0x801D3CCC; // type:object size:0x4 data:4byte -lbl_801D3CD0 = .sbss:0x801D3CD0; // type:object size:0x4 data:4byte -lbl_801D3CD4 = .sbss:0x801D3CD4; // type:object size:0x4 data:4byte -lbl_801D3CD8 = .sbss:0x801D3CD8; // type:object size:0x4 data:4byte -lbl_801D3CDC = .sbss:0x801D3CDC; // type:object size:0x4 data:4byte -lbl_801D3CE0 = .sbss:0x801D3CE0; // type:object size:0x4 data:4byte -lbl_801D3CE4 = .sbss:0x801D3CE4; // type:object size:0x4 data:4byte -lbl_801D3CE8 = .sbss:0x801D3CE8; // type:object size:0x4 data:4byte -lbl_801D3CEC = .sbss:0x801D3CEC; // type:object size:0x4 data:4byte -lbl_801D3CF0 = .sbss:0x801D3CF0; // type:object size:0x4 data:4byte -lbl_801D3CF4 = .sbss:0x801D3CF4; // type:object size:0x4 data:4byte -lbl_801D3CF8 = .sbss:0x801D3CF8; // type:object size:0x1 data:byte -lbl_801D3CF9 = .sbss:0x801D3CF9; // type:object size:0x1 data:byte -lbl_801D3CFA = .sbss:0x801D3CFA; // type:object size:0x1 data:byte -lbl_801D3CFC = .sbss:0x801D3CFC; // type:object size:0x4 data:4byte +omdispinfo = .sbss:0x801D3CC0; // type:object size:0x2 data:2byte +omSysExitReq = .sbss:0x801D3CC2; // type:object size:0x2 data:2byte +omUPauseFlag = .sbss:0x801D3CC4; // type:object size:0x1 data:byte +omnextovlstat = .sbss:0x801D3CC8; // type:object size:0x4 scope:local data:4byte +omovlstat = .sbss:0x801D3CCC; // type:object size:0x4 data:4byte +omnextovlevtno = .sbss:0x801D3CD0; // type:object size:0x4 scope:local data:4byte +omovlevtno = .sbss:0x801D3CD4; // type:object size:0x4 data:4byte +omovlhisidx = .sbss:0x801D3CD8; // type:object size:0x4 data:4byte +omcurdll = .sbss:0x801D3CDC; // type:object size:0x4 data:4byte +omcurovl = .sbss:0x801D3CE0; // type:object size:0x4 data:4byte +omnextovl = .sbss:0x801D3CE4; // type:object size:0x4 data:4byte +omwatchproc = .sbss:0x801D3CE8; // type:object size:0x4 data:4byte +omDBGSysKeyObj = .sbss:0x801D3CEC; // type:object size:0x4 data:4byte +y_start = .sbss:0x801D3CF0; // type:object size:0x4 scope:local data:4byte +x_start = .sbss:0x801D3CF4; // type:object size:0x4 scope:local data:4byte +Draw_Color = .sbss:0x801D3CF8; // type:object size:0x3 scope:local data:byte +XFB_putc = .sbss:0x801D3CFC; // type:object size:0x4 scope:local data:4byte lbl_801D3D00 = .sbss:0x801D3D00; // type:object size:0x4 lbl_801D3D04 = .sbss:0x801D3D04; // type:object size:0x4 data:float lbl_801D3D08 = .sbss:0x801D3D08; // type:object size:0x8 data:4byte frand_seed = .sbss:0x801D3D10; // type:object size:0x8 scope:local data:4byte -lbl_801D3D18 = .sbss:0x801D3D18; // type:object size:0x1 data:byte +fadeStat = .sbss:0x801D3D18; // type:object size:0x1 data:byte lbl_801D3D1C = .sbss:0x801D3D1C; // type:object size:0x4 data:4byte lbl_801D3D20 = .sbss:0x801D3D20; // type:object size:0x4 data:float lbl_801D3D24 = .sbss:0x801D3D24; // type:object size:0x4 data:float diff --git a/configure.py b/configure.py index 4957ecb5..52082b6b 100755 --- a/configure.py +++ b/configure.py @@ -246,6 +246,7 @@ config.libs = [ Object(NonMatching, "game/hsfload.c"), Object(NonMatching, "game/hsfdraw.c"), Object(NonMatching, "game/hsfman.c"), + Object(Matching, "game/objmain.c"), Object(NonMatching, "game/fault.c"), Object(NonMatching, "game/frand.c"), Object(Matching, "game/ovllist.c"), diff --git a/include/common_enums.h b/include/common_enums.h index 59090526..120538db 100644 --- a/include/common_enums.h +++ b/include/common_enums.h @@ -6,6 +6,7 @@ #define OVL_DEFINE(name, path) name, typedef enum { + OVL_INVALID = -1, #include "ovl_table.h" OVL_COUNT } OverlayID; diff --git a/include/common_structs.h b/include/common_structs.h index 1df17ec9..e13c91a7 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -2,13 +2,14 @@ #define _COMMON_STRUCTS_H #include "types.h" +#include "common_enums.h" #include "dolphin/dvd.h" -typedef struct UnkOvl { - s32 unk0; - char unk4[4]; - s32 unk8; -} UnkOvl; +typedef struct om_ovl_his_data { + OverlayID overlay; + int event; + int stat; +} omOvlHisData; typedef struct Vec3f { f32 x; @@ -129,4 +130,26 @@ typedef struct Player { /* 0x2C */ char unk_2C[4]; } Player; //size of 0x30 +typedef struct om_obj_data { + u16 stat; + s16 next_idx_alloc; + s16 prio; + s16 prev; + s16 next; + s16 next_idx; + s16 group; + u16 group_idx; + int unk10; + void (*func)(struct om_obj_data *); + Vec3f trans; + Vec3f rot; + Vec3f scale; + u16 mdlcnt; + s16 *model; + u16 mtncnt; + s16 *motion; + int work[4]; + void *data; +} omObjData; + #endif diff --git a/include/functions.h b/include/functions.h index 9b70a1a5..bc038fee 100644 --- a/include/functions.h +++ b/include/functions.h @@ -11,9 +11,6 @@ void Hu3DBGColorSet(u8, u8, u8); void Hu3DCameraCreate(s16); void Hu3DCameraPerspectiveSet(s16, f32, f32, f32, f32); void Hu3DCameraViewportSet(s16, f32, f32, f32, f32, f32, f32); -void omOvlHisChg(s32, s32, s32, s32); -UnkOvl* omOvlHisGet(s32); -void* omInitObjMan(s32, s32); void fn_80044920(s16); void fn_80045F74(s16, s32); s32 fn_800578E4(void); @@ -68,8 +65,13 @@ void HuPrcResetStat(Process *process, u16 value); void HuPrcAllPause(int flag); void HuPrcAllUPause(int flag); -void omOvlGotoEx(OverlayID overlay, s16 end_mode, int stat, int event); -void omOvlReturnEx(int level, s16 end_mode); +void omOvlCallEx(OverlayID overlay, s16 arg2, int event, int stat); +void omOvlGotoEx(OverlayID overlay, s16 arg2, int event, int stat); +void omOvlReturnEx(s16 level, s16 arg2); +omOvlHisData* omOvlHisGet(s32); +void omOvlHisChg(s32 level, OverlayID overlay, int event, int stat); +Process *omInitObjMan(s16 max_objs, int prio); + void WipeCreate(char dir, char type, short duration); void pfInit(void); diff --git a/src/game/objmain.c b/src/game/objmain.c new file mode 100644 index 00000000..402ff00c --- /dev/null +++ b/src/game/objmain.c @@ -0,0 +1,594 @@ +#include "common.h" + +#define OM_OVL_HIS_MAX 16 +#define OM_MAX_GROUPS 10 + +typedef struct om_obj_group { + u16 next_idx; + u16 max_objs; + u16 num_objs; + u16 *next; + omObjData **obj; +} omObjGroup; + +typedef struct om_obj_man { + s16 max_objs; + s16 num_objs; + s16 next_idx; + s16 obj_last; + s16 obj_first; + s16 unkA; + omObjData *obj; + omObjGroup *group; +} omObjMan; + +extern u32 totalPolyCnted; + +extern void Hu3DModelPosSet(s16 index, float x, float y, float z); +extern void Hu3DModelRotSet(s16 index, float x, float y, float z); +extern void Hu3DModelScaleSet(s16 index, float x, float y, float z); + +extern void espInit(void); +extern void omDLLDBGOut(void); +extern void omDLLInit(FileListEntry *ovl_list); +extern int omDLLStart(s16 ovl, s16 dll); +extern void omDLLNumEnd(s16 ovl, s16 arg2); +extern void omSysPauseEnable(BOOL flag); +extern void fn_800338EC(s16 ovl); +extern void HuAudDllSndGrpSet(u16 dll); +extern void fn_8003F3AC(void); +extern void fn_8004D6F4(s16 arg); +extern void fn_80035A0C(void); + +extern s32 _CheckFlag(u32 flag); + +extern char fadeStat; + +omObjData *omDBGSysKeyObj; +Process *omwatchproc; +OverlayID omnextovl; +OverlayID omcurovl; +int omcurdll; +int omovlhisidx; +int omovlevtno; +int omnextovlevtno; +int omovlstat; +static int omnextovlstat; +char omUPauseFlag; +s16 omSysExitReq; +s16 omdispinfo; + +static omOvlHisData omovlhis[OM_OVL_HIS_MAX]; + +char omSysPauseEnableFlag = TRUE; +OverlayID omprevovl = OVL_INVALID; + +static void omWatchOverlayProc(void); +static void omInsertObj(Process *objman_process, omObjData *object); + +void omMain(void); +void omOvlKill(s16 arg1); +void omDestroyObjMan(void); +void omAddMember(Process *objman_process, u16 group, omObjData *object); +void omSetTra(omObjData *object, float x, float y, float z); +void omSetRot(omObjData *object, float x, float y, float z); +void omSetSca(omObjData *object, float x, float y, float z); +void omDelMember(Process *objman_process, omObjData *object); + +void omMasterInit(int prio, FileListEntry *ovl_list, int ovl_count, OverlayID start_ovl) +{ + omDLLInit(ovl_list); + omwatchproc = HuPrcCreate(omWatchOverlayProc, prio, 8192, 0); + HuPrcSetStat(omwatchproc, 12); + omcurovl = OVL_INVALID; + omovlhisidx = -1; + omOvlCallEx(start_ovl, 1, 0, 0); + omDBGSysKeyObj = NULL; + omSysPauseEnable(TRUE); +} + +static void omWatchOverlayProc(void) +{ + while(1) { + if(omcurovl == OVL_INVALID) { + if(omnextovl >= 0 && fadeStat == 0) { + HuPrcSleep(0); + OSReport("++++++++++++++++++++ Start New OVL %d (EVT:%d STAT:0x%08x) ++++++++++++++++++\n", omnextovl, omnextovlevtno, omnextovlstat); + HuMemHeapDump(HuMemHeapPtrGet(HEAP_SYSTEM), -1); + HuMemHeapDump(HuMemHeapPtrGet(HEAP_DATA), -1); + HuMemHeapDump(HuMemHeapPtrGet(HEAP_DVD), -1); + OSReport("objman>Used Memory Size:%08x\n", HuMemUsedMallocSizeGet(HEAP_SYSTEM)); + OSReport("objman>Used Memory Cnt:%d\n", HuMemUsedMallocBlockGet(HEAP_SYSTEM)); + OSReport("objman>Init esp\n"); + espInit(); + OSReport("objman>Call objectsetup\n"); + fn_800338EC(omnextovl); + HuAudDllSndGrpSet(omnextovl); + omcurovl = omnextovl; + omovlevtno = omnextovlevtno; + omovlstat = omnextovlstat; + omnextovl = OVL_INVALID; + if(_CheckFlag(0x1000C)) { + fn_8003F3AC(); + } + omSysPauseEnable(TRUE); + omcurdll = omDLLStart(omcurovl, 0); + OSReport("objman>ObjectSetup end\n"); + if(omcurovl != OVL_INVALID) { + goto watch_child; + } else { + continue; + } + } else { + HuPrcVSleep(); + } + } else { + watch_child: + HuPrcChildWatch(); + } + } +} + +void omOvlCallEx(OverlayID overlay, s16 arg2, int event, int stat) +{ + OSReport("objman>Call New Ovl %d(%d)\n", overlay, arg2); + if(omovlhisidx >= OM_OVL_HIS_MAX) { + OSReport("objman>OVL Call over error\n"); + return; + } + omovlhis[++omovlhisidx].overlay = overlay; + omovlhis[omovlhisidx].event = event; + omovlhis[omovlhisidx].stat = stat; + omOvlGotoEx(overlay, arg2, event, stat); +} + +void omOvlGotoEx(OverlayID overlay, s16 arg2, int event, int stat) +{ + omprevovl = omcurovl; + if(omcurovl >= 0) { + omOvlKill(arg2); + } + omnextovl = overlay; + omnextovlevtno = event; + omnextovlstat = stat; +} + +void omOvlReturnEx(s16 level, s16 arg2) +{ + omovlhisidx -= level; + OSReport("objman>Ovl Return %d=%d(%d)\n", level, omovlhisidx, arg2); + if(omovlhisidx < 0) { + OSReport("objman>OVL under error\n"); + omovlhisidx = 0; + } + omOvlGotoEx(omovlhis[omovlhisidx].overlay, arg2, omovlhis[omovlhisidx].event, omovlhis[omovlhisidx].stat); +} + +void omOvlKill(s16 arg) +{ + fn_8004D6F4(-1); + fn_80035A0C(); + Hu3DAllKill(); + HuWinAllKill(); + HuSprClose(); + HuPrcChildKill(omwatchproc); + HuMemDirectFreeNum(HEAP_SYSTEM, 0x10000000); + HuDataDirCloseNum(0x10000000); + HuMemDirectFreeNum(HEAP_DVD, 0x10000000); + HuMemDirectFreeNum(HEAP_DATA, 0x10000000); + HuPadRumbleAllStop(); + HuAudFXListnerKill(); + OSReport("OvlKill %d\n", arg); + omSysExitReq = FALSE; + omDLLNumEnd(omcurovl, arg); + omcurovl = OVL_INVALID; + omDBGSysKeyObj = NULL; +} + +void omOvlHisChg(s32 level, OverlayID overlay, int event, int stat) +{ + omOvlHisData *history; + if(omovlhisidx-level < 0 || omovlhisidx-level >= OM_OVL_HIS_MAX) { + OSReport("objman> omOvlHisChg: overlay 実行履歴の範囲外を変更しようとしました\n"); + return; + } + history = &omovlhis[omovlhisidx-level]; + history->overlay = overlay; + history->event = event; + history->stat = stat; +} + +omOvlHisData *omOvlHisGet(s32 level) +{ + if(omovlhisidx-level < 0 || omovlhisidx-level >= OM_OVL_HIS_MAX) { + OSReport("objman> omOvlHisGet: overlay 実行履歴の範囲外を参照しようとしました\n"); + return NULL; + } + return &omovlhis[omovlhisidx-level]; +} + +Process *omInitObjMan(s16 max_objs, int prio) +{ + omObjGroup *group_all; + omObjData *obj_all; + omObjData *obj; + int i; + omObjMan *objman; + Process *process; + OSReport("objman>InitObjMan start\n"); + max_objs += 2; + omSysExitReq = FALSE; + process = HuPrcChildCreate(omMain, prio, 16384, 0, omwatchproc); + HuPrcSetStat(process, 12); + objman = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(omObjMan), 0x10000000); + objman->max_objs = max_objs; + process->user_data = objman; + process->dtor = omDestroyObjMan; + objman->num_objs = 0; + objman->next_idx = 0; + objman->obj_last = -1; + objman->obj_first = -1; + obj_all = HuMemDirectMallocNum(HEAP_SYSTEM, max_objs*sizeof(omObjData), 0x10000000); + objman->obj = obj_all; + group_all = HuMemDirectMallocNum(HEAP_SYSTEM, OM_MAX_GROUPS*sizeof(omObjGroup), 0x10000000); + objman->group = group_all; + for(i=0; istat = 1; + obj->prio = obj->prev =obj->next = -1; + obj->unk10 = 0; + obj->trans.x = obj->trans.y = obj->trans.z = obj->rot.x = obj->rot.y = obj->rot.z = 0.0f; + obj->scale.x = obj->scale.y = obj->scale.z = 1.0f; + obj->model = obj->motion = NULL; + obj->func = obj->data = NULL; + obj->next_idx = i+1; + obj->mtncnt = 0; + obj->motion = NULL; + } + for(i=0; iInitObjMan end\n"); + omUPauseFlag = FALSE; + HuPrcAllUPause(0); + return process; +} + +void omDestroyObjMan(void) +{ + Process *process = HuPrcCurrentGet(); + omObjMan *objman = process->user_data; + objman->obj_last = -1; + OSReport("objman>Destory ObjMan\n"); +} + +omObjData *omAddObjEx(Process *objman_process, s16 prio, u16 mdlcnt, u16 mtncnt, s16 group, void (*func)(omObjData *)) +{ + int i; + omObjData *object; + s16 next_idx; + omObjMan *objman = objman_process->user_data; + omObjData *obj_base = objman->obj; + if(objman->num_objs == objman->max_objs) { + return NULL; + } + next_idx = objman->next_idx; + object = &obj_base[next_idx]; + object->next_idx_alloc = next_idx; + object->prio = prio; + omInsertObj(objman_process, object); + if(mdlcnt) { + object->model = HuMemDirectMallocNum(HEAP_SYSTEM, mdlcnt*sizeof(s16), 0x10000000); + object->mdlcnt = mdlcnt; + for(i=0; imodel[i] = -1; + } + } else { + object->model = NULL; + object->mdlcnt = 0; + } + if(mtncnt) { + object->motion = HuMemDirectMallocNum(HEAP_SYSTEM, mtncnt*sizeof(s16), 0x10000000); + object->mtncnt = mtncnt; + } else { + object->motion = NULL; + object->mtncnt = 0; + } + if(group >= 0) { + omAddMember(objman_process, group, object); + } else { + object->group = group; + object->group_idx = 0; + } + object->stat = 4; + object->unk10 = 0; + object->func = func; + object->work[0] = object->work[1] = object->work[2] = object->work[3] = 0; + objman->next_idx = object->next_idx; + objman->num_objs++; + omSetTra(object, 0.0f, 0.0f, 0.0f); + omSetRot(object, 0.0f, 0.0f, 0.0f); + omSetSca(object, 1.0f, 1.0f, 1.0f); + return object; +} + +static void omInsertObj(Process *objman_process, omObjData *object) +{ + omObjData *obj_new; + omObjMan *objman = objman_process->user_data; + omObjData *obj_all = objman->obj; + s16 next_idx_alloc = object->next_idx_alloc; + s16 prio = object->prio; + s16 obj_idx; + s16 prev_idx; + if(objman->obj_first == -1) { + object->prev = -1; + object->next = -1; + objman->obj_first = next_idx_alloc; + objman->obj_last = next_idx_alloc; + (void)objman; //HACK for matching + return; + } + for(obj_idx = objman->obj_first; obj_idx != -1; obj_idx = obj_new->next) { + obj_new = &obj_all[obj_idx]; + if(obj_new->prio <= prio) { + break; + } + prev_idx = obj_idx; + } + if(obj_idx != -1) { + object->prev = obj_new->prev; + object->next = obj_idx; + if(obj_new->prev != -1) { + obj_all[obj_new->prev].next = next_idx_alloc; + } else { + objman->obj_first = next_idx_alloc; + } + obj_new->prev = next_idx_alloc; + } else { + object->next = -1; + object->prev = prev_idx; + obj_new->next = next_idx_alloc; + objman->obj_last = next_idx_alloc; + } +} + +void omAddMember(Process *objman_process, u16 group, omObjData *object) +{ + omObjMan *objman = objman_process->user_data; + omObjGroup *group_ptr = &objman->group[group]; + if(group_ptr->num_objs != group_ptr->max_objs) { + object->group = group; + object->group_idx = group_ptr->next_idx; + group_ptr->obj[group_ptr->next_idx] = object; + group_ptr->next_idx = group_ptr->next[group_ptr->next_idx]; + group_ptr->num_objs++; + } +} + +void omDelObjEx(Process *objman_process, omObjData *object) +{ + omObjMan *objman = objman_process->user_data; + omObjData *obj_all = objman->obj; + s16 next_idx_alloc = object->next_idx_alloc; + if(objman->num_objs == 0 || object->stat == 1) { + return; + } + objman->num_objs--; + if(object->group >= 0) { + omDelMember(objman_process, object); + } + if(object->motion != NULL) { + HuMemDirectFree(object->motion); + object->motion = NULL; + } + if(object->model != NULL) { + HuMemDirectFree(object->model); + object->model = NULL; + } + if(object->data != NULL) { + HuMemDirectFree(object->data); + object->data = NULL; + } + object->stat = 1; + if(object->next >= 0) { + obj_all[object->next].prev = object->prev; + } + if(object->prev >= 0) { + obj_all[object->prev].next = object->next; + } + if(objman->num_objs != 0) { + if(object->prev < 0) { + objman->obj_first = obj_all[object->next].next_idx_alloc; + } + if(object->next < 0) { + objman->obj_last = obj_all[object->prev].next_idx_alloc; + } + } else { + objman->obj_first = objman->obj_last = -1; + } + object->next_idx = objman->next_idx; + objman->next_idx = next_idx_alloc; +} + +void omDelMember(Process *objman_process, omObjData *object) +{ + if(object->group != -1) { + omObjMan *objman = objman_process->user_data; + omObjData *obj_all = objman->obj; + omObjGroup *group = &objman->group[object->group]; + group->obj[object->group_idx] = NULL; + group->next[object->group_idx] = group->next_idx; + group->next_idx = object->group_idx; + object->group = -1; + group->num_objs--; + } +} + +void omMakeGroupEx(Process *objman_process, u16 group, u16 max_objs) +{ + int i; + omObjMan *objman = objman_process->user_data; + omObjGroup *group_ptr = &objman->group[group]; + if(group_ptr->obj != NULL) { + HuMemDirectFree(group_ptr->obj); + } + if(group_ptr->next != NULL) { + HuMemDirectFree(group_ptr->next); + } + group_ptr->next_idx = 0; + group_ptr->max_objs = max_objs; + group_ptr->num_objs = 0; + group_ptr->obj = HuMemDirectMallocNum(HEAP_SYSTEM, max_objs*sizeof(omObjData *), 0x10000000); + group_ptr->next = HuMemDirectMallocNum(HEAP_SYSTEM, max_objs*sizeof(u16), 0x10000000); + for(i=0; iobj[i] = NULL; + group_ptr->next[i] = i+1; + } +} + +omObjData **omGetGroupMemberListEx(Process *objman_process, s16 group) +{ + omObjMan *objman = objman_process->user_data; + return objman->group[group].obj; +} + +void omSetStatBit(omObjData *obj, u16 stat) +{ + obj->stat |= stat; +} + +void omResetStatBit(omObjData *obj, u16 stat) +{ + obj->stat &= ~stat; +} + +void omSetTra(omObjData *obj, float x, float y, float z) +{ + obj->trans.x = x; + obj->trans.y = y; + obj->trans.z = z; +} + +void omSetRot(omObjData *obj, float x, float y, float z) +{ + obj->rot.x = x; + obj->rot.y = y; + obj->rot.z = z; +} + +void omSetSca(omObjData *obj, float x, float y, float z) +{ + obj->scale.x = x; + obj->scale.y = y; + obj->scale.z = z; +} + +void omMain(void) +{ + Process *process = HuPrcCurrentGet(); + omObjMan *objman = process->user_data; + omObjData *obj_all = objman->obj; + omObjData *object; + s16 obj_index; + omDLLDBGOut(); + while(1) { + if(omdispinfo) { + float scale = 1.5f; + GXColor color; + color.a = 96; + color.r = 0; + color.g = 0; + color.b = 255; + printWin(7, 23, 128*scale, 40*scale, &color); + fontcolor = 14; + print8(8, 24, scale, "\xFD\x01H:%08lX(%ld)", HuMemUsedMallocSizeGet(HEAP_SYSTEM), HuMemUsedMallocBlockGet(HEAP_SYSTEM)); + print8(8, 24+(8*scale), scale, "\xFD\x01M:%08lX(%ld)", HuMemUsedMallocSizeGet(HEAP_DATA), HuMemUsedMallocBlockGet(HEAP_DATA)); + print8(8, 24+(16*scale), scale, "\xFD\x01OBJ:%d/%d", objman->num_objs, objman->max_objs); + print8(8, 24+(24*scale), scale, "\xFD\x01OVL:%ld(%ld<%ld)", omovlhisidx, omcurovl, omprevovl); + print8(8, 24+(32*scale), scale, "\xFD\x01POL:%ld", totalPolyCnted); + } + obj_index = objman->obj_last; + while(obj_index != -1) { + object = &obj_all[obj_index]; + obj_index = object->prev; + if((object->stat & 0x3) == 0) { + if(object->func != NULL && (object->stat & 0x58) == 0) { + object->func(object); + } + if(omcurovl == -1 || objman->obj_last == -1) { + break; + } + if((object->stat & 0x3) == 0) { + if((obj_all[obj_index].stat & 0x3) != 0) { + obj_index = object->prev; + } + if(object->model != NULL && object->model[0] != -1 && !(object->stat & 0x100)) { + Hu3DModelPosSet(object->model[0], object->trans.x, object->trans.y, object->trans.z); + Hu3DModelRotSet(object->model[0], object->rot.x, object->rot.y, object->rot.z); + Hu3DModelScaleSet(object->model[0], object->scale.x, object->scale.y, object->scale.z); + } + } + } + } + HuPrcVSleep(); + } +} + +//Dummy function to force string literals in binary +static void omDumpObj(Process *objman_process) +{ + omObjMan *objman = objman_process->user_data; + omObjData *obj_all = objman->obj; + int i; + OSReport("=================== 現在登録されている OBJECT ==================\n"); + OSReport("STAT PRI GRPN MEMN PROG (TRA) (ROT) (SCA) mdlcnt mtncnt work[0] work[1] work[2] work[3] *data\n"); + for(i=0; imax_objs; i++) { + omObjData *object = &obj_all[i]; + OSReport("%04d:%04X %04X %d %d %08X (%.2f %.2f %.2f) (%.2f %.2f %.2f) (%.2f %.2f %.2f) %d %d %08X %08X %08X %08X %08X\n", + object->stat, object->stat, object->prio, object->group, object->unk10, object->func, + object->trans.x, object->trans.y, object->trans.z, + object->rot.x, object->rot.y, object->rot.z, + object->scale.x, object->scale.y, object->scale.z, + object->mdlcnt, object->mtncnt, object->work[0], object->work[1], object->work[2], object->work[3], object->data); + } + OSReport("================================================================\n"); +} + +void omAllPause(int arg0) +{ + Process *objman_process = HuPrcCurrentGet(); + omObjMan *objman = objman_process->user_data; + int i; + if(arg0) { + for(i=0; imax_objs; i++) { + if((objman->obj[i].stat & 0x21) == 0) { + omSetStatBit(&objman->obj[i], 0x10); + } + } + } else { + for(i=0; imax_objs; i++) { + if((objman->obj[i].stat & 0x21) == 0) { + omResetStatBit(&objman->obj[i], 0x10); + } + } + } +} + +char omPauseChk(void) +{ + if(omDBGSysKeyObj == NULL) { + return 0; + } else { + return omDBGSysKeyObj->work[0] & 0x1; + } +} + +OverlayID omCurrentOvlGet(void) +{ + return omcurovl; +} \ No newline at end of file From ff2212c2157b932bf09e5f49243aa5adfb55575c Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Sat, 25 Nov 2023 22:03:44 -0600 Subject: [PATCH 2/2] Move variables/data declarations to headers --- include/functions.h | 52 ++++++++++++++++++++++++++++++++++++++++++++- include/variables.h | 18 ++++++++++++++++ src/game/objmain.c | 35 ++---------------------------- 3 files changed, 71 insertions(+), 34 deletions(-) diff --git a/include/functions.h b/include/functions.h index bc038fee..b23fdd75 100644 --- a/include/functions.h +++ b/include/functions.h @@ -65,12 +65,39 @@ void HuPrcResetStat(Process *process, u16 value); void HuPrcAllPause(int flag); void HuPrcAllUPause(int flag); +void omMasterInit(int prio, FileListEntry *ovl_list, int ovl_count, OverlayID start_ovl); void omOvlCallEx(OverlayID overlay, s16 arg2, int event, int stat); void omOvlGotoEx(OverlayID overlay, s16 arg2, int event, int stat); void omOvlReturnEx(s16 level, s16 arg2); -omOvlHisData* omOvlHisGet(s32); +void omOvlKill(s16 arg); void omOvlHisChg(s32 level, OverlayID overlay, int event, int stat); +omOvlHisData *omOvlHisGet(s32 level); Process *omInitObjMan(s16 max_objs, int prio); +void omDestroyObjMan(void); +omObjData *omAddObjEx(Process *objman_process, s16 prio, u16 mdlcnt, u16 mtncnt, s16 group, void (*func)(omObjData *)); +void omAddMember(Process *objman_process, u16 group, omObjData *object); +void omDelObjEx(Process *objman_process, omObjData *object); +void omDelMember(Process *objman_process, omObjData *object); +void omMakeGroupEx(Process *objman_process, u16 group, u16 max_objs); +omObjData **omGetGroupMemberListEx(Process *objman_process, s16 group); +void omSetStatBit(omObjData *obj, u16 stat); +void omResetStatBit(omObjData *obj, u16 stat); +void omSetTra(omObjData *obj, float x, float y, float z); +void omSetRot(omObjData *obj, float x, float y, float z); +void omSetSca(omObjData *obj, float x, float y, float z); +void omMain(void); +void omAllPause(BOOL pause); +char omPauseChk(void); +OverlayID omCurrentOvlGet(void); + + +void omDLLDBGOut(void); +void omDLLInit(FileListEntry *ovl_list); +int omDLLStart(s16 ovl, s16 dll); +void omDLLNumEnd(s16 ovl, s16 arg2); + +void omSysPauseEnable(BOOL flag); + void WipeCreate(char dir, char type, short duration); @@ -117,6 +144,29 @@ void HuAR_ARAMtoMRAM(void *dst); void HuAR_ARAMtoMRAMNum(void *dst, s32 num); BOOL HuARDMACheck(); +void Hu3DModelPosSet(s16 index, float x, float y, float z); +void Hu3DModelRotSet(s16 index, float x, float y, float z); +void Hu3DModelScaleSet(s16 index, float x, float y, float z); + +void espInit(void); + +void HuSprClose(void); + +void HuWinAllKill(void); + +void HuPadRumbleAllStop(void); + +void HuAudFXListnerKill(void); +void HuAudDllSndGrpSet(u16 ovl); +void fn_800338EC(s16 ovl); + +void fn_80035A0C(void); + +void fn_8003F3AC(void); +void fn_8004D6F4(s16 arg); + +s32 _CheckFlag(u32 flag); + void BoardMessCreate(s16, s32, s32); void BoardMessKill(void); void BoardMessWait(void); diff --git a/include/variables.h b/include/variables.h index e898231d..e667599b 100644 --- a/include/variables.h +++ b/include/variables.h @@ -26,4 +26,22 @@ extern FileListEntry _ovltbl[]; extern u32 DirDataSize; +extern u32 totalPolyCnted; +extern char fadeStat; + +extern omObjData *omDBGSysKeyObj; +extern Process *omwatchproc; +extern OverlayID omnextovl; +extern OverlayID omcurovl; +extern int omcurdll; +extern int omovlhisidx; +extern int omovlevtno; +extern int omnextovlevtno; +extern int omovlstat; +extern char omUPauseFlag; +extern s16 omSysExitReq; +extern s16 omdispinfo; +extern char omSysPauseEnableFlag; +extern OverlayID omprevovl; + #endif diff --git a/src/game/objmain.c b/src/game/objmain.c index 402ff00c..418f45cb 100644 --- a/src/game/objmain.c +++ b/src/game/objmain.c @@ -22,28 +22,6 @@ typedef struct om_obj_man { omObjGroup *group; } omObjMan; -extern u32 totalPolyCnted; - -extern void Hu3DModelPosSet(s16 index, float x, float y, float z); -extern void Hu3DModelRotSet(s16 index, float x, float y, float z); -extern void Hu3DModelScaleSet(s16 index, float x, float y, float z); - -extern void espInit(void); -extern void omDLLDBGOut(void); -extern void omDLLInit(FileListEntry *ovl_list); -extern int omDLLStart(s16 ovl, s16 dll); -extern void omDLLNumEnd(s16 ovl, s16 arg2); -extern void omSysPauseEnable(BOOL flag); -extern void fn_800338EC(s16 ovl); -extern void HuAudDllSndGrpSet(u16 dll); -extern void fn_8003F3AC(void); -extern void fn_8004D6F4(s16 arg); -extern void fn_80035A0C(void); - -extern s32 _CheckFlag(u32 flag); - -extern char fadeStat; - omObjData *omDBGSysKeyObj; Process *omwatchproc; OverlayID omnextovl; @@ -66,15 +44,6 @@ OverlayID omprevovl = OVL_INVALID; static void omWatchOverlayProc(void); static void omInsertObj(Process *objman_process, omObjData *object); -void omMain(void); -void omOvlKill(s16 arg1); -void omDestroyObjMan(void); -void omAddMember(Process *objman_process, u16 group, omObjData *object); -void omSetTra(omObjData *object, float x, float y, float z); -void omSetRot(omObjData *object, float x, float y, float z); -void omSetSca(omObjData *object, float x, float y, float z); -void omDelMember(Process *objman_process, omObjData *object); - void omMasterInit(int prio, FileListEntry *ovl_list, int ovl_count, OverlayID start_ovl) { omDLLInit(ovl_list); @@ -559,12 +528,12 @@ static void omDumpObj(Process *objman_process) OSReport("================================================================\n"); } -void omAllPause(int arg0) +void omAllPause(BOOL pause) { Process *objman_process = HuPrcCurrentGet(); omObjMan *objman = objman_process->user_data; int i; - if(arg0) { + if(pause) { for(i=0; imax_objs; i++) { if((objman->obj[i].stat & 0x21) == 0) { omSetStatBit(&objman->obj[i], 0x10);