From 7eb08b6ee832f11971da0cfdc53b5a55b74ac79d Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 5 Sep 2022 00:01:13 -0400 Subject: [PATCH] Migrate s32->int, u32->uint; fix dolphin/types.h --- include/Kyoto/Alloc/IAllocator.hpp | 58 ++++++++-------- include/Kyoto/Audio/CSfxHandle.hpp | 4 +- include/Kyoto/CCrc32.hpp | 2 +- include/Kyoto/CPakFile.hpp | 8 +-- include/Kyoto/CRandom16.hpp | 10 +-- include/Kyoto/CResFactory.hpp | 16 ++--- include/Kyoto/CResLoader.hpp | 6 +- include/Kyoto/Graphics/CColor.hpp | 8 +-- include/Kyoto/Graphics/CCubeMaterial.hpp | 2 +- include/Kyoto/Graphics/CGX.hpp | 36 +++++----- include/Kyoto/Graphics/CGraphicsSys.hpp | 2 +- include/Kyoto/Graphics/CModelFlags.hpp | 12 ++-- include/Kyoto/Graphics/CTevCombiners.hpp | 2 +- include/Kyoto/IObjectStore.hpp | 4 +- include/Kyoto/Math/CMath.hpp | 2 +- include/Kyoto/Math/CVector2i.hpp | 4 +- include/Kyoto/Math/CVector3f.hpp | 4 +- include/Kyoto/Particles/CParticleGen.hpp | 4 +- include/Kyoto/Streams/CInputStream.hpp | 30 ++++----- include/Kyoto/Streams/CMemoryInStream.hpp | 2 +- include/Kyoto/TOneStatic.hpp | 4 +- include/Kyoto/TReservedAverage.hpp | 4 +- include/Kyoto/Text/CStringTable.hpp | 2 +- include/MetaRender/CCubeRenderer.hpp | 2 +- include/MetroidPrime/CActor.hpp | 58 ++++++++-------- include/MetroidPrime/CActorLights.hpp | 20 +++--- include/MetroidPrime/CActorParameters.hpp | 14 ++-- include/MetroidPrime/CAnimData.hpp | 28 ++++---- include/MetroidPrime/CAnimPlaybackParms.hpp | 6 +- include/MetroidPrime/CCharacterInfo.hpp | 10 +-- include/MetroidPrime/CEffectComponent.hpp | 2 +- include/MetroidPrime/CEnvFxManager.hpp | 2 +- include/MetroidPrime/CGameArea.hpp | 18 ++--- include/MetroidPrime/CGameGlobalObjects.hpp | 4 +- .../MetroidPrime/CHierarchyPoseBuilder.hpp | 2 +- include/MetroidPrime/CIOWinManager.hpp | 4 +- include/MetroidPrime/CMain.hpp | 8 +-- include/MetroidPrime/CObjectList.hpp | 8 +-- include/MetroidPrime/CPASAnimState.hpp | 8 +-- include/MetroidPrime/CPASDatabase.hpp | 2 +- include/MetroidPrime/CPOINode.hpp | 18 ++--- include/MetroidPrime/CParticleData.hpp | 4 +- include/MetroidPrime/CSortedLists.hpp | 2 +- include/MetroidPrime/CWeaponMgr.hpp | 2 +- include/MetroidPrime/CWorld.hpp | 10 +-- include/MetroidPrime/Cameras/CCameraHint.hpp | 4 +- .../MetroidPrime/Cameras/CCameraManager.hpp | 10 +-- .../MetroidPrime/Cameras/CCameraShakeData.hpp | 4 +- include/MetroidPrime/Cameras/CGameCamera.hpp | 2 +- include/MetroidPrime/Player/CGameOptions.hpp | 18 ++--- include/MetroidPrime/Player/CGameState.hpp | 4 +- include/MetroidPrime/TGameTypes.hpp | 12 ++-- include/MetroidPrime/Tweaks/CTweakGame.hpp | 2 +- include/MetroidPrime/Tweaks/CTweaks.hpp | 2 +- include/dolphin/types.h | 4 +- include/rstl/reserved_vector.hpp | 14 ++-- include/rstl/rmemory_allocator.hpp | 2 +- include/rstl/vector.hpp | 22 +++---- include/types.h | 3 + src/Kyoto/Alloc/IAllocator.cpp | 8 +-- src/Kyoto/Basics/CSWDataDolphin.cpp | 2 +- src/Kyoto/CCrc32.cpp | 6 +- src/Kyoto/CRandom16.cpp | 10 +-- src/Kyoto/Graphics/CCubeMaterial.cpp | 26 ++++---- src/Kyoto/Graphics/CGX.cpp | 66 +++++++++---------- src/Kyoto/Graphics/DolphinCColor.cpp | 28 ++++---- src/Kyoto/Streams/CInputStream.cpp | 52 +++++++-------- src/Kyoto/Streams/CMemoryInStream.cpp | 2 +- src/Kyoto/Text/CStringTable.cpp | 22 +++---- src/MetroidPrime/CActor.cpp | 22 +++---- src/MetroidPrime/CObjectList.cpp | 8 +-- src/MetroidPrime/Cameras/CCameraHint.cpp | 2 +- src/MetroidPrime/main.cpp | 8 +-- 73 files changed, 413 insertions(+), 410 deletions(-) diff --git a/include/Kyoto/Alloc/IAllocator.hpp b/include/Kyoto/Alloc/IAllocator.hpp index 453a3d83..36c75c11 100644 --- a/include/Kyoto/Alloc/IAllocator.hpp +++ b/include/Kyoto/Alloc/IAllocator.hpp @@ -19,44 +19,44 @@ public: enum EType { kTP_Unk0 }; struct SMetrics { - u32 x0_heapSize; - u32 x4_; - u32 x8_; - u32 xc_; - u32 x10_; - u32 x14_heapSize2; // Remaining heap size? - u32 x18_; - u32 x1c_; - u32 x20_; - u32 x24_; - u32 x28_; - u32 x2c_smallNumAllocs; - u32 x30_smallAllocatedSize; - u32 x34_smallRemainingSize; - u32 x38_mediumNumAllocs; - u32 x3c_mediumAllocatedSize; - u32 x40_mediumBlocksAvailable; - u32 x44_; - u32 x48_; - u32 x4c_; - u32 x50_mediumTotalAllocated; - u32 x54_fakeStatics; - SMetrics(u32 heapSize, u32 unk1, u32 unk2, u32 unk3, u32 unk4, u32 heapSize2, u32 unk5, u32 unk6, u32 unk7, u32 unk8, u32 unk9, - u32 smallAllocNumAllocs, u32 smallAllocAllocatedSize, u32 smallAllocRemainingSize, u32 mediumAllocNumAllocs, - u32 mediumAllocAllocatedSize, u32 mediumAllocBlocksAvailable, u32 unk10, u32 unk11, u32 unk12, u32 mediumAllocTotalAllocated, - u32 fakeStatics); + uint x0_heapSize; + uint x4_; + uint x8_; + uint xc_; + uint x10_; + uint x14_heapSize2; // Remaining heap size? + uint x18_; + uint x1c_; + uint x20_; + uint x24_; + uint x28_; + uint x2c_smallNumAllocs; + uint x30_smallAllocatedSize; + uint x34_smallRemainingSize; + uint x38_mediumNumAllocs; + uint x3c_mediumAllocatedSize; + uint x40_mediumBlocksAvailable; + uint x44_; + uint x48_; + uint x4c_; + uint x50_mediumTotalAllocated; + uint x54_fakeStatics; + SMetrics(uint heapSize, uint unk1, uint unk2, uint unk3, uint unk4, uint heapSize2, uint unk5, uint unk6, uint unk7, uint unk8, uint unk9, + uint smallAllocNumAllocs, uint smallAllocAllocatedSize, uint smallAllocRemainingSize, uint mediumAllocNumAllocs, + uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable, uint unk10, uint unk11, uint unk12, uint mediumAllocTotalAllocated, + uint fakeStatics); }; struct SAllocInfo { void* x0_infoPtr; - u32 x4_len; + uint x4_len; bool x8_hasPrevious; bool x9_; const char* xc_fileAndLne; const char* x10_type; }; - typedef const bool (*FOutOfMemoryCb)(void*, u32); + typedef const bool (*FOutOfMemoryCb)(void*, uint); typedef const bool (*FEnumAllocationsCb)(const SAllocInfo& info, const void* ptr); virtual ~IAllocator(); @@ -71,7 +71,7 @@ public: virtual void SetOutOfMemoryCallback(FOutOfMemoryCb cb, const void* data) = 0; virtual void EnumAllocations(FEnumAllocationsCb func, const void* ptr, bool b) const = 0; virtual SAllocInfo GetAllocInfo(const void* ptr) const = 0; - virtual void OffsetFakeStatics(s32 offset) = 0; + virtual void OffsetFakeStatics(int offset) = 0; virtual SMetrics GetMetrics() const = 0; }; diff --git a/include/Kyoto/Audio/CSfxHandle.hpp b/include/Kyoto/Audio/CSfxHandle.hpp index f5919cdc..4b3c0497 100644 --- a/include/Kyoto/Audio/CSfxHandle.hpp +++ b/include/Kyoto/Audio/CSfxHandle.hpp @@ -6,7 +6,7 @@ class CSfxHandle { public: CSfxHandle() : value(0) {} - CSfxHandle(u32 value) : value(value) {} + CSfxHandle(uint value) : value(value) {} // GetIndex__10CSfxHandleCFv // NullHandle__10CSfxHandleFv @@ -16,7 +16,7 @@ public: operator bool() const { return value != 0; } private: - u32 value; + uint value; }; CHECK_SIZEOF(CSfxHandle, 0x4) diff --git a/include/Kyoto/CCrc32.hpp b/include/Kyoto/CCrc32.hpp index 3561a25d..46457eb2 100644 --- a/include/Kyoto/CCrc32.hpp +++ b/include/Kyoto/CCrc32.hpp @@ -4,7 +4,7 @@ class CCRC32 { public: - static u32 Calculate(const void* data, u32 length); + static uint Calculate(const void* data, uint length); }; #endif // __CCRC32_HPP__ diff --git a/include/Kyoto/CPakFile.hpp b/include/Kyoto/CPakFile.hpp index dfdd1756..f8657ae5 100644 --- a/include/Kyoto/CPakFile.hpp +++ b/include/Kyoto/CPakFile.hpp @@ -26,13 +26,13 @@ private: int x2c_asyncLoadPhase; // EAsyncPhase rstl::auto_ptr< void > x30_dvdReq; // IDvdRequest rstl::vector< u8 > x38_headerData; - u32 x48_resTableOffset; - u32 x4c_resTableCount; - s32 x50_aramBase; + uint x48_resTableOffset; + uint x4c_resTableCount; + int x50_aramBase; rstl::vector< rstl::pair< rstl::string, SObjectTag > > x54_nameList; rstl::vector< CAssetId > x64_depList; rstl::vector< SResInfo > x74_resList; - mutable s32 x84_currentSeek; + mutable int x84_currentSeek; }; #endif diff --git a/include/Kyoto/CRandom16.hpp b/include/Kyoto/CRandom16.hpp index fdd5912b..667207ed 100644 --- a/include/Kyoto/CRandom16.hpp +++ b/include/Kyoto/CRandom16.hpp @@ -21,14 +21,14 @@ class CRandom16 { static void _SetRandomNumber(CRandom16* rnd); public: static CRandom16* GetRandomNumber(); - CRandom16(u32 seed = 99); - void SetSeed(u32 seed); - s32 Range(s32 min, s32 max); + CRandom16(uint seed = 99); + void SetSeed(uint seed); + int Range(int min, int max); float Range(float min, float max); - s32 Next(); + int Next(); float Float(); private: - u32 mSeed; + uint mSeed; }; #endif // __CRANDOM16_HPP__ diff --git a/include/Kyoto/CResFactory.hpp b/include/Kyoto/CResFactory.hpp index c11d8179..4375f23d 100644 --- a/include/Kyoto/CResFactory.hpp +++ b/include/Kyoto/CResFactory.hpp @@ -12,20 +12,20 @@ class CResFactory { public: virtual ~CResFactory() {} - void AsyncIdle(u32 time); + void AsyncIdle(uint time); CResLoader& GetResLoader() { return x4_resLoader; } private: CResLoader x4_resLoader; CFactoryMgr x5c_factoryMgr; - u32 x94_; - u32 x98_; - u32 x9c_; - u32 xa0_; - u32 xa4_; - u32 xa8_; - u32 xac_; + uint x94_; + uint x98_; + uint x9c_; + uint xa0_; + uint xa4_; + uint xa8_; + uint xac_; rstl::list< void > xb0_; }; diff --git a/include/Kyoto/CResLoader.hpp b/include/Kyoto/CResLoader.hpp index d31d7aae..bfcbc9f0 100644 --- a/include/Kyoto/CResLoader.hpp +++ b/include/Kyoto/CResLoader.hpp @@ -14,13 +14,13 @@ struct SResInfo { CAssetId x0_id; bool x4_compressed : 1; int x4_typeIdx; // CFactoryMgr::ETypeTable - u32 x5_offsetDiv32 : 27; - u32 x7_sizeDiv32 : 27; + uint x5_offsetDiv32 : 27; + uint x7_sizeDiv32 : 27; }; class CResLoader { public: - s32 GetPakCount() const; + int GetPakCount() const; CPakFile& GetPakFile(int idx) const; void AddPakFileAsync(const rstl::string&, bool, bool); void AsyncIdlePakLoading(); diff --git a/include/Kyoto/Graphics/CColor.hpp b/include/Kyoto/Graphics/CColor.hpp index 66a87441..eb6682e7 100644 --- a/include/Kyoto/Graphics/CColor.hpp +++ b/include/Kyoto/Graphics/CColor.hpp @@ -15,7 +15,7 @@ class CInputStream; class CColor { public: CColor() {} - CColor(u32 col) : mRgba(col) {} + CColor(uint col) : mRgba(col) {} CColor(CInputStream& in); CColor(f32 r, f32 g, f32 b, f32 a = 1.f); CColor(u8 r, u8 g, u8 b, u8 a = 255) { @@ -29,7 +29,7 @@ public: void Get(float& r, float& g, float& b, float& a) const; void Get(float& r, float& g, float& b) const; static CColor Lerp(const CColor& a, const CColor& b, float t); - static u32 Lerp(u32 a, u32 b, float t); + static uint Lerp(uint a, uint b, float t); static CColor Modulate(const CColor& a, const CColor& b); static CColor Add(const CColor& a, const CColor& b); f32 GetRed() const { return CCast::ToReal32(mR) * (1/255.f); } @@ -41,7 +41,7 @@ public: u8 GetBlueu8() const { return mB; } u8 GetAlphau8() const { return mA; } u16 ToRGB5A3() const; - GXColor ToGX(u32); + GXColor ToGX(uint); static const CColor& Black(); static const CColor& White(); @@ -61,7 +61,7 @@ private: u8 mB; u8 mA; }; - u32 mRgba; + uint mRgba; }; static const CColor sBlackColor; diff --git a/include/Kyoto/Graphics/CCubeMaterial.hpp b/include/Kyoto/Graphics/CCubeMaterial.hpp index 7e4eb820..ceb991d6 100644 --- a/include/Kyoto/Graphics/CCubeMaterial.hpp +++ b/include/Kyoto/Graphics/CCubeMaterial.hpp @@ -11,7 +11,7 @@ extern CVector3f sPlayerPosition; class CCubeMaterial { public: private: - static void SetupBlendMode(u32 blendFactors, const CModelFlags& flags, bool alphaTest); + static void SetupBlendMode(uint blendFactors, const CModelFlags& flags, bool alphaTest); static CVector3f sViewingFrom; }; diff --git a/include/Kyoto/Graphics/CGX.hpp b/include/Kyoto/Graphics/CGX.hpp index 1671e978..f6a0adab 100644 --- a/include/Kyoto/Graphics/CGX.hpp +++ b/include/Kyoto/Graphics/CGX.hpp @@ -11,12 +11,12 @@ class CGX { public: struct STevState { - u32 x0_colorInArgs; - u32 x4_alphaInArgs; - u32 x8_colorOps; - u32 xc_alphaOps; - u32 x10_indFlags; - u32 x14_tevOrderFlags; + uint x0_colorInArgs; + uint x4_alphaInArgs; + uint x8_colorOps; + uint xc_alphaOps; + uint x10_indFlags; + uint x14_tevOrderFlags; u8 x18_kColorSel; u8 x19_kAlphaSel; @@ -24,7 +24,7 @@ public: }; struct STexState { - u32 x0_coordGen; + uint x0_coordGen; STexState(); }; @@ -50,7 +50,7 @@ public: u16 x34_chanCtrls[2]; GXColor x38_chanAmbColors[2]; GXColor x40_chanMatColors[2]; - u32 x48_descList; + uint x48_descList; union { u8 x4c_chanFlags; struct { @@ -71,7 +71,7 @@ public: GXColor x58_kColors[4]; STevState x68_tevStates[16]; STexState x228_texStates[8]; - u32 x248_alphaCompare; + uint x248_alphaCompare; SFogParams x24c_fogParams; SGXState(); @@ -94,9 +94,9 @@ public: static void SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d); static void SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d); static void SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp, GXTevRegID outReg); - static void SetTevColorOp_Compressed(GXTevStageID stageId, u32 flags); + static void SetTevColorOp_Compressed(GXTevStageID stageId, uint flags); static void SetTevAlphaOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp, GXTevRegID outReg); - static void SetTevAlphaOp_Compressed(GXTevStageID stageId, u32 flags); + static void SetTevAlphaOp_Compressed(GXTevStageID stageId, uint flags); static void SetTevKColorSel(GXTevStageID stageId, GXTevKColorSel sel); static void SetTevKAlphaSel(GXTevStageID stageId, GXTevKAlphaSel sel); static void SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color); @@ -112,11 +112,11 @@ public: static void SetFog(GXFogType type, f32 startZ, f32 endZ, f32 nearZ, f32 farZ, const GXColor& color); static void SetLineWidth(u8 width, GXTexOffset offset); static void SetIndTexMtxSTPointFive(GXIndTexMtxID id, s8 scaleExp); - static void SetVtxDescv_Compressed(u32 flags); + static void SetVtxDescv_Compressed(uint flags); static void SetVtxDesc(GXAttr attr, GXAttrType type); // name? static void ResetVtxDescv(); // name? static void SetVtxDescv(const GXVtxDescList* list); - static void SetStandardDirectTev_Compressed(GXTevStageID stageId, u32 colorArgs, u32 alphaArgs, u32 colorOps, u32 alphaOps); + static void SetStandardDirectTev_Compressed(GXTevStageID stageId, uint colorArgs, uint alphaArgs, uint colorOps, uint alphaOps); static void SetStandardTevColorAlphaOp(GXTevStageID stageId); static void CallDisplayList(const void* ptr, size_t size); @@ -133,17 +133,17 @@ public: static void GetFog(GXFogType* fogType, f32* fogStartZ, f32* fogEndZ, f32* fogNearZ, f32* fogFarZ, GXColor* fogColor); static inline bool CompareGXColors(const GXColor& lhs, const GXColor& rhs) { - return *reinterpret_cast< const u32* >(&lhs) == *reinterpret_cast< const u32* >(&rhs); + return *reinterpret_cast< const uint* >(&lhs) == *reinterpret_cast< const uint* >(&rhs); } static inline void CopyGXColor(GXColor& dst, const GXColor& src) { - *reinterpret_cast< u32* >(&dst) = *reinterpret_cast< const u32* >(&src); + *reinterpret_cast< uint* >(&dst) = *reinterpret_cast< const uint* >(&src); } - static inline u32 MaskAndShiftLeft(u32 v, u32 m, u32 s) { return (v & m) << s; } - static inline u32 ShiftRightAndMask(u32 v, u32 m, u32 s) { return (v >> s) & m; } + static inline uint MaskAndShiftLeft(uint v, uint m, uint s) { return (v & m) << s; } + static inline uint ShiftRightAndMask(uint v, uint m, uint s) { return (v >> s) & m; } private: static void FlushState(); - static void update_fog(u32 flags); + static void update_fog(uint flags); static void apply_fog() { static const GXColor black = {0, 0, 0, 0}; GXSetFog(static_cast< GXFogType >(sGXState.x53_fogType), sGXState.x24c_fogParams.x0_fogStartZ, sGXState.x24c_fogParams.x4_fogEndZ, diff --git a/include/Kyoto/Graphics/CGraphicsSys.hpp b/include/Kyoto/Graphics/CGraphicsSys.hpp index a6cfd5e4..e484b83e 100644 --- a/include/Kyoto/Graphics/CGraphicsSys.hpp +++ b/include/Kyoto/Graphics/CGraphicsSys.hpp @@ -8,7 +8,7 @@ public: ~CGraphicsSys(); private: - u32 pad; + uint pad; }; #endif diff --git a/include/Kyoto/Graphics/CModelFlags.hpp b/include/Kyoto/Graphics/CModelFlags.hpp index 1c137a5f..93a7a8ed 100644 --- a/include/Kyoto/Graphics/CModelFlags.hpp +++ b/include/Kyoto/Graphics/CModelFlags.hpp @@ -26,15 +26,15 @@ public: : x0_blendMode(trans), x1_matSetIdx(0), x2_flags(kF_DepthCompare | kF_DepthUpdate), x4_color(rgba, rgba, rgba, rgba) {} CModelFlags(ETrans trans, CColor color) : x0_blendMode(trans), x1_matSetIdx(0), x2_flags(kF_DepthCompare | kF_DepthUpdate), x4_color(color) {} - CModelFlags(const CModelFlags& flags, u32 otherFlags) + CModelFlags(const CModelFlags& flags, uint otherFlags) : x0_blendMode(flags.x0_blendMode), x1_matSetIdx(flags.x1_matSetIdx), x2_flags(otherFlags), x4_color(flags.x4_color) {} - CModelFlags(const CModelFlags& flags, bool b /* TODO what's this? */, s32 shaderSet) + CModelFlags(const CModelFlags& flags, bool b /* TODO what's this? */, int shaderSet) : x0_blendMode(flags.x0_blendMode), x1_matSetIdx(shaderSet), x2_flags(flags.x2_flags), x4_color(flags.x4_color) {} - CModelFlags UseShaderSet(s32 matSet) { return CModelFlags(*this, false, matSet); } + CModelFlags UseShaderSet(int matSet) { return CModelFlags(*this, false, matSet); } CModelFlags DontLoadTextures() { return CModelFlags(*this, GetOtherFlags() | kF_NoTextureLock); } CModelFlags DepthCompareUpdate(bool compare, bool update) { - u32 flags = GetOtherFlags(); + uint flags = GetOtherFlags(); if (compare) { flags |= kF_DepthCompare; } else { @@ -50,8 +50,8 @@ public: CModelFlags DepthBackwards() { return CModelFlags(*this, GetOtherFlags() | kF_DepthGreater); } ETrans GetTrans() const { return static_cast< ETrans >(x0_blendMode); } - s32 GetShaderSet() const { return x1_matSetIdx; } - u32 GetOtherFlags() const { return x2_flags; } + int GetShaderSet() const { return x1_matSetIdx; } + uint GetOtherFlags() const { return x2_flags; } CColor GetColor() const { return x4_color; } static CModelFlags Normal() { return CModelFlags(kT_Opaque, 1.f); } diff --git a/include/Kyoto/Graphics/CTevCombiners.hpp b/include/Kyoto/Graphics/CTevCombiners.hpp index 3f149ebe..76d3afa8 100644 --- a/include/Kyoto/Graphics/CTevCombiners.hpp +++ b/include/Kyoto/Graphics/CTevCombiners.hpp @@ -87,7 +87,7 @@ public: class CTevPass { public: - u32 x0_id; + uint x0_id; ColorPass x4_colorPass; AlphaPass x14_alphaPass; CTevOp x24_colorOp; diff --git a/include/Kyoto/IObjectStore.hpp b/include/Kyoto/IObjectStore.hpp index 34f33feb..a274f4ce 100644 --- a/include/Kyoto/IObjectStore.hpp +++ b/include/Kyoto/IObjectStore.hpp @@ -8,8 +8,8 @@ #define kInvalidAssetId 0xFFFFFFFFu -typedef u32 CAssetId; -typedef u32 FourCC; +typedef uint CAssetId; +typedef uint FourCC; struct SObjectTag { FourCC type; diff --git a/include/Kyoto/Math/CMath.hpp b/include/Kyoto/Math/CMath.hpp index b159f67b..23409a3e 100644 --- a/include/Kyoto/Math/CMath.hpp +++ b/include/Kyoto/Math/CMath.hpp @@ -8,7 +8,7 @@ public: static f32 FastCosR(f32 v); static f32 FastSinR(f32 v); static inline f32 FastFmod(f32 x, f32 y) { - s32 v = static_cast(x * (1.f / y)); + int v = static_cast(x * (1.f / y)); return x - v * y; } }; diff --git a/include/Kyoto/Math/CVector2i.hpp b/include/Kyoto/Math/CVector2i.hpp index 950571bc..8492ef00 100644 --- a/include/Kyoto/Math/CVector2i.hpp +++ b/include/Kyoto/Math/CVector2i.hpp @@ -5,8 +5,8 @@ class CVector2i { private: - s32 x; - s32 y; + int x; + int y; }; #endif \ No newline at end of file diff --git a/include/Kyoto/Math/CVector3f.hpp b/include/Kyoto/Math/CVector3f.hpp index c7871bf3..893b13b2 100644 --- a/include/Kyoto/Math/CVector3f.hpp +++ b/include/Kyoto/Math/CVector3f.hpp @@ -48,8 +48,8 @@ public: f32 operator[](EDimY) const { return mY; } f32 operator[](EDimZ) const { return mZ; } - f32& operator[](s32 i) { return *(&mX + i); } - // f32 operator[](s32 i) const { return *(&mX + i); } + f32& operator[](int i) { return *(&mX + i); } + // f32 operator[](int i) const { return *(&mX + i); } bool IsNonZero() const { return mX != 0.f || mY != 0.f || mZ != 0.f; } void DropZ() { mZ = 0.f; } diff --git a/include/Kyoto/Particles/CParticleGen.hpp b/include/Kyoto/Particles/CParticleGen.hpp index f13b1d71..007a2824 100644 --- a/include/Kyoto/Particles/CParticleGen.hpp +++ b/include/Kyoto/Particles/CParticleGen.hpp @@ -32,12 +32,12 @@ public: virtual float GetGeneratorRate() const { return 1.f; } virtual bool IsSystemDeletable() const = 0; virtual CAABox GetBounds() const = 0; - virtual s32 GetParticleCOunt() const = 0; + virtual int GetParticleCOunt() const = 0; virtual bool SystemHasLight() const = 0; virtual CLight GetLight() = 0; virtual void DestroyParticles() = 0; virtual void AddModifier(CWarp*) = 0; - virtual u32 Get4CharId() const = 0; + virtual uint Get4CharId() const = 0; }; #endif // _CPARTICLEGEN_HPP diff --git a/include/Kyoto/Streams/CInputStream.hpp b/include/Kyoto/Streams/CInputStream.hpp index 65b693ec..6e1b7534 100644 --- a/include/Kyoto/Streams/CInputStream.hpp +++ b/include/Kyoto/Streams/CInputStream.hpp @@ -11,19 +11,19 @@ inline T cinput_stream_helper(const TType< T >& type, CInputStream& in); class CInputStream { public: - CInputStream(s32 len); - CInputStream(const void* ptr, s32 len, bool owned); + CInputStream(int len); + CInputStream(const void* ptr, int len, bool owned); virtual ~CInputStream(); - virtual u32 Read(void* dest, u32 len) = 0; + virtual uint Read(void* dest, uint len) = 0; f32 ReadFloat(); u64 ReadLongLong(); - u32 ReadLong(); + uint ReadLong(); u16 ReadShort(); bool ReadBool(); u8 ReadChar(); - u32 ReadBits(u32 len); - u32 ReadBytes(void* dest, unsigned long len); + uint ReadBits(uint len); + uint ReadBytes(void* dest, unsigned long len); void Get(void* dest, unsigned long len); template < typename T > @@ -35,26 +35,26 @@ private: bool GrabAnotherBlock(); bool InternalReadNext(); - u32 x4_blockOffset; - u32 x8_blockLen; - u32 xc_len; + uint x4_blockOffset; + uint x8_blockLen; + uint xc_len; u8* x10_ptr; bool x14_owned; - u32 x18_readPosition; - u32 x1c_bitWord; - u32 x20_bitOffset; + uint x18_readPosition; + uint x1c_bitWord; + uint x20_bitOffset; }; template <> -inline s32 cinput_stream_helper(const TType< s32 >& type, CInputStream& in) { +inline int cinput_stream_helper(const TType< int >& type, CInputStream& in) { return in.ReadLong(); } template <> -inline u32 cinput_stream_helper(const TType< u32 >& type, CInputStream& in) { +inline uint cinput_stream_helper(const TType< uint >& type, CInputStream& in) { return in.ReadLong(); } template <> -inline unsigned int cinput_stream_helper(const TType< unsigned int >& type, CInputStream& in) { +inline unsigned long cinput_stream_helper(const TType< unsigned long >& type, CInputStream& in) { return in.ReadLong(); } template <> diff --git a/include/Kyoto/Streams/CMemoryInStream.hpp b/include/Kyoto/Streams/CMemoryInStream.hpp index b9cb10de..57df29f0 100644 --- a/include/Kyoto/Streams/CMemoryInStream.hpp +++ b/include/Kyoto/Streams/CMemoryInStream.hpp @@ -13,7 +13,7 @@ public: CMemoryInStream(const void* ptr, unsigned long len); CMemoryInStream(const void* ptr, unsigned long len, EOwnerShip ownership); virtual ~CMemoryInStream() override {} - virtual u32 Read(void* dest, u32 len) override; + virtual uint Read(void* dest, uint len) override; }; #endif diff --git a/include/Kyoto/TOneStatic.hpp b/include/Kyoto/TOneStatic.hpp index 5db7d5aa..71939064 100644 --- a/include/Kyoto/TOneStatic.hpp +++ b/include/Kyoto/TOneStatic.hpp @@ -18,8 +18,8 @@ private: static u8 sAllocSpace[sizeof(T)]; return &sAllocSpace; } - static u32& ReferenceCount() { - static u32 sReferenceCount = 0; + static uint& ReferenceCount() { + static uint sReferenceCount = 0; return sReferenceCount; } }; diff --git a/include/Kyoto/TReservedAverage.hpp b/include/Kyoto/TReservedAverage.hpp index ddfdaa86..9a51bdc4 100644 --- a/include/Kyoto/TReservedAverage.hpp +++ b/include/Kyoto/TReservedAverage.hpp @@ -6,7 +6,7 @@ #include "rstl/optional_object.hpp" #include "rstl/reserved_vector.hpp" -template < typename T, s32 N > +template < typename T, int N > class TReservedAverage : rstl::reserved_vector< T, N > { public: TReservedAverage(const T& value) { @@ -14,7 +14,7 @@ public: } void AddValue(const T& value) { push_back(value); - for (s32 i = size() - 1; i > 0; --i) { + for (int i = size() - 1; i > 0; --i) { operator[](i) = operator[](i - 1); } operator[](0) = value; diff --git a/include/Kyoto/Text/CStringTable.hpp b/include/Kyoto/Text/CStringTable.hpp index 0ae17a57..369400e6 100644 --- a/include/Kyoto/Text/CStringTable.hpp +++ b/include/Kyoto/Text/CStringTable.hpp @@ -8,7 +8,7 @@ #include "Kyoto/Streams/CInputStream.hpp" class CStringTable { - s32 x0_stringCount; + int x0_stringCount; rstl::single_ptr< u8 > x4_data; public: diff --git a/include/MetaRender/CCubeRenderer.hpp b/include/MetaRender/CCubeRenderer.hpp index df501a96..1d26fd50 100644 --- a/include/MetaRender/CCubeRenderer.hpp +++ b/include/MetaRender/CCubeRenderer.hpp @@ -37,7 +37,7 @@ public: virtual void AddParticleGen1(); virtual void AddParticleGen2(); virtual void AddPlaneObject(); - virtual void AddDrawable(const void* obj, const CVector3f& pos, const CAABox& bounds, s32 mode, IRenderer::EDrawableSorting sorting); + virtual void AddDrawable(const void* obj, const CVector3f& pos, const CAABox& bounds, int mode, IRenderer::EDrawableSorting sorting); virtual void SetDrawableCallback(); virtual void SetWorldViewpoint(); virtual void SetPerspective1(); diff --git a/include/MetroidPrime/CActor.hpp b/include/MetroidPrime/CActor.hpp index 272a3300..478bf72d 100644 --- a/include/MetroidPrime/CActor.hpp +++ b/include/MetroidPrime/CActor.hpp @@ -234,13 +234,13 @@ public: SAdvancementDeltas UpdateAnimation(float dt, CStateManager& mgr, bool advTree); - void ProcessSoundEvent(s32 sfxId, f32 weight, s32 flags, f32 fallOff, f32 maxDist, u8 minVol, u8 maxVol, const CVector3f& toListener, - const CVector3f& position, s32 aid, CStateManager& mgr, bool translateId); + void ProcessSoundEvent(int sfxId, f32 weight, int flags, f32 fallOff, f32 maxDist, u8 minVol, u8 maxVol, const CVector3f& toListener, + const CVector3f& position, int aid, CStateManager& mgr, bool translateId); void UpdateSfxEmitters(); void RemoveEmitter(); void SetModelData(const CModelData& modelData); - f32 GetAverageAnimVelocity(s32 anim); + f32 GetAverageAnimVelocity(int anim); void EnsureRendered(const CStateManager& mgr) const; void EnsureRendered(const CStateManager& mgr, const CVector3f& pos, const CAABox& bounds) const; void DrawTouchBounds() const; @@ -315,38 +315,38 @@ protected: CAABox x9c_renderBounds; CModelFlags xb4_drawFlags; f32 xbc_time; - u32 xc0_pitchBend; + uint xc0_pitchBend; TUniqueId xc4_fluidId; TUniqueId xc6_nextDrawNode; - s32 xc8_drawnToken; - s32 xcc_addedToken; + int xc8_drawnToken; + int xcc_addedToken; f32 xd0_damageMag; u8 xd4_maxVol; rstl::reserved_vector< CSfxHandle, 2 > xd8_nonLoopingSfxHandles; - u32 xe4_24_nextNonLoopingSfxHandle : 3; - u32 xe4_27_notInSortedLists : 1; - u32 xe4_28_transformDirty : 1; - u32 xe4_29_actorLightsDirty : 1; - u32 xe4_30_outOfFrustum : 1; - u32 xe4_31_calculateLighting : 1; - u32 xe5_24_shadowEnabled : 1; - u32 xe5_25_shadowDirty : 1; - u32 xe5_26_muted : 1; - u32 xe5_27_useInSortedLists : 1; - u32 xe5_28_callTouch : 1; - u32 xe5_29_globalTimeProvider : 1; - u32 xe5_30_renderUnsorted : 1; - u32 xe5_31_pointGeneratorParticles : 1; - u32 xe6_24_fluidCounter : 3; + uint xe4_24_nextNonLoopingSfxHandle : 3; + uint xe4_27_notInSortedLists : 1; + uint xe4_28_transformDirty : 1; + uint xe4_29_actorLightsDirty : 1; + uint xe4_30_outOfFrustum : 1; + uint xe4_31_calculateLighting : 1; + uint xe5_24_shadowEnabled : 1; + uint xe5_25_shadowDirty : 1; + uint xe5_26_muted : 1; + uint xe5_27_useInSortedLists : 1; + uint xe5_28_callTouch : 1; + uint xe5_29_globalTimeProvider : 1; + uint xe5_30_renderUnsorted : 1; + uint xe5_31_pointGeneratorParticles : 1; + uint xe6_24_fluidCounter : 3; EThermalFlags xe6_27_thermalVisorFlags : 2; - u32 xe6_29_renderParticleDBInside : 1; - u32 xe6_30_enablePitchBend : 1; - u32 xe6_31_targetableVisorFlags : 4; - u32 xe7_27_enableRender : 1; - u32 xe7_28_worldLightingDirty : 1; - u32 xe7_29_drawEnabled : 1; - u32 xe7_30_doTargetDistanceTest : 1; - u32 xe7_31_targetable : 1; + uint xe6_29_renderParticleDBInside : 1; + uint xe6_30_enablePitchBend : 1; + uint xe6_31_targetableVisorFlags : 4; + uint xe7_27_enableRender : 1; + uint xe7_28_worldLightingDirty : 1; + uint xe7_29_drawEnabled : 1; + uint xe7_30_doTargetDistanceTest : 1; + uint xe7_31_targetable : 1; }; CHECK_SIZEOF(CActor, 0xe8) diff --git a/include/MetroidPrime/CActorLights.hpp b/include/MetroidPrime/CActorLights.hpp index d102aed9..7be78bc8 100644 --- a/include/MetroidPrime/CActorLights.hpp +++ b/include/MetroidPrime/CActorLights.hpp @@ -31,8 +31,8 @@ private: f32 x30_angleC; f32 x34_angleL; f32 x38_angleQ; - u32 x3c_priority; - u32 x40_lightId; + uint x3c_priority; + uint x40_lightId; mutable f32 x44_cachedRadius; mutable f32 x48_cachedIntensity; mutable bool x4c_24_intensityDirty : 1; @@ -69,19 +69,19 @@ private: bool x299_25_useBrightLightLag : 1; bool x299_26_ambientOnly : 1; bool x29a_findNearestDynamicLights; - s32 x29c_shadowLightArrIdx; - s32 x2a0_shadowLightIdx; - u32 x2a4_lastUpdateFrame; - u32 x2a8_areaUpdateFramePeriod; + int x29c_shadowLightArrIdx; + int x2a0_shadowLightIdx; + uint x2a4_lastUpdateFrame; + uint x2a8_areaUpdateFramePeriod; CVector3f x2ac_actorPosBias; - s32 x2b8_maxAreaLights; - s32 x2bc_maxDynamicLights; + int x2b8_maxAreaLights; + int x2bc_maxDynamicLights; CVector3f x2c0_lastActorPos; f32 x2cc_actorPositionDeltaUpdateThreshold; f32 x2d0_shadowDynamicRangeThreshold; f32 x2d4_worldLightingLevel; - s32 x2d8_brightLightIdx; - u32 x2dc_brightLightLag; + int x2d8_brightLightIdx; + uint x2dc_brightLightLag; }; CHECK_SIZEOF(CActorLights, 0x2e0) diff --git a/include/MetroidPrime/CActorParameters.hpp b/include/MetroidPrime/CActorParameters.hpp index 9f359f69..94fb8628 100644 --- a/include/MetroidPrime/CActorParameters.hpp +++ b/include/MetroidPrime/CActorParameters.hpp @@ -41,7 +41,7 @@ public: const CColor& GetAmbientColor() const { return x18_noLightsAmbient; } bool ShouldMakeLights() const { return x1c_makeLights; } - s32 GetMaxAreaLights() const { return x3c_maxAreaLights; } + int GetMaxAreaLights() const { return x3c_maxAreaLights; } rstl::auto_ptr< CActorLights > MakeActorLights() const; @@ -56,10 +56,10 @@ private: bool x1d_ambientChannelOverflow; EWorldLightingOptions x20_worldLightingOptions; ELightRecalculationOptions x24_lightRecalcOpts; - s32 x28_layerIdx; + int x28_layerIdx; CVector3f x2c_actorPosBias; - s32 x38_maxDynamicLights; - s32 x3c_maxAreaLights; + int x38_maxDynamicLights; + int x3c_maxAreaLights; }; CHECK_SIZEOF(CLightParameters, 0x40) @@ -90,9 +90,9 @@ public: static CVisorParameters None(); private: - u32 x0_mask : 4; - u32 x0_4_b1 : 1; - u32 x0_5_scanPassthrough : 1; + uint x0_mask : 4; + uint x0_4_b1 : 1; + uint x0_5_scanPassthrough : 1; }; CHECK_SIZEOF(CVisorParameters, 0x4) diff --git a/include/MetroidPrime/CAnimData.hpp b/include/MetroidPrime/CAnimData.hpp index 5d925246..a976202b 100644 --- a/include/MetroidPrime/CAnimData.hpp +++ b/include/MetroidPrime/CAnimData.hpp @@ -36,22 +36,22 @@ public: x120_particleDB.SetParticleEffectState(name, active, mgr); } - s32 GetCharacterIndex() const { return x204_charIdx; } - f32 GetAverageVelocity(s32 idx) const; + int GetCharacterIndex() const { return x204_charIdx; } + f32 GetAverageVelocity(int idx) const; - const CBoolPOINode* GetBoolPOIList(s32& count) const { + const CBoolPOINode* GetBoolPOIList(int& count) const { count = x20c_passedBoolCount; return mBoolPOINodes.data(); } - const CInt32POINode* GetInt32POIList(s32& count) const { + const CInt32POINode* GetInt32POIList(int& count) const { count = x210_passedIntCount; return mInt32POINodes.data(); } - const CParticlePOINode* GetParticlePOIList(s32& count) const { + const CParticlePOINode* GetParticlePOIList(int& count) const { count = x214_passedParticleCount; return mParticlePOINodes.data(); } - const CSoundPOINode* GetSoundPOIList(s32& count) const { + const CSoundPOINode* GetSoundPOIList(int& count) const { count = x218_passedSoundCount; return mSoundPOINodes.data(); } @@ -171,13 +171,13 @@ private: rstl::rc_ptr< CAnimTreeNode > x1f8_animRoot; rstl::rc_ptr< CTransitionManager > x1fc_transMgr; f32 x200_speedScale; - s32 x204_charIdx; - s32 x208_defaultAnim; - s32 x20c_passedBoolCount; - s32 x210_passedIntCount; - s32 x214_passedParticleCount; - s32 x218_passedSoundCount; - s32 x21c_particleLightIdx; + int x204_charIdx; + int x208_defaultAnim; + int x20c_passedBoolCount; + int x210_passedIntCount; + int x214_passedParticleCount; + int x218_passedSoundCount; + int x21c_particleLightIdx; bool x220_24_animating : 1; bool x220_25_loop : 1; bool x220_26_aligningPos : 1; @@ -189,7 +189,7 @@ private: CPoseAsTransforms x224_pose; CHierarchyPoseBuilder x2fc_poseBuilder; CAnimPlaybackParms x40c_playbackParms; - rstl::reserved_vector< rstl::pair< s32, CAdditiveAnimPlayback >, 8 > x434_additiveAnims; + rstl::reserved_vector< rstl::pair< int, CAdditiveAnimPlayback >, 8 > x434_additiveAnims; static rstl::reserved_vector< CBoolPOINode, 8 > mBoolPOINodes; static rstl::reserved_vector< CInt32POINode, 16 > mInt32POINodes; diff --git a/include/MetroidPrime/CAnimPlaybackParms.hpp b/include/MetroidPrime/CAnimPlaybackParms.hpp index f7d3c01c..4ae77597 100644 --- a/include/MetroidPrime/CAnimPlaybackParms.hpp +++ b/include/MetroidPrime/CAnimPlaybackParms.hpp @@ -9,11 +9,11 @@ class CVector3f; class CAnimPlaybackParms { private: - s32 x0_animA; - s32 x4_animB; + int x0_animA; + int x4_animB; f32 x8_blendWeight; bool xc_animating; - s32 x10_; + int x10_; CVector3f* x14_targetPos; bool x18_useLocator; CQuaternion* x1c_deltaOrient; diff --git a/include/MetroidPrime/CCharacterInfo.hpp b/include/MetroidPrime/CCharacterInfo.hpp index 9dde30c1..6914062f 100644 --- a/include/MetroidPrime/CCharacterInfo.hpp +++ b/include/MetroidPrime/CCharacterInfo.hpp @@ -29,15 +29,15 @@ private: CAssetId x14_cmdl; CAssetId x18_cksr; CAssetId x1c_cinf; - rstl::vector< rstl::pair< s32, rstl::pair< rstl::string, rstl::string > > > x20_animInfo; + rstl::vector< rstl::pair< int, rstl::pair< rstl::string, rstl::string > > > x20_animInfo; CPASDatabase x30_pasDatabase; CParticleResData x44_partRes; - u32 x84_unk; + uint x84_unk; rstl::vector< rstl::pair< rstl::string, CAABox > > x88_aabbs; rstl::vector< rstl::pair< rstl::string, rstl::vector< CEffectComponent > > > x98_effects; - u32 xa8_cmdlOverlay; - u32 xac_cksrOverlay; - rstl::vector< s32 > xb0_animIdxs; + uint xa8_cmdlOverlay; + uint xac_cksrOverlay; + rstl::vector< int > xb0_animIdxs; }; CHECK_SIZEOF(CCharacterInfo, 0xc0) diff --git a/include/MetroidPrime/CEffectComponent.hpp b/include/MetroidPrime/CEffectComponent.hpp index a11fd347..79074a7a 100644 --- a/include/MetroidPrime/CEffectComponent.hpp +++ b/include/MetroidPrime/CEffectComponent.hpp @@ -12,7 +12,7 @@ private: rstl::string x18_boneName; f32 x28_scale; CParticleData::EParentedMode x2c_parentedMode; - u32 x30_flags; + uint x30_flags; }; #endif \ No newline at end of file diff --git a/include/MetroidPrime/CEnvFxManager.hpp b/include/MetroidPrime/CEnvFxManager.hpp index 91bd35be..b2719a15 100644 --- a/include/MetroidPrime/CEnvFxManager.hpp +++ b/include/MetroidPrime/CEnvFxManager.hpp @@ -40,7 +40,7 @@ private: CVector3f x18_focusCellPosition; bool x24_enableSplash; f32 x28_firstSnowForce; - s32 x2c_lastBlockedGridIdx; + int x2c_lastBlockedGridIdx; f32 x30_fxDensity; f32 x34_targetFxDensity; f32 x38_maxDensityDeltaSpeed; diff --git a/include/MetroidPrime/CGameArea.hpp b/include/MetroidPrime/CGameArea.hpp index bb296298..d63fa6e6 100644 --- a/include/MetroidPrime/CGameArea.hpp +++ b/include/MetroidPrime/CGameArea.hpp @@ -20,12 +20,12 @@ public: virtual ~IGameArea(); virtual const CTransform4f& IGetTM() const = 0; virtual CAssetId IGetStringTableAssetId() const = 0; - virtual u32 IGetNumAttachedAreas() const = 0; + virtual uint IGetNumAttachedAreas() const = 0; virtual TAreaId IGetAttachedAreaId(int) const = 0; virtual bool IIsActive() const = 0; virtual CAssetId IGetAreaAssetId() const = 0; - virtual s32 IGetAreaSaveId() const = 0; - virtual rstl::pair< rstl::auto_ptr< u8 >, s32 > IGetScriptingMemoryAlways() const = 0; + virtual int IGetAreaSaveId() const = 0; + virtual rstl::pair< rstl::auto_ptr< u8 >, int > IGetScriptingMemoryAlways() const = 0; }; class Dock; @@ -37,12 +37,12 @@ public: ~CGameArea(); const CTransform4f& IGetTM() const override; CAssetId IGetStringTableAssetId() const override; - u32 IGetNumAttachedAreas() const override; + uint IGetNumAttachedAreas() const override; TAreaId IGetAttachedAreaId(int) const override; bool IIsActive() const override; CAssetId IGetAreaAssetId() const override; - s32 IGetAreaSaveId() const override; - rstl::pair< rstl::auto_ptr< u8 >, s32 > IGetScriptingMemoryAlways() const override; + int IGetAreaSaveId() const override; + rstl::pair< rstl::auto_ptr< u8 >, int > IGetScriptingMemoryAlways() const override; bool IsLoaded() const { return xf0_24_postConstructed; } bool IsActive() const { return xf0_25_active; } @@ -61,14 +61,14 @@ private: CTransform4f x3c_invTransform; CAABox x6c_aabb; CAssetId x84_mrea; - s32 x88_areaId; + int x88_areaId; rstl::vector< u16 > x8c_attachedAreaIndices; rstl::vector< SObjectTag > x9c_deps1; rstl::vector< SObjectTag > xac_deps2; - rstl::vector< u32 > xbc_layerDepOffsets; + rstl::vector< uint > xbc_layerDepOffsets; rstl::vector< Dock > xcc_docks; rstl::vector< CToken > xdc_tokens; - u32 xec_totalResourcesSize; + uint xec_totalResourcesSize; bool xf0_24_postConstructed : 1; bool xf0_25_active : 1; bool xf0_26_tokensReady : 1; diff --git a/include/MetroidPrime/CGameGlobalObjects.hpp b/include/MetroidPrime/CGameGlobalObjects.hpp index 4efd2e14..670dd0ac 100644 --- a/include/MetroidPrime/CGameGlobalObjects.hpp +++ b/include/MetroidPrime/CGameGlobalObjects.hpp @@ -36,9 +36,9 @@ private: CAiFuncMap x110_aiFuncMap; CGraphicsSys x130_graphicsSys; rstl::single_ptr< CGameState > x134_gameState; - u32 x138_; + uint x138_; rstl::optional_object< TCachedToken< unkptr > > x13c_; - u32 x14c_; + uint x14c_; rstl::single_ptr< CInGameTweakManager > x150_inGameTweakManager; TToken< CRasterFont > x154_defaultFont; }; diff --git a/include/MetroidPrime/CHierarchyPoseBuilder.hpp b/include/MetroidPrime/CHierarchyPoseBuilder.hpp index 17dd6922..772e1596 100644 --- a/include/MetroidPrime/CHierarchyPoseBuilder.hpp +++ b/include/MetroidPrime/CHierarchyPoseBuilder.hpp @@ -19,7 +19,7 @@ class TSegIdMap { private: CSegId x0_boneCount; CSegId x1_capacity; - u32 x4_maxCapacity; + uint x4_maxCapacity; CSegId x8_indirectionMap[200]; T* xd0_nodes; CSegId xd4_curPrevBone; diff --git a/include/MetroidPrime/CIOWinManager.hpp b/include/MetroidPrime/CIOWinManager.hpp index 10130e51..d4045870 100644 --- a/include/MetroidPrime/CIOWinManager.hpp +++ b/include/MetroidPrime/CIOWinManager.hpp @@ -12,8 +12,8 @@ public: inline bool IsEmpty() const { return x4_ == 0 && x0_ == 0; } private: - u32 x0_; - u32 x4_; + uint x0_; + uint x4_; rstl::list< unkptr > x8_; }; diff --git a/include/MetroidPrime/CMain.hpp b/include/MetroidPrime/CMain.hpp index 749e48b4..76ee3c19 100644 --- a/include/MetroidPrime/CMain.hpp +++ b/include/MetroidPrime/CMain.hpp @@ -23,7 +23,7 @@ public: void StreamNewGameState(CInputStream& in, int saveIdx); void RefreshGameState(); void AddWorldPaks(); - void AsyncIdle(u32 time); + void AsyncIdle(uint time); int RsMain(int argc, const char* const* argv); void InitializeSubsystems(); void FillInAssetIDs(); @@ -50,9 +50,9 @@ private: f32 x120_; f32 x124_; CGameGlobalObjects* x128_gameGlobalObjects; - u32 x12c_flowState; // EFlowState - rstl::reserved_vector< u32, 10 > x130_frameTimes; - s32 x15c_frameTimeIdx; + uint x12c_flowState; // EFlowState + rstl::reserved_vector< uint, 10 > x130_frameTimes; + int x15c_frameTimeIdx; bool x160_24_finished : 1; bool x160_25_mfGameBuilt : 1; bool x160_26_screenFading : 1; diff --git a/include/MetroidPrime/CObjectList.hpp b/include/MetroidPrime/CObjectList.hpp index d574b3f7..15cb16da 100644 --- a/include/MetroidPrime/CObjectList.hpp +++ b/include/MetroidPrime/CObjectList.hpp @@ -37,10 +37,10 @@ public: const CEntity* GetObjectById() const; CEntity* GetValidObjectById(TUniqueId uid); const CEntity* GetValidObjectById(TUniqueId uid) const; - CEntity* operator[](s32 idx); - const CEntity* operator[](s32 idx) const; - const CEntity* GetValidObjectByIndex(s32 idx) const; - s32 size() const { return mCount; } + CEntity* operator[](int idx); + const CEntity* operator[](int idx) const; + const CEntity* GetValidObjectByIndex(int idx) const; + int size() const { return mCount; } private: SObjectListEntry mObjects[1024]; diff --git a/include/MetroidPrime/CPASAnimState.hpp b/include/MetroidPrime/CPASAnimState.hpp index 03e4dcc8..c4d76149 100644 --- a/include/MetroidPrime/CPASAnimState.hpp +++ b/include/MetroidPrime/CPASAnimState.hpp @@ -47,8 +47,8 @@ public: kPT_Enum = 4, }; union UParmValue { - s32 m_int; - u32 m_uint; + int m_int; + uint m_uint; f32 m_float; bool m_bool; }; @@ -77,7 +77,7 @@ private: class CPASAnimInfo { private: - u32 x0_id; + uint x0_id; rstl::reserved_vector< CPASAnimParm::UParmValue, 8 > x4_parms; }; @@ -86,7 +86,7 @@ private: pas::EAnimationState x0_id; rstl::vector< CPASParmInfo > x4_parms; rstl::vector< CPASAnimInfo > x14_anims; - rstl::vector< s32 > x24_selectionCache; + rstl::vector< int > x24_selectionCache; }; CHECK_SIZEOF(CPASAnimState, 0x34) diff --git a/include/MetroidPrime/CPASDatabase.hpp b/include/MetroidPrime/CPASDatabase.hpp index 23832cda..80ce7487 100644 --- a/include/MetroidPrime/CPASDatabase.hpp +++ b/include/MetroidPrime/CPASDatabase.hpp @@ -10,7 +10,7 @@ class CPASDatabase { private: rstl::vector< CPASAnimState > x0_states; - s32 x10_defaultState; + int x10_defaultState; }; CHECK_SIZEOF(CPASDatabase, 0x14) diff --git a/include/MetroidPrime/CPOINode.hpp b/include/MetroidPrime/CPOINode.hpp index 13e2b950..bd7acb2b 100644 --- a/include/MetroidPrime/CPOINode.hpp +++ b/include/MetroidPrime/CPOINode.hpp @@ -27,19 +27,19 @@ public: EPOIType GetPoiType() const { return static_cast< EPOIType >(x18_type); } const CCharAnimTime& GetTime() const { return x1c_time; } f32 GetWeight() const { return x2c_weight; } - s32 GetCharacterIndex() const { return x30_charIdx; } - s32 GetFlags() const { return x34_flags; } + int GetCharacterIndex() const { return x30_charIdx; } + int GetFlags() const { return x34_flags; } protected: u16 x4_; rstl::string x8_name; u16 x18_type; CCharAnimTime x1c_time; - s32 x24_index; + int x24_index; bool x28_unique; f32 x2c_weight; - s32 x30_charIdx; - s32 x34_flags; + int x30_charIdx; + int x34_flags; }; CHECK_SIZEOF(CPOINode, 0x38) @@ -60,11 +60,11 @@ public: // __ct__13CInt32POINodeFQ24rstl66basic_string,Q24rstl17rmemory_allocator>UsRC13CCharAnimTimeibfiiiRCQ24rstl66basic_string,Q24rstl17rmemory_allocator> // CopyNodeMinusStartTime__13CInt32POINodeFRC13CInt32POINodeRC13CCharAnimTime - s32 GetValue() const { return x38_val; } + int GetValue() const { return x38_val; } const rstl::string& GetLocatorName() const { return x3c_lctrName; } private: - s32 x38_val; + int x38_val; rstl::string x3c_lctrName; }; @@ -75,12 +75,12 @@ private: class CSoundPOINode : public CPOINode { public: - u32 GetSoundId() const { return x38_sfxId; } + uint GetSoundId() const { return x38_sfxId; } f32 GetFallOff() const { return x3c_falloff; } f32 GetMaxDistance() const { return x40_maxDist; } private: - u32 x38_sfxId; + uint x38_sfxId; f32 x3c_falloff; f32 x40_maxDist; }; diff --git a/include/MetroidPrime/CParticleData.hpp b/include/MetroidPrime/CParticleData.hpp index ee15dfab..29b953f3 100644 --- a/include/MetroidPrime/CParticleData.hpp +++ b/include/MetroidPrime/CParticleData.hpp @@ -17,7 +17,7 @@ public: }; private: - u32 x0_duration; + uint x0_duration; SObjectTag x4_particle; rstl::string xc_boneName; f32 x1c_scale; @@ -26,7 +26,7 @@ private: class CAuxiliaryParticleData { private: - u32 x0_duration; + uint x0_duration; SObjectTag x4_particle; CVector3f xc_translation; f32 x18_scale; diff --git a/include/MetroidPrime/CSortedLists.hpp b/include/MetroidPrime/CSortedLists.hpp index 22e1213d..810c548c 100644 --- a/include/MetroidPrime/CSortedLists.hpp +++ b/include/MetroidPrime/CSortedLists.hpp @@ -21,7 +21,7 @@ CHECK_SIZEOF(SNode, 0x2c); struct SSortedList { s16 x0_ids[kMaxObjects]; - u32 x800_size; + uint x800_size; }; CHECK_SIZEOF(SSortedList, 0x804); diff --git a/include/MetroidPrime/CWeaponMgr.hpp b/include/MetroidPrime/CWeaponMgr.hpp index e9bbd833..856e87dc 100644 --- a/include/MetroidPrime/CWeaponMgr.hpp +++ b/include/MetroidPrime/CWeaponMgr.hpp @@ -10,7 +10,7 @@ class CWeaponMgr { private: - rstl::map< TUniqueId, rstl::reserved_vector< s32, 15 > > x0_weapons; + rstl::map< TUniqueId, rstl::reserved_vector< int, 15 > > x0_weapons; }; CHECK_SIZEOF(CWeaponMgr, 0x14); diff --git a/include/MetroidPrime/CWorld.hpp b/include/MetroidPrime/CWorld.hpp index 35162cce..f3a5aad8 100644 --- a/include/MetroidPrime/CWorld.hpp +++ b/include/MetroidPrime/CWorld.hpp @@ -25,7 +25,7 @@ public: virtual TAreaId IGetAreaId(CAssetId id) const = 0; virtual bool ICheckWorldComplete() = 0; virtual rstl::string IGetDefaultAudioTrack() const = 0; - virtual s32 IGetAreaCount() const = 0; + virtual int IGetAreaCount() const = 0; }; class CGameArea; @@ -55,7 +55,7 @@ public: TAreaId IGetAreaId(CAssetId id) const override; bool ICheckWorldComplete() override; rstl::string IGetDefaultAudioTrack() const override; - s32 IGetAreaCount() const override; + int IGetAreaCount() const override; const CGameArea& GetAreaAlways(TAreaId id) const { return *x18_areas[id.Value()]; @@ -87,13 +87,13 @@ private: rstl::vector< CRelay > x2c_relays; rstl::rc_ptr< IDvdRequest > x3c_loadToken; rstl::single_ptr< u8 > x40_loadBuf; - u32 x44_bufSz; - u32 x48_chainCount; + uint x44_bufSz; + uint x48_chainCount; CGameArea* x4c_chainHeads[5]; IObjectStore* x60_objectStore; IFactory* x64_resFactory; TAreaId x68_curAreaId; - u32 x6c_loadedAudioGrpCount; + uint x6c_loadedAudioGrpCount; bool x70_24_currentAreaNeedsAllocation : 1; bool x70_25_loadPaused : 1; bool x70_26_skyboxActive : 1; diff --git a/include/MetroidPrime/Cameras/CCameraHint.hpp b/include/MetroidPrime/Cameras/CCameraHint.hpp index ec2c8a74..729aaee2 100644 --- a/include/MetroidPrime/Cameras/CCameraHint.hpp +++ b/include/MetroidPrime/Cameras/CCameraHint.hpp @@ -7,7 +7,7 @@ class CCameraHint { public: - CCameraHint(u32 overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, f32 minDist, f32 maxDist, + CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, f32 minDist, f32 maxDist, f32 backwardsDist, const CVector3f& lookAtOffset, const CVector3f& chaseLookAtOffset, const CVector3f& ballToCam, f32 fov, f32 attitudeRange, f32 azimuthRange, f32 anglePerSecond, f32 clampVelRange, f32 clampRotRange, f32 elevation, f32 interpolateTime, @@ -15,7 +15,7 @@ public: virtual ~CCameraHint(); private: - u32 mOverrideFlags; + uint mOverrideFlags; CBallCamera::EBallCameraBehaviour mBehaviour; f32 mMinDist; f32 mMaxDist; diff --git a/include/MetroidPrime/Cameras/CCameraManager.hpp b/include/MetroidPrime/Cameras/CCameraManager.hpp index 4c9fdd0c..8f2bba2a 100644 --- a/include/MetroidPrime/Cameras/CCameraManager.hpp +++ b/include/MetroidPrime/Cameras/CCameraManager.hpp @@ -28,14 +28,14 @@ private: TUniqueId x0_curCameraId; rstl::vector< TUniqueId > x4_cineCameras; rstl::list< CCameraShakeData > x14_shakers; - u32 x2c_lastShakeId; + uint x2c_lastShakeId; CVector3f x30_shakeOffset; CAreaFog x3c_fog; - s32 x74_fluidCounter; + int x74_fluidCounter; TUniqueId x78_fluidId; CFirstPersonCamera* x7c_fpCamera; CBallCamera* x80_ballCamera; - s32 x84_rumbleId; + int x84_rumbleId; CInterpolationCamera* x88_interpCamera; s16 x8c_; f32 x90_rumbleCooldown; @@ -48,8 +48,8 @@ private: TUniqueId xa2_spindleCamId; TUniqueId xa4_pathCamId; TUniqueId xa6_camHintId; - s32 xa8_hintPriority; - rstl::reserved_vector< rstl::pair< s32, TUniqueId >, 64 > xac_cameraHints; + int xa8_hintPriority; + rstl::reserved_vector< rstl::pair< int, TUniqueId >, 64 > xac_cameraHints; rstl::reserved_vector< TUniqueId, 64 > x2b0_inactiveCameraHints; rstl::reserved_vector< TUniqueId, 64 > x334_activeCameraHints; bool x3b8_24_ : 1; diff --git a/include/MetroidPrime/Cameras/CCameraShakeData.hpp b/include/MetroidPrime/Cameras/CCameraShakeData.hpp index 9ffa78f3..3e8ac8b2 100644 --- a/include/MetroidPrime/Cameras/CCameraShakeData.hpp +++ b/include/MetroidPrime/Cameras/CCameraShakeData.hpp @@ -34,8 +34,8 @@ private: CCameraShakerComponent x8_shakerX; CCameraShakerComponent x44_shakerY; CCameraShakerComponent x80_shakerZ; - u32 xbc_shakerId; - u32 xc0_flags; + uint xbc_shakerId; + uint xc0_flags; CVector3f xc4_sfxPos; f32 xd0_sfxDist; }; diff --git a/include/MetroidPrime/Cameras/CGameCamera.hpp b/include/MetroidPrime/Cameras/CGameCamera.hpp index 2a311d7d..eba6c61a 100644 --- a/include/MetroidPrime/Cameras/CGameCamera.hpp +++ b/include/MetroidPrime/Cameras/CGameCamera.hpp @@ -22,7 +22,7 @@ private: f32 x160_znear; f32 x164_zfar; f32 x168_aspect; - u32 x16c_controllerIdx; + uint x16c_controllerIdx; mutable bool x170_24_perspDirty : 1; bool x170_25_disablesInput : 1; f32 x174_delayTime; diff --git a/include/MetroidPrime/Player/CGameOptions.hpp b/include/MetroidPrime/Player/CGameOptions.hpp index e5ff7417..97f870c2 100644 --- a/include/MetroidPrime/Player/CGameOptions.hpp +++ b/include/MetroidPrime/Player/CGameOptions.hpp @@ -19,15 +19,15 @@ public: private: rstl::reserved_vector< bool, 64 > x0_; - s32 x44_soundMode; // CAudioSys::ESurroundModes - u32 x48_screenBrightness; - s32 x4c_screenXOffset; - s32 x50_screenYOffset; - s32 x54_screenStretch; - u32 x58_sfxVol; - u32 x5c_musicVol; - u32 x60_hudAlpha; - u32 x64_helmetAlpha; + int x44_soundMode; // CAudioSys::ESurroundModes + uint x48_screenBrightness; + int x4c_screenXOffset; + int x50_screenYOffset; + int x54_screenStretch; + uint x58_sfxVol; + uint x5c_musicVol; + uint x60_hudAlpha; + uint x64_helmetAlpha; bool x68_24_hudLag : 1; bool x68_25_invertY : 1; bool x68_26_rumble : 1; diff --git a/include/MetroidPrime/Player/CGameState.hpp b/include/MetroidPrime/Player/CGameState.hpp index 7bf80800..362dd3cb 100644 --- a/include/MetroidPrime/Player/CGameState.hpp +++ b/include/MetroidPrime/Player/CGameState.hpp @@ -26,7 +26,7 @@ public: CSystemOptions& SystemOptions() { return xa8_systemOptions; } CGameOptions& GameOptions() { return x17c_gameOptions; } CHintOptions& HintOptions() { return x1f8_hintOptions; } - u32& SaveIdx() { return x20c_saveIdx; } + uint& SaveIdx() { return x20c_saveIdx; } u64& CardSerial() { return x210_cardSerial; } rstl::vector< u8 >& BackupBuf() { return x218_backupBuf; } @@ -40,7 +40,7 @@ private: CSystemOptions xa8_systemOptions; CGameOptions x17c_gameOptions; CHintOptions x1f8_hintOptions; - u32 x20c_saveIdx; + uint x20c_saveIdx; u64 x210_cardSerial; rstl::vector< u8 > x218_backupBuf; bool x228_24_hardMode : 1; diff --git a/include/MetroidPrime/TGameTypes.hpp b/include/MetroidPrime/TGameTypes.hpp index 51ee5448..480a85bb 100644 --- a/include/MetroidPrime/TGameTypes.hpp +++ b/include/MetroidPrime/TGameTypes.hpp @@ -12,11 +12,11 @@ extern TEditorId kInvalidEditorId; extern TUniqueId kInvalidUniqueId; struct TAreaId { - s32 value; + int value; TAreaId() : value(-1) {} - TAreaId(s32 value) : value(value) {} - s32 Value() const { return value; } + TAreaId(int value) : value(value) {} + int Value() const { return value; } bool operator==(const TAreaId& other) const { return value == other.value; } bool operator!=(const TAreaId& other) const { return value != other.value; } @@ -24,11 +24,11 @@ struct TAreaId { CHECK_SIZEOF(TAreaId, 0x4) struct TEditorId { - u32 value; + uint value; TEditorId() : value(-1) {} - TEditorId(u32 value) : value(value) {} - u32 Value() const { return value; } + TEditorId(uint value) : value(value) {} + uint Value() const { return value; } bool operator==(const TEditorId& other) const { return value == other.value; } bool operator!=(const TEditorId& other) const { return value != other.value; } diff --git a/include/MetroidPrime/Tweaks/CTweakGame.hpp b/include/MetroidPrime/Tweaks/CTweakGame.hpp index 3955545a..1e630561 100644 --- a/include/MetroidPrime/Tweaks/CTweakGame.hpp +++ b/include/MetroidPrime/Tweaks/CTweakGame.hpp @@ -10,7 +10,7 @@ public: const rstl::string& GetWorldPrefix() { return x4_worldPrefix; } private: - u32 x0_; + uint x0_; rstl::string x4_worldPrefix; }; diff --git a/include/MetroidPrime/Tweaks/CTweaks.hpp b/include/MetroidPrime/Tweaks/CTweaks.hpp index a97756d5..235886c1 100644 --- a/include/MetroidPrime/Tweaks/CTweaks.hpp +++ b/include/MetroidPrime/Tweaks/CTweaks.hpp @@ -9,7 +9,7 @@ public: void RegisterTweaks(); private: - u32 x0_unk; + uint x0_unk; }; #endif diff --git a/include/dolphin/types.h b/include/dolphin/types.h index 789ff05b..526b4774 100644 --- a/include/dolphin/types.h +++ b/include/dolphin/types.h @@ -14,11 +14,11 @@ typedef uint64_t u64; #else typedef signed char s8; typedef signed short int s16; -typedef signed int s32; +typedef signed long s32; typedef signed long long int s64; typedef unsigned char u8; typedef unsigned short int u16; -typedef unsigned int u32; +typedef unsigned long u32; typedef unsigned long long int u64; #endif diff --git a/include/rstl/reserved_vector.hpp b/include/rstl/reserved_vector.hpp index 71c8d373..f09c36f6 100644 --- a/include/rstl/reserved_vector.hpp +++ b/include/rstl/reserved_vector.hpp @@ -7,9 +7,9 @@ #include "rstl/pointer_iterator.hpp" namespace rstl { -template < typename T, s32 N > +template < typename T, int N > class reserved_vector { - s32 x0_count; + int x0_count; u8 x4_data[N * sizeof(T)]; public: @@ -36,7 +36,7 @@ public: return *this; } void clear() { - for (s32 i = 0; i < x0_count; ++i) { + for (int i = 0; i < x0_count; ++i) { rstl::destroy(&data()[i]); } x0_count = 0; @@ -54,14 +54,14 @@ public: inline T* data() { return reinterpret_cast< T* >(x4_data); } inline const T* data() const { return reinterpret_cast< const T* >(x4_data); } - inline s32 size() const { return x0_count; } - inline s32 capacity() const { return N; } + inline int size() const { return x0_count; } + inline int capacity() const { return N; } inline T& front() { return data()[0]; } inline const T& front() const { return data()[0]; } inline T& back() { return data()[x0_count - 1]; } inline const T& back() const { return data()[x0_count - 1]; } - inline T& operator[](s32 idx) { return data()[idx]; } - inline const T& operator[](s32 idx) const { return data()[idx]; } + inline T& operator[](int idx) { return data()[idx]; } + inline const T& operator[](int idx) const { return data()[idx]; } }; } // namespace rstl diff --git a/include/rstl/rmemory_allocator.hpp b/include/rstl/rmemory_allocator.hpp index 3c248bb6..2e56ce11 100644 --- a/include/rstl/rmemory_allocator.hpp +++ b/include/rstl/rmemory_allocator.hpp @@ -8,7 +8,7 @@ namespace rstl { struct rmemory_allocator { template < typename T > - static void allocate(T*& out, s32 sz) { + static void allocate(T*& out, int sz) { out = reinterpret_cast< T* >(new u8[sz]); } template < typename T > diff --git a/include/rstl/vector.hpp b/include/rstl/vector.hpp index 98cdd741..f9949381 100644 --- a/include/rstl/vector.hpp +++ b/include/rstl/vector.hpp @@ -10,8 +10,8 @@ namespace rstl { template < typename T, typename Alloc = rmemory_allocator > class vector { Alloc x0_allocator; - s32 x4_count; - s32 x8_capacity; + int x4_count; + int x8_capacity; T* xc_items; public: @@ -23,14 +23,14 @@ public: inline iterator end() { return iterator(xc_items + x4_count); } inline const_iterator end() const { return const_iterator(xc_items + x4_count); } inline vector() : x4_count(0), x8_capacity(0), xc_items(NULL) {} - inline vector(s32 count) : x4_count(0), x8_capacity(0), xc_items(0) { reserve(count); } + inline vector(int count) : x4_count(0), x8_capacity(0), xc_items(0) { reserve(count); } vector(const vector& other) { x4_count = other.x4_count; x8_capacity = other.x8_capacity; if (other.x4_count == 0 && other.x8_capacity == 0) { xc_items = NULL; } else { - s32 sz = x8_capacity * sizeof(T); + int sz = x8_capacity * sizeof(T); if (sz == 0) { xc_items = NULL; } else { @@ -44,7 +44,7 @@ public: x0_allocator.deallocate(xc_items); } - void reserve(s32 size); + void reserve(int size); void push_back(const T& in) { if (x4_count >= x8_capacity) { @@ -79,21 +79,21 @@ public: inline T* data() { return xc_items; } inline const T* data() const { return xc_items; } - inline s32 size() const { return x4_count; } - inline s32 capacity() const { return x8_capacity; } + inline int size() const { return x4_count; } + inline int capacity() const { return x8_capacity; } inline T& front() { return xc_items[0]; } inline const T& front() const { return xc_items[0]; } inline T& back() { return xc_items[x4_count - 1]; } inline const T& back() const { return xc_items[x4_count - 1]; } - inline T& operator[](s32 idx) { return xc_items[idx]; } - inline const T& operator[](s32 idx) const { return xc_items[idx]; } + inline T& operator[](int idx) { return xc_items[idx]; } + inline const T& operator[](int idx) const { return xc_items[idx]; } }; template < typename T, typename Alloc > -void vector< T, Alloc >::reserve(s32 size) { +void vector< T, Alloc >::reserve(int size) { if (size <= x8_capacity) return; - s32 sz = size * sizeof(T); + int sz = size * sizeof(T); T* newData; if (sz == 0) { newData = nullptr; diff --git a/include/types.h b/include/types.h index 46042027..d264cc0b 100644 --- a/include/types.h +++ b/include/types.h @@ -9,6 +9,9 @@ extern "C" { #include +// Dolphin u32 is unsigned long +typedef unsigned int uint; + // Pointer to unknown, to be determined at a later date. typedef void* unkptr; diff --git a/src/Kyoto/Alloc/IAllocator.cpp b/src/Kyoto/Alloc/IAllocator.cpp index 3b7ac192..ef7793d2 100644 --- a/src/Kyoto/Alloc/IAllocator.cpp +++ b/src/Kyoto/Alloc/IAllocator.cpp @@ -2,10 +2,10 @@ #include "Kyoto/Basics/COsContext.hpp" -IAllocator::SMetrics::SMetrics(u32 heapSize, u32 unk1, u32 unk2, u32 unk3, u32 unk4, u32 heapSize2, u32 unk5, u32 unk6, u32 unk7, u32 unk8, - u32 unk9, u32 smallAllocNumAllocs, u32 smallAllocAllocatedSize, u32 smallAllocRemainingSize, - u32 mediumAllocNumAllocs, u32 mediumAllocAllocatedSize, u32 mediumAllocBlocksAvailable, u32 unk10, u32 unk11, - u32 unk12, u32 mediumAllocTotalAllocated, u32 fakeStatics) +IAllocator::SMetrics::SMetrics(uint heapSize, uint unk1, uint unk2, uint unk3, uint unk4, uint heapSize2, uint unk5, uint unk6, uint unk7, uint unk8, + uint unk9, uint smallAllocNumAllocs, uint smallAllocAllocatedSize, uint smallAllocRemainingSize, + uint mediumAllocNumAllocs, uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable, uint unk10, uint unk11, + uint unk12, uint mediumAllocTotalAllocated, uint fakeStatics) : x0_heapSize(heapSize) , x4_(unk1) , x8_(unk2) diff --git a/src/Kyoto/Basics/CSWDataDolphin.cpp b/src/Kyoto/Basics/CSWDataDolphin.cpp index 0f988d49..94841eb7 100644 --- a/src/Kyoto/Basics/CSWDataDolphin.cpp +++ b/src/Kyoto/Basics/CSWDataDolphin.cpp @@ -6,7 +6,7 @@ void CStopwatch::CSWData::Wait(f32 v) const { OSTime duration = OSSecondsToTicks(v); OSTime end = OSGetTime() + duration; volatile OSTime current; - volatile s32 diff; + volatile int diff; do { current = OSGetTime(); diff = current - end; diff --git a/src/Kyoto/CCrc32.cpp b/src/Kyoto/CCrc32.cpp index 4e3cd0eb..f404c765 100644 --- a/src/Kyoto/CCrc32.cpp +++ b/src/Kyoto/CCrc32.cpp @@ -1,6 +1,6 @@ #include "Kyoto/CCrc32.hpp" -static const u32 gkCRC32Table[256] = { +static const uint gkCRC32Table[256] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, @@ -32,8 +32,8 @@ static const u32 gkCRC32Table[256] = { 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D, }; -u32 CCRC32::Calculate(const void* data, u32 length) { - u32 checksum = 0xFFFFFFFF; +uint CCRC32::Calculate(const void* data, uint length) { + uint checksum = 0xFFFFFFFF; const s8* buf = static_cast(data); while ((length--) > 0) { checksum = (checksum >> 8) ^ gkCRC32Table[(checksum ^ *(buf++)) & 0xFF]; diff --git a/src/Kyoto/CRandom16.cpp b/src/Kyoto/CRandom16.cpp index 970b7f77..600605fa 100644 --- a/src/Kyoto/CRandom16.cpp +++ b/src/Kyoto/CRandom16.cpp @@ -29,20 +29,20 @@ CRandom16* CRandom16::GetRandomNumber() { return gRandomNumber; } void CRandom16::_SetRandomNumber(CRandom16* rnd) { gRandomNumber = rnd; } -CRandom16::CRandom16(u32 seed) : mSeed(seed) {} +CRandom16::CRandom16(uint seed) : mSeed(seed) {} -void CRandom16::SetSeed(u32 seed) { mSeed = seed; } +void CRandom16::SetSeed(uint seed) { mSeed = seed; } -s32 CRandom16::Range(s32 min, s32 max) { return min + (Next() % ((max - min) + 1)); } +int CRandom16::Range(int min, int max) { return min + (Next() % ((max - min) + 1)); } float CRandom16::Range(float min, float max) { return ((max - min) * Float()) + min; } -s32 CRandom16::Next() { +int CRandom16::Next() { mSeed = (mSeed * 0x41c64e6d) + 0x00003039; return (mSeed >> 16) & 0xffff; } f32 CRandom16::Float() { - s32 next = Next(); + int next = Next(); return 1.52590222E-5f * next; } diff --git a/src/Kyoto/Graphics/CCubeMaterial.cpp b/src/Kyoto/Graphics/CCubeMaterial.cpp index fb94c32e..2b64890b 100644 --- a/src/Kyoto/Graphics/CCubeMaterial.cpp +++ b/src/Kyoto/Graphics/CCubeMaterial.cpp @@ -7,7 +7,7 @@ #include inline void CGX::SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1) { - u32 flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) | MaskAndShiftLeft(op, 7, 11) | + uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) | MaskAndShiftLeft(op, 7, 11) | MaskAndShiftLeft(comp1, 7, 14) | MaskAndShiftLeft(ref1, 0xFF, 17); if (sGXState.x248_alphaCompare != flags) { sGXState.x248_alphaCompare = flags; @@ -16,7 +16,7 @@ inline void CGX::SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompa } } inline void CGX::SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac, GXLogicOp op) { - u32 flags = MaskAndShiftLeft(mode, 3, 0) | MaskAndShiftLeft(srcFac, 7, 2) | MaskAndShiftLeft(dstFac, 7, 5) | MaskAndShiftLeft(op, 0xF, 8); + uint flags = MaskAndShiftLeft(mode, 3, 0) | MaskAndShiftLeft(srcFac, 7, 2) | MaskAndShiftLeft(dstFac, 7, 5) | MaskAndShiftLeft(op, 0xF, 8); if (flags != sGXState.x56_blendMode) { update_fog(flags); sGXState.x56_blendMode = flags; @@ -25,7 +25,7 @@ inline void CGX::SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFac } inline void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color) { STevState& state = sGXState.x68_tevStates[stageId]; - u32 flags = MaskAndShiftLeft(texCoord, 0xFF, 0) | MaskAndShiftLeft(texMap, 0xFF, 8) | MaskAndShiftLeft(color, 0xFF, 16); + uint flags = MaskAndShiftLeft(texCoord, 0xFF, 0) | MaskAndShiftLeft(texMap, 0xFF, 8) | MaskAndShiftLeft(color, 0xFF, 16); if (state.x14_tevOrderFlags != flags) { state.x14_tevOrderFlags = flags; GXSetTevOrder(stageId, texCoord, texMap, color); @@ -52,7 +52,7 @@ CVector3f sPlayerPosition; CVector3f CCubeMaterial::sViewingFrom; static CTransform4f sTextureProjectionTransform = CTransform4f::Identity(); -void CCubeMaterial::SetupBlendMode(u32 blendFactors, const CModelFlags& flags, bool alphaTest) { +void CCubeMaterial::SetupBlendMode(uint blendFactors, const CModelFlags& flags, bool alphaTest) { GXBlendFactor newSrcFactor = static_cast< GXBlendFactor >(blendFactors & 0xFFFF); GXBlendFactor newDstFactor = static_cast< GXBlendFactor >(blendFactors >> 0x10); CModelFlags::ETrans blendMode = flags.GetTrans(); @@ -73,24 +73,24 @@ void CCubeMaterial::SetupBlendMode(u32 blendFactors, const CModelFlags& flags, b CGX::SetBlendMode(GX_BM_BLEND, newSrcFactor, newDstFactor, GX_LO_CLEAR); } -void HandleTev(s32 tevCur, const u32* materialDataCur, const u32* texMapTexCoordFlags, bool shadowMapsEnabled) { +void HandleTev(int tevCur, const uint* materialDataCur, const uint* texMapTexCoordFlags, bool shadowMapsEnabled) { const GXTevStageID stage = static_cast< GXTevStageID >(tevCur); - const u32 colorArgs = shadowMapsEnabled ? 0x7a04f : SBig(materialDataCur[0]); - const u32 alphaArgs = SBig(materialDataCur[1]); - const u32 colorOps = SBig(materialDataCur[2]); - const u32 alphaOps = SBig(materialDataCur[3]); + const uint colorArgs = shadowMapsEnabled ? 0x7a04f : SBig(materialDataCur[0]); + const uint alphaArgs = SBig(materialDataCur[1]); + const uint colorOps = SBig(materialDataCur[2]); + const uint alphaOps = SBig(materialDataCur[3]); CGX::SetStandardDirectTev_Compressed(stage, colorArgs, alphaArgs, colorOps, alphaOps); - u32 tmtcFlags = SBig(*texMapTexCoordFlags); - u32 matFlags = SBig(materialDataCur[4]); + uint tmtcFlags = SBig(*texMapTexCoordFlags); + uint matFlags = SBig(materialDataCur[4]); CGX::SetTevOrder(stage, static_cast< GXTexCoordID >(tmtcFlags & 0xFF), static_cast< GXTexMapID >(tmtcFlags >> 8 & 0xFF), static_cast< GXChannelID >(matFlags & 0xFF)); CGX::SetTevKColorSel(stage, static_cast< GXTevKColorSel >(matFlags >> 0x8 & 0xFF)); CGX::SetTevKAlphaSel(stage, static_cast< GXTevKAlphaSel >(matFlags >> 0x10 & 0xFF)); } -u32 HandleAnimatedUV(const u32* uvAnim, GXTexMtx texMtx, GXPTTexMtx ptTexMtx) { +uint HandleAnimatedUV(const uint* uvAnim, GXTexMtx texMtx, GXPTTexMtx ptTexMtx) { static const Mtx postMtx = { {0.5f, 0.0f, 0.0f, 0.5f}, {0.0f, 0.0f, 0.5f, 0.5f}, @@ -101,7 +101,7 @@ u32 HandleAnimatedUV(const u32* uvAnim, GXTexMtx texMtx, GXPTTexMtx ptTexMtx) { {0.0f, 0.0f, 0.5f, 0.5f}, {0.0f, 0.0f, 0.0f, 1.0f}, }; - u32 type = SBig(*uvAnim); + uint type = SBig(*uvAnim); const f32* params = reinterpret_cast< const f32* >(uvAnim + 1); switch (type) { case 0: { diff --git a/src/Kyoto/Graphics/CGX.cpp b/src/Kyoto/Graphics/CGX.cpp index bba8d554..1b64d14b 100644 --- a/src/Kyoto/Graphics/CGX.cpp +++ b/src/Kyoto/Graphics/CGX.cpp @@ -48,7 +48,7 @@ void CGX::SetChanCtrl(EChannelId channel, GXBool enable, GXColorSrc ambSrc, GXCo if (lights == GX_LIGHT_NULL) { enable = GX_FALSE; } - u32 flags = MaskAndShiftLeft(enable, 1, 0) | MaskAndShiftLeft(ambSrc, 1, 1) | MaskAndShiftLeft(matSrc, 1, 2) | + uint flags = MaskAndShiftLeft(enable, 1, 0) | MaskAndShiftLeft(ambSrc, 1, 1) | MaskAndShiftLeft(matSrc, 1, 2) | MaskAndShiftLeft(lights, 0xFF, 3) | MaskAndShiftLeft(diffFn, 3, 11) | MaskAndShiftLeft(attnFn, 3, 13); state = flags; sGXState.x4c_chanFlags = ((flags != prevFlags) << (channel + 1)) | (sGXState.x4c_chanFlags & ~(1 << (channel + 1))); @@ -69,7 +69,7 @@ void CGX::SetTevKColor(GXTevKColorID id, const GXColor& color) { } void CGX::SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d) { - u32 flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) | MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15); + uint flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) | MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15); STevState& state = sGXState.x68_tevStates[stageId]; if (flags != state.x0_colorInArgs) { state.x0_colorInArgs = flags; @@ -78,7 +78,7 @@ void CGX::SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, } void CGX::SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d) { - u32 flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) | MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15); + uint flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) | MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15); STevState& state = sGXState.x68_tevStates[stageId]; if (flags != state.x4_alphaInArgs) { state.x4_alphaInArgs = flags; @@ -87,7 +87,7 @@ void CGX::SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, } void CGX::SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp, GXTevRegID outReg) { - u32 flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) | MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) | + uint flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) | MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) | MaskAndShiftLeft(outReg, 3, 9); STevState& state = sGXState.x68_tevStates[stageId]; if (flags != state.x8_colorOps) { @@ -96,7 +96,7 @@ void CGX::SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevS } } -void CGX::SetTevColorOp_Compressed(GXTevStageID stageId, u32 flags) { +void CGX::SetTevColorOp_Compressed(GXTevStageID stageId, uint flags) { STevState& state = sGXState.x68_tevStates[stageId]; if (flags != state.x8_colorOps) { state.x8_colorOps = flags; @@ -107,7 +107,7 @@ void CGX::SetTevColorOp_Compressed(GXTevStageID stageId, u32 flags) { } void CGX::SetTevAlphaOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp, GXTevRegID outReg) { - u32 flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) | MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) | + uint flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) | MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) | MaskAndShiftLeft(outReg, 3, 9); STevState& state = sGXState.x68_tevStates[stageId]; if (flags != state.xc_alphaOps) { @@ -116,7 +116,7 @@ void CGX::SetTevAlphaOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevS } } -void CGX::SetTevAlphaOp_Compressed(GXTevStageID stageId, u32 flags) { +void CGX::SetTevAlphaOp_Compressed(GXTevStageID stageId, uint flags) { STevState& state = sGXState.x68_tevStates[stageId]; if (flags != state.xc_alphaOps) { state.xc_alphaOps = flags; @@ -144,7 +144,7 @@ void CGX::SetTevKAlphaSel(GXTevStageID stageId, GXTevKAlphaSel sel) { void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color) { STevState& state = sGXState.x68_tevStates[stageId]; - u32 flags = MaskAndShiftLeft(texCoord, 0xFF, 0) | MaskAndShiftLeft(texMap, 0xFF, 8) | MaskAndShiftLeft(color, 0xFF, 16); + uint flags = MaskAndShiftLeft(texCoord, 0xFF, 0) | MaskAndShiftLeft(texMap, 0xFF, 8) | MaskAndShiftLeft(color, 0xFF, 16); if (state.x14_tevOrderFlags != flags) { state.x14_tevOrderFlags = flags; GXSetTevOrder(stageId, texCoord, texMap, color); @@ -152,7 +152,7 @@ void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID te } void CGX::SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac, GXLogicOp op) { - u32 flags = MaskAndShiftLeft(mode, 3, 0) | MaskAndShiftLeft(srcFac, 7, 2) | MaskAndShiftLeft(dstFac, 7, 5) | MaskAndShiftLeft(op, 0xF, 8); + uint flags = MaskAndShiftLeft(mode, 3, 0) | MaskAndShiftLeft(srcFac, 7, 2) | MaskAndShiftLeft(dstFac, 7, 5) | MaskAndShiftLeft(op, 0xF, 8); if (flags != sGXState.x56_blendMode) { update_fog(flags); sGXState.x56_blendMode = flags; @@ -170,7 +170,7 @@ void CGX::SetZMode(bool compareEnable, GXCompare func, bool updateEnable) { } void CGX::SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1) { - u32 flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) | MaskAndShiftLeft(op, 7, 11) | + uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) | MaskAndShiftLeft(op, 7, 11) | MaskAndShiftLeft(comp1, 7, 14) | MaskAndShiftLeft(ref1, 0xFF, 17); if (sGXState.x248_alphaCompare != flags) { sGXState.x248_alphaCompare = flags; @@ -182,7 +182,7 @@ void CGX::SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp void CGX::SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt, GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel, GXIndTexWrap wrapS, GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod, GXIndTexAlphaSel alphaSel) { STevState& state = sGXState.x68_tevStates[stageId]; - u32 flags = MaskAndShiftLeft(indStage, 3, 0) | MaskAndShiftLeft(fmt, 3, 2) | MaskAndShiftLeft(biasSel, 7, 4) | + uint flags = MaskAndShiftLeft(indStage, 3, 0) | MaskAndShiftLeft(fmt, 3, 2) | MaskAndShiftLeft(biasSel, 7, 4) | MaskAndShiftLeft(mtxSel, 15, 7) | MaskAndShiftLeft(wrapS, 7, 11) | MaskAndShiftLeft(wrapT, 7, 14) | MaskAndShiftLeft(addPrev, 1, 17) | MaskAndShiftLeft(indLod, 1, 18) | MaskAndShiftLeft(alphaSel, 3, 19); if (state.x10_indFlags != flags) { @@ -201,13 +201,13 @@ void CGX::SetTevDirect(GXTevStageID stageId) { void CGX::SetTexCoordGen(GXTexCoordID dstCoord, GXTexGenType fn, GXTexGenSrc src, GXTexMtx mtx, GXBool normalize, GXPTTexMtx postMtx) { STexState& state = sGXState.x228_texStates[dstCoord]; - u32 vm = (mtx - GX_TEXMTX0) / 3; - u32 vp = postMtx - GX_PTTEXMTX0; + uint vm = (mtx - GX_TEXMTX0) / 3; + uint vp = postMtx - GX_PTTEXMTX0; #if NONMATCHING // Similarly to GXTexMtx, this should also be divided by 3 vp /= 3; #endif - u32 flags = MaskAndShiftLeft(fn, 0xF, 0) | MaskAndShiftLeft(src, 0x1F, 4) | MaskAndShiftLeft(vm, 0x1F, 9) | + uint flags = MaskAndShiftLeft(fn, 0xF, 0) | MaskAndShiftLeft(src, 0x1F, 4) | MaskAndShiftLeft(vm, 0x1F, 9) | MaskAndShiftLeft(normalize, 1, 14) | MaskAndShiftLeft(vp, 0x3F, 15); if (state.x0_coordGen != flags) { state.x0_coordGen = flags; @@ -223,7 +223,7 @@ void CGX::SetNumIndStages(u8 num) { } void CGX::SetArray(GXAttr attr, const void* data, u8 stride) { - u32 idx = attr - GX_VA_POS; + uint idx = attr - GX_VA_POS; if (data == nullptr || sGXState.x0_arrayPtrs[idx] == data) { return; } @@ -291,13 +291,13 @@ CGX::SGXState::SGXState() , x248_alphaCompare(UINT_MAX) { const GXColor sGXClear = {0, 0, 0, 0}; const GXColor sGXWhite = {255, 255, 255, 255}; - for (s32 i = 0; i < 2; ++i) { + for (int i = 0; i < 2; ++i) { x30_prevChanCtrls[i] = USHRT_MAX; x34_chanCtrls[i] = USHRT_MAX; x38_chanAmbColors[i] = sGXClear; x40_chanMatColors[i] = sGXWhite; } - for (s32 i = 0; i < 4; ++i) { + for (int i = 0; i < 4; ++i) { x58_kColors[i] = sGXClear; } SetChanCtrl(Channel0, false, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); @@ -307,13 +307,13 @@ CGX::SGXState::SGXState() void CGX::ResetGXStates() { sGXState.x48_descList = 0; GXClearVtxDesc(); - for (s32 i = 0; i < 12; i++) { + for (int i = 0; i < 12; i++) { sGXState.x0_arrayPtrs[i] = reinterpret_cast< const void* >(1); } - for (s32 i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { CTexture::InvalidateTexmap(static_cast< GXTexMapID >(i)); } - for (s32 i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { GXSetTevKColor(static_cast< GXTevKColorID >(i), sGXState.x58_kColors[i]); } GXSetTevSwapModeTable(GX_TEV_SWAP1, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_RED); @@ -322,13 +322,13 @@ void CGX::ResetGXStates() { SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0); GXSetCurrentMtx(GX_PNMTX0); SetNumIndStages(0); - for (s32 i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { GXSetIndTexCoordScale(static_cast< GXIndTexStageID >(i), GX_ITS_1, GX_ITS_1); } - for (s32 i = 0; i < 16; i++) { + for (int i = 0; i < 16; i++) { SetTevDirect(static_cast< GXTevStageID >(i)); } - for (s32 i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { GXSetTexCoordScaleManually(static_cast< GXTexCoordID >(i), false, 0, 0); } GXSetZTexture(GX_ZT_DISABLE, GX_TF_Z8, 0); @@ -349,7 +349,7 @@ void CGX::FlushState() { GXBool enable = ShiftRightAndMask(flags, 1, 0); GXColorSrc ambSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 1)); GXColorSrc matSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 2)); - u32 lightMask = ShiftRightAndMask(flags, 0xFF, 3); + uint lightMask = ShiftRightAndMask(flags, 0xFF, 3); GXDiffuseFn diffFn = static_cast< GXDiffuseFn >(ShiftRightAndMask(flags, 3, 11)); GXAttnFn attnFn = static_cast< GXAttnFn >(ShiftRightAndMask(flags, 3, 13)); GXSetChanCtrl(GX_COLOR0, enable, ambSrc, matSrc, lightMask, diffFn, attnFn); @@ -360,7 +360,7 @@ void CGX::FlushState() { GXBool enable = ShiftRightAndMask(flags, 1, 0); GXColorSrc ambSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 1)); GXColorSrc matSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 2)); - u32 lightMask = ShiftRightAndMask(flags, 0xFF, 3); + uint lightMask = ShiftRightAndMask(flags, 0xFF, 3); GXDiffuseFn diffFn = static_cast< GXDiffuseFn >(ShiftRightAndMask(flags, 3, 11)); GXAttnFn attnFn = static_cast< GXAttnFn >(ShiftRightAndMask(flags, 3, 13)); GXSetChanCtrl(GX_COLOR1, enable, ambSrc, matSrc, lightMask, diffFn, attnFn); @@ -377,13 +377,13 @@ void CGX::SetIndTexMtxSTPointFive(GXIndTexMtxID id, s8 scaleExp) { GXSetIndTexMtx(id, const_cast< f32(*)[3] >(indMtx), scaleExp); } -void CGX::SetVtxDescv_Compressed(u32 flags) { +void CGX::SetVtxDescv_Compressed(uint flags) { if (flags == sGXState.x48_descList) { return; } GXVtxDescList* list = sVtxDescList; - for (u32 idx = 0; idx < 11; ++idx) { - u32 shift = idx * 2; + for (uint idx = 0; idx < 11; ++idx) { + uint shift = idx * 2; if ((flags & 3 << shift) == (sGXState.x48_descList & 3 << shift)) { continue; } @@ -398,9 +398,9 @@ void CGX::SetVtxDescv_Compressed(u32 flags) { } void CGX::SetVtxDesc(GXAttr attr, GXAttrType type) { - u32 lshift = (attr - GX_VA_POS) * 2; - u32 rshift = 3 << lshift; - u32 flags = type << lshift; + uint lshift = (attr - GX_VA_POS) * 2; + uint rshift = 3 << lshift; + uint flags = type << lshift; if (flags != (sGXState.x48_descList & rshift)) { sGXState.x48_descList = flags | (sGXState.x48_descList & ~rshift); GXSetVtxDesc(attr, type); @@ -416,14 +416,14 @@ void CGX::ResetVtxDescv() { } void CGX::SetVtxDescv(const GXVtxDescList* list) { - u32 flags = 0; + uint flags = 0; for (; list->attr != GX_VA_NULL; ++list) { flags |= (list->type & 3) << (list->attr - GX_VA_POS) * 2; } SetVtxDescv_Compressed(flags); } -void CGX::SetStandardDirectTev_Compressed(GXTevStageID stageId, u32 colorArgs, u32 alphaArgs, u32 colorOps, u32 alphaOps) { +void CGX::SetStandardDirectTev_Compressed(GXTevStageID stageId, uint colorArgs, uint alphaArgs, uint colorOps, uint alphaOps) { STevState& state = sGXState.x68_tevStates[stageId]; if (state.x10_indFlags != 0) { state.x10_indFlags = 0; diff --git a/src/Kyoto/Graphics/DolphinCColor.cpp b/src/Kyoto/Graphics/DolphinCColor.cpp index 8f710209..f1c24a82 100644 --- a/src/Kyoto/Graphics/DolphinCColor.cpp +++ b/src/Kyoto/Graphics/DolphinCColor.cpp @@ -44,25 +44,25 @@ CColor CColor::Lerp(const CColor& a, const CColor& b, float t) { omt * a.GetAlpha() + t * b.GetAlpha()); } -u32 CColor::Lerp(u32 a, u32 b, float t) { - u32 alpha = t * 256.f; +uint CColor::Lerp(uint a, uint b, float t) { + uint alpha = t * 256.f; - u32 dstrb = a & 0xff00ff; - u32 dstag = a >> 8 & 0xff00ff; + uint dstrb = a & 0xff00ff; + uint dstag = a >> 8 & 0xff00ff; - u32 srcrb = b & 0xff00ff; - u32 srcag = b >> 8 & 0xff00ff; + uint srcrb = b & 0xff00ff; + uint srcag = b >> 8 & 0xff00ff; - u32 drb = srcrb - dstrb; - u32 dag = srcag - dstag; + uint drb = srcrb - dstrb; + uint dag = srcag - dstag; drb *= alpha; dag *= alpha; drb >>= 8; dag >>= 8; - const u32 rb = (drb + dstrb) & 0x00ff00ff; - const u32 ag = (dag + dstag) << 8 & 0xff00ff00; + const uint rb = (drb + dstrb) & 0x00ff00ff; + const uint ag = (dag + dstag) << 8 & 0xff00ff00; return rb | ag; } @@ -73,10 +73,10 @@ CColor CColor::Modulate(const CColor& a, const CColor& b) { } CColor CColor::Add(const CColor& arg0, const CColor& arg1) { - return CColor((u8)rstl::min_val< u32 >(255, arg0.GetRedu8() + arg1.GetRedu8()), - (u8)rstl::min_val< u32 >(255, arg0.GetGreenu8() + arg1.GetGreenu8()), - (u8)rstl::min_val< u32 >(255, arg0.GetBlueu8() + arg1.GetBlueu8()), - (u8)rstl::min_val< u32 >(255, arg0.GetAlphau8() + arg1.GetAlphau8())); + return CColor((u8)rstl::min_val< uint >(255, arg0.GetRedu8() + arg1.GetRedu8()), + (u8)rstl::min_val< uint >(255, arg0.GetGreenu8() + arg1.GetGreenu8()), + (u8)rstl::min_val< uint >(255, arg0.GetBlueu8() + arg1.GetBlueu8()), + (u8)rstl::min_val< uint >(255, arg0.GetAlphau8() + arg1.GetAlphau8())); } u16 CColor::ToRGB5A3() const { diff --git a/src/Kyoto/Streams/CInputStream.cpp b/src/Kyoto/Streams/CInputStream.cpp index 69bedf1d..cf7f87a2 100644 --- a/src/Kyoto/Streams/CInputStream.cpp +++ b/src/Kyoto/Streams/CInputStream.cpp @@ -4,7 +4,7 @@ #include "Kyoto/Alloc/CMemory.hpp" -CInputStream::CInputStream(s32 len) +CInputStream::CInputStream(int len) : x4_blockOffset(0) , x8_blockLen(0) , xc_len(len) @@ -14,7 +14,7 @@ CInputStream::CInputStream(s32 len) , x1c_bitWord(0) , x20_bitOffset(0) {} -CInputStream::CInputStream(const void* ptr, s32 len, bool owned) +CInputStream::CInputStream(const void* ptr, int len, bool owned) : x4_blockOffset(0) , x8_blockLen(len) , xc_len(len) @@ -39,12 +39,12 @@ bool CInputStream::InternalReadNext() { bool CInputStream::GrabAnotherBlock() { return InternalReadNext(); } void CInputStream::Get(void* dest, unsigned long len) { - u32 remain = len; - u32 readCount = 0; + uint remain = len; + uint readCount = 0; x20_bitOffset = 0; while (remain != 0) { - u32 blockLen = x8_blockLen - x4_blockOffset; + uint blockLen = x8_blockLen - x4_blockOffset; blockLen = remain < blockLen ? remain : blockLen; if (blockLen != 0) { @@ -53,7 +53,7 @@ void CInputStream::Get(void* dest, unsigned long len) { readCount += blockLen; x4_blockOffset += blockLen; } else if (remain > 256) { - u32 readLen = Read(reinterpret_cast< u8* >(dest) + readCount, remain); + uint readLen = Read(reinterpret_cast< u8* >(dest) + readCount, remain); remain -= readLen; readCount += readLen; } else { @@ -64,7 +64,7 @@ void CInputStream::Get(void* dest, unsigned long len) { x18_readPosition += readCount; } -u32 CInputStream::ReadBytes(void* dest, unsigned long len) { +uint CInputStream::ReadBytes(void* dest, unsigned long len) { if (len == 0) { return 0; } @@ -73,11 +73,11 @@ u32 CInputStream::ReadBytes(void* dest, unsigned long len) { GrabAnotherBlock(); } - u32 curLen = len; - u32 curReadLen = 0; + uint curLen = len; + uint curReadLen = 0; while (curReadLen < len) { - u32 remain = x8_blockLen - x4_blockOffset; + uint remain = x8_blockLen - x4_blockOffset; if (remain == 0) { if (InternalReadNext()) { continue; @@ -86,7 +86,7 @@ u32 CInputStream::ReadBytes(void* dest, unsigned long len) { } } - u32 sz = curLen < remain ? curLen : remain; + uint sz = curLen < remain ? curLen : remain; memcpy(reinterpret_cast< u8* >(dest) + curReadLen, x10_ptr + x4_blockOffset, sz); curReadLen += sz; curLen -= sz; @@ -97,41 +97,41 @@ u32 CInputStream::ReadBytes(void* dest, unsigned long len) { return curReadLen; } -static inline u32 BitsToBytes(u32 bits) { return (bits / 8) + ((bits % 8) ? 1 : 0); } +static inline uint BitsToBytes(uint bits) { return (bits / 8) + ((bits % 8) ? 1 : 0); } -u32 CInputStream::ReadBits(u32 bitCount) { +uint CInputStream::ReadBits(uint bitCount) { if (x20_bitOffset >= bitCount) { - u32 mask = 0xffffffff; - u32 bwShift = 32 - bitCount; + uint mask = 0xffffffff; + uint bwShift = 32 - bitCount; if (bitCount != 0x20) { mask = (1 << bitCount) - 1; } - u32 ret = mask & (x1c_bitWord >> bwShift); + uint ret = mask & (x1c_bitWord >> bwShift); x20_bitOffset -= bitCount; x1c_bitWord <<= bitCount; return ret; } - u32 shiftAmt = bitCount - x20_bitOffset; + uint shiftAmt = bitCount - x20_bitOffset; - u32 ret = 0; + uint ret = 0; { - u32 mask = 0xffffffff; - u32 bwShift = 32 - x20_bitOffset; + uint mask = 0xffffffff; + uint bwShift = 32 - x20_bitOffset; if (x20_bitOffset != 0x20) { mask = (1 << x20_bitOffset) - 1; } ret = (mask & (x1c_bitWord >> bwShift)) << shiftAmt; } - u32 len = BitsToBytes(shiftAmt); + uint len = BitsToBytes(shiftAmt); x20_bitOffset = 0; Get(&x1c_bitWord, len); { - u32 mask = 0xffffffff; - u32 bwShift = 32 - shiftAmt; + uint mask = 0xffffffff; + uint bwShift = 32 - shiftAmt; if (shiftAmt != 0x20) { mask = (1 << shiftAmt) - 1; } @@ -158,9 +158,9 @@ u16 CInputStream::ReadShort() { return s; } -u32 CInputStream::ReadLong() { - static u32 l; - Get(&l, sizeof(u32)); +uint CInputStream::ReadLong() { + static uint l; + Get(&l, sizeof(uint)); return l; } diff --git a/src/Kyoto/Streams/CMemoryInStream.cpp b/src/Kyoto/Streams/CMemoryInStream.cpp index 56c5afe1..6cb1ea93 100644 --- a/src/Kyoto/Streams/CMemoryInStream.cpp +++ b/src/Kyoto/Streams/CMemoryInStream.cpp @@ -5,4 +5,4 @@ CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len, EOwnerShip CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len) : CInputStream(ptr, len, false) {} -u32 CMemoryInStream::Read(void* dest, u32 len) { return 0; } +uint CMemoryInStream::Read(void* dest, uint len) { return 0; } diff --git a/src/Kyoto/Text/CStringTable.cpp b/src/Kyoto/Text/CStringTable.cpp index 6930de0a..136d31b9 100644 --- a/src/Kyoto/Text/CStringTable.cpp +++ b/src/Kyoto/Text/CStringTable.cpp @@ -11,34 +11,34 @@ static const wchar_t skInvalidString[] = L"Invalid"; CStringTable::CStringTable(CInputStream& in) : x0_stringCount(0), x4_data(NULL) { in.ReadLong(); in.ReadLong(); - s32 langCount = in.Get(TType< s32 >()); - x0_stringCount = in.Get(TType< u32 >()); - rstl::vector< rstl::pair< FourCC, u32 > > langOffsets(langCount); - for (s32 i = 0; i < langCount; ++i) { - langOffsets.push_back(in.Get(TType< rstl::pair< FourCC, u32 > >())); + int langCount = in.Get(TType< int >()); + x0_stringCount = in.Get(TType< uint >()); + rstl::vector< rstl::pair< FourCC, uint > > langOffsets(langCount); + for (int i = 0; i < langCount; ++i) { + langOffsets.push_back(in.Get(TType< rstl::pair< FourCC, uint > >())); } - s32 offset = langOffsets.front().second; - for (s32 i = 0; i < langCount; ++i) { + int offset = langOffsets.front().second; + for (int i = 0; i < langCount; ++i) { if (langOffsets[i].first == mCurrentLanguage) { offset = langOffsets[i].second; break; } } - for (u32 i = 0; i < offset; ++i) { + for (uint i = 0; i < offset; ++i) { in.ReadChar(); } - u32 dataLen = in.Get(TType< u32 >()); + uint dataLen = in.Get(TType< uint >()); x4_data = new u8[dataLen]; in.ReadBytes(x4_data.get(), dataLen); } -const wchar_t* CStringTable::GetString(s32 idx) const { +const wchar_t* CStringTable::GetString(int idx) const { if (idx < 0 || idx >= x0_stringCount) { return skInvalidString; } - s32 offset = *(reinterpret_cast< const s32* >(x4_data.get()) + idx); + int offset = *(reinterpret_cast< const int* >(x4_data.get()) + idx); return reinterpret_cast< const wchar_t* >(x4_data.get() + offset); } diff --git a/src/MetroidPrime/CActor.cpp b/src/MetroidPrime/CActor.cpp index ece139aa..99fd0b23 100644 --- a/src/MetroidPrime/CActor.cpp +++ b/src/MetroidPrime/CActor.cpp @@ -102,7 +102,7 @@ SAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool ad UpdateSfxEmitters(); if (HasAnimation()) { u16 maxVol = xd4_maxVol; - s32 aid = x4_areaId.Value(); + int aid = x4_areaId.Value(); const CGameCamera* camera = mgr.GetCameraManager()->GetCurrentCamera(mgr); const CVector3f origin = GetTranslation(); @@ -112,15 +112,15 @@ SAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool ad const CSoundPOINode* soundNode; const CParticlePOINode* particleNode; - s32 soundNodeCount = 0; + int soundNodeCount = 0; if (HasAnimation()) { soundNode = GetAnimationData()->GetSoundPOIList(soundNodeCount); } else { soundNode = nullptr; } if (soundNodeCount > 0 && soundNode != nullptr) { - for (s32 i = 0; i < soundNodeCount; ++soundNode, ++i) { - s32 charIdx = soundNode->GetCharacterIndex(); + for (int i = 0; i < soundNodeCount; ++soundNode, ++i) { + int charIdx = soundNode->GetCharacterIndex(); if (soundNode->GetPoiType() != kPT_Sound || GetMuted()) continue; if (charIdx != -1 && GetAnimationData()->GetCharacterIndex() != charIdx) @@ -130,15 +130,15 @@ SAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool ad } } - s32 intNodeCount = 0; + int intNodeCount = 0; if (HasAnimation()) { intNode = GetAnimationData()->GetInt32POIList(intNodeCount); } else { intNode = nullptr; } if (intNodeCount > 0 && intNode != nullptr) { - for (s32 i = 0; i < intNodeCount; ++intNode, ++i) { - s32 charIdx = intNode->GetCharacterIndex(); + for (int i = 0; i < intNodeCount; ++intNode, ++i) { + int charIdx = intNode->GetCharacterIndex(); if (intNode->GetPoiType() == kPT_SoundInt32 && !GetMuted() && (charIdx == -1 || GetAnimationData()->GetCharacterIndex() == charIdx)) { ProcessSoundEvent(intNode->GetValue(), intNode->GetWeight(), intNode->GetFlags(), 0.1f, 150.f, 20, maxVol, toCamera, origin, aid, @@ -149,15 +149,15 @@ SAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool ad } } - s32 particleNodeCount = 0; + int particleNodeCount = 0; if (HasAnimation()) { particleNode = GetAnimationData()->GetParticlePOIList(particleNodeCount); } else { particleNode = nullptr; } if (particleNodeCount > 0 && particleNode != nullptr) { - for (s32 i = 0; i < particleNodeCount; ++particleNode, ++i) { - s32 charIdx = particleNode->GetCharacterIndex(); + for (int i = 0; i < particleNodeCount; ++particleNode, ++i) { + int charIdx = particleNode->GetCharacterIndex(); if (charIdx != -1 && GetAnimationData()->GetCharacterIndex() != charIdx) continue; AnimationData()->SetParticleEffectState(particleNode->GetString(), true, mgr); @@ -181,7 +181,7 @@ void CActor::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUse } } -f32 CActor::GetAverageAnimVelocity(s32 anim) { return HasAnimation() ? GetAnimationData()->GetAverageVelocity(anim) : 0.f; } +f32 CActor::GetAverageAnimVelocity(int anim) { return HasAnimation() ? GetAnimationData()->GetAverageVelocity(anim) : 0.f; } void CActor::CalculateRenderBounds() { if (HasModelData()) { diff --git a/src/MetroidPrime/CObjectList.cpp b/src/MetroidPrime/CObjectList.cpp index 77d7e1f1..cac4cb17 100644 --- a/src/MetroidPrime/CObjectList.cpp +++ b/src/MetroidPrime/CObjectList.cpp @@ -6,7 +6,7 @@ CObjectList::CObjectList(EGameObjectList list) : mListType(list) , mFirstId(-1) , mCount(0) { - for (s32 i = 0; i < kMaxObjects; ++i) { + for (int i = 0; i < kMaxObjects; ++i) { mObjects[i] = SObjectListEntry(); } } @@ -39,8 +39,8 @@ CEntity* CObjectList::GetValidObjectById(TUniqueId uid) {} const CEntity* CObjectList::GetValidObjectById(TUniqueId uid) const {} -CEntity* CObjectList::operator[](s32 idx) {} +CEntity* CObjectList::operator[](int idx) {} -const CEntity* CObjectList::operator[](s32 idx) const {} +const CEntity* CObjectList::operator[](int idx) const {} -const CEntity* CObjectList::GetValidObjectByIndex(s32 idx) const {} +const CEntity* CObjectList::GetValidObjectByIndex(int idx) const {} diff --git a/src/MetroidPrime/Cameras/CCameraHint.cpp b/src/MetroidPrime/Cameras/CCameraHint.cpp index 21240905..985cca14 100644 --- a/src/MetroidPrime/Cameras/CCameraHint.cpp +++ b/src/MetroidPrime/Cameras/CCameraHint.cpp @@ -1,7 +1,7 @@ #include "MetroidPrime/Cameras/CCameraHint.hpp" #include "Kyoto/Alloc/CMemory.hpp" -CCameraHint::CCameraHint(u32 overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, float minDist, float maxDist, float backwardsDist, +CCameraHint::CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, float minDist, float maxDist, float backwardsDist, CVector3f* lookAtOffset, CVector3f* chaseLookAtOffset, CVector3f* ballToCam, float fov, float attitudeRange, float azimuthRange, float anglePerSecond, float clampVelRange, float clampRotRange, float elevation, float InterpolationTime, float clampVelTime, float controlInterpDur) diff --git a/src/MetroidPrime/main.cpp b/src/MetroidPrime/main.cpp index 9ffe57d5..6057ba6f 100644 --- a/src/MetroidPrime/main.cpp +++ b/src/MetroidPrime/main.cpp @@ -111,7 +111,7 @@ void CMain::RefreshGameState() { // 8000487C void CMain::EnsureWorldPaksReady(void) { CResLoader& resLoader = gpResourceFactory->GetResLoader(); - for (s32 i = 0; i < resLoader.GetPakCount(); ++i) { + for (int i = 0; i < resLoader.GetPakCount(); ++i) { CPakFile& file = resLoader.GetPakFile(i); if (file.IsWorldPak()) { file.EnsureWorldPakReady(); @@ -132,9 +132,9 @@ void CMain::AddWorldPaks() { } // 80004CE8 -void CMain::AsyncIdle(u32 time) { +void CMain::AsyncIdle(uint time) { if (time < 500) { - u32 total = 0; + uint total = 0; for (int i = 0; i < x130_frameTimes.capacity(); ++i) { total += x130_frameTimes[i]; } @@ -233,7 +233,7 @@ int CMain::RsMain(int argc, const char* const* argv) { x104_.AddValue(t2 / dt); x11c_ = x104_.GetAverage().data(); - u32 idleMicros; + uint idleMicros; f64 idleTime = (dt - (t1 + t2)) - 0.00075; if (idleTime > 0) idleMicros = idleTime * 1000000;