From 02ca9b78932abba7eda3613b24019965b55129c8 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 18 Sep 2024 23:07:35 -0600 Subject: [PATCH] Minor cleanup & renaming --- config/GM8E01_00/symbols.txt | 4 ++-- config/GM8E01_01/symbols.txt | 4 ++-- include/Kyoto/Alloc/CMemory.hpp | 2 ++ include/Kyoto/Basics/CCast.hpp | 14 +++++--------- include/dolphin/types.h | 3 ++- libc/math.h | 9 +++------ src/MetroidPrime/BodyState/CBSLoopAttack.cpp | 4 +--- src/MetroidPrime/CGameCubeDoll.cpp | 3 +-- 8 files changed, 18 insertions(+), 25 deletions(-) diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index 1288631a..099b6407 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -1743,7 +1743,7 @@ __ct__9CTweakGuiFR12CInputStream = .text:0x80074360; // type:function size:0xA5C __dt__9CTweakGuiFv = .text:0x80074DBC; // type:function size:0x178 scope:global __dl__22TOneStatic<9CTweakGui>FPv = .text:0x80074F34; // type:function size:0x2C scope:global GetSortingBounds__12CScriptActorCFRC13CStateManager = .text:0x80074F60; // type:function size:0x84 scope:global -GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponMode17EProjectileAttrib = .text:0x80074FE4; // type:function size:0xA0 scope:global +GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponModei = .text:0x80074FE4; // type:function size:0xA0 scope:global Accept__12CScriptActorFR8IVisitor = .text:0x80075084; // type:function size:0x38 scope:global PreRender__12CScriptActorFR13CStateManagerRC14CFrustumPlanes = .text:0x800750BC; // type:function size:0x244 scope:global AcceptScriptMsg__12CScriptActorF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x80075300; // type:function size:0x20C scope:global @@ -9111,7 +9111,7 @@ LoadAnimations__10CGunMotionFv = .text:0x801D8F74; // type:function size:0x38 sc EnterFidget__10CGunMotionFR13CStateManagerQ28SamusGun11EFidgetTypei = .text:0x801D8FAC; // type:function size:0x3C scope:global BasePosition__10CGunMotionFb = .text:0x801D8FE8; // type:function size:0x90 scope:global GetFreeLookSetId__10CGunMotionCFv = .text:0x801D9078; // type:function size:0x8 scope:global -ReturnToDefault__10CGunMotionFR13CStateManager = .text:0x801D9080; // type:function size:0x28 scope:global +ReturnToDefault__10CGunMotionFR13CStateManagerb = .text:0x801D9080; // type:function size:0x28 scope:global Draw__10CGunMotionCFRC13CStateManagerRC12CTransform4f = .text:0x801D90A8; // type:function size:0x84 scope:global Update__10CGunMotionFfR13CStateManager = .text:0x801D912C; // type:function size:0x8C scope:global PlayPasAnim__10CGunMotionFQ28SamusGun15EAnimationStateR13CStateManagerfb = .text:0x801D91B8; // type:function size:0x420 scope:global diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index 0cedd277..7d26f314 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -1743,7 +1743,7 @@ __ct__9CTweakGuiFR12CInputStream = .text:0x800743DC; // type:function size:0xA5C __dt__9CTweakGuiFv = .text:0x80074E38; // type:function size:0x178 scope:global __dl__22TOneStatic<9CTweakGui>FPv = .text:0x80074FB0; // type:function size:0x2C scope:global GetSortingBounds__12CScriptActorCFRC13CStateManager = .text:0x80074FDC; // type:function size:0x84 scope:global -GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponMode17EProjectileAttrib = .text:0x80075060; // type:function size:0xA0 scope:global +GetCollisionResponseType__12CScriptActorCFRC9CVector3fRC9CVector3fRC11CWeaponModei = .text:0x80075060; // type:function size:0xA0 scope:global Accept__12CScriptActorFR8IVisitor = .text:0x80075100; // type:function size:0x38 scope:global PreRender__12CScriptActorFR13CStateManagerRC14CFrustumPlanes = .text:0x80075138; // type:function size:0x244 scope:global AcceptScriptMsg__12CScriptActorF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x8007537C; // type:function size:0x20C scope:global @@ -9117,7 +9117,7 @@ LoadAnimations__10CGunMotionFv = .text:0x801D8FF0; // type:function size:0x38 sc EnterFidget__10CGunMotionFR13CStateManagerQ28SamusGun11EFidgetTypei = .text:0x801D9028; // type:function size:0x3C scope:global BasePosition__10CGunMotionFb = .text:0x801D9064; // type:function size:0x90 scope:global GetFreeLookSetId__10CGunMotionCFv = .text:0x801D90F4; // type:function size:0x8 scope:global -ReturnToDefault__10CGunMotionFR13CStateManager = .text:0x801D90FC; // type:function size:0x28 scope:global +ReturnToDefault__10CGunMotionFR13CStateManagerb = .text:0x801D90FC; // type:function size:0x28 scope:global Draw__10CGunMotionCFRC13CStateManagerRC12CTransform4f = .text:0x801D9124; // type:function size:0x84 scope:global Update__10CGunMotionFfR13CStateManager = .text:0x801D91A8; // type:function size:0x8C scope:global PlayPasAnim__10CGunMotionFQ28SamusGun15EAnimationStateR13CStateManagerfb = .text:0x801D9234; // type:function size:0x420 scope:global diff --git a/include/Kyoto/Alloc/CMemory.hpp b/include/Kyoto/Alloc/CMemory.hpp index f627fafb..fdd47863 100644 --- a/include/Kyoto/Alloc/CMemory.hpp +++ b/include/Kyoto/Alloc/CMemory.hpp @@ -34,6 +34,8 @@ inline void operator delete(void* ptr) { CMemory::Free(ptr); } inline void operator delete[](void* ptr) { CMemory::Free(ptr); } #define rs_new new ("??(??)", nullptr) #else +void operator delete(void* ptr); +void operator delete[](void* ptr); #define rs_new new #endif diff --git a/include/Kyoto/Basics/CCast.hpp b/include/Kyoto/Basics/CCast.hpp index efaa87a6..211a57d7 100644 --- a/include/Kyoto/Basics/CCast.hpp +++ b/include/Kyoto/Basics/CCast.hpp @@ -17,8 +17,6 @@ inline uchar ToUint8(register float in) { return *ptr; } -inline uchar ToUint8(int c) { return static_cast(c); } - inline float ToReal32(register const uchar& in) { register float r; asm { @@ -47,22 +45,20 @@ inline ushort FtoUS(register float in) { return *ptr; } -inline int FtoL(float in) { return static_cast< int >(in); } -inline float LtoF(int in) { return static_cast< float >(in); } - #else inline uchar ToUint8(float in) { return static_cast< uchar >(in); } -inline uchar ToUint8(int c) { return static_cast(c); } inline float ToReal32(uchar in) { return static_cast< float >(in); } inline short FtoS(float in) { return static_cast< short >(in); } inline ushort FtoUS(float in) { return static_cast< ushort >(in); } -inline int FtoL(float in) { return static_cast< int >(in); } -inline float LtoF(int in) { return static_cast< float >(in); } #endif +inline uchar ToUint8(int c) { return static_cast< uchar >(c); } +inline int FtoL(float in) { return static_cast< int >(in); } +inline float LtoF(int in) { return static_cast< float >(in); } +inline float ToReal32(int in) { return static_cast< float >(in); } inline int ToInt32(float in) { return static_cast< int >(in); } inline unsigned short ToUint16(unsigned short in) { return static_cast< short >(in); } -inline char ToChar(int c) { return ToUint8(c) ; } +inline char ToChar(int c) { return ToUint8(c); } } // namespace CCast #endif // _CCAST diff --git a/include/dolphin/types.h b/include/dolphin/types.h index 7180dc04..a79ff451 100644 --- a/include/dolphin/types.h +++ b/include/dolphin/types.h @@ -1,8 +1,9 @@ #ifndef _DOLPHIN_TYPES #define _DOLPHIN_TYPES -#ifdef TARGET_PC #include + +#ifdef TARGET_PC typedef int8_t s8; typedef int16_t s16; typedef int32_t s32; diff --git a/libc/math.h b/libc/math.h index 279795f2..683a3513 100644 --- a/libc/math.h +++ b/libc/math.h @@ -43,16 +43,13 @@ typedef int _INT32; typedef unsigned int _UINT32; #endif -int abs(int n); #ifdef __MWERKS__ #define abs(n) __abs(n) #define labs(n) __labs(n) -static inline double fabs(double x) { return __fabs(x); } +_MATH_INLINE double fabs(double x) { return __fabs(x); } #else -// static inline int abs(int n) { -// int mask = n >> 31; -// return (n + mask) ^ mask; -// } +int abs(int n); +long labs(long n); #endif extern _INT32 __float_huge[]; diff --git a/src/MetroidPrime/BodyState/CBSLoopAttack.cpp b/src/MetroidPrime/BodyState/CBSLoopAttack.cpp index 633135b3..d6421a09 100644 --- a/src/MetroidPrime/BodyState/CBSLoopAttack.cpp +++ b/src/MetroidPrime/BodyState/CBSLoopAttack.cpp @@ -12,9 +12,7 @@ CBSLoopAttack::CBSLoopAttack() : x4_state(pas::kLS_Invalid) , x8_loopAttackType(pas::kLAT_Invalid) , xc_24_waitForAnimOver(false) -, xc_25_advance(false) - -{} +, xc_25_advance(false) {} void CBSLoopAttack::Start(CBodyController& bc, CStateManager& mgr) { const CBCLoopAttackCmd* cmd = diff --git a/src/MetroidPrime/CGameCubeDoll.cpp b/src/MetroidPrime/CGameCubeDoll.cpp index 13de528b..6f66eb28 100644 --- a/src/MetroidPrime/CGameCubeDoll.cpp +++ b/src/MetroidPrime/CGameCubeDoll.cpp @@ -79,7 +79,6 @@ void CGameCubeDoll::Draw(float alpha) { CTransform4f::Scale(0.2f)); TToken< CModel > model(x0_model); - CModelFlags flags(CModelFlags::kT_Blend, alphaFader); - model->Draw(flags); + model->Draw(CModelFlags(CModelFlags::kT_Blend, alphaFader)); CGraphics::DisableAllLights(); }