From ab2a3c0799a83be83043e111bd4eed67181a6a9e Mon Sep 17 00:00:00 2001 From: EstexNT Date: Sun, 15 Mar 2026 16:17:08 +0300 Subject: [PATCH] Match and link VarParam --- config/SOME01/splits.txt | 11 ++- config/SOME01/symbols.txt | 34 +++---- configure.py | 3 +- src/GameUtil/VarParam.cpp | 40 ++++++++ src/GameUtil/VarParam.hpp | 27 +++++- src/GameUtil/VarParamManager.cpp | 157 +++++++++++++++++++++++++++++++ 6 files changed, 251 insertions(+), 21 deletions(-) create mode 100644 src/GameUtil/VarParam.cpp create mode 100644 src/GameUtil/VarParamManager.cpp diff --git a/config/SOME01/splits.txt b/config/SOME01/splits.txt index 1078bb3..6814890 100644 --- a/config/SOME01/splits.txt +++ b/config/SOME01/splits.txt @@ -3112,8 +3112,17 @@ GameUtil/DebugPrint.cpp: .sdata start:0x803200E0 end:0x803200F8 .sdata2 start:0x803297B8 end:0x803297C8 +GameUtil/VarParam.cpp: + .text start:0x801ECEC4 end:0x801ED0E0 + .rodata start:0x802E51C8 end:0x802E51F0 + .data start:0x8031ECE8 end:0x8031ED10 + GameUtil/VarParamManager.cpp: - .text start:0x801ECEC4 end:0x801ED6A8 + .text start:0x801ED0E0 end:0x801ED6A8 + .rodata start:0x802E51F0 end:0x802E5258 + .data start:0x8031ED10 end:0x8031ED48 + .sdata start:0x803200F8 end:0x80320108 + .sdata2 start:0x803297C8 end:0x803297E0 GameUtil/code_801ED6A8.cpp: .text start:0x801ED6A8 end:0x801ED7D4 diff --git a/config/SOME01/symbols.txt b/config/SOME01/symbols.txt index 55a5262..04d5af6 100644 --- a/config/SOME01/symbols.txt +++ b/config/SOME01/symbols.txt @@ -8235,16 +8235,16 @@ _14__11CDebugPrintFv = .text:0x801EC618; // type:function size:0x5C fn_801EC674__11CDebugPrintFlllPCce = .text:0x801EC674; // type:function size:0x1DC fn_801EC850__11CDebugPrintFPCcP16__va_list_struct = .text:0x801EC850; // type:function size:0x670 _18__11CDebugPrintFv = .text:0x801ECEC0; // type:function size:0x4 -fn_801ECEC4 = .text:0x801ECEC4; // type:function size:0x21C +fn_801ECEC4__9CVarParamFll = .text:0x801ECEC4; // type:function size:0x21C __ct__16CVarParamManagerFv = .text:0x801ED0E0; // type:function size:0x1C -fn_801ED0FC = .text:0x801ED0FC; // type:function size:0x68 -fn_801ED164 = .text:0x801ED164; // type:function size:0x4 -fn_801ED168 = .text:0x801ED168; // type:function size:0x90 -fn_801ED1F8 = .text:0x801ED1F8; // type:function size:0x68 -fn_801ED260 = .text:0x801ED260; // type:function size:0x4 -fn_801ED264 = .text:0x801ED264; // type:function size:0x48 +__dt__30TSingleton<16CVarParamManager>Fv = .text:0x801ED0FC; // type:function size:0x68 +_08__30TSingleton<16CVarParamManager>Fv = .text:0x801ED164; // type:function size:0x4 +__dt__16CVarParamManagerFv = .text:0x801ED168; // type:function size:0x90 +_10__16CVarParamManagerFl = .text:0x801ED1F8; // type:function size:0x68 +_14__16CVarParamManagerFv = .text:0x801ED260; // type:function size:0x4 +_08__16CVarParamManagerFv = .text:0x801ED264; // type:function size:0x48 fn_801ED2AC__16CVarParamManagerFv = .text:0x801ED2AC; // type:function size:0x1A0 -fn_801ED44C = .text:0x801ED44C; // type:function size:0x25C +fn_801ED44C__16CVarParamManagerFv = .text:0x801ED44C; // type:function size:0x25C fn_801ED6A8__FP15struct_801ED6A8 = .text:0x801ED6A8; // type:function size:0x5C fn_801ED704__FP15struct_801ED6A8Ul = .text:0x801ED704; // type:function size:0xB4 fn_801ED7B8__FP15struct_801ED6A8 = .text:0x801ED7B8; // type:function size:0x1C @@ -12240,10 +12240,10 @@ lbl_802E516C = .rodata:0x802E516C; // type:object size:0x17 scope:local data:str lbl_802E5188 = .rodata:0x802E5188; // type:object size:0xC data:string lbl_802E5194 = .rodata:0x802E5194; // type:object size:0x1A data:string lbl_802E51B0 = .rodata:0x802E51B0; // type:object size:0x18 data:string -lbl_802E51C8 = .rodata:0x802E51C8; // type:object size:0x28 -lbl_802E51F0 = .rodata:0x802E51F0; // type:object size:0x11 data:string -lbl_802E5204 = .rodata:0x802E5204; // type:object size:0x1D data:string -lbl_802E5224 = .rodata:0x802E5224; // type:object size:0x34 +@stringBase0 = .rodata:0x802E51C8; // type:object size:0x28 scope:local data:string_table +lbl_802E51F0 = .rodata:0x802E51F0; // type:object size:0x11 scope:local data:string +lbl_802E5204 = .rodata:0x802E5204; // type:object size:0x1D scope:local data:string +@stringBase0 = .rodata:0x802E5224; // type:object size:0x34 scope:local data:string_table lbl_802E5258 = .rodata:0x802E5258; // type:object size:0xE data:string lbl_802E5268 = .rodata:0x802E5268; // type:object size:0x1A data:string lbl_802E5284 = .rodata:0x802E5284; // type:object size:0xB data:string @@ -14472,9 +14472,9 @@ lbl_8031EC48 = .data:0x8031EC48; // type:object size:0xC @STRING@Next__Q34nw4r2ut14CharStrmReaderFv@0 = .data:0x8031EC9C; // type:object size:0x33 data:string @STRING@Next__Q34nw4r2ut14CharStrmReaderFv = .data:0x8031ECD0; // type:object size:0x11 data:string jumptable_8031ECE8 = .data:0x8031ECE8; // type:object size:0x24 scope:local -lbl_8031ED10 = .data:0x8031ED10; // type:object size:0x18 -lbl_8031ED28 = .data:0x8031ED28; // type:object size:0x10 -lbl_8031ED38 = .data:0x8031ED38; // type:object size:0x10 +__vt__16CVarParamManager = .data:0x8031ED10; // type:object size:0x18 +lbl_8031ED28 = .data:0x8031ED28; // type:object size:0x10 scope:local +__vt__30TSingleton<16CVarParamManager> = .data:0x8031ED38; // type:object size:0x10 __vt__13CDebugConsole = .data:0x8031ED48; // type:object size:0x14 lbl_8031ED5C = .data:0x8031ED5C; // type:object size:0xC __vt__27TSingleton<13CDebugConsole> = .data:0x8031ED68; // type:object size:0x10 @@ -15164,8 +15164,8 @@ __RTTI__24TSingleton<10CSDManager> = .sdata:0x803200D8; // type:object size:0x8 __RTTI__11CDebugPrint = .sdata:0x803200E0; // type:object size:0x8 __RTTI__28CVector = .sdata:0x803200E8; // type:object size:0x8 __RTTI__25TSingleton<11CDebugPrint> = .sdata:0x803200F0; // type:object size:0x8 -lbl_803200F8 = .sdata:0x803200F8; // type:object size:0x8 -lbl_80320100 = .sdata:0x80320100; // type:object size:0x8 +__RTTI__16CVarParamManager = .sdata:0x803200F8; // type:object size:0x8 +__RTTI__30TSingleton<16CVarParamManager> = .sdata:0x80320100; // type:object size:0x8 __RTTI__13CDebugConsole = .sdata:0x80320108; // type:object size:0x8 __RTTI__27TSingleton<13CDebugConsole> = .sdata:0x80320110; // type:object size:0x8 __RTTI__10CDebugFont = .sdata:0x80320118; // type:object size:0x8 diff --git a/configure.py b/configure.py index 33927dd..8765c1c 100755 --- a/configure.py +++ b/configure.py @@ -1286,7 +1286,8 @@ def MatchingFor(*versions): Object(NonMatching, "GameUtil/CheckPointManager.cpp"), Object(Matching, "GameUtil/SDManager.cpp"), Object(NonMatching, "GameUtil/DebugPrint.cpp"), - Object(NonMatching, "GameUtil/VarParamManager.cpp"), + Object(Matching, "GameUtil/VarParam.cpp"), + Object(Matching, "GameUtil/VarParamManager.cpp"), Object(Matching, "GameUtil/code_801ED6A8.cpp"), Object(Matching, "GameUtil/TPL.cpp"), Object(Matching, "GameUtil/DebugFont.cpp"), diff --git a/src/GameUtil/VarParam.cpp b/src/GameUtil/VarParam.cpp new file mode 100644 index 0000000..e9d8dcc --- /dev/null +++ b/src/GameUtil/VarParam.cpp @@ -0,0 +1,40 @@ +#include "VarParam.hpp" +#include "DebugPrint.hpp" + +void CVarParam::fn_801ECEC4(s32 x, s32 y) { + gDebugPrint->fn_801EC674(x, y, 1, "%s", mTitle); + + switch (mType) { + case 0: + gDebugPrint->fn_801EC674(x + 200, y, 1, "%d", mUlongVal); + break; + case 1: + gDebugPrint->fn_801EC674(x + 200, y, 1, "%d", mUintVal); + break; + case 2: + gDebugPrint->fn_801EC674(x + 200, y, 1, "%d", mUshortVal); + break; + case 3: + gDebugPrint->fn_801EC674(x + 200, y, 1, "%d", mUcharVal); + break; + + case 4: + gDebugPrint->fn_801EC674(x + 200, y, 1, "%d", mLongVal); + break; + case 5: + gDebugPrint->fn_801EC674(x + 200, y, 1, "%d", mIntVal); + break; + case 6: + gDebugPrint->fn_801EC674(x + 200, y, 1, "%d", mShortVal); + break; + case 7: + gDebugPrint->fn_801EC674(x + 200, y, 1, "%d", mCharVal); + break; + + case 8: + gDebugPrint->fn_801EC674(x + 200, y, 1, "%f", mFloatVal); + break; + } +} + +CW_FORCE_STRINGS(var_param, " %s : \t : %d\n", " %s : \t : %f\n"); diff --git a/src/GameUtil/VarParam.hpp b/src/GameUtil/VarParam.hpp index 7996cb1..7f00b88 100644 --- a/src/GameUtil/VarParam.hpp +++ b/src/GameUtil/VarParam.hpp @@ -6,7 +6,30 @@ #include "Mem.hpp" -class CVarParam; +#include "List.hpp" + +class CVarParam : public CList { +public: + CVarParam(); + ~CVarParam(); + + void fn_801ECEC4(s32 x, s32 y); + +private: + char mTitle[0x20]; + u32 unk2C; + u32 mType; + u64 &mUlongVal; + u32 &mUintVal; + u16 &mUshortVal; + u8 &mUcharVal; + s64 &mLongVal; + s32 &mIntVal; + s16 &mShortVal; + s8 &mCharVal; + f32 &mFloatVal; + u8 unk58[0xa8 - 0x58]; +}; class CVarParamManager : public TSingleton { public: @@ -32,4 +55,4 @@ class CVarParamManager : public TSingleton { extern CVarParamManager *gVarParamManager; -#endif \ No newline at end of file +#endif diff --git a/src/GameUtil/VarParamManager.cpp b/src/GameUtil/VarParamManager.cpp new file mode 100644 index 0000000..6364c9b --- /dev/null +++ b/src/GameUtil/VarParamManager.cpp @@ -0,0 +1,157 @@ +#include "VarParam.hpp" +#include "DebugPrint.hpp" +#include + +CVarParamManager::CVarParamManager(void) { + mDisplayMode = 0; + mUnk0C = 0; +} + +CVarParamManager::~CVarParamManager(void) { + _08(); +} + +void CVarParamManager::_10(s32 paramNum) { + // assumed CVarParam + u32 size = ROUND_UP(paramNum * sizeof(CVarParam), 32); + mHeapStart = new (eHeap_MEM2, 32) u8[size]; + mHeap = MEMCreateExpHeap(mHeapStart, size); + mVarParamHead = 0; +} + +void CVarParamManager::_14(void) { + +} + +void CVarParamManager::_08(void) { + mVarParamHead->removeAll(); + mVarParamHead = 0; + MEMDestroyExpHeap(mHeap); + delete[] mHeapStart; +} + +CW_FORCE_STRINGS(var_param_manager, "==== VarParam Info ====\n", "========\n"); + +void CVarParamManager::fn_801ED2AC(void) { + s32 y; + s32 temp_r27; + s32 paramNum; + s32 i; + s32 paramDrawnNum; + + if (mDisplayMode == 0) { + return; + } + fn_801ED44C(); + + CVarParam *param = mVarParamHead; + if (param == NULL) { + gDebugPrint->fn_801EC674(20, 20, 1, "No Entry"); + return; + } + + + u8 rawParamNum = 0; + for (CVarParam *it = param; it != NULL; it = static_cast(it->getNext())) { + rawParamNum++; + } + + s32 temp_r5 = mUnk0C / 18; + if (temp_r5 == ((u8)((rawParamNum - 1) / 18 + 1)) - 1) { + paramNum = rawParamNum % 18; + if (paramNum == 0) { + paramNum = 18; + } + } else { + paramNum = 18; + } + + temp_r27 = temp_r5 * 18; + i = 0; + paramDrawnNum = 0; + y = 40; + for (CVarParam *it = param; it != NULL; it = static_cast(it->getNext()), i++) { + if (i < temp_r27) { + continue; + } + + it->fn_801ECEC4(40, y); + if (i == mUnk0C) { + if (mDisplayMode == 2) { + gDebugPrint->fn_801EC674(20, y, 1, "⇒"); + } else { + gDebugPrint->fn_801EC674(20, y, 1, "→"); + } + } + paramDrawnNum++; + y += 20; + if (paramDrawnNum >= paramNum) { + return; + } + } +} + +void CVarParamManager::fn_801ED44C(void) { + f32 coord[4]; + + coord[0] = 0.02f; + coord[1] = 0.02f; + coord[2] = 0.98f; + coord[3] = 0.98f; + + Mtx44 projMtx; + C_MTXOrtho(projMtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 500.0f); + GXSetProjection(projMtx, GX_ORTHOGRAPHIC); + + Mtx mtx; + MTXIdentity(mtx); + GXLoadPosMtxImm(mtx, 0); + GXSetCurrentMtx(0); + + GXClearVtxDesc(); + GXInvalidateVtxCache(); + GXInvalidateTexAll(); + + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); + + GXSetNumChans(1); + GXSetNumTexGens(0); + GXSetNumIndStages(0); + GXSetNumTevStages(1); + GXSetTevDirect(GX_TEVSTAGE0); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_C0, GX_CC_RASC,GX_CC_ZERO); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_A0, GX_CA_RASA,GX_CA_ZERO); + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, TRUE, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, TRUE, GX_TEVPREV); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetChanCtrl(GX_COLOR0A0, FALSE, GX_SRC_VTX, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE); + GXSetColorUpdate(TRUE); + GXSetAlphaUpdate(TRUE); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET); + GXSetZMode(FALSE, GX_ALWAYS, FALSE); + GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0); + + GXSetCullMode(GX_CULL_NONE); + GXSetClipMode(GX_CLIP_ENABLE); + + GXSetTevColor(GX_TEVREG0, (GXColor){ 0, 0, 0, 216 }); + + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + + GXPosition2f32(coord[0], coord[1]); + GXColor1u32(0xFFFFFFFF); + + GXPosition2f32(coord[0], coord[3]); + GXColor1u32(0xFFFFFFFF); + + GXPosition2f32(coord[2], coord[3]); + GXColor1u32(0xFFFFFFFF); + + GXPosition2f32(coord[2], coord[1]); + GXColor1u32(0xFFFFFFFF); + + GXEnd(); +}