Fix spurious differences when using ninja diff (#2294)

* Fix spurious differences when using ninja diff

* Fix some clangd errors/warnings
This commit is contained in:
LagoLunatic
2025-01-27 01:01:05 -05:00
committed by GitHub
parent 5644936254
commit bf4053fefa
48 changed files with 296 additions and 140 deletions
+2
View File
@@ -495,6 +495,7 @@ inline f32 J2DHermiteInterpolation<s16>(register f32 pp1, register s16* pp2, reg
register s16* p6 = pp6;
register s16* p7 = pp7;
// clang-format off
#ifdef __MWERKS__
asm {
psq_l ff2, 0(p2), 0x1, 5
psq_l ff0, 0(p5), 0x1, 5
@@ -517,6 +518,7 @@ inline f32 J2DHermiteInterpolation<s16>(register f32 pp1, register s16* pp2, reg
fmadds fout, ff4, ff2, fout
fsubs fout, fout, ff0
}
#endif
// clang-format on
return fout;
}
@@ -101,6 +101,7 @@ public:
}; // Size: 0x14
inline void J3DFillZero32B(register void* param_0, register u32 param_1) {
#ifdef __MWERKS__
asm {
srwi param_1, param_1, 5
mtctr param_1
@@ -109,6 +110,7 @@ inline void J3DFillZero32B(register void* param_0, register u32 param_1) {
addi param_0, param_0, 0x20
bdnz lbl_8032D948
}
#endif
}
#endif /* J3DSKINDEFORM_H */
+4
View File
@@ -56,18 +56,22 @@ struct J3DTextureSRTInfo {
register const f32* src = &other.mScaleX;
register f32* dst = &mScaleX;
register f32 xy;
#ifdef __MWERKS__
asm {
psq_l xy, 0(src), 0, 0
psq_st xy, 0(dst), 0, 0
};
#endif
// Unclear why there's a 4 byte copy here.
*(u32*)&mRotation = *(u32*)&other.mRotation;
src = &other.mTranslationX;
dst = &mTranslationX;
#ifdef __MWERKS__
asm {
psq_l xy, 0(src), 0, 0
psq_st xy, 0(dst), 0, 0
};
#endif
}
}; // Size: 0x14
+2 -2
View File
@@ -240,14 +240,14 @@ struct J3DTevOrder : public J3DTevOrderInfo {
};
extern u8 j3dTevSwapTableTable[1024];
extern u8 const data_804563F8;
extern u8 const j3dDefaultTevSwapTableID;
/**
* @ingroup jsystem-j3d
*
*/
struct J3DTevSwapModeTable {
/* 8000E134 */ J3DTevSwapModeTable() { mIdx = data_804563F8; }
/* 8000E134 */ J3DTevSwapModeTable() { mIdx = j3dDefaultTevSwapTableID; }
J3DTevSwapModeTable(J3DTevSwapModeTableInfo const& info) {
mIdx = calcTevSwapTableID(info.field_0x0, info.field_0x1, info.field_0x2, info.field_0x3);
}
@@ -76,6 +76,7 @@ inline void J3DPSMtx33Copy(register Mtx3P src, register Mtx3P dst) {
register f32 fr2;
register f32 fr1;
register f32 fr0;
#ifdef __MWERKS__
asm {
psq_l fr4, 0(src), 0, 0
psq_l fr3, 8(src), 0, 0
@@ -88,6 +89,7 @@ inline void J3DPSMtx33Copy(register Mtx3P src, register Mtx3P dst) {
psq_st fr1, 0x18(dst), 0, 0
stfs fr0, 0x20(dst)
}
#endif
}
inline void J3DPSMtx33CopyFrom34(register MtxP src, register Mtx3P dst) {
@@ -97,6 +99,7 @@ inline void J3DPSMtx33CopyFrom34(register MtxP src, register Mtx3P dst) {
register f32 z2;
register f32 x_y3;
register f32 z3;
#ifdef __MWERKS__
asm {
psq_l x_y1, 0(src), 0, 0
lfs z1, 8(src)
@@ -111,6 +114,7 @@ inline void J3DPSMtx33CopyFrom34(register MtxP src, register Mtx3P dst) {
psq_st x_y3, 24(dst), 0, 0
stfs z3, 0x20(dst)
}
#endif
}
// regalloc issues
@@ -131,6 +135,7 @@ inline void J3DPSMulMtxVec(register MtxP mtx, register Vec* vec, register Vec* d
register f32 fra2;
register f32 fr01;
register f32 fr00;
#ifdef __MWERKS__
asm {
psq_l fr00, 0(vec), 0, 0
psq_l fr2, 0(mtx), 0, 0
@@ -153,6 +158,7 @@ inline void J3DPSMulMtxVec(register MtxP mtx, register Vec* vec, register Vec* d
ps_sum0 fra6, fra5, fra6, fra5
psq_st fra6, 8(dst), 1, 0
}
#endif
}
// regalloc issues
@@ -173,6 +179,7 @@ inline void J3DPSMulMtxVec(register MtxP mtx, register SVec* vec, register SVec*
register f32 fra2;
register f32 fr01;
register f32 fr00;
#ifdef __MWERKS__
asm {
psq_l fr00, 0(vec), 0, 7
psq_l fr2, 0(mtx), 0, 0
@@ -195,6 +202,7 @@ inline void J3DPSMulMtxVec(register MtxP mtx, register SVec* vec, register SVec*
ps_sum0 fra6, fra5, fra6, fra5
psq_st fra6, 4(dst), 1, 7
}
#endif
}
// regalloc issues
@@ -213,6 +221,7 @@ inline void J3DPSMulMtxVec(register Mtx3P mtx, register Vec* vec, register Vec*
register f32 fr2;
register f32 fr01;
register f32 fr00;
#ifdef __MWERKS__
asm {
lis punit, PSMulUnit01@ha
psq_l fr00, 0(vec), 0, 0
@@ -239,6 +248,7 @@ inline void J3DPSMulMtxVec(register Mtx3P mtx, register Vec* vec, register Vec*
ps_sum0 fr6, fr5, fr6, fr5
psq_st fr6, 8(dst), 1, 0
}
#endif
}
// regalloc issues
@@ -252,6 +262,7 @@ inline void J3DPSMulMtxVec(register Mtx3P mtx, register SVec* vec, register SVec
register f32 fr2;
register f32 fr01;
register f32 fr00;
#ifdef __MWERKS__
asm {
lis punit, PSMulUnit01@ha
psq_l fr00, 0(vec), 0, 7
@@ -278,6 +289,7 @@ inline void J3DPSMulMtxVec(register Mtx3P mtx, register SVec* vec, register SVec
ps_sum0 fr6, fr5, fr6, fr5
psq_st fr6, 4(dst), 1, 7
}
#endif
}
#endif /* J3DTRANSFORM_H */
+1 -1
View File
@@ -114,7 +114,7 @@ namespace JASDsp {
extern u8 const DSPADPCM_FILTER[64];
extern u32 const DSPRES_FILTER[320];
extern u16 SEND_TABLE[12 + 12 /* padding */];
extern u16 SEND_TABLE[];
extern TChannel* CH_BUF;
extern FxBuf* FX_BUF;
extern f32 sDSPVolume;
+7 -5
View File
@@ -99,6 +99,8 @@ public:
void free(void* ptr, u32 n) { JASGenericMemPool::free(ptr, n); }
};
namespace JASKernel { JKRHeap* getSystemHeap(); };
/**
* @ingroup jsystem-jaudio
*
@@ -183,7 +185,7 @@ public:
}
void* alloc(u32 size) {
T::Lock lock(&mMutex);
typename T::Lock lock(&mMutex);
if (field_0x18->getFreeSize() < size) {
if (ChunkSize < size) {
return NULL;
@@ -196,7 +198,7 @@ public:
}
void free(void* ptr) {
T::Lock lock(&mMutex);
typename T::Lock lock(&mMutex);
MemoryChunk* chunk = field_0x18;
MemoryChunk* prevChunk = NULL;
while (chunk != NULL) {
@@ -269,17 +271,17 @@ template <typename T>
class JASMemPool_MultiThreaded : public JASGenericMemPool {
public:
void newMemPool(int param_0) {
JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
typename JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
JASGenericMemPool::newMemPool(sizeof(T), param_0);
}
void* alloc(size_t count) {
JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
typename JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
return JASGenericMemPool::alloc(count);
}
void free(void* ptr, u32 param_1) {
JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
typename JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
JASGenericMemPool::free(ptr, param_1);
}
};
+14 -2
View File
@@ -117,12 +117,14 @@ inline void setTVec3f(const f32* vec_a, f32* vec_b) {
register f32 a_x;
register f32 b_x;
#ifdef __MWERKS__
asm {
psq_l a_x, 0(v_a), 0, 0
lfs b_x, 8(v_a)
psq_st a_x, 0(v_b), 0, 0
stfs b_x, 8(v_b)
};
#endif
}
// Until we figure out TVec3 ctors
@@ -188,6 +190,7 @@ struct TVec3<f32> : public Vec {
register f32 za;
register f32 zb;
register f32 z;
#ifdef __MWERKS__
asm {
psq_l a_x_y, 0(srca), 0, 0
psq_l b_x_y, 0(srcb), 0, 0
@@ -198,6 +201,7 @@ struct TVec3<f32> : public Vec {
fmuls z, za, zb
stfs z, 8(dst)
};
#endif
}
inline void mul(const TVec3<f32>& a) {
@@ -273,6 +277,7 @@ struct TVec3<f32> : public Vec {
register f32 x_y;
register f32* dst = &x;
register f32 zres;
#ifdef __MWERKS__
asm {
psq_l x_y, 0(dst), 0, 0
psq_l z, 8(dst), 1, 0
@@ -281,6 +286,7 @@ struct TVec3<f32> : public Vec {
ps_muls0 zres, z, sc
psq_st zres, 8(dst), 1, 0
};
#endif
}
void scale(register f32 sc, const TVec3<f32>& other) {
@@ -289,6 +295,7 @@ struct TVec3<f32> : public Vec {
register f32 x_y;
register f32* dst = &x;
register f32 zres;
#ifdef __MWERKS__
asm {
psq_l x_y, 0(src), 0, 0
psq_l z, 8(src), 1, 0
@@ -297,6 +304,7 @@ struct TVec3<f32> : public Vec {
ps_muls0 zres, z, sc
psq_st zres, 8(dst), 1, 0
};
#endif
}
void scaleAdd(register f32 sc, const TVec3<f32>& a, const TVec3<f32>& b) {
@@ -308,6 +316,7 @@ struct TVec3<f32> : public Vec {
const register f32* src = &x;
register f32 x_y;
register f32 z;
#ifdef __MWERKS__
asm {
psq_l x_y, 0(src), 0, 0
ps_neg x_y, x_y
@@ -316,6 +325,7 @@ struct TVec3<f32> : public Vec {
fneg z, z
stfs z, 8(rdst)
};
#endif
}
void negate() {
@@ -371,6 +381,7 @@ struct TVec3<f32> : public Vec {
register f32 otheryz;
register f32 otherxy;
register f32 thisxy;
#ifdef __MWERKS__
asm {
psq_l thisyz, 4(pThis), 0, 0
psq_l otheryz, 4(pOther), 0, 0
@@ -380,6 +391,7 @@ struct TVec3<f32> : public Vec {
ps_madd otheryz, thisxy, otherxy, thisyz
ps_sum0 res, otheryz, thisyz, thisyz
};
#endif
return res;
}
@@ -462,7 +474,7 @@ struct TVec2 {
template <class T>
struct TBox {
TBox() : i(), f() {}
TBox(const TBox& other) : i(other.f), f(other.y) {}
TBox(const TBox& other) : i(other.i), f(other.f) {}
T i, f;
};
@@ -510,7 +522,7 @@ struct TBox2 : TBox<TVec2<T> > {
void set(const TBox2& other) { set(other.i, other.f); }
void set(const TVec2<f32>& i, const TVec2<f32>& f) { this->i.set(i), this->f.set(f); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { i.set(x0, y0); f.set(x1, y1); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { this->i.set(x0, y0); this->f.set(x1, y1); }
};
// clang-format on
+15
View File
@@ -2,6 +2,7 @@
#define JMATH_H
#include "dolphin/mtx.h"
#include "math.h"
void JMAMTXApplyScale(const Mtx, Mtx, f32, f32, f32);
void JMAEulerToQuat(s16 param_0, s16 param_1, s16 param_2, Quaternion* param_3);
@@ -21,9 +22,11 @@ inline f32 JMAFastReciprocal(f32 value) {
inline float __frsqrtes(register double f) {
register float out;
// clang-format off
#ifdef __MWERKS__
asm {
frsqrte out, f
}
#endif
// clang-format on
return out;
}
@@ -31,9 +34,11 @@ inline float __frsqrtes(register double f) {
inline f32 JMAFastSqrt(register f32 input) {
if (input > 0.0f) {
register f32 out;
#ifdef __MWERKS__
asm {
frsqrte out, input
}
#endif
return out * input;
} else {
return input;
@@ -51,6 +56,7 @@ inline f32 JMAHermiteInterpolation(register f32 p1, register f32 p2, register f3
register f32 ff27;
register f32 ff26;
// clang-format off
#ifdef __MWERKS__
asm {
fsubs ff31, p1, p2
fsubs ff30, p5, p2
@@ -67,6 +73,7 @@ inline f32 JMAHermiteInterpolation(register f32 p1, register f32 p2, register f3
fnmsubs ff25,ff31,ff25,ff26
}
#endif
// clang-format on
return ff25;
}
@@ -80,18 +87,21 @@ inline f32 fastReciprocal(f32 value) {
inline void gekko_ps_copy3(register void* dst, register const void* src) {
register f32 src0;
register f32 src1;
#ifdef __MWERKS__
asm {
psq_l src0, 0(src), 0, 0
lfs src1, 8(src)
psq_st src0, 0(dst), 0, 0
stfs src1, 8(dst)
};
#endif
}
inline void gekko_ps_copy6(register void* dst, register const void* src) {
register f32 src0;
register f32 src1;
register f32 src2;
#ifdef __MWERKS__
asm {
psq_l src0, 0(src), 0, 0
psq_l src1, 8(src), 0, 0
@@ -100,6 +110,7 @@ inline void gekko_ps_copy6(register void* dst, register const void* src) {
psq_st src1, 8(dst), 0, 0
psq_st src2, 16(dst), 0, 0
};
#endif
}
inline void gekko_ps_copy12(register void* dst, register const void* src) {
@@ -109,6 +120,7 @@ inline void gekko_ps_copy12(register void* dst, register const void* src) {
register f32 src3;
register f32 src4;
register f32 src5;
#ifdef __MWERKS__
asm {
psq_l src0, 0(src), 0, 0
psq_l src1, 8(src), 0, 0
@@ -123,6 +135,7 @@ inline void gekko_ps_copy12(register void* dst, register const void* src) {
psq_st src4, 32(dst), 0, 0
psq_st src5, 40(dst), 0, 0
};
#endif
}
inline void gekko_ps_copy16(register void* dst, register const void* src) {
@@ -134,6 +147,7 @@ inline void gekko_ps_copy16(register void* dst, register const void* src) {
register f32 src5;
register f32 src6;
register f32 src7;
#ifdef __MWERKS__
asm {
psq_l src0, 0(src), 0, 0
psq_l src1, 8(src), 0, 0
@@ -152,6 +166,7 @@ inline void gekko_ps_copy16(register void* dst, register const void* src) {
psq_st src6, 48(dst), 0, 0
psq_st src7, 56(dst), 0, 0
};
#endif
}
}; // namespace JMath
+1 -1
View File
@@ -114,7 +114,7 @@ struct TResourceContainer {
static JMessage::locale::parseCharacter_function sapfnParseCharacter_[5];
/* 0x00 */ u8 mEncodingType;
/* 0x04 */ int (*pfnParseCharacter_)(const char** string) const;
/* 0x04 */ int (*pfnParseCharacter_)(const char** string);
/* 0x08 */ TCResource resContainer_;
/* 0x18 */ TResource_color resColor_;
};
+1
View File
@@ -3,6 +3,7 @@
#include "SSystem/SComponent/c_xyz.h"
#include "dolphin/mtx.h"
#include "SSystem/SComponent/c_math.h"
inline bool cLib_IsZero(f32 value) {
return fabsf(value) < 8e-11f;
-6
View File
@@ -25,12 +25,6 @@ public:
/* 80192F10 */ dBrightCheck_c(JKRArchive*);
/* 80192F98 */ virtual ~dBrightCheck_c();
// TODO: probably fake, probably going to break some other function
// need to figure out this weird vtable padding issue
virtual void dummy() = 0;
virtual void dummy2() = 0;
virtual void dummy3() = 0;
/* 80193030 */ void screenSet();
/* 801934D0 */ void _move();
/* 80193508 */ void modeWait();
-6
View File
@@ -32,12 +32,6 @@ public:
/* 801924A0 */ virtual ~dFile_info_c();
// fake? needed to get vtable size correct
#ifdef DFILE_INFO_C_DUMMY_VIRTUAL
virtual void dummy() = 0;
virtual void dummy2() = 0;
#endif
void setBasePane(J2DPane* pane) { mFileInfo.mBasePane = pane; }
CPaneMgrAlpha* getDatBase() { return mDatBase; }
CPaneMgrAlpha* getNoDatBase() { return mNoDatBase; }
-6
View File
@@ -38,12 +38,6 @@ public:
/* 80191C18 */ virtual ~dFile_warning_c();
// fake? needed to get vtable size correct
#ifdef DFILE_WARNING_C_DUMMY_VIRTUAL
virtual void dummy() = 0;
virtual void dummy2() = 0;
#endif
u8 getStatus() { return mStatus; }
void draw() { _draw(); }
-5
View File
@@ -43,11 +43,6 @@ public:
/* 801AFBF4 */ virtual void draw();
/* 801AED64 */ virtual ~dMenu_Calibration_c();
// this is just a hack to get .data section to match
// not sure how to fix it without this atm
virtual void unk0() = 0;
virtual void unk1() = 0;
/* 0x004 */ JKRExpHeap* mpHeap;
/* 0x008 */ JKRArchive* mpArchive;
/* 0x00C */ J2DScreen* mpCalibrationMainScrn;
+6 -1
View File
@@ -39,6 +39,7 @@ inline void C_VECAdd(register const Vec* a, register const Vec* b, register Vec*
register f32 az;
register f32 sumz;
register f32 bz;
#ifdef __MWERKS__
asm {
psq_l axy, 0(a), 0, 0
psq_l bxy, 0(b), 0, 0
@@ -49,6 +50,7 @@ inline void C_VECAdd(register const Vec* a, register const Vec* b, register Vec*
ps_add sumz, az, bz
psq_st sumz, 8(ab), 1, 0
}
#endif
}
inline void C_VECSubtract(register const Vec* a, register const Vec* b, register Vec* ab) {
@@ -57,6 +59,7 @@ inline void C_VECSubtract(register const Vec* a, register const Vec* b, register
register f32 az;
register f32 subz;
register f32 bz;
#ifdef __MWERKS__
asm {
psq_l axy, 0(a), 0, 0
psq_l bxy, 0(b), 0, 0
@@ -67,6 +70,7 @@ inline void C_VECSubtract(register const Vec* a, register const Vec* b, register
ps_sub subz, az, bz
psq_st subz, 8(ab), 1, 0
}
#endif
}
inline f32 C_VECSquareMag(const Vec* v) {
@@ -74,6 +78,7 @@ inline f32 C_VECSquareMag(const Vec* v) {
register f32 z;
register f32 res;
register const f32* src = &v->x;
#ifdef __MWERKS__
asm {
psq_l x_y, 0(src), 0, 0
ps_mul x_y, x_y, x_y
@@ -81,7 +86,7 @@ inline f32 C_VECSquareMag(const Vec* v) {
ps_madd res, z, z, x_y
ps_sum0 res, res, x_y, x_y
}
;
#endif
return res;
}
+27 -21
View File
@@ -5,27 +5,27 @@
#include "macros.h"
#include "dolphin/dvd.h"
#include "dolphin/os/OSAlarm.h"
#include "dolphin/os/OSAlloc.h"
#include "dolphin/os/OSArena.h"
#include "dolphin/os/OSAudioSystem.h"
#include "dolphin/os/OSCache.h"
#include "dolphin/os/OSContext.h"
#include "dolphin/os/OSError.h"
#include "dolphin/os/OSExec.h"
#include "dolphin/os/OSFont.h"
#include "dolphin/os/OSInterrupt.h"
#include "dolphin/os/OSLink.h"
#include "dolphin/os/OSMemory.h"
#include "dolphin/os/OSMessage.h"
#include "dolphin/os/OSMutex.h"
#include "dolphin/os/OSReboot.h"
#include "dolphin/os/OSReset.h"
#include "dolphin/os/OSResetSW.h"
#include "dolphin/os/OSRtc.h"
#include "dolphin/os/OSSync.h"
#include "dolphin/os/OSThread.h"
#include "dolphin/os/OSTime.h"
#include "dolphin/os/OSAlarm.h" // IWYU pragma: export
#include "dolphin/os/OSAlloc.h" // IWYU pragma: export
#include "dolphin/os/OSArena.h" // IWYU pragma: export
#include "dolphin/os/OSAudioSystem.h" // IWYU pragma: export
#include "dolphin/os/OSCache.h" // IWYU pragma: export
#include "dolphin/os/OSContext.h" // IWYU pragma: export
#include "dolphin/os/OSError.h" // IWYU pragma: export
#include "dolphin/os/OSExec.h" // IWYU pragma: export
#include "dolphin/os/OSFont.h" // IWYU pragma: export
#include "dolphin/os/OSInterrupt.h" // IWYU pragma: export
#include "dolphin/os/OSLink.h" // IWYU pragma: export
#include "dolphin/os/OSMemory.h" // IWYU pragma: export
#include "dolphin/os/OSMessage.h" // IWYU pragma: export
#include "dolphin/os/OSMutex.h" // IWYU pragma: export
#include "dolphin/os/OSReboot.h" // IWYU pragma: export
#include "dolphin/os/OSReset.h" // IWYU pragma: export
#include "dolphin/os/OSResetSW.h" // IWYU pragma: export
#include "dolphin/os/OSRtc.h" // IWYU pragma: export
#include "dolphin/os/OSSync.h" // IWYU pragma: export
#include "dolphin/os/OSThread.h" // IWYU pragma: export
#include "dolphin/os/OSTime.h" // IWYU pragma: export
void OSReportInit(void);
void OSSwitchFiberEx(u32, u32, u32, u32, u32, u32);
@@ -145,10 +145,12 @@ inline s16 __OSf32tos16(register f32 inF) {
u32 tmp;
register u32* tmpPtr = &tmp;
// clang-format off
#ifdef __MWERKS__
asm {
psq_st inF, 0(tmpPtr), 0x1, 5
lha out, 0(tmpPtr)
}
#endif
// clang-format on
return out;
@@ -163,10 +165,12 @@ inline u8 __OSf32tou8(register f32 inF) {
u32 tmp;
register u32* tmpPtr = &tmp;
// clang-format off
#ifdef __MWERKS__
asm {
psq_st inF, 0(tmpPtr), 0x1, 2
lbz out, 0(tmpPtr)
}
#endif
// clang-format on
return out;
@@ -178,6 +182,7 @@ inline void OSf32tou8(f32* f, u8* out) {
static inline void OSInitFastCast(void) {
// clang-format off
#ifdef __MWERKS__
asm {
li r3, 4
oris r3, r3, 4
@@ -192,6 +197,7 @@ static inline void OSInitFastCast(void) {
oris r3, r3, 7
mtspr 0x395, r3
}
#endif
// clang-format on
}
+4
View File
@@ -48,6 +48,10 @@ inline BOOL checkEqual(s32 a, s32 b) {
return (u32)__cntlzw(a - b) >> 5;
}
#ifndef __MWERKS__
void* __memcpy(void*, const void*, int);
#endif
#define FAST_DIV(x, n) (x >> (n / 2))
#define SQUARE(x) ((x) * (x))