mirror of
https://github.com/PrimeDecomp/prime.git
synced 2026-07-12 18:18:56 -07:00
Replace int types in Retro code
Retro seemingly avoided using the Dolphin
typedefs in most places, opting to use int/uint
instead. This likely means they didn't use
u8/s8/u16/s16/etc either.
Former-commit-id: 133326ae40
This commit is contained in:
@@ -42,6 +42,10 @@ Metaforce is a non-matching decompilation, and often uses modern C++ features th
|
||||
### Converting types
|
||||
|
||||
Metaforce -> decomp
|
||||
- `s8` -> `char`
|
||||
- `u8` -> `uchar`
|
||||
- `s16` -> `short`
|
||||
- `u16` -> `ushort`
|
||||
- `s32` -> `int`
|
||||
- `u32` -> `uint`
|
||||
- `zeus::CTransform` -> `CTransform4f`
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
: CCollisionPrimitive(matList), x10_aabb(box) {}
|
||||
// TODO
|
||||
|
||||
u32 GetTableIndex() const override;
|
||||
uint GetTableIndex() const override;
|
||||
CAABox CalculateAABox(const CTransform4f&) const override;
|
||||
CAABox CalculateLocalAABox() const override;
|
||||
FourCC GetPrimType() const override;
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
CCollidableSphere(const CSphere& sphere, const CMaterialList& material)
|
||||
: CCollisionPrimitive(material), x10_sphere(sphere) {}
|
||||
|
||||
u32 GetTableIndex() const override;
|
||||
uint GetTableIndex() const override;
|
||||
CAABox CalculateAABox(const CTransform4f&) const override;
|
||||
CAABox CalculateLocalAABox() const override;
|
||||
FourCC GetPrimType() const override;
|
||||
|
||||
@@ -16,7 +16,7 @@ class CCollisionPrimitive {
|
||||
public:
|
||||
CCollisionPrimitive(const CMaterialList& list);
|
||||
|
||||
virtual u32 GetTableIndex() const = 0;
|
||||
virtual uint GetTableIndex() const = 0;
|
||||
virtual void SetMaterial(const CMaterialList&);
|
||||
virtual const CMaterialList& GetMaterial() const;
|
||||
virtual CAABox CalculateAABox(const CTransform4f&) const = 0;
|
||||
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
// HasMaterials__13CMaterialListCFv weak
|
||||
// GetField__13CMaterialListCFUxUx weak
|
||||
// Intersection__13CMaterialListCFRC13CMaterialList weak
|
||||
static s32 BitPosition(u64 flags);
|
||||
static int BitPosition(u64 flags);
|
||||
// GetMaterialString__13CMaterialListCFv weak
|
||||
bool SharesMaterials(const CMaterialList& other) const {
|
||||
return (other.value & value) ? true : false;
|
||||
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
kI_Valid,
|
||||
};
|
||||
|
||||
f32 GetTime() const { return x0_t; }
|
||||
float GetTime() const { return x0_t; }
|
||||
bool IsValid() const { return x20_valid; }
|
||||
// GetPlane__14CRayCastResultCFv
|
||||
// GetPoint__14CRayCastResultCFv
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
// MakeInvalid__14CRayCastResultFv
|
||||
|
||||
private:
|
||||
f32 x0_t;
|
||||
float x0_t;
|
||||
CVector3f x4_point;
|
||||
CPlane x10_plane;
|
||||
bool x20_valid;
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
u8 pad[0x14];
|
||||
uchar pad[0x14];
|
||||
|
||||
static CGuiSys* spGuiSys;
|
||||
};
|
||||
|
||||
@@ -14,12 +14,12 @@ public:
|
||||
int GetAllocatedAmount() const;
|
||||
|
||||
private:
|
||||
u8 x0_owned;
|
||||
uchar x0_owned;
|
||||
void* x4_ptr;
|
||||
s32 x8_bufferLen;
|
||||
s32 xc_;
|
||||
s32 x10_nextFreeAddr;
|
||||
s32 x14_;
|
||||
int x8_bufferLen;
|
||||
int xc_;
|
||||
int x10_nextFreeAddr;
|
||||
int x14_;
|
||||
};
|
||||
|
||||
#endif // _CCIRCULARBUFFER
|
||||
|
||||
@@ -37,8 +37,8 @@ public:
|
||||
x14_next = next;
|
||||
x14_next = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x14_next & ~31));
|
||||
}
|
||||
u32 GetPrevMaskedFlags();
|
||||
u32 GetNextMaskedFlags();
|
||||
uint GetPrevMaskedFlags();
|
||||
uint GetNextMaskedFlags();
|
||||
void SetTopOfHeapAllocated(bool topOfHeap);
|
||||
size_t GetLength() const { return x4_len; }
|
||||
SGameMemInfo* GetNextFree() const { return (SGameMemInfo*)((size_t)x18_nextFree & ~31); }
|
||||
@@ -95,16 +95,16 @@ public:
|
||||
size_t GetLargestFreeChunk() const;
|
||||
|
||||
private:
|
||||
SGameMemInfo** GetBinPtr(u32 bin) { return &x14_bins[bin]; }
|
||||
u8 x4_;
|
||||
u8 x5_;
|
||||
u8 x6_;
|
||||
u8 x7_;
|
||||
u32 x8_heapSize;
|
||||
SGameMemInfo** GetBinPtr(uint bin) { return &x14_bins[bin]; }
|
||||
uchar x4_;
|
||||
uchar x5_;
|
||||
uchar x6_;
|
||||
uchar x7_;
|
||||
uint x8_heapSize;
|
||||
SGameMemInfo* xc_first;
|
||||
SGameMemInfo* x10_last;
|
||||
SGameMemInfo* x14_bins[16];
|
||||
u32 x54_;
|
||||
uint x54_;
|
||||
FOutOfMemoryCb x58_oomCallback;
|
||||
const void* x5c_oomTarget;
|
||||
CSmallAllocPool* x60_smallAllocPool;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
class CMediumAllocPool {
|
||||
public:
|
||||
struct SMediumAllocPuddle {
|
||||
u8 unk;
|
||||
uchar unk;
|
||||
void* x4_mainData;
|
||||
void* x8_bookKeeping;
|
||||
void* xc_cachedBookKeepingOffset;
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
void AddPuddle(uint, void*, int);
|
||||
void ClearPuddles();
|
||||
|
||||
s32 Free(const void* ptr);
|
||||
int Free(const void* ptr);
|
||||
|
||||
uint GetTotalEntries();
|
||||
uint GetNumBlocksAvailable();
|
||||
|
||||
@@ -13,16 +13,16 @@ public:
|
||||
bool Free(const void* ptr);
|
||||
|
||||
bool PtrWithinPool(const void* ptr) const {
|
||||
return u32((reinterpret_cast< const u8* >(ptr) - reinterpret_cast< u8* >(x0_mainData)) / 4) <
|
||||
x8_numBlocks;
|
||||
return uint((reinterpret_cast< const uchar* >(ptr) - reinterpret_cast< uchar* >(x0_mainData)) /
|
||||
4) < x8_numBlocks;
|
||||
}
|
||||
|
||||
uint GetIndexFromPtr(const void* ptr) const {
|
||||
return ((const u8*)ptr - x0_mainData) / kPointerSize;
|
||||
return ((const uchar*)ptr - x0_mainData) / kPointerSize;
|
||||
}
|
||||
long GetEntryValue(uint idx) const { return (long)*((u8*)x4_bookKeeping + idx); }
|
||||
u8* GetPtrFromIndex(unsigned int idx) const {
|
||||
return static_cast< u8* >(x0_mainData) + (idx << 3);
|
||||
long GetEntryValue(uint idx) const { return (long)*((uchar*)x4_bookKeeping + idx); }
|
||||
uchar* GetPtrFromIndex(unsigned int idx) const {
|
||||
return static_cast< uchar* >(x0_mainData) + (idx << 3);
|
||||
}
|
||||
|
||||
uint GetNumBlocksAvailable() const { return x18_numBlocksAvailable; }
|
||||
|
||||
@@ -50,16 +50,16 @@ public:
|
||||
union UParmValue {
|
||||
int m_int;
|
||||
uint m_uint;
|
||||
f32 m_float;
|
||||
float m_float;
|
||||
bool m_bool;
|
||||
};
|
||||
CPASAnimParm(const CPASAnimParm& other) : x0_value(other.x0_value), x4_type(other.x4_type) {}
|
||||
|
||||
static CPASAnimParm FromEnum(s32 val);
|
||||
static CPASAnimParm FromEnum(int val);
|
||||
static CPASAnimParm FromBool(bool val);
|
||||
static CPASAnimParm FromReal32(float val);
|
||||
static CPASAnimParm FromUint32(u32 val);
|
||||
static CPASAnimParm FromInt32(s32 val);
|
||||
static CPASAnimParm FromUint32(uint val);
|
||||
static CPASAnimParm FromInt32(int val);
|
||||
static CPASAnimParm NoParameter();
|
||||
|
||||
int GetInt32Value() const;
|
||||
|
||||
@@ -15,17 +15,17 @@ enum ETRKRepeatMode {
|
||||
|
||||
class CAudioSys {
|
||||
public:
|
||||
CAudioSys(u8, u8, u8, u8, uint);
|
||||
CAudioSys(uchar, uchar, uchar, uchar, uint);
|
||||
~CAudioSys();
|
||||
|
||||
static void SysSetVolume(u8, uint, u8);
|
||||
static void SetDefaultVolumeScale(s16);
|
||||
static void SetVolumeScale(s16);
|
||||
static void SysSetVolume(uchar, uint, uchar);
|
||||
static void SetDefaultVolumeScale(short);
|
||||
static void SetVolumeScale(short);
|
||||
static void TrkSetSampleRate(ETRKSampleRate);
|
||||
|
||||
static s16 GetDefaultVolumeScale();
|
||||
static short GetDefaultVolumeScale();
|
||||
|
||||
static const u8 kMaxVolume;
|
||||
static const uchar kMaxVolume;
|
||||
};
|
||||
|
||||
#endif // _CAUDIOSYS
|
||||
|
||||
@@ -8,28 +8,28 @@
|
||||
class CVector3f;
|
||||
class CSfxManager {
|
||||
public:
|
||||
static void Update(f32 dt);
|
||||
static void Update(float dt);
|
||||
static void RemoveEmitter(CSfxHandle handle);
|
||||
static void UpdateEmitter(CSfxHandle handle, const CVector3f& pos, const CVector3f& dir,
|
||||
uchar maxVol);
|
||||
|
||||
static const s16 kMaxPriority; // 0xFF
|
||||
static const s16 kMedPriority; // 0x7F
|
||||
static const u16 kInternalInvalidSfxId; // 0xFFFF
|
||||
static const int kAllAreas; // 0xFFFFFFFF
|
||||
static CSfxHandle AddEmitter(u16 id, const CVector3f& pos, const CVector3f& dir,
|
||||
bool useAcoustics, bool looped, s16 prio = kMedPriority,
|
||||
static const short kMaxPriority; // 0xFF
|
||||
static const short kMedPriority; // 0x7F
|
||||
static const ushort kInternalInvalidSfxId; // 0xFFFF
|
||||
static const int kAllAreas; // 0xFFFFFFFF
|
||||
static CSfxHandle AddEmitter(ushort id, const CVector3f& pos, const CVector3f& dir,
|
||||
bool useAcoustics, bool looped, short prio = kMedPriority,
|
||||
int areaId = kAllAreas);
|
||||
static CSfxHandle AddEmitter(u16 id, const CVector3f& pos, const CVector3f& dir, uchar vol,
|
||||
bool useAcoustics, bool looped, s16 prio = kMedPriority,
|
||||
static CSfxHandle AddEmitter(ushort id, const CVector3f& pos, const CVector3f& dir, uchar vol,
|
||||
bool useAcoustics, bool looped, short prio = kMedPriority,
|
||||
int areaId = kAllAreas);
|
||||
static void Shutdown();
|
||||
static u16 TranslateSFXID(u16);
|
||||
static ushort TranslateSFXID(ushort);
|
||||
|
||||
static void PitchBend(CSfxHandle handle, int pitch);
|
||||
|
||||
static CSfxHandle SfxStart(u16 id, u8 vol, u8 pan, bool useAcoustics, s16 prio, bool looped,
|
||||
s32 areaId);
|
||||
static CSfxHandle SfxStart(ushort id, uchar vol, uchar pan, bool useAcoustics, short prio,
|
||||
bool looped, int areaId);
|
||||
static bool IsPlaying(const CSfxHandle& handle);
|
||||
};
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
class CStreamAudioManager {
|
||||
public:
|
||||
static void Update(f32 dt);
|
||||
static void Update(float dt);
|
||||
static void StopAll();
|
||||
static void SetMusicVolume(u8);
|
||||
static void SetMusicVolume(uchar);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
namespace CCast {
|
||||
#ifdef __MWERKS__
|
||||
inline u8 ToUint8(register f32 in) {
|
||||
u8 a;
|
||||
register u8* ptr = &a;
|
||||
register u8 r;
|
||||
inline uchar ToUint8(register float in) {
|
||||
uchar a;
|
||||
register uchar* ptr = &a;
|
||||
register uchar r;
|
||||
|
||||
asm {
|
||||
psq_st in, 0(ptr), 1, OS_FASTCAST_U8
|
||||
@@ -19,17 +19,17 @@ inline u8 ToUint8(register f32 in) {
|
||||
return r;
|
||||
}
|
||||
|
||||
inline f32 ToReal32(register const u8& in) {
|
||||
register f32 r;
|
||||
inline float ToReal32(register const uchar& in) {
|
||||
register float r;
|
||||
asm {
|
||||
psq_l r, 0(in), 1, 2
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
inline s16 FtoS(register f32 in) {
|
||||
s16 a;
|
||||
register s16* ptr = &a;
|
||||
inline short FtoS(register float in) {
|
||||
short a;
|
||||
register short* ptr = &a;
|
||||
|
||||
asm {
|
||||
psq_st in, 0(ptr), 1, OS_FASTCAST_S16
|
||||
@@ -37,9 +37,9 @@ inline s16 FtoS(register f32 in) {
|
||||
return *ptr;
|
||||
}
|
||||
#else
|
||||
inline u8 ToUint8(f32 in) { return static_cast< u8 >(in); }
|
||||
inline f32 ToReal32(u8 in) { return static_cast< f32 >(in); }
|
||||
inline s16 FtoS(f32 in) { return static_cast< s16 >(in); }
|
||||
inline uchar ToUint8(float in) { return static_cast< uchar >(in); }
|
||||
inline float ToReal32(uchar in) { return static_cast< float >(in); }
|
||||
inline short FtoS(float in) { return static_cast< short >(in); }
|
||||
#endif
|
||||
} // namespace CCast
|
||||
|
||||
|
||||
@@ -12,17 +12,17 @@ public:
|
||||
CSWData() : x0_timerFreq(0), x8_timerFreqO1M(0), x10_timerPeriod(0.f) {}
|
||||
|
||||
bool Initialize();
|
||||
void Wait(f32) const;
|
||||
void Wait(float) const;
|
||||
|
||||
s64 GetTimerFreq() const { return x0_timerFreq; }
|
||||
s64 GetTimerFreqO1M() const { return x8_timerFreqO1M; }
|
||||
f32 GetTimerPeriod() const { return x10_timerPeriod; }
|
||||
float GetTimerPeriod() const { return x10_timerPeriod; }
|
||||
s64 GetCPUCycles() const { return OSGetTime(); }
|
||||
|
||||
private:
|
||||
s64 x0_timerFreq;
|
||||
s64 x8_timerFreqO1M;
|
||||
f32 x10_timerPeriod;
|
||||
float x10_timerPeriod;
|
||||
};
|
||||
|
||||
CStopwatch() : x0_startTime(mData.GetCPUCycles()) {}
|
||||
@@ -34,14 +34,14 @@ public:
|
||||
}
|
||||
x0_startTime = mData.GetCPUCycles();
|
||||
}
|
||||
inline f32 GetElapsedTime() const {
|
||||
inline float GetElapsedTime() const {
|
||||
return (mData.GetCPUCycles() - x0_startTime) * mData.GetTimerPeriod();
|
||||
}
|
||||
inline s64 GetElapsedMicros() const {
|
||||
return (mData.GetCPUCycles() - x0_startTime) / mData.GetTimerFreqO1M();
|
||||
}
|
||||
|
||||
static void Wait(f32);
|
||||
static void Wait(float);
|
||||
|
||||
private:
|
||||
static CSWData mData;
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
static void Initialize(uint);
|
||||
|
||||
private:
|
||||
static u32 mPreInitializeAlloc;
|
||||
static uint mPreInitializeAlloc;
|
||||
};
|
||||
|
||||
#endif // _CARAMMANAGER
|
||||
|
||||
@@ -8,7 +8,7 @@ public:
|
||||
static bool FileExists(const char*);
|
||||
|
||||
private:
|
||||
u8 pad[0x28];
|
||||
uchar pad[0x28];
|
||||
};
|
||||
|
||||
#endif // _CDVDFILE
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
class CFactoryMgr {
|
||||
public:
|
||||
private:
|
||||
u8 pad[0x38];
|
||||
uchar pad[0x38];
|
||||
};
|
||||
|
||||
class CFactoryFnReturn {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user