summaryrefslogtreecommitdiff
path: root/src/JSystem
diff options
context:
space:
mode:
authorkipcode66 <kipcode66@gmail.com>2025-12-07 00:08:05 -0500
committerGitHub <noreply@github.com>2025-12-06 21:08:05 -0800
commitfc31053cb6cbae738923c93f4ab574b06334d73d (patch)
treef47a4ddc2b88d00a87617a56e8489b2f60028bb8 /src/JSystem
parent7ac2c38caf44f8b20088a4f0376371ce15c78844 (diff)
Improving compatibility with standard cpp compiler (#2920)
* Improving compatibility with standard cpp compiler * Add __REGISTER macro for non mwcc compatibility * Fix for PR comments * fix missing define for revolution * Simplifying cSAngle conversion
Diffstat (limited to 'src/JSystem')
-rw-r--r--src/JSystem/J3DGraphAnimator/J3DAnimation.cpp8
-rw-r--r--src/JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp52
-rw-r--r--src/JSystem/J3DGraphBase/J3DTransform.cpp18
-rw-r--r--src/JSystem/JMath/JMath.cpp30
4 files changed, 54 insertions, 54 deletions
diff --git a/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp b/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp
index 870871a88a..8cfa46ff23 100644
--- a/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp
+++ b/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp
@@ -507,10 +507,10 @@ inline f32 J3DHermiteInterpolation(f32 p1, f32 const* p2, f32 const* p3, f32 con
return JMAHermiteInterpolation(p1, *p2, *p3, *p4, *p5, *p6, *p7);
}
-inline f32 J3DHermiteInterpolation(register f32 pp1, register s16 const* pp2,
- register s16 const* pp3, register s16 const* pp4,
- register s16 const* pp5, register s16 const* pp6,
- register s16 const* pp7) {
+inline f32 J3DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER s16 const* pp2,
+ __REGISTER s16 const* pp3, __REGISTER s16 const* pp4,
+ __REGISTER s16 const* pp5, __REGISTER s16 const* pp6,
+ __REGISTER s16 const* pp7) {
#ifdef __MWERKS__
register f32 p1 = pp1;
register f32 ff8;
diff --git a/src/JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp b/src/JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp
index 8aeab2520f..4acd201eb0 100644
--- a/src/JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp
+++ b/src/JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp
@@ -237,10 +237,10 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) {
static f32 J3DUnit01[] = { 0.0f, 1.0f };
void J3DMtxBuffer::calcWeightEnvelopeMtx() {
- register MtxP weightAnmMtx;
- register Mtx* worldMtx;
- register Mtx* invMtx;
- register f32 weight;
+ __REGISTER MtxP weightAnmMtx;
+ __REGISTER Mtx* worldMtx;
+ __REGISTER Mtx* invMtx;
+ __REGISTER f32 weight;
int idx;
int j;
int mixNum;
@@ -251,27 +251,27 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
u8* pScale;
#if DEBUG || !__MWERKS__
- register Mtx mtx;
+ __REGISTER Mtx mtx;
#else
- register f32 var_f1;
- register f32 var_f2;
- register f32 var_f3;
- register f32 var_f4;
- register f32 var_f5;
- register f32 var_f6;
- register f32 var_f7;
- register f32 var_f8;
- register f32 var_f9;
- register f32 var_f10;
- register f32 var_f11;
- register f32 var_f12;
- register f32 var_f13;
- register f32 var_f31;
- register f32 var_f30;
- register f32 var_f29;
- register f32 var_f28;
- register f32 var_f27;
- register f32* var_r7 = J3DUnit01;
+ __REGISTER f32 var_f1;
+ __REGISTER f32 var_f2;
+ __REGISTER f32 var_f3;
+ __REGISTER f32 var_f4;
+ __REGISTER f32 var_f5;
+ __REGISTER f32 var_f6;
+ __REGISTER f32 var_f7;
+ __REGISTER f32 var_f8;
+ __REGISTER f32 var_f9;
+ __REGISTER f32 var_f10;
+ __REGISTER f32 var_f11;
+ __REGISTER f32 var_f12;
+ __REGISTER f32 var_f13;
+ __REGISTER f32 var_f31;
+ __REGISTER f32 var_f30;
+ __REGISTER f32 var_f29;
+ __REGISTER f32 var_f28;
+ __REGISTER f32 var_f27;
+ __REGISTER f32* var_r7 = J3DUnit01;
#endif
i = -1;
@@ -316,8 +316,8 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
MTXConcat(*worldMtx, *invMtx, mtx);
#else
// Fakematch? Doesn't match if worldMtx and invMtx are used directly.
- register void* var_r5 = worldMtx;
- register void* var_r6 = invMtx;
+ __REGISTER void* var_r5 = worldMtx;
+ __REGISTER void* var_r6 = invMtx;
asm {
psq_l var_f2, 0x0(var_r6), 0, 0 /* qr0 */
psq_l var_f1, 0x0(var_r5), 0, 0 /* qr0 */
diff --git a/src/JSystem/J3DGraphBase/J3DTransform.cpp b/src/JSystem/J3DGraphBase/J3DTransform.cpp
index 2e5473ebb8..890d40dee5 100644
--- a/src/JSystem/J3DGraphBase/J3DTransform.cpp
+++ b/src/JSystem/J3DGraphBase/J3DTransform.cpp
@@ -5,7 +5,7 @@
#include "JSystem/JMath/JMATrigonometric.h"
#include "JSystem/JMath/JMath.h"
-void __MTGQR7(register u32 v) {
+void __MTGQR7(__REGISTER u32 v) {
#ifdef __MWERKS__
// clang-format off
asm {
@@ -23,8 +23,8 @@ void J3DGQRSetup7(u32 r0, u32 r1, u32 r2, u32 r3) {
// this uses a non-standard sqrtf, not sure why or how its supposed to be setup
#if !PLATFORM_SHIELD
-inline f32 J3D_sqrtf(register f32 x) {
- register f32 recip;
+inline f32 J3D_sqrtf(__REGISTER f32 x) {
+ __REGISTER f32 recip;
if (x > 0.0f) {
#ifdef __MWERKS__ // clang-format off
@@ -38,7 +38,7 @@ inline f32 J3D_sqrtf(register f32 x) {
#define J3D_sqrtf sqrtf
#endif
-void J3DCalcBBoardMtx(register Mtx mtx) {
+void J3DCalcBBoardMtx(__REGISTER Mtx mtx) {
f32 x = (mtx[0][0] * mtx[0][0]) + (mtx[1][0] * mtx[1][0]) + (mtx[2][0] * mtx[2][0]);
f32 y = (mtx[0][1] * mtx[0][1]) + (mtx[1][1] * mtx[1][1]) + (mtx[2][1] * mtx[2][1]);
f32 z = (mtx[0][2] * mtx[0][2]) + (mtx[1][2] * mtx[1][2]) + (mtx[2][2] * mtx[2][2]);
@@ -53,7 +53,7 @@ void J3DCalcBBoardMtx(register Mtx mtx) {
z = J3D_sqrtf(z);
}
- register f32 zero = 0.0f;
+ __REGISTER f32 zero = 0.0f;
// zero out gaps of zeroes
#ifdef __MWERKS__ // clang-format off
asm {
@@ -101,7 +101,7 @@ void J3DCalcYBBoardMtx(Mtx mtx) {
mtx[2][2] = vec.z * z;
}
-asm void J3DPSCalcInverseTranspose(register Mtx src, register Mtx33 dst) {
+asm void J3DPSCalcInverseTranspose(__REGISTER Mtx src, __REGISTER Mtx33 dst) {
#ifdef __MWERKS__ // clang-format off
psq_l f0, 0(src), 1, 0
psq_l f1, 4(src), 0, 0
@@ -290,7 +290,7 @@ void J3DGetTextureMtxMayaOld(const J3DTextureSRTInfo& srt, Mtx dst) {
dst[2][2] = 1.0f;
}
-asm void J3DScaleNrmMtx(register Mtx mtx, const register Vec& scl) {
+asm void J3DScaleNrmMtx(__REGISTER Mtx mtx, const __REGISTER Vec& scl) {
#ifdef __MWERKS__ // clang-format off
nofralloc;
@@ -326,7 +326,7 @@ asm void J3DScaleNrmMtx(register Mtx mtx, const register Vec& scl) {
#endif // clang-format on
}
-asm void J3DScaleNrmMtx33(register Mtx33 mtx, const register Vec& scale) {
+asm void J3DScaleNrmMtx33(__REGISTER Mtx33 mtx, const __REGISTER Vec& scale) {
#ifdef __MWERKS__ // clang-format off
psq_l f0, 0(mtx), 0, 0
psq_l f6, 0(scale), 0, 0
@@ -352,7 +352,7 @@ asm void J3DScaleNrmMtx33(register Mtx33 mtx, const register Vec& scale) {
#endif // clang-format on
}
-asm void J3DMtxProjConcat(register Mtx mtx1, register Mtx mtx2, register Mtx dst) {
+asm void J3DMtxProjConcat(__REGISTER Mtx mtx1, __REGISTER Mtx mtx2, __REGISTER Mtx dst) {
#ifdef __MWERKS__ // clang-format off
psq_l f2, 0(mtx1), 0, 0
psq_l f3, 8(mtx1), 0, 0
diff --git a/src/JSystem/JMath/JMath.cpp b/src/JSystem/JMath/JMath.cpp
index ec60a65305..fe9a5c9cfd 100644
--- a/src/JSystem/JMath/JMath.cpp
+++ b/src/JSystem/JMath/JMath.cpp
@@ -19,10 +19,10 @@ void JMAEulerToQuat(s16 x, s16 y, s16 z, Quaternion* quat) {
quat->z = sinZ * (cosX * cosY) - cosZ * (sinX * sinY);
}
-void JMAQuatLerp(register const Quaternion* p, register const Quaternion* q, f32 t,
+void JMAQuatLerp(__REGISTER const Quaternion* p, __REGISTER const Quaternion* q, f32 t,
Quaternion* dst) {
- register f32 pxy, pzw, qxy, qzw;
- register f32 dp;
+ __REGISTER f32 pxy, pzw, qxy, qzw;
+ __REGISTER f32 dp;
#ifdef __MWERKS__ // clang-format off
// compute dot product
@@ -52,8 +52,8 @@ void JMAQuatLerp(register const Quaternion* p, register const Quaternion* q, f32
}
}
-void JMAFastVECNormalize(register const Vec* src, register Vec* dst) {
- register f32 vxy, rxy, vz, length;
+void JMAFastVECNormalize(__REGISTER const Vec* src, __REGISTER Vec* dst) {
+ __REGISTER f32 vxy, rxy, vz, length;
#ifdef __MWERKS__ // clang-format off
asm {
psq_l vxy, 0(src), 0, 0
@@ -70,11 +70,11 @@ void JMAFastVECNormalize(register const Vec* src, register Vec* dst) {
#endif // clang-format on
}
-void JMAVECScaleAdd(register const Vec* vec1, register const Vec* vec2, register Vec* dst,
- register f32 scale) {
- register f32 v1xy;
- register f32 v2xy = scale;
- register f32 rxy, v1z, v2z, rz;
+void JMAVECScaleAdd(__REGISTER const Vec* vec1, __REGISTER const Vec* vec2, __REGISTER Vec* dst,
+ __REGISTER f32 scale) {
+ __REGISTER f32 v1xy;
+ __REGISTER f32 v2xy = scale;
+ __REGISTER f32 rxy, v1z, v2z, rz;
#ifdef __MWERKS__ // clang-format off
asm {
psq_l v1xy, 0(vec1), 0, 0
@@ -90,11 +90,11 @@ void JMAVECScaleAdd(register const Vec* vec1, register const Vec* vec2, register
#endif // clang-format on
}
-void JMAMTXApplyScale(register const Mtx src, register Mtx dst, register f32 xScale,
- register f32 yScale, register f32 zScale) {
- register f32 scale = yScale;
- register f32 x, y, z;
- register f32 normal = 1.0f;
+void JMAMTXApplyScale(__REGISTER const Mtx src, __REGISTER Mtx dst, __REGISTER f32 xScale,
+ __REGISTER f32 yScale, __REGISTER f32 zScale) {
+ __REGISTER f32 scale = yScale;
+ __REGISTER f32 x, y, z;
+ __REGISTER f32 normal = 1.0f;
#ifdef __MWERKS__ // clang-format off
asm {
// scale first 2 components