From 85ed9c3f99a2a6ba55ebf02db1f3a4989f1ebe2f Mon Sep 17 00:00:00 2001 From: HidoranBlaze Date: Sun, 18 Oct 2026 17:30:50 -0600 Subject: [PATCH 1/4] rename symbols, remove pad stack in hsd_8039D9C8 --- config/GALE01/symbols.txt | 30 +++++++-------- src/melee/ef/eflib.c | 16 +++----- src/melee/ef/eflib.h | 2 +- src/melee/lb/lb_00B0.c | 4 +- src/melee/lb/lb_00F9.c | 6 +-- src/melee/lb/lb_020A.c | 2 +- src/sysdolphin/baselib/generator.c | 27 +++++-------- src/sysdolphin/baselib/generator.h | 6 ++- src/sysdolphin/baselib/particle.c | 62 +++++++++++++++--------------- src/sysdolphin/baselib/particle.h | 16 ++++---- src/sysdolphin/baselib/psappsrt.c | 14 +++---- src/sysdolphin/baselib/psdisp.c | 4 +- src/sysdolphin/baselib/psstructs.h | 5 --- src/sysdolphin/baselib/quatlib.c | 8 ++-- src/sysdolphin/baselib/quatlib.h | 8 ++-- 15 files changed, 98 insertions(+), 112 deletions(-) diff --git a/config/GALE01/symbols.txt b/config/GALE01/symbols.txt index eaf59dae00..2f82559fac 100644 --- a/config/GALE01/symbols.txt +++ b/config/GALE01/symbols.txt @@ -19459,11 +19459,11 @@ HSD_SListPrependList = .text:0x8037E62C; // type:function size:0x50 scope:global HSD_SListRemove = .text:0x8037E67C; // type:function size:0x48 scope:global ObjInfoInit = .text:0x8037E6C4; // type:function size:0x44 scope:global MatToQuat = .text:0x8037E708; // type:function size:0x420 scope:global -HSD_QuatLib_8037EB28 = .text:0x8037EB28; // type:function size:0x124 scope:global -HSD_QuatLib_8037EC4C = .text:0x8037EC4C; // type:function size:0x94 scope:global -HSD_QuatLib_8037ECE0 = .text:0x8037ECE0; // type:function size:0x12C scope:global +MatToEuler = .text:0x8037EB28; // type:function size:0x124 scope:global +QuatMul = .text:0x8037EC4C; // type:function size:0x94 scope:global +AngleAxisToQuat = .text:0x8037ECE0; // type:function size:0x12C scope:global EulerToQuat = .text:0x8037EE0C; // type:function size:0x11C scope:global -HSD_QuatLib_8037EF28 = .text:0x8037EF28; // type:function size:0x288 scope:global +QuatSlerp = .text:0x8037EF28; // type:function size:0x288 scope:global HSD_Free = .text:0x8037F1B0; // type:function size:0x34 scope:global HSD_MemAlloc = .text:0x8037F1E4; // type:function size:0x60 scope:global HSD_ShadowGetAllocData = .text:0x8037F244; // type:function size:0xC scope:global @@ -19798,11 +19798,11 @@ hsd_80398F8C = .text:0x80398F8C; // type:function size:0x24C scope:global applyForceJObj = .text:0x803991D8; // type:function size:0x134 scope:global hsd_8039930C = .text:0x8039930C; // type:function size:0x3BA0 scope:global hsd_8039CEAC = .text:0x8039CEAC; // type:function size:0xA0 scope:global -hsd_8039CF4C = .text:0x8039CF4C; // type:function size:0xFC scope:global -hsd_8039D048 = .text:0x8039D048; // type:function size:0x58 scope:global +psSetPointJObj = .text:0x8039CF4C; // type:function size:0xFC scope:global +psClearPointJObj = .text:0x8039D048; // type:function size:0x58 scope:global hsd_8039D0A0 = .text:0x8039D0A0; // type:function size:0x144 scope:global -hsd_8039D1E4 = .text:0x8039D1E4; // type:function size:0x8 scope:global -hsd_8039D1EC = .text:0x8039D1EC; // type:function size:0x28 scope:global +psSetUserFunc = .text:0x8039D1E4; // type:function size:0x8 scope:global +psGetNewIDNum = .text:0x8039D1EC; // type:function size:0x28 scope:global hsd_8039D214 = .text:0x8039D214; // type:function size:0x140 scope:global hsd_8039D354 = .text:0x8039D354; // type:function size:0x58 scope:global hsd_8039D3AC = .text:0x8039D3AC; // type:function size:0x130 scope:global @@ -26746,8 +26746,8 @@ hsd_804D0908 = .bss:0x804D0908; // type:object size:0x40 scope:global data:4byte hsd_804D0948 = .bss:0x804D0948; // type:object size:0x104 scope:local data:4byte psFormGroupArray = .bss:0x804D0A4C; // type:object size:0x104 scope:global data:4byte psTexGroupArray = .bss:0x804D0B50; // type:object size:0x104 scope:global data:4byte -psNumCmdList = .bss:0x804D0C54; // type:object size:0x104 scope:global data:4byte -psCmdListArray = .bss:0x804D0D58; // type:object size:0x104 scope:global data:4byte +psCmdListArray = .bss:0x804D0C54; // type:object size:0x104 scope:global data:4byte +psNumCmdList = .bss:0x804D0D58; // type:object size:0x104 scope:global data:4byte ptclref_804D0E5C = .bss:0x804D0E5C; // type:object size:0x104 scope:global data:4byte hsd_804D0F60 = .bss:0x804D0F60; // type:object size:0x30 scope:global data:byte hsd_804D0F90 = .bss:0x804D0F90; // type:object size:0x30 scope:global data:byte @@ -29595,12 +29595,12 @@ hsd_804D78C8 = .sbss:0x804D78C8; // type:object size:0x4 scope:local data:4byte hsd_804D78CC = .sbss:0x804D78CC; // type:object size:0x4 scope:local data:4byte hsd_804D78D0 = .sbss:0x804D78D0; // type:object size:0x4 scope:local align:4 data:float psCallback = .sbss:0x804D78D4; // type:object size:0x4 scope:local data:4byte -hsd_804D78D8 = .sbss:0x804D78D8; // type:object size:0x2 scope:global data:2byte -hsd_804D78DA = .sbss:0x804D78DA; // type:object size:0x2 scope:global data:2byte +numPeakPSAppSRT = .sbss:0x804D78D8; // type:object size:0x2 scope:global data:2byte +numPeakGenerators = .sbss:0x804D78DA; // type:object size:0x2 scope:global data:2byte numPeakParticles = .sbss:0x804D78DC; // type:object size:0x2 scope:local data:2byte -hsd_804D78DE = .sbss:0x804D78DE; // type:object size:0x2 scope:global data:2byte -hsd_804D78E0 = .sbss:0x804D78E0; // type:object size:0x2 scope:global data:2byte -hsd_804D78E2 = .sbss:0x804D78E2; // type:object size:0x2 scope:local data:2byte +numActivePSAppSRT = .sbss:0x804D78DE; // type:object size:0x2 scope:global data:2byte +numActiveGenerators = .sbss:0x804D78E0; // type:object size:0x2 scope:global data:2byte +numActiveParticles = .sbss:0x804D78E2; // type:object size:0x2 scope:local data:2byte hsd_804D78E4 = .sbss:0x804D78E4; // type:object size:0x2 scope:local hsd_804D78E8 = .sbss:0x804D78E8; // type:object size:0x4 scope:global data:4byte hsd_804D78EC = .sbss:0x804D78EC; // type:object size:0x4 scope:global data:4byte diff --git a/src/melee/ef/eflib.c b/src/melee/ef/eflib.c index 4ee9d201ad..05865eb50f 100644 --- a/src/melee/ef/eflib.c +++ b/src/melee/ef/eflib.c @@ -926,7 +926,7 @@ void efLib_Cb_DPtcl(int linkNo, int bank, int gfx_id, HSD_JObj* jobj) efLib_SpawnParticleEffect(bank, gfx_id, jobj, 1); } -void efLib_Cb_ParticleRender(HSD_Particle* particle) +int efLib_Cb_ParticleRender(HSD_Particle* particle) { Vec3 translate; Vec3 scale; @@ -952,11 +952,7 @@ void efLib_Cb_ParticleRender(HSD_Particle* particle) } } -static void (*particleCallbacks[3])(HSD_Particle* particle) = { - efLib_Cb_ParticleRender, - NULL, - NULL, -}; +HSD_PSUserFunc particleCallbacks = { efLib_Cb_ParticleRender, NULL, NULL }; // Global particle callback. Checks if the particle cmdList matches // bank 0 refs (0x96, 0x97, 0x98, 0x21B). If matched, attaches an @@ -965,16 +961,16 @@ static void (*particleCallbacks[3])(HSD_Particle* particle) = { void efLib_Cb_PtclAppSRTHook(HSD_Generator* gen) { if (gen->cmdList == ptclref_804D0E5C[0][0x96]->cmdList) { - hsd_8039D1E4(gen, particleCallbacks); + psSetUserFunc(gen, &particleCallbacks); } if (gen->cmdList == ptclref_804D0E5C[0][0x97]->cmdList) { - hsd_8039D1E4(gen, particleCallbacks); + psSetUserFunc(gen, &particleCallbacks); } if (gen->cmdList == ptclref_804D0E5C[0][0x98]->cmdList) { - hsd_8039D1E4(gen, particleCallbacks); + psSetUserFunc(gen, &particleCallbacks); } if (gen->cmdList == ptclref_804D0E5C[0][0x21B]->cmdList) { - hsd_8039D1E4(gen, particleCallbacks); + psSetUserFunc(gen, &particleCallbacks); } } diff --git a/src/melee/ef/eflib.h b/src/melee/ef/eflib.h index 7676805cca..3b49fdfbfd 100644 --- a/src/melee/ef/eflib.h +++ b/src/melee/ef/eflib.h @@ -78,7 +78,7 @@ efLib_CreateGenerator_AppSRT_SetFacingDirScale(s32 gfx_id, va_list vlist); HSD_JObj* jobj); /* 05DB70 */ void efLib_Cb_DPtcl(int linkNo, int bank, int gfx_id, HSD_JObj* jobj); -/* 05DBC0 */ void efLib_Cb_ParticleRender(HSD_Particle* particle); +/* 05DBC0 */ int efLib_Cb_ParticleRender(HSD_Particle* particle); /* 05DCD0 */ void efLib_Cb_PtclAppSRTHook(HSD_Generator* particle); // Effect callbacks diff --git a/src/melee/lb/lb_00B0.c b/src/melee/lb/lb_00B0.c index 827cf4c487..0bb87f0b73 100644 --- a/src/melee/lb/lb_00B0.c +++ b/src/melee/lb/lb_00B0.c @@ -539,7 +539,7 @@ void lb_8000C490(HSD_JObj* jobj1, HSD_JObj* jobj2, HSD_JObj* arg2, float arg8, quat2.z = -quat2.z; quat2.w = -quat2.w; } - HSD_QuatLib_8037EF28(&quat1, &quat2, &arg2->rotate, arg9); + QuatSlerp(&quat1, &quat2, &arg2->rotate, arg9); HSD_JObjSetFlags(arg2, 0x20000U); HSD_JObjSetFlags(arg2, 0x40U); } @@ -641,7 +641,7 @@ void lb_8000C868(HSD_Joint* arg0, HSD_JObj* arg1, HSD_JObj* arg2, float arg8, sp94.z = -sp94.z; sp94.w = -sp94.w; } - HSD_QuatLib_8037EF28(&spA4, &sp94, &arg2->rotate, arg9); + QuatSlerp(&spA4, &sp94, &arg2->rotate, arg9); HSD_JObjSetFlags(arg2, 0x20000U); HSD_JObjSetFlags(arg2, 0x40U); } diff --git a/src/melee/lb/lb_00F9.c b/src/melee/lb/lb_00F9.c index a0919b6918..de28ae0b48 100644 --- a/src/melee/lb/lb_00F9.c +++ b/src/melee/lb/lb_00F9.c @@ -875,14 +875,14 @@ void lb_8001044C(DynamicsDesc* desc, void* colliders_raw, int num_colliders, PSMTXMultVec(bone_mtx, &rotation_axis, &local_axis); if (!approximatelyZeroVec3(local_axis)) { Quaternion rotation; - HSD_QuatLib_8037ECE0(&local_axis, &angle_quat, angle_diff); + AngleAxisToQuat(&local_axis, &angle_quat, angle_diff); euler_angles.x = jobj->rotate.x; euler_angles.y = jobj->rotate.y; euler_angles.z = jobj->rotate.z; EulerToQuat(&euler_angles, &euler_quat); - HSD_QuatLib_8037EC4C(&angle_quat, &euler_quat, &result_quat); + QuatMul(&angle_quat, &euler_quat, &result_quat); PSMTXQuat(bone_mtx, &result_quat); - HSD_QuatLib_8037EB28(bone_mtx, (Vec3*) &rotation); + MatToEuler(bone_mtx, (Vec3*) &rotation); HSD_JObjSetRotation(jobj, &rotation); HSD_JObjClearFlagsAll(jobj, 0x20000U); } diff --git a/src/melee/lb/lb_020A.c b/src/melee/lb/lb_020A.c index 2bffda0a8a..022894d22f 100644 --- a/src/melee/lb/lb_020A.c +++ b/src/melee/lb/lb_020A.c @@ -198,7 +198,7 @@ void fn_8002113C(HSD_JObj* jobj, Vec3* axis, f32 angle) HSD_JObjGetRotation(jobj, (Quaternion*) &rot); HSD_MkRotationMtx(tmpMtx, &rot); PSMTXConcat(tmpMtx, rotMtx, result); - HSD_QuatLib_8037EB28(result, &rot); + MatToEuler(result, &rot); HSD_JObjSetRotation(jobj, (Quaternion*) &rot); } else { HSD_JObjGetRotation(jobj, &rot2); diff --git a/src/sysdolphin/baselib/generator.c b/src/sysdolphin/baselib/generator.c index 4798dddf5d..abc5102815 100644 --- a/src/sysdolphin/baselib/generator.c +++ b/src/sysdolphin/baselib/generator.c @@ -21,12 +21,12 @@ static u16 lbl_804D6368 = 0x100; -void hsd_8039D1E4(HSD_Generator* gen, void* userfunc) +void psSetUserFunc(HSD_Generator* gen, HSD_PSUserFunc* userfunc) { gen->userfunc = userfunc; } -u16 hsd_8039D1EC(void) +u16 psGetNewIDNum(void) { lbl_804D6368++; if (lbl_804D6368 < 256) { @@ -74,8 +74,8 @@ void hsd_8039D354(u32 unused) { HSD_ObjAllocInit(&hsd_804D0F90.alloc_data, sizeof(HSD_Generator), 4); hsd_804D78FC = NULL; - hsd_804D78E0 = 0; - hsd_804D78DA = 0; + numActiveGenerators = 0; + numPeakGenerators = 0; hsd_804D78F4 = NULL; psCamera = NULL; hsd_804D78E8 = NULL; @@ -123,7 +123,7 @@ HSD_Generator* hsd_8039D3AC(HSD_Generator* gen, HSD_Generator* prev) gen->jobj = NULL; } HSD_ObjFree(&hsd_804D0F90.alloc_data, gen); - hsd_804D78E0--; + numActiveGenerators--; return prev; } @@ -308,7 +308,6 @@ void hsd_8039D71C(HSD_Generator* gen) HSD_Generator* hsd_8039D9C8(void) { HSD_Generator* gen; - PAD_STACK(8); gen = HSD_ObjAlloc(&hsd_804D0F90.alloc_data); if (gen != NULL) { @@ -318,9 +317,9 @@ HSD_Generator* hsd_8039D9C8(void) return NULL; } - hsd_804D78E0++; - if (hsd_804D78E0 > hsd_804D78DA) { - hsd_804D78DA = hsd_804D78E0; + numActiveGenerators++; + if (numActiveGenerators > numPeakGenerators) { + numPeakGenerators = numActiveGenerators; } if (hsd_804D78F8 == NULL || hsd_804D78F8->next == NULL) { @@ -336,11 +335,7 @@ HSD_Generator* hsd_8039D9C8(void) hsd_804D78F8->next->next = gen; } - lbl_804D6368++; - if (lbl_804D6368 < 0x100) { - lbl_804D6368 = 0x100; - } - gen->idnum = lbl_804D6368; + gen->idnum = psGetNewIDNum(); gen->appsrt = NULL; gen->userfunc = NULL; return gen; @@ -1031,8 +1026,6 @@ HSD_Generator* hsd_8039EFAC(s32 linkNo, s32 bank, s32 gfx_id, HSD_JObj* jobj) return gen; } -/// @todo The bound check reads the .bss array named `psCmdListArray`, not -/// `psNumCmdList`; the two names look swapped against their addresses. HSD_Generator* hsd_8039F05C(s32 linkNo, s32 bank, s32 idx) { HSD_Generator* gen; @@ -1043,7 +1036,7 @@ HSD_Generator* hsd_8039F05C(s32 linkNo, s32 bank, s32 idx) if (linkNo >= 8) { return NULL; } - if (idx >= psCmdListArray[bank]) { + if (idx >= psNumCmdList[bank]) { return NULL; } diff --git a/src/sysdolphin/baselib/generator.h b/src/sysdolphin/baselib/generator.h index d74916d18b..013a9fc47c 100644 --- a/src/sysdolphin/baselib/generator.h +++ b/src/sysdolphin/baselib/generator.h @@ -7,14 +7,16 @@ #include +#include + struct hsd_804D0F60_t { HSD_ObjAllocData alloc_data; UNK_T pad; }; /* 39D0A0 */ void hsd_8039D0A0(HSD_Generator*); -/* 39D1E4 */ void hsd_8039D1E4(HSD_Generator*, void*); -/* 39D1EC */ u16 hsd_8039D1EC(void); +/* 39D1E4 */ void psSetUserFunc(HSD_Generator*, HSD_PSUserFunc*); +/* 39D1EC */ u16 psGetNewIDNum(void); /* 39D214 */ void hsd_8039D214(HSD_Generator*); /* 39D354 */ void hsd_8039D354(u32); /* 39D3AC */ HSD_Generator* hsd_8039D3AC(HSD_Generator*, HSD_Generator*); diff --git a/src/sysdolphin/baselib/particle.c b/src/sysdolphin/baselib/particle.c index acf3f95d3f..172af08ea2 100644 --- a/src/sysdolphin/baselib/particle.c +++ b/src/sysdolphin/baselib/particle.c @@ -37,12 +37,12 @@ typedef struct { /* 4D78D0 */ static u32 hsd_804D78D0; /* 4D78D4 */ static int (**psCallback)(HSD_Particle* part); -/* 4D78D8 */ u16 hsd_804D78D8 = 0; -/* 4D78DA */ u16 hsd_804D78DA = 0; +/* 4D78D8 */ u16 numPeakPSAppSRT = 0; +/* 4D78DA */ u16 numPeakGenerators = 0; /* 4D78DC */ static u16 numPeakParticles; -/* 4D78DE */ u16 hsd_804D78DE = 0; -/* 4D78E0 */ u16 hsd_804D78E0 = 0; -/* 4D78E2 */ static u16 hsd_804D78E2; +/* 4D78DE */ u16 numActivePSAppSRT = 0; +/* 4D78E0 */ u16 numActiveGenerators = 0; +/* 4D78E2 */ static u16 numActiveParticles; #ifdef MUST_MATCH #pragma push #pragma force_active on @@ -58,8 +58,8 @@ static HSD_JObj* psPointJObj[8]; /* 4D0948 */ u32* hsd_804D0948[65]; /* 4D0A4C */ int psFormGroupArray[65]; /* 4D0B50 */ HSD_PSTexGroup** psTexGroupArray[65]; -/* 4D0C54 */ HSD_PSFormGroup** psNumCmdList[65]; -/* 4D0D58 */ int psCmdListArray[65]; +/* 4D0C54 */ HSD_PSFormGroup** psCmdListArray[65]; +/* 4D0D58 */ int psNumCmdList[65]; /* 4D0E5C */ HSD_PSCmdList** ptclref_804D0E5C[65]; /* 4D0F60 */ struct hsd_804D0F60_t hsd_804D0F60; @@ -136,15 +136,15 @@ void psInitDataBankLoad(int bank, const int* cmdBank, const int* texBank, psTexGroupArray[bank] = (HSD_PSTexGroup**) (texBank + 1); if (formBank != NULL) { - psNumCmdList[bank] = (HSD_PSFormGroup**) (formBank + 1); + psCmdListArray[bank] = (HSD_PSFormGroup**) (formBank + 1); } else { - psNumCmdList[bank] = NULL; + psCmdListArray[bank] = NULL; } version = *(u16*) cmdBank; switch (version) { case 0: - psCmdListArray[bank] = cmdBank[1]; + psNumCmdList[bank] = cmdBank[1]; ptclref_804D0E5C[bank] = (HSD_PSCmdList**) (cmdBank + 2); break; case 0x40: @@ -152,7 +152,7 @@ void psInitDataBankLoad(int bank, const int* cmdBank, const int* texBank, case 0x42: case 0x43: { s32 count = cmdBank[1]; - psCmdListArray[bank] = cmdBank[2] + count; + psNumCmdList[bank] = cmdBank[2] + count; ptclref_804D0E5C[bank] = (HSD_PSCmdList**) (cmdBank + 3 - count); break; } @@ -333,8 +333,8 @@ void hsd_80398A08(u32 unused) (void) hsd_804D0948; (void) psFormGroupArray; (void) psTexGroupArray; - (void) psNumCmdList; (void) psCmdListArray; + (void) psNumCmdList; (void) ptclref_804D0E5C; HSD_ObjAllocInit(&hsd_804D0F60.alloc_data, sizeof(HSD_Particle), 4); @@ -343,14 +343,14 @@ void hsd_80398A08(u32 unused) for (i = 0; i < 16; i++) { hsd_804D0908[i] = NULL; } - hsd_804D78E2 = 0; + numActiveParticles = 0; numPeakParticles = 0; for (i = 0; i < 0x41; i++) { - psCmdListArray[i] = 0; + psNumCmdList[i] = 0; psFormGroupArray[i] = 0; ptclref_804D0E5C[i] = NULL; psTexGroupArray[i] = NULL; - psNumCmdList[i] = NULL; + psCmdListArray[i] = NULL; hsd_804D0948[i] = NULL; } psCallback = NULL; @@ -377,15 +377,15 @@ HSD_Particle* psGenerateParticle0(HSD_Particle** head, int linkNo, int bank, return NULL; } - hsd_804D78E2 += 1; - if (hsd_804D78E2 > numPeakParticles) { - numPeakParticles = hsd_804D78E2; + numActiveParticles += 1; + if (numActiveParticles > numPeakParticles) { + numPeakParticles = numActiveParticles; } if (gp != NULL) { pp->idnum = gp->idnum; } else { - pp->idnum = hsd_8039D1EC(); + pp->idnum = psGetNewIDNum(); } pp->appsrt = NULL; @@ -636,7 +636,7 @@ static inline HSD_Particle* psSpawnChild(HSD_Particle** head, int linkNo, child = NULL; } else if (bank >= 65) { child = NULL; - } else if (idx >= psCmdListArray[bank]) { + } else if (idx >= psNumCmdList[bank]) { child = NULL; } else { cl = ptclref_804D0E5C[bank][idx]; @@ -1004,7 +1004,7 @@ void* hsd_8039930C(HSD_Particle* pp, HSD_Particle* prev) child = NULL; } else if (bank >= 65) { child = NULL; - } else if (idx >= psCmdListArray[bank]) { + } else if (idx >= psNumCmdList[bank]) { child = NULL; } else { cl = ptclref_804D0E5C[bank][idx]; @@ -1327,7 +1327,7 @@ void* hsd_8039930C(HSD_Particle* pp, HSD_Particle* prev) child = NULL; } else if (bank >= 65) { child = NULL; - } else if (idx >= psCmdListArray[bank]) { + } else if (idx >= psNumCmdList[bank]) { child = NULL; } else { cl = ptclref_804D0E5C[bank][idx]; @@ -1652,7 +1652,7 @@ void* hsd_8039930C(HSD_Particle* pp, HSD_Particle* prev) child = NULL; } else if (bank >= 65) { child = NULL; - } else if (idx >= psCmdListArray[bank]) { + } else if (idx >= psNumCmdList[bank]) { child = NULL; } else { cl = ptclref_804D0E5C[bank][idx]; @@ -1718,7 +1718,7 @@ void* hsd_8039930C(HSD_Particle* pp, HSD_Particle* prev) child = NULL; } else if (bank >= 65) { child = NULL; - } else if (idx >= psCmdListArray[bank]) { + } else if (idx >= psNumCmdList[bank]) { child = NULL; } else { cl = ptclref_804D0E5C[bank][idx]; @@ -2839,9 +2839,9 @@ void* hsd_8039930C(HSD_Particle* pp, HSD_Particle* prev) } /* Free particle */ - hsd_8039D048(pp); + psClearPointJObj(pp); HSD_ObjFree(&hsd_804D0F60.alloc_data, pp); - hsd_804D78E2--; + numActiveParticles--; return next_pp; } } @@ -2905,7 +2905,7 @@ void* hsd_8039930C(HSD_Particle* pp, HSD_Particle* prev) if (psPointJObj[jobj_idx] == NULL) { HSD_JObj* new_jobj = HSD_JObjAlloc(); if (new_jobj != NULL) { - hsd_8039CF4C(jobj_idx + 1, new_jobj); + psSetPointJObj(jobj_idx + 1, new_jobj); HSD_JObjUnref(new_jobj); } } @@ -2971,7 +2971,7 @@ void hsd_8039CEAC(u32 mask) } } -void hsd_8039CF4C(s32 index, HSD_JObj* jobj) +void psSetPointJObj(int index, HSD_JObj* jobj) { if (index < 0 || index > 8) { return; @@ -3000,9 +3000,9 @@ void hsd_8039CF4C(s32 index, HSD_JObj* jobj) } } -void hsd_8039D048(void* particle) +void psClearPointJObj(HSD_Particle* particle) { - u32 flags = ((HSD_Particle*) particle)->kind; + u32 flags = particle->kind; if (flags & 0x8000) { HSD_JObj** p = &psPointJObj[(flags >> 12) & 7]; if (*p != NULL) { @@ -3065,7 +3065,7 @@ void hsd_8039D0A0(HSD_Generator* gen) } HSD_ObjFree(&data->alloc_data, prt); - hsd_804D78E2--; + numActiveParticles--; } else { prev = prt; } diff --git a/src/sysdolphin/baselib/particle.h b/src/sysdolphin/baselib/particle.h index c8504f58f0..98a515dbd0 100644 --- a/src/sysdolphin/baselib/particle.h +++ b/src/sysdolphin/baselib/particle.h @@ -30,17 +30,17 @@ psGenerateParticle0(HSD_Particle** head, int linkNo, int bank, u32 kind, /* 3991D8 */ s32 applyForceJObj(HSD_Generator*, HSD_JObj*, f32, f32); /* 39930C */ void* hsd_8039930C(HSD_Particle*, HSD_Particle*); /* 39CEAC */ void hsd_8039CEAC(u32); -/* 39CF4C */ void hsd_8039CF4C(s32, HSD_JObj*); -/* 39D048 */ void hsd_8039D048(void* particle); +/* 39CF4C */ void psSetPointJObj(int, HSD_JObj*); +/* 39D048 */ void psClearPointJObj(HSD_Particle* particle); /* 4D0A4C */ extern int psFormGroupArray[65]; /* 4D0B50 */ extern HSD_PSTexGroup** psTexGroupArray[65]; -/* 4D0C54 */ extern HSD_PSFormGroup** psNumCmdList[65]; -/* 4D0D58 */ extern int psCmdListArray[65]; +/* 4D0C54 */ extern HSD_PSFormGroup** psCmdListArray[65]; +/* 4D0D58 */ extern int psNumCmdList[65]; /* 4D0E5C */ extern HSD_PSCmdList** ptclref_804D0E5C[65]; -/* 4D78D8 */ extern u16 hsd_804D78D8; -/* 4D78DA */ extern u16 hsd_804D78DA; -/* 4D78DE */ extern u16 hsd_804D78DE; -/* 4D78E0 */ extern u16 hsd_804D78E0; +/* 4D78D8 */ extern u16 numPeakPSAppSRT; +/* 4D78DA */ extern u16 numPeakGenerators; +/* 4D78DE */ extern u16 numActivePSAppSRT; +/* 4D78E0 */ extern u16 numActiveGenerators; /* 4D78E8 */ extern void (*hsd_804D78E8)(HSD_Generator*, Mtx); /* 4D78EC */ extern void (*hsd_804D78EC)(HSD_Generator*); /* 4D78F0 */ extern HSD_CObj* psCamera; diff --git a/src/sysdolphin/baselib/psappsrt.c b/src/sysdolphin/baselib/psappsrt.c index 63cbcbaa15..f2e1e2b751 100644 --- a/src/sysdolphin/baselib/psappsrt.c +++ b/src/sysdolphin/baselib/psappsrt.c @@ -11,8 +11,8 @@ bool psInitAppSRT(int num, int size) { - hsd_804D78DE = 0; - hsd_804D78D8 = 0; + numActivePSAppSRT = 0; + numPeakPSAppSRT = 0; HSD_PSAppSrt_804D7958[0] = (u16) size; HSD_ObjAllocInit(&HSD_PSAppSrt_804D10B0, size, 4U); return 0; @@ -44,9 +44,9 @@ HSD_psAppSRT* psAddGeneratorAppSRT(s32 status, u16 idnum) srt->xA2 = 0; srt->gp = NULL; srt->idnum = idnum; - hsd_804D78DE += 1; - if (hsd_804D78DE > hsd_804D78D8) { - hsd_804D78D8 = hsd_804D78DE; + numActivePSAppSRT += 1; + if (numActivePSAppSRT > numPeakPSAppSRT) { + numPeakPSAppSRT = numActivePSAppSRT; } } return srt; @@ -96,7 +96,7 @@ int psRemoveParticleAppSRT(HSD_Particle* pp) srt->freefunc(srt); } HSD_ObjFree(&HSD_PSAppSrt_804D10B0, srt); - hsd_804D78DE--; + numActivePSAppSRT--; } pp->appsrt = NULL; return count; @@ -125,7 +125,7 @@ int psRemoveGeneratorSRT(HSD_Generator* gp) srt->freefunc(srt); } HSD_ObjFree(&HSD_PSAppSrt_804D10B0, srt); - hsd_804D78DE--; + numActivePSAppSRT--; } gp->appsrt = NULL; return count; diff --git a/src/sysdolphin/baselib/psdisp.c b/src/sysdolphin/baselib/psdisp.c index be842e68f9..e1620d7bf1 100644 --- a/src/sysdolphin/baselib/psdisp.c +++ b/src/sysdolphin/baselib/psdisp.c @@ -2029,8 +2029,8 @@ void psDispParticles(u32 target_link, u32 sw) } } - if (psNumCmdList[pp->bank] != NULL && - (form_group = psNumCmdList[pp->bank][pp->texGroup]) != + if (psCmdListArray[pp->bank] != NULL && + (form_group = psCmdListArray[pp->bank][pp->texGroup]) != NULL #ifdef MUST_MATCH && form_group->formTable != NULL diff --git a/src/sysdolphin/baselib/psstructs.h b/src/sysdolphin/baselib/psstructs.h index 077f0f5652..64d75d19cb 100644 --- a/src/sysdolphin/baselib/psstructs.h +++ b/src/sysdolphin/baselib/psstructs.h @@ -336,11 +336,8 @@ HSD_Particle* psGenerateParticleIDN(int linkNo, int bank, int id); void psKillParticle(HSD_Particle* pp); void psKillAllParticle(void); -void psSetPointJObj(int no, HSD_JObj* jobj); void psSetPointJObjNodup(HSD_JObj* jobj, int no); -void psClearPointJObj(void); - void psDeletePntJObjwithParticle(HSD_Particle* pp); void psKillFamily(u16 idnum, int linkNo); @@ -353,8 +350,6 @@ void psRestartFamily(u16 idnum, int linkNo); void psSetCallback(int (**callback)(HSD_Particle* part)); -void psSetUserFunc(HSD_Generator* gp, HSD_PSUserFunc* userfunc); - static inline void psRemoveBillboardCamera(void); #endif diff --git a/src/sysdolphin/baselib/quatlib.c b/src/sysdolphin/baselib/quatlib.c index c354914ff2..5888271af0 100644 --- a/src/sysdolphin/baselib/quatlib.c +++ b/src/sysdolphin/baselib/quatlib.c @@ -56,7 +56,7 @@ s32 MatToQuat(Mtx m, Quaternion* q) return 0; } -s32 HSD_QuatLib_8037EB28(Mtx m, Vec3* euler) +s32 MatToEuler(Mtx m, Vec3* euler) { f32 len; @@ -74,7 +74,7 @@ s32 HSD_QuatLib_8037EB28(Mtx m, Vec3* euler) return 0; } -s32 HSD_QuatLib_8037EC4C(Quaternion* p, Quaternion* q, Quaternion* out) +s32 QuatMul(Quaternion* p, Quaternion* q, Quaternion* out) { f32 x; f32 y; @@ -95,7 +95,7 @@ s32 HSD_QuatLib_8037EC4C(Quaternion* p, Quaternion* q, Quaternion* out) return 0; } -s32 HSD_QuatLib_8037ECE0(Vec3* axis, Quaternion* q, f32 angle) +s32 AngleAxisToQuat(Vec3* axis, Quaternion* q, f32 angle) { f32 len; f32 half_angle; @@ -145,7 +145,7 @@ s32 EulerToQuat(Vec3* euler, Quaternion* q) return 0; } -s32 HSD_QuatLib_8037EF28(Quaternion* p, Quaternion* q, Quaternion* out, f32 t) +s32 QuatSlerp(Quaternion* p, Quaternion* q, Quaternion* out, f32 t) { f32 cosom; f32 t2; diff --git a/src/sysdolphin/baselib/quatlib.h b/src/sysdolphin/baselib/quatlib.h index c80eccd81c..4653974cab 100644 --- a/src/sysdolphin/baselib/quatlib.h +++ b/src/sysdolphin/baselib/quatlib.h @@ -6,10 +6,10 @@ #include s32 MatToQuat(Mtx, Quaternion*); -s32 HSD_QuatLib_8037EB28(Mtx, Vec3*); -s32 HSD_QuatLib_8037EC4C(Quaternion*, Quaternion*, Quaternion*); -s32 HSD_QuatLib_8037ECE0(Vec3*, Quaternion*, f32); +s32 MatToEuler(Mtx, Vec3*); +s32 QuatMul(Quaternion*, Quaternion*, Quaternion*); +s32 AngleAxisToQuat(Vec3*, Quaternion*, f32); s32 EulerToQuat(Vec3*, Quaternion*); -s32 HSD_QuatLib_8037EF28(Quaternion*, Quaternion*, Quaternion*, f32); +s32 QuatSlerp(Quaternion*, Quaternion*, Quaternion*, f32); #endif From c4c78bc3dc3f8083d7540b0e0d0bea09c20aec09 Mon Sep 17 00:00:00 2001 From: HidoranBlaze Date: Sun, 18 Oct 2026 17:53:32 -0600 Subject: [PATCH 2/4] fix removed static keyword from particleCallbacks --- src/melee/ef/eflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/melee/ef/eflib.c b/src/melee/ef/eflib.c index 05865eb50f..9bd1d0aa20 100644 --- a/src/melee/ef/eflib.c +++ b/src/melee/ef/eflib.c @@ -952,7 +952,7 @@ int efLib_Cb_ParticleRender(HSD_Particle* particle) } } -HSD_PSUserFunc particleCallbacks = { efLib_Cb_ParticleRender, NULL, NULL }; +static HSD_PSUserFunc particleCallbacks = { efLib_Cb_ParticleRender, NULL, NULL }; // Global particle callback. Checks if the particle cmdList matches // bank 0 refs (0x96, 0x97, 0x98, 0x21B). If matched, attaches an From 4dc05e4cfbb7cfcf6ad4a4aada515de4bf208024 Mon Sep 17 00:00:00 2001 From: HidoranBlaze Date: Sun, 18 Oct 2026 18:09:57 -0600 Subject: [PATCH 3/4] formatting changes to satisfy pre-commit --- src/sysdolphin/baselib/generator.h | 1 - src/sysdolphin/baselib/psdisp.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sysdolphin/baselib/generator.h b/src/sysdolphin/baselib/generator.h index 013a9fc47c..9dbefff768 100644 --- a/src/sysdolphin/baselib/generator.h +++ b/src/sysdolphin/baselib/generator.h @@ -6,7 +6,6 @@ #include #include - #include struct hsd_804D0F60_t { diff --git a/src/sysdolphin/baselib/psdisp.c b/src/sysdolphin/baselib/psdisp.c index e1620d7bf1..0fd522d16e 100644 --- a/src/sysdolphin/baselib/psdisp.c +++ b/src/sysdolphin/baselib/psdisp.c @@ -2030,8 +2030,8 @@ void psDispParticles(u32 target_link, u32 sw) } if (psCmdListArray[pp->bank] != NULL && - (form_group = psCmdListArray[pp->bank][pp->texGroup]) != - NULL + (form_group = + psCmdListArray[pp->bank][pp->texGroup]) != NULL #ifdef MUST_MATCH && form_group->formTable != NULL #endif From ad37ce0ddb0ff29d80fd3d6e32efe04cf40bac82 Mon Sep 17 00:00:00 2001 From: HidoranBlaze Date: Sun, 18 Oct 2026 18:48:44 -0600 Subject: [PATCH 4/4] more formatting changes --- src/melee/ef/eflib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/melee/ef/eflib.c b/src/melee/ef/eflib.c index 9bd1d0aa20..f5e02f62f5 100644 --- a/src/melee/ef/eflib.c +++ b/src/melee/ef/eflib.c @@ -952,7 +952,8 @@ int efLib_Cb_ParticleRender(HSD_Particle* particle) } } -static HSD_PSUserFunc particleCallbacks = { efLib_Cb_ParticleRender, NULL, NULL }; +static HSD_PSUserFunc particleCallbacks = { efLib_Cb_ParticleRender, NULL, + NULL }; // Global particle callback. Checks if the particle cmdList matches // bank 0 refs (0x96, 0x97, 0x98, 0x21B). If matched, attaches an