From b946ec975fd08764c489ef2d8b058d0dc99344a8 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 28 Sep 2026 18:32:12 -0400 Subject: [PATCH] Add const to JSystem mtx src params, fixing a regalloc --- include/JSystem/J3DGraphBase/J3DTransform.h | 4 ++-- include/JSystem/JKernel/JKRHeap.h | 1 - include/JSystem/JParticle/JPAEmitter.h | 4 ++-- include/JSystem/JParticle/JPAMath.h | 6 +++--- src/JSystem/J3DGraphBase/J3DTransform.cpp | 4 ++-- src/JSystem/JParticle/JPAMath.cpp | 6 +++--- src/d/actor/d_a_bgn2.cpp | 1 - 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/JSystem/J3DGraphBase/J3DTransform.h b/include/JSystem/J3DGraphBase/J3DTransform.h index 30a65c207..d30fe90f0 100644 --- a/include/JSystem/J3DGraphBase/J3DTransform.h +++ b/include/JSystem/J3DGraphBase/J3DTransform.h @@ -38,8 +38,8 @@ void J3DGetTextureMtxMayaOld(const J3DTextureSRTInfo&, Mtx); void J3DScaleNrmMtx(Mtx, const Vec&); void J3DScaleNrmMtx33(Mtx33, const Vec&); void J3DMtxProjConcat(Mtx, Mtx, Mtx); -void J3DPSMtx33Copy(Mtx3P src, Mtx3P dst); -void J3DPSMtx33CopyFrom34(MtxP src, Mtx3P dst); +void J3DPSMtx33Copy(const Mtx3P src, Mtx3P dst); +void J3DPSMtx33CopyFrom34(const MtxP src, Mtx3P dst); void J3DPSMtxArrayConcat(Mtx, Mtx, Mtx, u32); inline void J3DPSMulMtxVec(__REGISTER MtxP mtx, __REGISTER Vec* vec, __REGISTER Vec* dst) { diff --git a/include/JSystem/JKernel/JKRHeap.h b/include/JSystem/JKernel/JKRHeap.h index ddaed2503..d3d77c025 100644 --- a/include/JSystem/JKernel/JKRHeap.h +++ b/include/JSystem/JKernel/JKRHeap.h @@ -131,7 +131,6 @@ public: static void copyMemory(void* dst, void* src, u32 size); static void fillMemory(void* dst, u32 size, u8 value); // NOTE: never used - static bool checkMemoryFilled(void* src, u32 size, u8 value); static JKRErrorHandler setErrorHandler(JKRErrorHandler errorHandler); diff --git a/include/JSystem/JParticle/JPAEmitter.h b/include/JSystem/JParticle/JPAEmitter.h index a76671873..818b913d4 100644 --- a/include/JSystem/JParticle/JPAEmitter.h +++ b/include/JSystem/JParticle/JPAEmitter.h @@ -212,10 +212,10 @@ public: u8 getGlobalAlpha() { return mGlobalPrmColor.a; } void setGlobalAlpha(u8 alpha) { mGlobalPrmColor.a = alpha; } - void setGlobalRTMatrix(MtxP mtx) { + void setGlobalRTMatrix(const MtxP mtx) { JPASetRMtxTVecfromMtx(mtx, mGlobalRotation, mGlobalTranslation); } - void setGlobalSRTMatrix(MtxP mtx) { + void setGlobalSRTMatrix(const MtxP mtx) { JPASetRMtxSTVecfromMtx(mtx, mGlobalRotation, mGlobalDynamicsScale, mGlobalTranslation); } void setGlobalRotation(const JGeometry::TVec3& rot) { diff --git a/include/JSystem/JParticle/JPAMath.h b/include/JSystem/JParticle/JPAMath.h index f63ce1eaa..72f235975 100644 --- a/include/JSystem/JParticle/JPAMath.h +++ b/include/JSystem/JParticle/JPAMath.h @@ -8,9 +8,9 @@ void JPAGetYZRotateMtx(s16, s16, Mtx); void JPAGetXYZRotateMtx(s16, s16, s16, Mtx); void JPAGetDirMtx(const JGeometry::TVec3&, Mtx); -void JPASetSVecfromMtx(Mtx, JGeometry::TVec3&); -void JPASetRMtxTVecfromMtx(Mtx, Mtx, JGeometry::TVec3&); -void JPASetRMtxSTVecfromMtx(Mtx, Mtx, JGeometry::TVec3&, JGeometry::TVec3&); +void JPASetSVecfromMtx(const MtxP, JGeometry::TVec3&); +void JPASetRMtxTVecfromMtx(const MtxP, Mtx, JGeometry::TVec3&); +void JPASetRMtxSTVecfromMtx(const MtxP, Mtx, JGeometry::TVec3&, JGeometry::TVec3&); f32 JPAGetKeyFrameValue(f32, u16, const f32*); void JPAGetUnitVec(s16, s16, JGeometry::TVec3&); diff --git a/src/JSystem/J3DGraphBase/J3DTransform.cpp b/src/JSystem/J3DGraphBase/J3DTransform.cpp index 23939434e..add236fb0 100644 --- a/src/JSystem/J3DGraphBase/J3DTransform.cpp +++ b/src/JSystem/J3DGraphBase/J3DTransform.cpp @@ -470,7 +470,7 @@ void J3DMtxProjConcat(__REGISTER Mtx a, __REGISTER Mtx b, __REGISTER Mtx dst) { } /* 802DACE0-802DAD0C .text J3DPSMtx33Copy__FPA3_fPA3_f */ -void J3DPSMtx33Copy(__REGISTER Mtx3P src, __REGISTER Mtx3P dst) { +void J3DPSMtx33Copy(__REGISTER const Mtx3P src, __REGISTER Mtx3P dst) { __REGISTER f32 x1_y1; __REGISTER f32 z1_x2; __REGISTER f32 y2_z2; @@ -494,7 +494,7 @@ asm { } /* 802DAD0C-802DAD40 .text J3DPSMtx33CopyFrom34__FPA4_fPA3_f */ -void J3DPSMtx33CopyFrom34(__REGISTER MtxP src, __REGISTER Mtx3P dst) { +void J3DPSMtx33CopyFrom34(__REGISTER const MtxP src, __REGISTER Mtx3P dst) { #ifdef __MWERKS__ asm { psq_l f0, 0(src), 0, 0 diff --git a/src/JSystem/JParticle/JPAMath.cpp b/src/JSystem/JParticle/JPAMath.cpp index c0ace52a1..ed1123e9f 100644 --- a/src/JSystem/JParticle/JPAMath.cpp +++ b/src/JSystem/JParticle/JPAMath.cpp @@ -94,7 +94,7 @@ void JPAGetDirMtx(const JGeometry::TVec3& dir, Mtx dst) { } /* 80259B6C-80259C90 .text JPASetSVecfromMtx__FPA4_fRQ29JGeometry8TVec3 */ -void JPASetSVecfromMtx(Mtx mtx, JGeometry::TVec3& scale) { +void JPASetSVecfromMtx(const MtxP mtx, JGeometry::TVec3& scale) { f32 m00 = mtx[0][0], m10 = mtx[1][0], m20 = mtx[2][0]; scale.x = JGeometry::TUtil::sqrt(m00*m00 + m10*m10 + m20*m20); @@ -106,13 +106,13 @@ void JPASetSVecfromMtx(Mtx mtx, JGeometry::TVec3& scale) { } /* 80259C90-80259CB8 .text JPASetRMtxTVecfromMtx__FPA4_fPA4_fRQ29JGeometry8TVec3 */ -void JPASetRMtxTVecfromMtx(Mtx src, Mtx dst, JGeometry::TVec3& translate) { +void JPASetRMtxTVecfromMtx(const MtxP src, Mtx dst, JGeometry::TVec3& translate) { JGeometry::TVec3 scale; JPASetRMtxSTVecfromMtx(src, dst, scale, translate); } /* 80259CB8-80259DD0 .text JPASetRMtxSTVecfromMtx__FPA4_fPA4_fRQ29JGeometry8TVec3RQ29JGeometry8TVec3 */ -void JPASetRMtxSTVecfromMtx(Mtx src, Mtx dst, JGeometry::TVec3& scale, JGeometry::TVec3& translate) { +void JPASetRMtxSTVecfromMtx(const MtxP src, Mtx dst, JGeometry::TVec3& scale, JGeometry::TVec3& translate) { JPASetSVecfromMtx(src, scale); MTXIdentity(dst); if (scale.x != 0.0f) { diff --git a/src/d/actor/d_a_bgn2.cpp b/src/d/actor/d_a_bgn2.cpp index f9e501385..f4c89413e 100644 --- a/src/d/actor/d_a_bgn2.cpp +++ b/src/d/actor/d_a_bgn2.cpp @@ -181,7 +181,6 @@ static void asi_hamon_set(bgn2_class* i_this) { /* 00000D88-00000FA8 .text attack_eff_set__FP10bgn2_class4cXyz */ static void attack_eff_set(bgn2_class* i_this, cXyz param_2) { - /* Nonmatching - retail-only regalloc */ #if VERSION == VERSION_DEMO fopAc_ac_c* actor = &i_this->actor; #endif