Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions config/GALE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 7 additions & 10 deletions src/melee/ef/eflib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -952,11 +952,8 @@ void efLib_Cb_ParticleRender(HSD_Particle* particle)
}
}

static void (*particleCallbacks[3])(HSD_Particle* particle) = {
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
Expand All @@ -965,16 +962,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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/melee/ef/eflib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/melee/lb/lb_00B0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions src/melee/lb/lb_00F9.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/melee/lb/lb_020A.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
27 changes: 10 additions & 17 deletions src/sysdolphin/baselib/generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
5 changes: 3 additions & 2 deletions src/sysdolphin/baselib/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
#include <placeholder.h>

#include <sysdolphin/baselib/objalloc.h>
#include <sysdolphin/baselib/psstructs.h>

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*);
Expand Down
Loading
Loading