From bf4053fefa301a307065a07ffc4c3f9f970f2638 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 27 Jan 2025 01:01:05 -0500 Subject: [PATCH] Fix spurious differences when using `ninja diff` (#2294) * Fix spurious differences when using ninja diff * Fix some clangd errors/warnings --- .clangd | 3 + config/GZ2E01/config.yml | 3 + config/GZ2E01/symbols.txt | 8 +-- config/ShieldD/symbols.txt | 4 +- include/JSystem/J2DGraph/J2DAnimation.h | 2 + .../JSystem/J3DGraphAnimator/J3DSkinDeform.h | 2 + include/JSystem/J3DGraphBase/J3DStruct.h | 4 ++ include/JSystem/J3DGraphBase/J3DTevs.h | 4 +- include/JSystem/J3DGraphBase/J3DTransform.h | 12 ++++ include/JSystem/JAudio2/JASDSPInterface.h | 2 +- include/JSystem/JAudio2/JASHeapCtrl.h | 12 ++-- include/JSystem/JGeometry.h | 16 ++++- include/JSystem/JMath/JMath.h | 15 ++++ include/JSystem/JMessage/resource.h | 2 +- include/SSystem/SComponent/c_lib.h | 1 + include/d/d_bright_check.h | 6 -- include/d/d_file_sel_info.h | 6 -- include/d/d_file_sel_warning.h | 6 -- include/d/d_menu_calibration.h | 5 -- include/dolphin/mtx/vec.h | 7 +- include/dolphin/os.h | 48 +++++++------ include/global.h | 4 ++ src/JSystem/J3DGraphBase/J3DGD.cpp | 5 +- src/JSystem/J3DGraphBase/J3DSys.cpp | 4 +- src/JSystem/J3DGraphBase/J3DTevs.cpp | 2 +- src/JSystem/J3DU/J3DUClipper.cpp | 4 +- src/JSystem/JAudio2/JASDSPInterface.cpp | 15 +--- src/JSystem/JAudio2/JAUSectionHeap.cpp | 2 - src/JSystem/JAudio2/dsptask.cpp | 2 +- src/JSystem/JKernel/JKRAram.cpp | 2 - src/JSystem/JMath/JMATrigonometric.cpp | 15 ++-- .../JStudio/JStudio/jstudio-object.cpp | 2 - .../MSL/MSL_C/MSL_Common/Include/math.h | 4 ++ src/d/actor/d_a_npc.cpp | 2 - src/d/actor/d_a_player.cpp | 18 ++--- src/d/d_bright_check.cpp | 19 ++++- src/d/d_camera.cpp | 2 - src/d/d_ev_camera.cpp | 2 - src/d/d_file_sel_info.cpp | 20 +++++- src/d/d_menu_calibration.cpp | 17 ++++- src/d/d_menu_dmap.cpp | 2 - src/d/d_msg_class.cpp | 2 - src/d/d_msg_scrn_talk.cpp | 2 - src/d/d_msg_unit.cpp | 2 - src/d/d_name.cpp | 4 +- src/d/d_select_cursor.cpp | 40 +++++++++-- src/d/d_shop_system.cpp | 71 ++++++++++++++++++- src/dolphin/vi/vi.c | 4 +- 48 files changed, 296 insertions(+), 140 deletions(-) diff --git a/.clangd b/.clangd index a881cfe028b..9e0e2f2e6a0 100644 --- a/.clangd +++ b/.clangd @@ -1,5 +1,8 @@ CompileFlags: Add: [-Wno-c++11-compat-deprecated-writable-strings, -Wno-extern-initializer, -Wno-multichar] +Diagnostics: + Suppress: + - "warn_char_constant_too_large" --- If: PathMatch: .*/*.inc diff --git a/config/GZ2E01/config.yml b/config/GZ2E01/config.yml index 1926345eb4f..053f24d9a1c 100644 --- a/config/GZ2E01/config.yml +++ b/config/GZ2E01/config.yml @@ -6,6 +6,9 @@ splits: config/GZ2E01/splits.txt symbols: config/GZ2E01/symbols.txt mw_comment_version: 11 # GC Linker 2.7 quick_analysis: true # Initial analysis completed +force_active: [ + _MetroTRK_Has_Framing, +] modules: - object: files/RELS.arc:rels/mmem/f_pc_profile_lst.rel hash: 183231361986731ad6bd26624a03a44dceda905b diff --git a/config/GZ2E01/symbols.txt b/config/GZ2E01/symbols.txt index beff6feffed..76be6e38c89 100644 --- a/config/GZ2E01/symbols.txt +++ b/config/GZ2E01/symbols.txt @@ -17395,7 +17395,7 @@ sMixFuncs__9JASDriver = .rodata:0x8039B2E0; // type:object size:0x10 scope:globa @stringBase0 = .rodata:0x8039B2F0; // type:object size:0x48 scope:local align:4 data:string_table @stringBase0 = .rodata:0x8039B338; // type:object size:0x13 scope:local align:4 data:string_table DSPADPCM_FILTER__6JASDsp = .rodata:0x8039B360; // type:object size:0x40 scope:global align:4 -DSPRES_FILTER__6JASDsp = .rodata:0x8039B3A0; // type:object size:0x500 scope:global align:4 +DSPRES_FILTER__6JASDsp = .rodata:0x8039B3A0; // type:object size:0x500 scope:global align:4 noreloc connect_table$463 = .rodata:0x8039B8A0; // type:object size:0x18 scope:local align:4 @81 = .rodata:0x8039B8B8; // type:object size:0x1A scope:local align:4 data:string @88 = .rodata:0x8039B8D4; // type:object size:0x1F scope:local align:4 data:string @@ -17473,7 +17473,7 @@ j2dDefaultIndTevStageInfo = .rodata:0x803A1BF4; // type:object size:0xC scope:gl @1849 = .rodata:0x803A1C20; // type:object size:0x10 scope:local align:4 data:4byte @3028 = .rodata:0x803A1C30; // type:object size:0x10 scope:local align:4 data:4byte @3037 = .rodata:0x803A1C40; // type:object size:0x14 scope:local align:4 data:4byte -@stringBase0 = .rodata:0x803A1C58; // type:object size:0x4 scope:local align:4 data:string_table +@stringBase0 = .rodata:0x803A1C58; // type:object size:0x3 scope:local align:4 data:string_table ...rodata.0 = .rodata:0x803A1C60; // type:label scope:local @1508 = .rodata:0x803A1C60; // type:object size:0x10 scope:local align:4 data:4byte @1557 = .rodata:0x803A1C70; // type:object size:0x10 scope:local align:4 @@ -20087,7 +20087,7 @@ table_list$151 = .data:0x803C78A8; // type:object size:0x10 scope:local align:4 history$267 = .data:0x803C78B8; // type:object size:0x28 scope:local align:4 data:4byte __vt__14JASAudioThread = .data:0x803C78E0; // type:object size:0x10 scope:global align:4 SEND_TABLE__6JASDsp = .data:0x803C78F0; // type:object size:0x18 scope:global align:4 -jdsp = .data:0x803C7920; // type:object size:0x1F00 scope:global align:4 noreloc +jdsp = .data:0x803C7920; // type:object size:0x1F00 scope:global align:32 noreloc __vt__10JAIAudible = .data:0x803C9820; // type:object size:0x14 scope:global align:4 __vt__11JAIAudience = .data:0x803C9838; // type:object size:0x20 scope:global align:4 __vt__5JAISe = .data:0x803C9858; // type:object size:0x58 scope:global align:4 @@ -26424,7 +26424,7 @@ j3dDefaultTevSwapMode = .sdata2:0x804563E4; // type:object size:0x4 scope:global j3dDefaultTevSwapModeTable = .sdata2:0x804563E8; // type:object size:0x4 scope:global align:4 data:byte j3dDefaultBlendInfo = .sdata2:0x804563EC; // type:object size:0x4 scope:global align:4 data:4byte j3dDefaultColorChanInfo = .sdata2:0x804563F0; // type:object size:0x8 scope:global align:4 data:byte -data_804563F8 = .sdata2:0x804563F8; // type:object size:0x2 scope:global align:2 data:byte +j3dDefaultTevSwapTableID = .sdata2:0x804563F8; // type:object size:0x1 scope:global align:1 data:byte j3dDefaultAlphaCmpID = .sdata2:0x804563FA; // type:object size:0x2 scope:global align:2 data:2byte j3dDefaultZModeID = .sdata2:0x804563FC; // type:object size:0x2 scope:global align:2 data:2byte @781 = .sdata2:0x80456400; // type:object size:0x4 scope:local align:4 data:float diff --git a/config/ShieldD/symbols.txt b/config/ShieldD/symbols.txt index 2c62433e7f5..c06bbeeb645 100644 --- a/config/ShieldD/symbols.txt +++ b/config/ShieldD/symbols.txt @@ -31999,7 +31999,7 @@ sCurveTableSqRoot__13JASOscillator = .rodata:0x80654DE8; // type:object size:0x4 sCurveTableSquare__13JASOscillator = .rodata:0x80654E2C; // type:object size:0x44 scope:global sMixFuncs__9JASDriver = .rodata:0x80654E70; // type:object size:0x10 scope:global DSPADPCM_FILTER__6JASDsp = .rodata:0x80654E80; // type:object size:0x40 scope:global -DSPRES_FILTER__6JASDsp = .rodata:0x80654EC0; // type:object size:0x500 scope:global +DSPRES_FILTER__6JASDsp = .rodata:0x80654EC0; // type:object size:0x500 scope:global noreloc @LOCAL@setBusConnect__Q26JASDsp8TChannelFUcUc@connect_table = .rodata:0x806553C0; // type:object size:0x18 scope:local @stringBase0 = .rodata:0x806553D8; // type:object size:0x6E scope:local data:string_table @stringBase0 = .rodata:0x80655448; // type:object size:0x163 scope:local data:string_table @@ -69752,7 +69752,7 @@ j3dDefaultTevKColor = .sdata2:0x80752AD8; // type:object size:0x4 scope:global d j3dDefaultTevSwapModeTable = .sdata2:0x80752ADC; // type:object size:0x4 scope:global j3dDefaultBlendInfo = .sdata2:0x80752AE0; // type:object size:0x4 scope:global j3dDefaultColorChanInfo = .sdata2:0x80752AE8; // type:object size:0x8 scope:global -lbl_80752AF0 = .sdata2:0x80752AF0; // type:object size:0x1 data:byte +j3dDefaultTevSwapTableID = .sdata2:0x80752AF0; // type:object size:0x1 data:byte j3dDefaultAlphaCmpID = .sdata2:0x80752AF2; // type:object size:0x2 scope:global data:2byte j3dDefaultZModeID = .sdata2:0x80752AF4; // type:object size:0x2 scope:global data:2byte @12585 = .sdata2:0x80752AF8; // type:object size:0x4 scope:local data:float diff --git a/include/JSystem/J2DGraph/J2DAnimation.h b/include/JSystem/J2DGraph/J2DAnimation.h index cba04c924f1..1b4f5c20384 100644 --- a/include/JSystem/J2DGraph/J2DAnimation.h +++ b/include/JSystem/J2DGraph/J2DAnimation.h @@ -495,6 +495,7 @@ inline f32 J2DHermiteInterpolation(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(register f32 pp1, register s16* pp2, reg fmadds fout, ff4, ff2, fout fsubs fout, fout, ff0 } +#endif // clang-format on return fout; } diff --git a/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h b/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h index 2cb33d13935..5e03122ce3d 100644 --- a/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h +++ b/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h @@ -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 */ diff --git a/include/JSystem/J3DGraphBase/J3DStruct.h b/include/JSystem/J3DGraphBase/J3DStruct.h index 80f1cdabe18..29fd75b2080 100644 --- a/include/JSystem/J3DGraphBase/J3DStruct.h +++ b/include/JSystem/J3DGraphBase/J3DStruct.h @@ -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 diff --git a/include/JSystem/J3DGraphBase/J3DTevs.h b/include/JSystem/J3DGraphBase/J3DTevs.h index 136df1f7a51..f25c0a1a11c 100644 --- a/include/JSystem/J3DGraphBase/J3DTevs.h +++ b/include/JSystem/J3DGraphBase/J3DTevs.h @@ -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); } diff --git a/include/JSystem/J3DGraphBase/J3DTransform.h b/include/JSystem/J3DGraphBase/J3DTransform.h index 9225c44605c..28b79d8a9a6 100644 --- a/include/JSystem/J3DGraphBase/J3DTransform.h +++ b/include/JSystem/J3DGraphBase/J3DTransform.h @@ -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 */ diff --git a/include/JSystem/JAudio2/JASDSPInterface.h b/include/JSystem/JAudio2/JASDSPInterface.h index 996053975bd..370fe738e45 100644 --- a/include/JSystem/JAudio2/JASDSPInterface.h +++ b/include/JSystem/JAudio2/JASDSPInterface.h @@ -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; diff --git a/include/JSystem/JAudio2/JASHeapCtrl.h b/include/JSystem/JAudio2/JASHeapCtrl.h index 9c174511aeb..5eae318da5d 100644 --- a/include/JSystem/JAudio2/JASHeapCtrl.h +++ b/include/JSystem/JAudio2/JASHeapCtrl.h @@ -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 class JASMemPool_MultiThreaded : public JASGenericMemPool { public: void newMemPool(int param_0) { - JASThreadingModel::InterruptsDisable >::Lock lock(*this); + typename JASThreadingModel::InterruptsDisable >::Lock lock(*this); JASGenericMemPool::newMemPool(sizeof(T), param_0); } void* alloc(size_t count) { - JASThreadingModel::InterruptsDisable >::Lock lock(*this); + typename JASThreadingModel::InterruptsDisable >::Lock lock(*this); return JASGenericMemPool::alloc(count); } void free(void* ptr, u32 param_1) { - JASThreadingModel::InterruptsDisable >::Lock lock(*this); + typename JASThreadingModel::InterruptsDisable >::Lock lock(*this); JASGenericMemPool::free(ptr, param_1); } }; diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 141b6723669..281f7d5b402 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -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 : 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 : public Vec { fmuls z, za, zb stfs z, 8(dst) }; +#endif } inline void mul(const TVec3& a) { @@ -273,6 +277,7 @@ struct TVec3 : 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 : public Vec { ps_muls0 zres, z, sc psq_st zres, 8(dst), 1, 0 }; +#endif } void scale(register f32 sc, const TVec3& other) { @@ -289,6 +295,7 @@ struct TVec3 : 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 : public Vec { ps_muls0 zres, z, sc psq_st zres, 8(dst), 1, 0 }; +#endif } void scaleAdd(register f32 sc, const TVec3& a, const TVec3& b) { @@ -308,6 +316,7 @@ struct TVec3 : 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 : public Vec { fneg z, z stfs z, 8(rdst) }; +#endif } void negate() { @@ -371,6 +381,7 @@ struct TVec3 : 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 : public Vec { ps_madd otheryz, thisxy, otherxy, thisyz ps_sum0 res, otheryz, thisyz, thisyz }; +#endif return res; } @@ -462,7 +474,7 @@ struct TVec2 { template 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 > { void set(const TBox2& other) { set(other.i, other.f); } void set(const TVec2& i, const TVec2& 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 diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h index e37460e115f..0968feed00b 100644 --- a/include/JSystem/JMath/JMath.h +++ b/include/JSystem/JMath/JMath.h @@ -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 diff --git a/include/JSystem/JMessage/resource.h b/include/JSystem/JMessage/resource.h index a322c5b952d..4a4b990dc3c 100644 --- a/include/JSystem/JMessage/resource.h +++ b/include/JSystem/JMessage/resource.h @@ -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_; }; diff --git a/include/SSystem/SComponent/c_lib.h b/include/SSystem/SComponent/c_lib.h index c6ee07af1f9..99693a03050 100644 --- a/include/SSystem/SComponent/c_lib.h +++ b/include/SSystem/SComponent/c_lib.h @@ -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; diff --git a/include/d/d_bright_check.h b/include/d/d_bright_check.h index bab911da219..53c09629196 100644 --- a/include/d/d_bright_check.h +++ b/include/d/d_bright_check.h @@ -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(); diff --git a/include/d/d_file_sel_info.h b/include/d/d_file_sel_info.h index ded203c3089..0d75e7f9d61 100644 --- a/include/d/d_file_sel_info.h +++ b/include/d/d_file_sel_info.h @@ -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; } diff --git a/include/d/d_file_sel_warning.h b/include/d/d_file_sel_warning.h index 8164ed4afda..640f26e99cb 100644 --- a/include/d/d_file_sel_warning.h +++ b/include/d/d_file_sel_warning.h @@ -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(); } diff --git a/include/d/d_menu_calibration.h b/include/d/d_menu_calibration.h index 4498fa31957..f8abc508b36 100644 --- a/include/d/d_menu_calibration.h +++ b/include/d/d_menu_calibration.h @@ -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; diff --git a/include/dolphin/mtx/vec.h b/include/dolphin/mtx/vec.h index 91216e74642..d3f7a8e3659 100644 --- a/include/dolphin/mtx/vec.h +++ b/include/dolphin/mtx/vec.h @@ -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; } diff --git a/include/dolphin/os.h b/include/dolphin/os.h index 1537226f902..0fbf83fce42 100644 --- a/include/dolphin/os.h +++ b/include/dolphin/os.h @@ -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 } diff --git a/include/global.h b/include/global.h index d626b182aba..5cb534ede82 100644 --- a/include/global.h +++ b/include/global.h @@ -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)) diff --git a/src/JSystem/J3DGraphBase/J3DGD.cpp b/src/JSystem/J3DGraphBase/J3DGD.cpp index 5e361862b9e..9f247100e28 100644 --- a/src/JSystem/J3DGraphBase/J3DGD.cpp +++ b/src/JSystem/J3DGraphBase/J3DGD.cpp @@ -485,8 +485,7 @@ void J3DGDSetTevOrder(GXTevStageID stage, GXTexCoordID coord0, GXTexMapID map0, coord0 = coord0 >= GX_MAXCOORD ? GX_TEXCOORD0 : coord0; coord1 = coord1 >= GX_MAXCOORD ? GX_TEXCOORD0 : coord1; GDOverflowCheck(5); - static u8 c2r[32] = {0, 1, 0, 1, 0, 1, 7, 5, 6, 0, 0, 0, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + static u8 c2r[] = {0, 1, 0, 1, 0, 1, 7, 5, 6, 0, 0, 0, 0, 0, 0, 7}; J3DGDWriteBPCmd((map0 & 7) | coord0 << 3 | (map0 != GX_TEXMAP_NULL && !(map0 & GX_TEXMAP_DISABLE)) << 6 | c2r[channel0 & 0xf] << 7 | (map1 & 7) << 0xc | coord1 << 0xf | @@ -662,4 +661,4 @@ void J3DFifoLoadTexCached(GXTexMapID id, u32 param_1, GXTexCacheSize param_2, u3 J3DFifoLoadBPCmd(param_3 >> 5 | (param_4 + 3) << 0xf | (param_4 + 3) << 0x12 | J3DTexImage2Ids[id] << 0x18); } -} \ No newline at end of file +} diff --git a/src/JSystem/J3DGraphBase/J3DSys.cpp b/src/JSystem/J3DGraphBase/J3DSys.cpp index 8e6e64f7abe..8f48ba181bc 100644 --- a/src/JSystem/J3DGraphBase/J3DSys.cpp +++ b/src/JSystem/J3DGraphBase/J3DSys.cpp @@ -131,7 +131,7 @@ void J3DSys::setTexCacheRegion(GXTexCacheSize size) { } /* 803CD8A0-803CD8B0 02A9C0 0010+00 1/1 0/0 0/0 .data NullTexData */ -SECTION_DATA static u8 NullTexData[16] = { +SECTION_DATA static u8 NullTexData[16] ALIGN_DECL(32) = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; @@ -397,4 +397,4 @@ void J3DSys::reinitPixelProc() { /* ############################################################################################## */ /* 80451598-804515A0 000A98 0004+04 0/0 1/1 0/0 .sbss j3dDefaultViewNo */ -u32 j3dDefaultViewNo; \ No newline at end of file +u32 j3dDefaultViewNo; diff --git a/src/JSystem/J3DGraphBase/J3DTevs.cpp b/src/JSystem/J3DGraphBase/J3DTevs.cpp index 3cf86c18ee7..36c740f6a34 100644 --- a/src/JSystem/J3DGraphBase/J3DTevs.cpp +++ b/src/JSystem/J3DGraphBase/J3DTevs.cpp @@ -556,7 +556,7 @@ extern const J3DColorChanInfo j3dDefaultColorChanInfo = { }; /* 804563F8-804563FA 0049F8 0002+00 0/0 1/1 0/0 .sdata2 None */ -extern const u8 data_804563F8 = 0x1B; +extern const u8 j3dDefaultTevSwapTableID = 0x1B; /* 804563FA-804563FC 0049FA 0002+00 0/0 1/1 0/0 .sdata2 j3dDefaultAlphaCmpID */ const u16 j3dDefaultAlphaCmpID = 0x00E7; diff --git a/src/JSystem/J3DU/J3DUClipper.cpp b/src/JSystem/J3DU/J3DUClipper.cpp index 1561d917cfb..cd2e9c28940 100644 --- a/src/JSystem/J3DU/J3DUClipper.cpp +++ b/src/JSystem/J3DU/J3DUClipper.cpp @@ -182,7 +182,5 @@ static char const* const stringBase_8039A9B8 = " J3DUClipper::mNear = %f"; /* 8039A9D1-8039A9F0 027031 0018+07 0/0 0/0 0/0 .rodata None */ static char const* const stringBase_8039A9D1 = " J3DUClipper::mFar = %f"; -/* @stringBase0 padding */ -static char const* const pad_8039A9E9 = "\0\0\0\0\0\0"; -/* 8039A984-8039A984 026FE4 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 8039A984-8039A984 026FE4 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/JSystem/JAudio2/JASDSPInterface.cpp b/src/JSystem/JAudio2/JASDSPInterface.cpp index 2580802278d..605724dc8dd 100644 --- a/src/JSystem/JAudio2/JASDSPInterface.cpp +++ b/src/JSystem/JAudio2/JASDSPInterface.cpp @@ -428,7 +428,7 @@ void JASDsp::initBuffer() { } /* 803C78F0-803C7920 024A10 0018+18 1/1 0/0 0/0 .data SEND_TABLE__6JASDsp */ -u16 JASDsp::SEND_TABLE[12 + 12 /* padding */] = { +u16 JASDsp::SEND_TABLE[] = { 0x0D00, 0x0D60, 0x0DC8, @@ -441,19 +441,6 @@ u16 JASDsp::SEND_TABLE[12 + 12 /* padding */] = { 0x0B00, 0x09A0, 0x0000, - /* padding */ - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, }; /* 8029DB78-8029DCA4 2984B8 012C+00 1/1 1/1 0/0 .text diff --git a/src/JSystem/JAudio2/JAUSectionHeap.cpp b/src/JSystem/JAudio2/JAUSectionHeap.cpp index ced71b66ca6..a036282c89b 100644 --- a/src/JSystem/JAudio2/JAUSectionHeap.cpp +++ b/src/JSystem/JAudio2/JAUSectionHeap.cpp @@ -310,8 +310,6 @@ void* JAUSection::newCopy(void const* param_0, u32 param_1, s32 param_2) { #pragma force_active on SECTION_DEAD static char const* const stringBase_8039B974 = "index out of range of bitset::test"; SECTION_DEAD static char const* const stringBase_8039B997 = "index out of range of bitset::set"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_8039B9B9 = "\0\0\0\0\0\0"; #pragma pop /* 802A5854-802A5948 2A0194 00F4+00 0/0 1/1 0/0 .text newWaveBank__10JAUSectionFUlPCv */ diff --git a/src/JSystem/JAudio2/dsptask.cpp b/src/JSystem/JAudio2/dsptask.cpp index 3ba233405ab..2296db43e9e 100644 --- a/src/JSystem/JAudio2/dsptask.cpp +++ b/src/JSystem/JAudio2/dsptask.cpp @@ -31,7 +31,7 @@ void DspHandShake(void*) { /* ############################################################################################## */ /* 803C7920-803C9820 024A40 1F00+00 1/1 0/0 0/0 .data jdsp */ -static u8 jdsp[7936] = { +static u8 jdsp[7936] ALIGN_DECL(32) = { 0x02, 0x9F, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x02, 0x9F, 0x06, 0xA5, 0x02, 0x9F, 0x00, 0x4E, 0x12, 0x05, 0x02, 0xBF, 0x00, 0x57, 0x81, 0x00, 0x00, 0x9F, 0x10, 0x00, diff --git a/src/JSystem/JKernel/JKRAram.cpp b/src/JSystem/JKernel/JKRAram.cpp index 7b6ed3f78d2..36970e97ec6 100644 --- a/src/JSystem/JKernel/JKRAram.cpp +++ b/src/JSystem/JKernel/JKRAram.cpp @@ -536,5 +536,3 @@ static u8* nextSrcData(u8* current) { /* ############################################################################################## */ /* 8039D0A6-8039D0B8 029706 000E+04 0/0 0/0 0/0 .rodata None */ static const char* stringBase_8039D0A6 = "bad aramSync\n"; -/* @stringBase0 padding */ -static const char* pad_8039D0B4 = "\0\0\0"; \ No newline at end of file diff --git a/src/JSystem/JMath/JMATrigonometric.cpp b/src/JSystem/JMath/JMATrigonometric.cpp index 0e9936b3010..b5b0ca4b022 100644 --- a/src/JSystem/JMath/JMATrigonometric.cpp +++ b/src/JSystem/JMath/JMATrigonometric.cpp @@ -9,13 +9,17 @@ #include "dol2asm.h" #include "global.h" +static f32 dummy() { + return 0.0f; +} + namespace std { template struct pair { A1 a1; B1 b1; pair() { - f32 tmp = FLOAT_LABEL(zero); + f32 tmp = 0.0f; a1 = tmp; b1 = tmp; // a1 = A1(); @@ -24,9 +28,6 @@ struct pair { }; } // namespace std -// fake, but couldn't find another way to make 0.0f go first in sdata2 in this TU -SECTION_SDATA2 static f32 zero[1 + 1] = {0.0f, 0.0f}; - inline f64 getConst() { return 6.2831854820251465; } @@ -54,7 +55,7 @@ struct TAtanTable { for (int i = 0; i < (u32)1024; i++) { table[i] = atan(getConst2() * i); } - table[0] = FLOAT_LABEL(zero); + table[0] = 0.0f; table[1024] = 0.7853982; // 0.25 * PI } }; @@ -66,7 +67,7 @@ struct TAsinAcosTable { for (int i = 0; i < 1024; i++) { table[i] = asin(getConst2() * i); } - table[0] = FLOAT_LABEL(zero); + table[0] = 0.0f; table[1024] = 0.7853982; // 0.25 * PI } }; @@ -87,4 +88,4 @@ TAtanTable atanTable_; /* 8044AA40-8044BA60 077760 1020+00 1/1 1/1 0/0 .bss asinAcosTable___5JMath */ TAsinAcosTable asinAcosTable_; -} // namespace JMath \ No newline at end of file +} // namespace JMath diff --git a/src/JSystem/JStudio/JStudio/jstudio-object.cpp b/src/JSystem/JStudio/JStudio/jstudio-object.cpp index f021932f035..59520072140 100644 --- a/src/JSystem/JStudio/JStudio/jstudio-object.cpp +++ b/src/JSystem/JStudio/JStudio/jstudio-object.cpp @@ -2321,8 +2321,6 @@ void func_8028892C() { #pragma push #pragma force_active on SECTION_DEAD static char const* const stringBase_8039AB78 = "(unnamed)"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_8039AB82 = "\0\0\0\0\0"; #pragma pop /* 804511F8-80451200 0006F8 0008+00 0/0 1/1 0/0 .sbss None */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h index 2beaeba9fdd..2d10346881f 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h @@ -28,6 +28,10 @@ double cos(double); float cosf(float); double exp(double); +extern double __frsqrte(double); +extern float __fres(float); + +extern double __fabs(double); extern float __fabsf(float); inline double fabs(double f) { return __fabs(f); diff --git a/src/d/actor/d_a_npc.cpp b/src/d/actor/d_a_npc.cpp index bef8fe3ecd9..7db452cbe7b 100644 --- a/src/d/actor/d_a_npc.cpp +++ b/src/d/actor/d_a_npc.cpp @@ -5364,8 +5364,6 @@ SECTION_DEAD static char const* const stringBase_803929DA = "%d, \t// デバ #pragma push #pragma force_active on SECTION_DEAD static char const* const stringBase_803929F7 = "%d, \t// デバグ情報ON\n"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_80392A12 = "\0\0\0\0\0"; #pragma pop /* 80450FF8-80451000 0004F8 0008+00 0/0 1/1 0/0 .sbss None */ diff --git a/src/d/actor/d_a_player.cpp b/src/d/actor/d_a_player.cpp index c5becca15ea..5c62029ba61 100644 --- a/src/d/actor/d_a_player.cpp +++ b/src/d/actor/d_a_player.cpp @@ -294,16 +294,16 @@ void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType) { /* 8015EF84-8015F068 1598C4 00E4+00 3/3 0/0 0/0 .text loadData__14daPy_anmHeap_cFUs */ void* daPy_anmHeap_c::loadData(u16 i_resId) { - static const char twglArcName[12] = "TWGate_Lk"; - static const char twgwArcName[12] = "TWGate_Wf"; - static const char sumouArcName[8] = "alSumou"; - static const char ocArcName[8] = "B_oh"; - static const char drArcName[8] = "B_DR"; - static const char msDemoArcName[8] = "Lv6Gate"; - static const char lastGanonArcName[8] = "B_gnd"; - static const char pigGanonArcName[8] = "B_mgn"; + static const char twglArcName[] = "TWGate_Lk"; + static const char twgwArcName[] = "TWGate_Wf"; + static const char sumouArcName[] = "alSumou"; + static const char ocArcName[] = "B_oh"; + static const char drArcName[] = "B_DR"; + static const char msDemoArcName[] = "Lv6Gate"; + static const char lastGanonArcName[] = "B_gnd"; + static const char pigGanonArcName[] = "B_mgn"; - static const char* arcName[8] = { + static const char* arcName[] = { sumouArcName, ocArcName, twglArcName, twgwArcName, drArcName, msDemoArcName, lastGanonArcName, pigGanonArcName, }; diff --git a/src/d/d_bright_check.cpp b/src/d/d_bright_check.cpp index 0de3084493f..fd758d016f6 100644 --- a/src/d/d_bright_check.cpp +++ b/src/d/d_bright_check.cpp @@ -11,6 +11,23 @@ #include "d/d_msg_string.h" #include "m_Do/m_Do_controller_pad.h" +// Need 0x10 bytes of padding with no symbol between dBrightCheck_c::__vtable and the end of .data +// This is likely caused by the vtable of an abstract base class getting put there and then stripped out. +// Not sure which abstract base class could go there though, so we simulate it with some dummy classes for now. +class dummy_abstract_class { +public: + virtual void virt_func_0() = 0; + virtual void virt_func_1() = 0; +}; +class dummy_child_class : dummy_abstract_class { + virtual void virt_func_0(); + virtual void virt_func_1(); +}; +static dummy_child_class dummy() { + dummy_child_class temp; + return temp; +} + /* 803BB5B0-803BB5BC 0186D0 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ static u8 cNullVec__6Z2Calc[12] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -135,4 +152,4 @@ void dBrightCheck_c::_draw() { void dDlst_BrightCheck_c::draw() { J2DGrafContext* graf_ctx = dComIfGp_getCurrentGrafPort(); Scr->draw(0.0f, 0.0f, graf_ctx); -} \ No newline at end of file +} diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index 1b278cfaa42..ed1d2290a52 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -3745,8 +3745,6 @@ bool dCamera_c::eventCamera(s32 param_0){ #pragma push #pragma force_active on SECTION_DEAD static char const* const stringBase_803942FB = "Continue"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_80394304 = "\0\0\0"; #pragma pop /* 8018050C-801806D4 17AE4C 01C8+00 1/0 0/0 0/0 .text currentEvCamera__9dCamera_cFv */ diff --git a/src/d/d_ev_camera.cpp b/src/d/d_ev_camera.cpp index 4b34ff5e087..251dc07b2ea 100644 --- a/src/d/d_ev_camera.cpp +++ b/src/d/d_ev_camera.cpp @@ -2044,8 +2044,6 @@ SECTION_DEAD static char const* const stringBase_8037AD4F = "ooxxxx"; SECTION_DEAD static char const* const stringBase_8037AD56 = "Set2"; SECTION_DEAD static char const* const stringBase_8037AD5B = "Use2"; SECTION_DEAD static char const* const stringBase_8037AD60 = "xxooox"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_8037AD67 = ""; #pragma pop /* 80096EDC-80097694 09181C 07B8+00 0/0 1/0 0/0 .text bspTransEvCamera__9dCamera_cFv */ diff --git a/src/d/d_file_sel_info.cpp b/src/d/d_file_sel_info.cpp index 33ea12f6e42..a1f37588a4f 100644 --- a/src/d/d_file_sel_info.cpp +++ b/src/d/d_file_sel_info.cpp @@ -4,16 +4,30 @@ */ #define NO_INLINE_DLSTBASE_DRAW -#define DFILE_INFO_C_DUMMY_VIRTUAL #include "d/d_file_sel_info.h" #include "JSystem/J2DGraph/J2DScreen.h" #include "JSystem/J2DGraph/J2DTextBox.h" #include "d/d_com_inf_game.h" #include "d/d_meter2_info.h" -#include "d/d_pane_class.h" +#include "d/d_pane_class_alpha.h" #include "stdio.h" +// Need 0xC bytes of padding with no symbol between dFile_info_c::__vtable and the end of .data +// This is likely caused by the vtable of an abstract base class getting put there and then stripped out. +// Not sure which abstract base class could go there though, so we simulate it with some dummy classes for now. +class dummy_abstract_class { +public: + virtual void virt_func_0() = 0; +}; +class dummy_child_class : dummy_abstract_class { + virtual void virt_func_0(); +}; +static dummy_child_class dummy() { + dummy_child_class temp; + return temp; +} + /* 803BB498-803BB4A8 0185B8 000C+04 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ static u8 cNullVec__6Z2Calc[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -208,4 +222,4 @@ void dDlst_FileInfo_c::draw() { } Scr->draw(0.0f, 0.0f, graf_ctx); -} \ No newline at end of file +} diff --git a/src/d/d_menu_calibration.cpp b/src/d/d_menu_calibration.cpp index e360a661bff..e6d9b2e40c2 100644 --- a/src/d/d_menu_calibration.cpp +++ b/src/d/d_menu_calibration.cpp @@ -11,6 +11,21 @@ #include "d/d_msg_string.h" #include "m_Do/m_Do_controller_pad.h" +// Need 0xC bytes of padding with no symbol between dMenu_Calibration_c::__vtable and the end of .data +// This is likely caused by the vtable of an abstract base class getting put there and then stripped out. +// Not sure which abstract base class could go there though, so we simulate it with some dummy classes for now. +class dummy_abstract_class { +public: + virtual void virt_func_0() = 0; +}; +class dummy_child_class : dummy_abstract_class { + virtual void virt_func_0(); +}; +static dummy_child_class dummy() { + dummy_child_class temp; + return temp; +} + /* 803BC238-803BC244 019358 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ static u8 cNullVec__6Z2Calc[12] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -348,4 +363,4 @@ void dMenu_Calibration_c::setHIO(bool i_useHIO) { /* 801AFBF4-801AFC14 1AA534 0020+00 1/0 0/0 0/0 .text draw__19dMenu_Calibration_cFv */ void dMenu_Calibration_c::draw() { _draw(); -} \ No newline at end of file +} diff --git a/src/d/d_menu_dmap.cpp b/src/d/d_menu_dmap.cpp index 0d61363b690..6f524c9f6ab 100644 --- a/src/d/d_menu_dmap.cpp +++ b/src/d/d_menu_dmap.cpp @@ -1782,8 +1782,6 @@ void dMenu_Dmap_c::mapControl() { #pragma force_active on SECTION_DEAD static char const* const stringBase_80395826 = "/res/FieldMap/res-d.arc"; SECTION_DEAD static char const* const stringBase_8039583E = "dat/data.dat"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_8039584B = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; #pragma pop /* 801BE328-801BE670 1B8C68 0348+00 0/0 1/1 0/0 .text isOpen__12dMenu_Dmap_cFv */ diff --git a/src/d/d_msg_class.cpp b/src/d/d_msg_class.cpp index 539d28cbfd7..de7d8b99092 100644 --- a/src/d/d_msg_class.cpp +++ b/src/d/d_msg_class.cpp @@ -2819,8 +2819,6 @@ void jmessage_tRenderingProcessor::do_rubyset(void const* param_0, u32 param_1) SECTION_DEAD static char const* const stringBase_80399652 = "" "\x1B" "CL[%d]"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_8039965A = "\0\0\0\0\0"; #pragma pop /* 8022F384-8022F53C 229CC4 01B8+00 3/3 0/0 0/0 .text diff --git a/src/d/d_msg_scrn_talk.cpp b/src/d/d_msg_scrn_talk.cpp index 979585678eb..1b5aa62fe41 100644 --- a/src/d/d_msg_scrn_talk.cpp +++ b/src/d/d_msg_scrn_talk.cpp @@ -128,8 +128,6 @@ SECTION_DEAD static char const* const stringBase_80399BB0 = "zelda_message_windo SECTION_DEAD static char const* const stringBase_80399BCD = "zelda_message_window_text_seirei.blo"; SECTION_DEAD static char const* const stringBase_80399BF2 = "zelda_message_window_text.blo"; SECTION_DEAD static char const* const stringBase_80399C10 = ""; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_80399C11 = "\0\0\0\0\0\0"; #pragma pop /* 803C13C8-803C1420 01E4E8 0058+00 2/2 0/0 0/0 .data __vt__14dMsgScrnTalk_c */ diff --git a/src/d/d_msg_unit.cpp b/src/d/d_msg_unit.cpp index 020cdbd43c1..8e67f8a0403 100644 --- a/src/d/d_msg_unit.cpp +++ b/src/d/d_msg_unit.cpp @@ -50,8 +50,6 @@ SECTION_DEAD static char const* const stringBase_803996F1 = "%d:%02d"; SECTION_DEAD static char const* const stringBase_803996F9 = ""; SECTION_DEAD static char const* const stringBase_803996FA = "%d%s"; SECTION_DEAD static char const* const stringBase_803996FF = "%d %s"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_80399705 = "\0\0"; #pragma pop /* 80454B40-80454B44 003140 0004+00 1/1 0/0 0/0 .sdata2 @3702 */ diff --git a/src/d/d_name.cpp b/src/d/d_name.cpp index 0a2a5bb0a40..c7ddadcc213 100644 --- a/src/d/d_name.cpp +++ b/src/d/d_name.cpp @@ -1033,8 +1033,6 @@ SECTION_DEAD static char const* const stringBase_80399F99 = "zelda_player_name.b SECTION_DEAD static char const* const stringBase_80399FAF = "zelda_player_name.bpk"; SECTION_DEAD static char const* const stringBase_80399FC5 = "zelda_player_name.btk"; SECTION_DEAD static char const* const stringBase_80399FDB = ""; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_80399FDC = "\0\0\0"; #pragma pop /* 80454DD4-80454DD8 0033D4 0004+00 1/1 0/0 0/0 .sdata2 @4722 */ @@ -1384,4 +1382,4 @@ dDlst_NameIN_c::~dDlst_NameIN_c() {} /* 802511A4-802511EC 24BAE4 0048+00 2/1 0/0 0/0 .text __dt__9dNm_HIO_cFv */ dNm_HIO_c::~dNm_HIO_c() {} -/* 80399CC8-80399CC8 026328 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 80399CC8-80399CC8 026328 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/d/d_select_cursor.cpp b/src/d/d_select_cursor.cpp index 3bfdb5257f7..64670de2fd1 100644 --- a/src/d/d_select_cursor.cpp +++ b/src/d/d_select_cursor.cpp @@ -208,13 +208,6 @@ dSelect_cursor_c::dSelect_cursor_c(u8 param_0, f32 param_1, JKRArchive* param_2) mPositionX = 0.0f; } -static void dummy() { - // Need 0x30 bytes of padding with no symbol between btk2_name$3688 and dSelect_cursor_c::__vtable - // This is likely caused by the vtables of abstract base classes getting put there and then stripped out. - // Not sure which abstract base classes could go there though. - static u8 padding_fakematch[0x30] = {}; -} - /* 801949EC-80194C30 18F32C 0244+00 1/0 0/0 0/0 .text __dt__16dSelect_cursor_cFv */ dSelect_cursor_c::~dSelect_cursor_c() { @@ -578,3 +571,36 @@ void dSelect_cursor_c::setBckAnimation(J2DAnmTransformKey* param_0) { void dSelect_cursor_c::moveCenter(J2DPane* i_pane, f32 i_x, f32 i_y) { i_pane->translate(i_x,i_y); } + +// Need 0x30 bytes of padding with no symbol between btk2_name$3688 and dSelect_cursor_c::__vtable +// This is likely caused by the vtables of abstract base classes getting put there and then stripped out. +// Not sure which abstract base classes could go there though, so we simulate it with some dummy classes for now. +class dummy_abstract_class { +public: + virtual void virt_func_0() = 0; + virtual void virt_func_1() = 0; + virtual void virt_func_2() = 0; + virtual void virt_func_3() = 0; + virtual void virt_func_4() = 0; + virtual void virt_func_5() = 0; + virtual void virt_func_6() = 0; + virtual void virt_func_7() = 0; + virtual void virt_func_8() = 0; + virtual void virt_func_9() = 0; +}; +class dummy_child_class : dummy_abstract_class { + virtual void virt_func_0(); + virtual void virt_func_1(); + virtual void virt_func_2(); + virtual void virt_func_3(); + virtual void virt_func_4(); + virtual void virt_func_5(); + virtual void virt_func_6(); + virtual void virt_func_7(); + virtual void virt_func_8(); + virtual void virt_func_9(); +}; +static dummy_child_class dummy() { + dummy_child_class temp; + return temp; +} diff --git a/src/d/d_shop_system.cpp b/src/d/d_shop_system.cpp index 41f358f75b6..5b43be94e58 100644 --- a/src/d/d_shop_system.cpp +++ b/src/d/d_shop_system.cpp @@ -179,7 +179,7 @@ static shop_item_data item_seira_shop = { }, }; -static processFunc process[22] = { +static processFunc process[] = { &dShopSystem_c::seq_wait, &dShopSystem_c::seq_start, &dShopSystem_c::seq_select_wait, &dShopSystem_c::seq_select_start, &dShopSystem_c::seq_select, &dShopSystem_c::seq_moving, @@ -1661,3 +1661,72 @@ bool dShopSystem_c::dpdMove() { } #pragma nosyminline on + +// Need 0x78 bytes of padding with no symbol between process and dShopSystem_c::__vtable +// This is likely caused by the vtables of abstract base classes getting put there and then stripped out. +// Not sure which abstract base class could go there though, so we simulate it with some dummy classes for now. +class dummy_abstract_class { +public: + virtual void virt_func_0() = 0; + virtual void virt_func_1() = 0; + virtual void virt_func_2() = 0; + virtual void virt_func_3() = 0; + virtual void virt_func_4() = 0; + virtual void virt_func_5() = 0; + virtual void virt_func_6() = 0; + virtual void virt_func_7() = 0; + virtual void virt_func_8() = 0; + virtual void virt_func_9() = 0; + virtual void virt_func_10() = 0; + virtual void virt_func_11() = 0; + virtual void virt_func_12() = 0; + virtual void virt_func_13() = 0; + virtual void virt_func_14() = 0; + virtual void virt_func_15() = 0; + virtual void virt_func_16() = 0; + virtual void virt_func_17() = 0; + virtual void virt_func_18() = 0; + virtual void virt_func_19() = 0; + virtual void virt_func_20() = 0; + virtual void virt_func_21() = 0; + virtual void virt_func_22() = 0; + virtual void virt_func_23() = 0; + virtual void virt_func_24() = 0; + virtual void virt_func_25() = 0; + virtual void virt_func_26() = 0; + virtual void virt_func_27() = 0; +}; +class dummy_child_class : dummy_abstract_class { + virtual void virt_func_0(); + virtual void virt_func_1(); + virtual void virt_func_2(); + virtual void virt_func_3(); + virtual void virt_func_4(); + virtual void virt_func_5(); + virtual void virt_func_6(); + virtual void virt_func_7(); + virtual void virt_func_8(); + virtual void virt_func_9(); + virtual void virt_func_10(); + virtual void virt_func_11(); + virtual void virt_func_12(); + virtual void virt_func_13(); + virtual void virt_func_14(); + virtual void virt_func_15(); + virtual void virt_func_16(); + virtual void virt_func_17(); + virtual void virt_func_18(); + virtual void virt_func_19(); + virtual void virt_func_20(); + virtual void virt_func_21(); + virtual void virt_func_22(); + virtual void virt_func_23(); + virtual void virt_func_24(); + virtual void virt_func_25(); + virtual void virt_func_26(); + virtual void virt_func_27(); +}; +static dummy_child_class dummy() { + dummy_child_class temp; + return temp; +} diff --git a/src/dolphin/vi/vi.c b/src/dolphin/vi/vi.c index ffd479cd1b3..a1bcae9fe8e 100644 --- a/src/dolphin/vi/vi.c +++ b/src/dolphin/vi/vi.c @@ -345,8 +345,8 @@ static VITimingInfo timing[10] = { /* 803D1920-803D1954 02EA40 0032+02 0/1 0/0 0/0 .data taps */ #pragma push #pragma force_active on -static u16 taps[26] = {496, 476, 430, 372, 297, 219, 142, 70, 12, 226, 203, 192, 196, - 207, 222, 236, 252, 8, 15, 19, 19, 15, 12, 8, 1, 0}; +static u16 taps[] = {496, 476, 430, 372, 297, 219, 142, 70, 12, 226, 203, 192, 196, + 207, 222, 236, 252, 8, 15, 19, 19, 15, 12, 8, 1}; #pragma pop /* 80451838-8045183C 000D38 0004+00 2/2 0/0 0/0 .sbss FBSet */