Migrate s32->int, u32->uint; fix dolphin/types.h

Former-commit-id: 7eb08b6ee8
This commit is contained in:
Luke Street 2022-09-05 00:01:13 -04:00
parent 5726400667
commit 0f25a3c8d4
73 changed files with 413 additions and 410 deletions

View File

@ -19,44 +19,44 @@ public:
enum EType { kTP_Unk0 }; enum EType { kTP_Unk0 };
struct SMetrics { struct SMetrics {
u32 x0_heapSize; uint x0_heapSize;
u32 x4_; uint x4_;
u32 x8_; uint x8_;
u32 xc_; uint xc_;
u32 x10_; uint x10_;
u32 x14_heapSize2; // Remaining heap size? uint x14_heapSize2; // Remaining heap size?
u32 x18_; uint x18_;
u32 x1c_; uint x1c_;
u32 x20_; uint x20_;
u32 x24_; uint x24_;
u32 x28_; uint x28_;
u32 x2c_smallNumAllocs; uint x2c_smallNumAllocs;
u32 x30_smallAllocatedSize; uint x30_smallAllocatedSize;
u32 x34_smallRemainingSize; uint x34_smallRemainingSize;
u32 x38_mediumNumAllocs; uint x38_mediumNumAllocs;
u32 x3c_mediumAllocatedSize; uint x3c_mediumAllocatedSize;
u32 x40_mediumBlocksAvailable; uint x40_mediumBlocksAvailable;
u32 x44_; uint x44_;
u32 x48_; uint x48_;
u32 x4c_; uint x4c_;
u32 x50_mediumTotalAllocated; uint x50_mediumTotalAllocated;
u32 x54_fakeStatics; uint 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, SMetrics(uint heapSize, uint unk1, uint unk2, uint unk3, uint unk4, uint heapSize2, uint unk5, uint unk6, uint unk7, uint unk8, uint unk9,
u32 smallAllocNumAllocs, u32 smallAllocAllocatedSize, u32 smallAllocRemainingSize, u32 mediumAllocNumAllocs, uint smallAllocNumAllocs, uint smallAllocAllocatedSize, uint smallAllocRemainingSize, uint mediumAllocNumAllocs,
u32 mediumAllocAllocatedSize, u32 mediumAllocBlocksAvailable, u32 unk10, u32 unk11, u32 unk12, u32 mediumAllocTotalAllocated, uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable, uint unk10, uint unk11, uint unk12, uint mediumAllocTotalAllocated,
u32 fakeStatics); uint fakeStatics);
}; };
struct SAllocInfo { struct SAllocInfo {
void* x0_infoPtr; void* x0_infoPtr;
u32 x4_len; uint x4_len;
bool x8_hasPrevious; bool x8_hasPrevious;
bool x9_; bool x9_;
const char* xc_fileAndLne; const char* xc_fileAndLne;
const char* x10_type; 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); typedef const bool (*FEnumAllocationsCb)(const SAllocInfo& info, const void* ptr);
virtual ~IAllocator(); virtual ~IAllocator();
@ -71,7 +71,7 @@ public:
virtual void SetOutOfMemoryCallback(FOutOfMemoryCb cb, const void* data) = 0; virtual void SetOutOfMemoryCallback(FOutOfMemoryCb cb, const void* data) = 0;
virtual void EnumAllocations(FEnumAllocationsCb func, const void* ptr, bool b) const = 0; virtual void EnumAllocations(FEnumAllocationsCb func, const void* ptr, bool b) const = 0;
virtual SAllocInfo GetAllocInfo(const void* ptr) 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; virtual SMetrics GetMetrics() const = 0;
}; };

View File

@ -6,7 +6,7 @@
class CSfxHandle { class CSfxHandle {
public: public:
CSfxHandle() : value(0) {} CSfxHandle() : value(0) {}
CSfxHandle(u32 value) : value(value) {} CSfxHandle(uint value) : value(value) {}
// GetIndex__10CSfxHandleCFv // GetIndex__10CSfxHandleCFv
// NullHandle__10CSfxHandleFv // NullHandle__10CSfxHandleFv
@ -16,7 +16,7 @@ public:
operator bool() const { return value != 0; } operator bool() const { return value != 0; }
private: private:
u32 value; uint value;
}; };
CHECK_SIZEOF(CSfxHandle, 0x4) CHECK_SIZEOF(CSfxHandle, 0x4)

View File

@ -4,7 +4,7 @@
class CCRC32 { class CCRC32 {
public: public:
static u32 Calculate(const void* data, u32 length); static uint Calculate(const void* data, uint length);
}; };
#endif // __CCRC32_HPP__ #endif // __CCRC32_HPP__

View File

@ -26,13 +26,13 @@ private:
int x2c_asyncLoadPhase; // EAsyncPhase int x2c_asyncLoadPhase; // EAsyncPhase
rstl::auto_ptr< void > x30_dvdReq; // IDvdRequest rstl::auto_ptr< void > x30_dvdReq; // IDvdRequest
rstl::vector< u8 > x38_headerData; rstl::vector< u8 > x38_headerData;
u32 x48_resTableOffset; uint x48_resTableOffset;
u32 x4c_resTableCount; uint x4c_resTableCount;
s32 x50_aramBase; int x50_aramBase;
rstl::vector< rstl::pair< rstl::string, SObjectTag > > x54_nameList; rstl::vector< rstl::pair< rstl::string, SObjectTag > > x54_nameList;
rstl::vector< CAssetId > x64_depList; rstl::vector< CAssetId > x64_depList;
rstl::vector< SResInfo > x74_resList; rstl::vector< SResInfo > x74_resList;
mutable s32 x84_currentSeek; mutable int x84_currentSeek;
}; };
#endif #endif

View File

@ -21,14 +21,14 @@ class CRandom16 {
static void _SetRandomNumber(CRandom16* rnd); static void _SetRandomNumber(CRandom16* rnd);
public: public:
static CRandom16* GetRandomNumber(); static CRandom16* GetRandomNumber();
CRandom16(u32 seed = 99); CRandom16(uint seed = 99);
void SetSeed(u32 seed); void SetSeed(uint seed);
s32 Range(s32 min, s32 max); int Range(int min, int max);
float Range(float min, float max); float Range(float min, float max);
s32 Next(); int Next();
float Float(); float Float();
private: private:
u32 mSeed; uint mSeed;
}; };
#endif // __CRANDOM16_HPP__ #endif // __CRANDOM16_HPP__

View File

@ -12,20 +12,20 @@ class CResFactory {
public: public:
virtual ~CResFactory() {} virtual ~CResFactory() {}
void AsyncIdle(u32 time); void AsyncIdle(uint time);
CResLoader& GetResLoader() { return x4_resLoader; } CResLoader& GetResLoader() { return x4_resLoader; }
private: private:
CResLoader x4_resLoader; CResLoader x4_resLoader;
CFactoryMgr x5c_factoryMgr; CFactoryMgr x5c_factoryMgr;
u32 x94_; uint x94_;
u32 x98_; uint x98_;
u32 x9c_; uint x9c_;
u32 xa0_; uint xa0_;
u32 xa4_; uint xa4_;
u32 xa8_; uint xa8_;
u32 xac_; uint xac_;
rstl::list< void > xb0_; rstl::list< void > xb0_;
}; };

View File

@ -14,13 +14,13 @@ struct SResInfo {
CAssetId x0_id; CAssetId x0_id;
bool x4_compressed : 1; bool x4_compressed : 1;
int x4_typeIdx; // CFactoryMgr::ETypeTable int x4_typeIdx; // CFactoryMgr::ETypeTable
u32 x5_offsetDiv32 : 27; uint x5_offsetDiv32 : 27;
u32 x7_sizeDiv32 : 27; uint x7_sizeDiv32 : 27;
}; };
class CResLoader { class CResLoader {
public: public:
s32 GetPakCount() const; int GetPakCount() const;
CPakFile& GetPakFile(int idx) const; CPakFile& GetPakFile(int idx) const;
void AddPakFileAsync(const rstl::string&, bool, bool); void AddPakFileAsync(const rstl::string&, bool, bool);
void AsyncIdlePakLoading(); void AsyncIdlePakLoading();

View File

@ -15,7 +15,7 @@ class CInputStream;
class CColor { class CColor {
public: public:
CColor() {} CColor() {}
CColor(u32 col) : mRgba(col) {} CColor(uint col) : mRgba(col) {}
CColor(CInputStream& in); CColor(CInputStream& in);
CColor(f32 r, f32 g, f32 b, f32 a = 1.f); CColor(f32 r, f32 g, f32 b, f32 a = 1.f);
CColor(u8 r, u8 g, u8 b, u8 a = 255) { 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, float& a) const;
void Get(float& r, float& g, float& b) const; void Get(float& r, float& g, float& b) const;
static CColor Lerp(const CColor& a, const CColor& b, float t); 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 Modulate(const CColor& a, const CColor& b);
static CColor Add(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); } f32 GetRed() const { return CCast::ToReal32(mR) * (1/255.f); }
@ -41,7 +41,7 @@ public:
u8 GetBlueu8() const { return mB; } u8 GetBlueu8() const { return mB; }
u8 GetAlphau8() const { return mA; } u8 GetAlphau8() const { return mA; }
u16 ToRGB5A3() const; u16 ToRGB5A3() const;
GXColor ToGX(u32); GXColor ToGX(uint);
static const CColor& Black(); static const CColor& Black();
static const CColor& White(); static const CColor& White();
@ -61,7 +61,7 @@ private:
u8 mB; u8 mB;
u8 mA; u8 mA;
}; };
u32 mRgba; uint mRgba;
}; };
static const CColor sBlackColor; static const CColor sBlackColor;

View File

@ -11,7 +11,7 @@ extern CVector3f sPlayerPosition;
class CCubeMaterial { class CCubeMaterial {
public: public:
private: private:
static void SetupBlendMode(u32 blendFactors, const CModelFlags& flags, bool alphaTest); static void SetupBlendMode(uint blendFactors, const CModelFlags& flags, bool alphaTest);
static CVector3f sViewingFrom; static CVector3f sViewingFrom;
}; };

View File

@ -11,12 +11,12 @@
class CGX { class CGX {
public: public:
struct STevState { struct STevState {
u32 x0_colorInArgs; uint x0_colorInArgs;
u32 x4_alphaInArgs; uint x4_alphaInArgs;
u32 x8_colorOps; uint x8_colorOps;
u32 xc_alphaOps; uint xc_alphaOps;
u32 x10_indFlags; uint x10_indFlags;
u32 x14_tevOrderFlags; uint x14_tevOrderFlags;
u8 x18_kColorSel; u8 x18_kColorSel;
u8 x19_kAlphaSel; u8 x19_kAlphaSel;
@ -24,7 +24,7 @@ public:
}; };
struct STexState { struct STexState {
u32 x0_coordGen; uint x0_coordGen;
STexState(); STexState();
}; };
@ -50,7 +50,7 @@ public:
u16 x34_chanCtrls[2]; u16 x34_chanCtrls[2];
GXColor x38_chanAmbColors[2]; GXColor x38_chanAmbColors[2];
GXColor x40_chanMatColors[2]; GXColor x40_chanMatColors[2];
u32 x48_descList; uint x48_descList;
union { union {
u8 x4c_chanFlags; u8 x4c_chanFlags;
struct { struct {
@ -71,7 +71,7 @@ public:
GXColor x58_kColors[4]; GXColor x58_kColors[4];
STevState x68_tevStates[16]; STevState x68_tevStates[16];
STexState x228_texStates[8]; STexState x228_texStates[8];
u32 x248_alphaCompare; uint x248_alphaCompare;
SFogParams x24c_fogParams; SFogParams x24c_fogParams;
SGXState(); SGXState();
@ -94,9 +94,9 @@ public:
static void SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d); 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 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(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(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 SetTevKColorSel(GXTevStageID stageId, GXTevKColorSel sel);
static void SetTevKAlphaSel(GXTevStageID stageId, GXTevKAlphaSel sel); static void SetTevKAlphaSel(GXTevStageID stageId, GXTevKAlphaSel sel);
static void SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color); 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 SetFog(GXFogType type, f32 startZ, f32 endZ, f32 nearZ, f32 farZ, const GXColor& color);
static void SetLineWidth(u8 width, GXTexOffset offset); static void SetLineWidth(u8 width, GXTexOffset offset);
static void SetIndTexMtxSTPointFive(GXIndTexMtxID id, s8 scaleExp); 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 SetVtxDesc(GXAttr attr, GXAttrType type); // name?
static void ResetVtxDescv(); // name? static void ResetVtxDescv(); // name?
static void SetVtxDescv(const GXVtxDescList* list); 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 SetStandardTevColorAlphaOp(GXTevStageID stageId);
static void CallDisplayList(const void* ptr, size_t size); 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 void GetFog(GXFogType* fogType, f32* fogStartZ, f32* fogEndZ, f32* fogNearZ, f32* fogFarZ, GXColor* fogColor);
static inline bool CompareGXColors(const GXColor& lhs, const GXColor& rhs) { 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) { 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 uint MaskAndShiftLeft(uint v, uint m, uint s) { return (v & m) << s; }
static inline u32 ShiftRightAndMask(u32 v, u32 m, u32 s) { return (v >> s) & m; } static inline uint ShiftRightAndMask(uint v, uint m, uint s) { return (v >> s) & m; }
private: private:
static void FlushState(); static void FlushState();
static void update_fog(u32 flags); static void update_fog(uint flags);
static void apply_fog() { static void apply_fog() {
static const GXColor black = {0, 0, 0, 0}; 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, GXSetFog(static_cast< GXFogType >(sGXState.x53_fogType), sGXState.x24c_fogParams.x0_fogStartZ, sGXState.x24c_fogParams.x4_fogEndZ,

View File

@ -8,7 +8,7 @@ public:
~CGraphicsSys(); ~CGraphicsSys();
private: private:
u32 pad; uint pad;
}; };
#endif #endif

View File

@ -26,15 +26,15 @@ public:
: x0_blendMode(trans), x1_matSetIdx(0), x2_flags(kF_DepthCompare | kF_DepthUpdate), x4_color(rgba, rgba, rgba, rgba) {} : x0_blendMode(trans), x1_matSetIdx(0), x2_flags(kF_DepthCompare | kF_DepthUpdate), x4_color(rgba, rgba, rgba, rgba) {}
CModelFlags(ETrans trans, CColor color) CModelFlags(ETrans trans, CColor color)
: x0_blendMode(trans), x1_matSetIdx(0), x2_flags(kF_DepthCompare | kF_DepthUpdate), x4_color(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) {} : 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) {} : 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 DontLoadTextures() { return CModelFlags(*this, GetOtherFlags() | kF_NoTextureLock); }
CModelFlags DepthCompareUpdate(bool compare, bool update) { CModelFlags DepthCompareUpdate(bool compare, bool update) {
u32 flags = GetOtherFlags(); uint flags = GetOtherFlags();
if (compare) { if (compare) {
flags |= kF_DepthCompare; flags |= kF_DepthCompare;
} else { } else {
@ -50,8 +50,8 @@ public:
CModelFlags DepthBackwards() { return CModelFlags(*this, GetOtherFlags() | kF_DepthGreater); } CModelFlags DepthBackwards() { return CModelFlags(*this, GetOtherFlags() | kF_DepthGreater); }
ETrans GetTrans() const { return static_cast< ETrans >(x0_blendMode); } ETrans GetTrans() const { return static_cast< ETrans >(x0_blendMode); }
s32 GetShaderSet() const { return x1_matSetIdx; } int GetShaderSet() const { return x1_matSetIdx; }
u32 GetOtherFlags() const { return x2_flags; } uint GetOtherFlags() const { return x2_flags; }
CColor GetColor() const { return x4_color; } CColor GetColor() const { return x4_color; }
static CModelFlags Normal() { return CModelFlags(kT_Opaque, 1.f); } static CModelFlags Normal() { return CModelFlags(kT_Opaque, 1.f); }

View File

@ -87,7 +87,7 @@ public:
class CTevPass { class CTevPass {
public: public:
u32 x0_id; uint x0_id;
ColorPass x4_colorPass; ColorPass x4_colorPass;
AlphaPass x14_alphaPass; AlphaPass x14_alphaPass;
CTevOp x24_colorOp; CTevOp x24_colorOp;

View File

@ -8,8 +8,8 @@
#define kInvalidAssetId 0xFFFFFFFFu #define kInvalidAssetId 0xFFFFFFFFu
typedef u32 CAssetId; typedef uint CAssetId;
typedef u32 FourCC; typedef uint FourCC;
struct SObjectTag { struct SObjectTag {
FourCC type; FourCC type;

View File

@ -8,7 +8,7 @@ public:
static f32 FastCosR(f32 v); static f32 FastCosR(f32 v);
static f32 FastSinR(f32 v); static f32 FastSinR(f32 v);
static inline f32 FastFmod(f32 x, f32 y) { static inline f32 FastFmod(f32 x, f32 y) {
s32 v = static_cast<s32>(x * (1.f / y)); int v = static_cast<int>(x * (1.f / y));
return x - v * y; return x - v * y;
} }
}; };

View File

@ -5,8 +5,8 @@
class CVector2i { class CVector2i {
private: private:
s32 x; int x;
s32 y; int y;
}; };
#endif #endif

View File

@ -48,8 +48,8 @@ public:
f32 operator[](EDimY) const { return mY; } f32 operator[](EDimY) const { return mY; }
f32 operator[](EDimZ) const { return mZ; } f32 operator[](EDimZ) const { return mZ; }
f32& operator[](s32 i) { return *(&mX + i); } f32& operator[](int i) { return *(&mX + i); }
// f32 operator[](s32 i) const { return *(&mX + i); } // f32 operator[](int i) const { return *(&mX + i); }
bool IsNonZero() const { return mX != 0.f || mY != 0.f || mZ != 0.f; } bool IsNonZero() const { return mX != 0.f || mY != 0.f || mZ != 0.f; }
void DropZ() { mZ = 0.f; } void DropZ() { mZ = 0.f; }

View File

@ -32,12 +32,12 @@ public:
virtual float GetGeneratorRate() const { return 1.f; } virtual float GetGeneratorRate() const { return 1.f; }
virtual bool IsSystemDeletable() const = 0; virtual bool IsSystemDeletable() const = 0;
virtual CAABox GetBounds() const = 0; virtual CAABox GetBounds() const = 0;
virtual s32 GetParticleCOunt() const = 0; virtual int GetParticleCOunt() const = 0;
virtual bool SystemHasLight() const = 0; virtual bool SystemHasLight() const = 0;
virtual CLight GetLight() = 0; virtual CLight GetLight() = 0;
virtual void DestroyParticles() = 0; virtual void DestroyParticles() = 0;
virtual void AddModifier(CWarp*) = 0; virtual void AddModifier(CWarp*) = 0;
virtual u32 Get4CharId() const = 0; virtual uint Get4CharId() const = 0;
}; };
#endif // _CPARTICLEGEN_HPP #endif // _CPARTICLEGEN_HPP

View File

@ -11,19 +11,19 @@ inline T cinput_stream_helper(const TType< T >& type, CInputStream& in);
class CInputStream { class CInputStream {
public: public:
CInputStream(s32 len); CInputStream(int len);
CInputStream(const void* ptr, s32 len, bool owned); CInputStream(const void* ptr, int len, bool owned);
virtual ~CInputStream(); virtual ~CInputStream();
virtual u32 Read(void* dest, u32 len) = 0; virtual uint Read(void* dest, uint len) = 0;
f32 ReadFloat(); f32 ReadFloat();
u64 ReadLongLong(); u64 ReadLongLong();
u32 ReadLong(); uint ReadLong();
u16 ReadShort(); u16 ReadShort();
bool ReadBool(); bool ReadBool();
u8 ReadChar(); u8 ReadChar();
u32 ReadBits(u32 len); uint ReadBits(uint len);
u32 ReadBytes(void* dest, unsigned long len); uint ReadBytes(void* dest, unsigned long len);
void Get(void* dest, unsigned long len); void Get(void* dest, unsigned long len);
template < typename T > template < typename T >
@ -35,26 +35,26 @@ private:
bool GrabAnotherBlock(); bool GrabAnotherBlock();
bool InternalReadNext(); bool InternalReadNext();
u32 x4_blockOffset; uint x4_blockOffset;
u32 x8_blockLen; uint x8_blockLen;
u32 xc_len; uint xc_len;
u8* x10_ptr; u8* x10_ptr;
bool x14_owned; bool x14_owned;
u32 x18_readPosition; uint x18_readPosition;
u32 x1c_bitWord; uint x1c_bitWord;
u32 x20_bitOffset; uint x20_bitOffset;
}; };
template <> 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(); return in.ReadLong();
} }
template <> 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(); return in.ReadLong();
} }
template <> 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(); return in.ReadLong();
} }
template <> template <>

View File

@ -13,7 +13,7 @@ public:
CMemoryInStream(const void* ptr, unsigned long len); CMemoryInStream(const void* ptr, unsigned long len);
CMemoryInStream(const void* ptr, unsigned long len, EOwnerShip ownership); CMemoryInStream(const void* ptr, unsigned long len, EOwnerShip ownership);
virtual ~CMemoryInStream() override {} virtual ~CMemoryInStream() override {}
virtual u32 Read(void* dest, u32 len) override; virtual uint Read(void* dest, uint len) override;
}; };
#endif #endif

View File

@ -18,8 +18,8 @@ private:
static u8 sAllocSpace[sizeof(T)]; static u8 sAllocSpace[sizeof(T)];
return &sAllocSpace; return &sAllocSpace;
} }
static u32& ReferenceCount() { static uint& ReferenceCount() {
static u32 sReferenceCount = 0; static uint sReferenceCount = 0;
return sReferenceCount; return sReferenceCount;
} }
}; };

View File

@ -6,7 +6,7 @@
#include "rstl/optional_object.hpp" #include "rstl/optional_object.hpp"
#include "rstl/reserved_vector.hpp" #include "rstl/reserved_vector.hpp"
template < typename T, s32 N > template < typename T, int N >
class TReservedAverage : rstl::reserved_vector< T, N > { class TReservedAverage : rstl::reserved_vector< T, N > {
public: public:
TReservedAverage(const T& value) { TReservedAverage(const T& value) {
@ -14,7 +14,7 @@ public:
} }
void AddValue(const T& value) { void AddValue(const T& value) {
push_back(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[](i) = operator[](i - 1);
} }
operator[](0) = value; operator[](0) = value;

View File

@ -8,7 +8,7 @@
#include "Kyoto/Streams/CInputStream.hpp" #include "Kyoto/Streams/CInputStream.hpp"
class CStringTable { class CStringTable {
s32 x0_stringCount; int x0_stringCount;
rstl::single_ptr< u8 > x4_data; rstl::single_ptr< u8 > x4_data;
public: public:

View File

@ -37,7 +37,7 @@ public:
virtual void AddParticleGen1(); virtual void AddParticleGen1();
virtual void AddParticleGen2(); virtual void AddParticleGen2();
virtual void AddPlaneObject(); 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 SetDrawableCallback();
virtual void SetWorldViewpoint(); virtual void SetWorldViewpoint();
virtual void SetPerspective1(); virtual void SetPerspective1();

View File

@ -234,13 +234,13 @@ public:
SAdvancementDeltas UpdateAnimation(float dt, CStateManager& mgr, bool advTree); 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, void ProcessSoundEvent(int sfxId, f32 weight, int flags, f32 fallOff, f32 maxDist, u8 minVol, u8 maxVol, const CVector3f& toListener,
const CVector3f& position, s32 aid, CStateManager& mgr, bool translateId); const CVector3f& position, int aid, CStateManager& mgr, bool translateId);
void UpdateSfxEmitters(); void UpdateSfxEmitters();
void RemoveEmitter(); void RemoveEmitter();
void SetModelData(const CModelData& modelData); 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;
void EnsureRendered(const CStateManager& mgr, const CVector3f& pos, const CAABox& bounds) const; void EnsureRendered(const CStateManager& mgr, const CVector3f& pos, const CAABox& bounds) const;
void DrawTouchBounds() const; void DrawTouchBounds() const;
@ -315,38 +315,38 @@ protected:
CAABox x9c_renderBounds; CAABox x9c_renderBounds;
CModelFlags xb4_drawFlags; CModelFlags xb4_drawFlags;
f32 xbc_time; f32 xbc_time;
u32 xc0_pitchBend; uint xc0_pitchBend;
TUniqueId xc4_fluidId; TUniqueId xc4_fluidId;
TUniqueId xc6_nextDrawNode; TUniqueId xc6_nextDrawNode;
s32 xc8_drawnToken; int xc8_drawnToken;
s32 xcc_addedToken; int xcc_addedToken;
f32 xd0_damageMag; f32 xd0_damageMag;
u8 xd4_maxVol; u8 xd4_maxVol;
rstl::reserved_vector< CSfxHandle, 2 > xd8_nonLoopingSfxHandles; rstl::reserved_vector< CSfxHandle, 2 > xd8_nonLoopingSfxHandles;
u32 xe4_24_nextNonLoopingSfxHandle : 3; uint xe4_24_nextNonLoopingSfxHandle : 3;
u32 xe4_27_notInSortedLists : 1; uint xe4_27_notInSortedLists : 1;
u32 xe4_28_transformDirty : 1; uint xe4_28_transformDirty : 1;
u32 xe4_29_actorLightsDirty : 1; uint xe4_29_actorLightsDirty : 1;
u32 xe4_30_outOfFrustum : 1; uint xe4_30_outOfFrustum : 1;
u32 xe4_31_calculateLighting : 1; uint xe4_31_calculateLighting : 1;
u32 xe5_24_shadowEnabled : 1; uint xe5_24_shadowEnabled : 1;
u32 xe5_25_shadowDirty : 1; uint xe5_25_shadowDirty : 1;
u32 xe5_26_muted : 1; uint xe5_26_muted : 1;
u32 xe5_27_useInSortedLists : 1; uint xe5_27_useInSortedLists : 1;
u32 xe5_28_callTouch : 1; uint xe5_28_callTouch : 1;
u32 xe5_29_globalTimeProvider : 1; uint xe5_29_globalTimeProvider : 1;
u32 xe5_30_renderUnsorted : 1; uint xe5_30_renderUnsorted : 1;
u32 xe5_31_pointGeneratorParticles : 1; uint xe5_31_pointGeneratorParticles : 1;
u32 xe6_24_fluidCounter : 3; uint xe6_24_fluidCounter : 3;
EThermalFlags xe6_27_thermalVisorFlags : 2; EThermalFlags xe6_27_thermalVisorFlags : 2;
u32 xe6_29_renderParticleDBInside : 1; uint xe6_29_renderParticleDBInside : 1;
u32 xe6_30_enablePitchBend : 1; uint xe6_30_enablePitchBend : 1;
u32 xe6_31_targetableVisorFlags : 4; uint xe6_31_targetableVisorFlags : 4;
u32 xe7_27_enableRender : 1; uint xe7_27_enableRender : 1;
u32 xe7_28_worldLightingDirty : 1; uint xe7_28_worldLightingDirty : 1;
u32 xe7_29_drawEnabled : 1; uint xe7_29_drawEnabled : 1;
u32 xe7_30_doTargetDistanceTest : 1; uint xe7_30_doTargetDistanceTest : 1;
u32 xe7_31_targetable : 1; uint xe7_31_targetable : 1;
}; };
CHECK_SIZEOF(CActor, 0xe8) CHECK_SIZEOF(CActor, 0xe8)

View File

@ -31,8 +31,8 @@ private:
f32 x30_angleC; f32 x30_angleC;
f32 x34_angleL; f32 x34_angleL;
f32 x38_angleQ; f32 x38_angleQ;
u32 x3c_priority; uint x3c_priority;
u32 x40_lightId; uint x40_lightId;
mutable f32 x44_cachedRadius; mutable f32 x44_cachedRadius;
mutable f32 x48_cachedIntensity; mutable f32 x48_cachedIntensity;
mutable bool x4c_24_intensityDirty : 1; mutable bool x4c_24_intensityDirty : 1;
@ -69,19 +69,19 @@ private:
bool x299_25_useBrightLightLag : 1; bool x299_25_useBrightLightLag : 1;
bool x299_26_ambientOnly : 1; bool x299_26_ambientOnly : 1;
bool x29a_findNearestDynamicLights; bool x29a_findNearestDynamicLights;
s32 x29c_shadowLightArrIdx; int x29c_shadowLightArrIdx;
s32 x2a0_shadowLightIdx; int x2a0_shadowLightIdx;
u32 x2a4_lastUpdateFrame; uint x2a4_lastUpdateFrame;
u32 x2a8_areaUpdateFramePeriod; uint x2a8_areaUpdateFramePeriod;
CVector3f x2ac_actorPosBias; CVector3f x2ac_actorPosBias;
s32 x2b8_maxAreaLights; int x2b8_maxAreaLights;
s32 x2bc_maxDynamicLights; int x2bc_maxDynamicLights;
CVector3f x2c0_lastActorPos; CVector3f x2c0_lastActorPos;
f32 x2cc_actorPositionDeltaUpdateThreshold; f32 x2cc_actorPositionDeltaUpdateThreshold;
f32 x2d0_shadowDynamicRangeThreshold; f32 x2d0_shadowDynamicRangeThreshold;
f32 x2d4_worldLightingLevel; f32 x2d4_worldLightingLevel;
s32 x2d8_brightLightIdx; int x2d8_brightLightIdx;
u32 x2dc_brightLightLag; uint x2dc_brightLightLag;
}; };
CHECK_SIZEOF(CActorLights, 0x2e0) CHECK_SIZEOF(CActorLights, 0x2e0)

View File

@ -41,7 +41,7 @@ public:
const CColor& GetAmbientColor() const { return x18_noLightsAmbient; } const CColor& GetAmbientColor() const { return x18_noLightsAmbient; }
bool ShouldMakeLights() const { return x1c_makeLights; } bool ShouldMakeLights() const { return x1c_makeLights; }
s32 GetMaxAreaLights() const { return x3c_maxAreaLights; } int GetMaxAreaLights() const { return x3c_maxAreaLights; }
rstl::auto_ptr< CActorLights > MakeActorLights() const; rstl::auto_ptr< CActorLights > MakeActorLights() const;
@ -56,10 +56,10 @@ private:
bool x1d_ambientChannelOverflow; bool x1d_ambientChannelOverflow;
EWorldLightingOptions x20_worldLightingOptions; EWorldLightingOptions x20_worldLightingOptions;
ELightRecalculationOptions x24_lightRecalcOpts; ELightRecalculationOptions x24_lightRecalcOpts;
s32 x28_layerIdx; int x28_layerIdx;
CVector3f x2c_actorPosBias; CVector3f x2c_actorPosBias;
s32 x38_maxDynamicLights; int x38_maxDynamicLights;
s32 x3c_maxAreaLights; int x3c_maxAreaLights;
}; };
CHECK_SIZEOF(CLightParameters, 0x40) CHECK_SIZEOF(CLightParameters, 0x40)
@ -90,9 +90,9 @@ public:
static CVisorParameters None(); static CVisorParameters None();
private: private:
u32 x0_mask : 4; uint x0_mask : 4;
u32 x0_4_b1 : 1; uint x0_4_b1 : 1;
u32 x0_5_scanPassthrough : 1; uint x0_5_scanPassthrough : 1;
}; };
CHECK_SIZEOF(CVisorParameters, 0x4) CHECK_SIZEOF(CVisorParameters, 0x4)

View File

@ -36,22 +36,22 @@ public:
x120_particleDB.SetParticleEffectState(name, active, mgr); x120_particleDB.SetParticleEffectState(name, active, mgr);
} }
s32 GetCharacterIndex() const { return x204_charIdx; } int GetCharacterIndex() const { return x204_charIdx; }
f32 GetAverageVelocity(s32 idx) const; f32 GetAverageVelocity(int idx) const;
const CBoolPOINode* GetBoolPOIList(s32& count) const { const CBoolPOINode* GetBoolPOIList(int& count) const {
count = x20c_passedBoolCount; count = x20c_passedBoolCount;
return mBoolPOINodes.data(); return mBoolPOINodes.data();
} }
const CInt32POINode* GetInt32POIList(s32& count) const { const CInt32POINode* GetInt32POIList(int& count) const {
count = x210_passedIntCount; count = x210_passedIntCount;
return mInt32POINodes.data(); return mInt32POINodes.data();
} }
const CParticlePOINode* GetParticlePOIList(s32& count) const { const CParticlePOINode* GetParticlePOIList(int& count) const {
count = x214_passedParticleCount; count = x214_passedParticleCount;
return mParticlePOINodes.data(); return mParticlePOINodes.data();
} }
const CSoundPOINode* GetSoundPOIList(s32& count) const { const CSoundPOINode* GetSoundPOIList(int& count) const {
count = x218_passedSoundCount; count = x218_passedSoundCount;
return mSoundPOINodes.data(); return mSoundPOINodes.data();
} }
@ -171,13 +171,13 @@ private:
rstl::rc_ptr< CAnimTreeNode > x1f8_animRoot; rstl::rc_ptr< CAnimTreeNode > x1f8_animRoot;
rstl::rc_ptr< CTransitionManager > x1fc_transMgr; rstl::rc_ptr< CTransitionManager > x1fc_transMgr;
f32 x200_speedScale; f32 x200_speedScale;
s32 x204_charIdx; int x204_charIdx;
s32 x208_defaultAnim; int x208_defaultAnim;
s32 x20c_passedBoolCount; int x20c_passedBoolCount;
s32 x210_passedIntCount; int x210_passedIntCount;
s32 x214_passedParticleCount; int x214_passedParticleCount;
s32 x218_passedSoundCount; int x218_passedSoundCount;
s32 x21c_particleLightIdx; int x21c_particleLightIdx;
bool x220_24_animating : 1; bool x220_24_animating : 1;
bool x220_25_loop : 1; bool x220_25_loop : 1;
bool x220_26_aligningPos : 1; bool x220_26_aligningPos : 1;
@ -189,7 +189,7 @@ private:
CPoseAsTransforms x224_pose; CPoseAsTransforms x224_pose;
CHierarchyPoseBuilder x2fc_poseBuilder; CHierarchyPoseBuilder x2fc_poseBuilder;
CAnimPlaybackParms x40c_playbackParms; 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< CBoolPOINode, 8 > mBoolPOINodes;
static rstl::reserved_vector< CInt32POINode, 16 > mInt32POINodes; static rstl::reserved_vector< CInt32POINode, 16 > mInt32POINodes;

View File

@ -9,11 +9,11 @@ class CVector3f;
class CAnimPlaybackParms { class CAnimPlaybackParms {
private: private:
s32 x0_animA; int x0_animA;
s32 x4_animB; int x4_animB;
f32 x8_blendWeight; f32 x8_blendWeight;
bool xc_animating; bool xc_animating;
s32 x10_; int x10_;
CVector3f* x14_targetPos; CVector3f* x14_targetPos;
bool x18_useLocator; bool x18_useLocator;
CQuaternion* x1c_deltaOrient; CQuaternion* x1c_deltaOrient;

View File

@ -29,15 +29,15 @@ private:
CAssetId x14_cmdl; CAssetId x14_cmdl;
CAssetId x18_cksr; CAssetId x18_cksr;
CAssetId x1c_cinf; 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; CPASDatabase x30_pasDatabase;
CParticleResData x44_partRes; CParticleResData x44_partRes;
u32 x84_unk; uint x84_unk;
rstl::vector< rstl::pair< rstl::string, CAABox > > x88_aabbs; rstl::vector< rstl::pair< rstl::string, CAABox > > x88_aabbs;
rstl::vector< rstl::pair< rstl::string, rstl::vector< CEffectComponent > > > x98_effects; rstl::vector< rstl::pair< rstl::string, rstl::vector< CEffectComponent > > > x98_effects;
u32 xa8_cmdlOverlay; uint xa8_cmdlOverlay;
u32 xac_cksrOverlay; uint xac_cksrOverlay;
rstl::vector< s32 > xb0_animIdxs; rstl::vector< int > xb0_animIdxs;
}; };
CHECK_SIZEOF(CCharacterInfo, 0xc0) CHECK_SIZEOF(CCharacterInfo, 0xc0)

View File

@ -12,7 +12,7 @@ private:
rstl::string x18_boneName; rstl::string x18_boneName;
f32 x28_scale; f32 x28_scale;
CParticleData::EParentedMode x2c_parentedMode; CParticleData::EParentedMode x2c_parentedMode;
u32 x30_flags; uint x30_flags;
}; };
#endif #endif

View File

@ -40,7 +40,7 @@ private:
CVector3f x18_focusCellPosition; CVector3f x18_focusCellPosition;
bool x24_enableSplash; bool x24_enableSplash;
f32 x28_firstSnowForce; f32 x28_firstSnowForce;
s32 x2c_lastBlockedGridIdx; int x2c_lastBlockedGridIdx;
f32 x30_fxDensity; f32 x30_fxDensity;
f32 x34_targetFxDensity; f32 x34_targetFxDensity;
f32 x38_maxDensityDeltaSpeed; f32 x38_maxDensityDeltaSpeed;

View File

@ -20,12 +20,12 @@ public:
virtual ~IGameArea(); virtual ~IGameArea();
virtual const CTransform4f& IGetTM() const = 0; virtual const CTransform4f& IGetTM() const = 0;
virtual CAssetId IGetStringTableAssetId() const = 0; virtual CAssetId IGetStringTableAssetId() const = 0;
virtual u32 IGetNumAttachedAreas() const = 0; virtual uint IGetNumAttachedAreas() const = 0;
virtual TAreaId IGetAttachedAreaId(int) const = 0; virtual TAreaId IGetAttachedAreaId(int) const = 0;
virtual bool IIsActive() const = 0; virtual bool IIsActive() const = 0;
virtual CAssetId IGetAreaAssetId() const = 0; virtual CAssetId IGetAreaAssetId() const = 0;
virtual s32 IGetAreaSaveId() const = 0; virtual int IGetAreaSaveId() const = 0;
virtual rstl::pair< rstl::auto_ptr< u8 >, s32 > IGetScriptingMemoryAlways() const = 0; virtual rstl::pair< rstl::auto_ptr< u8 >, int > IGetScriptingMemoryAlways() const = 0;
}; };
class Dock; class Dock;
@ -37,12 +37,12 @@ public:
~CGameArea(); ~CGameArea();
const CTransform4f& IGetTM() const override; const CTransform4f& IGetTM() const override;
CAssetId IGetStringTableAssetId() const override; CAssetId IGetStringTableAssetId() const override;
u32 IGetNumAttachedAreas() const override; uint IGetNumAttachedAreas() const override;
TAreaId IGetAttachedAreaId(int) const override; TAreaId IGetAttachedAreaId(int) const override;
bool IIsActive() const override; bool IIsActive() const override;
CAssetId IGetAreaAssetId() const override; CAssetId IGetAreaAssetId() const override;
s32 IGetAreaSaveId() const override; int IGetAreaSaveId() const override;
rstl::pair< rstl::auto_ptr< u8 >, s32 > IGetScriptingMemoryAlways() const override; rstl::pair< rstl::auto_ptr< u8 >, int > IGetScriptingMemoryAlways() const override;
bool IsLoaded() const { return xf0_24_postConstructed; } bool IsLoaded() const { return xf0_24_postConstructed; }
bool IsActive() const { return xf0_25_active; } bool IsActive() const { return xf0_25_active; }
@ -61,14 +61,14 @@ private:
CTransform4f x3c_invTransform; CTransform4f x3c_invTransform;
CAABox x6c_aabb; CAABox x6c_aabb;
CAssetId x84_mrea; CAssetId x84_mrea;
s32 x88_areaId; int x88_areaId;
rstl::vector< u16 > x8c_attachedAreaIndices; rstl::vector< u16 > x8c_attachedAreaIndices;
rstl::vector< SObjectTag > x9c_deps1; rstl::vector< SObjectTag > x9c_deps1;
rstl::vector< SObjectTag > xac_deps2; rstl::vector< SObjectTag > xac_deps2;
rstl::vector< u32 > xbc_layerDepOffsets; rstl::vector< uint > xbc_layerDepOffsets;
rstl::vector< Dock > xcc_docks; rstl::vector< Dock > xcc_docks;
rstl::vector< CToken > xdc_tokens; rstl::vector< CToken > xdc_tokens;
u32 xec_totalResourcesSize; uint xec_totalResourcesSize;
bool xf0_24_postConstructed : 1; bool xf0_24_postConstructed : 1;
bool xf0_25_active : 1; bool xf0_25_active : 1;
bool xf0_26_tokensReady : 1; bool xf0_26_tokensReady : 1;

View File

@ -36,9 +36,9 @@ private:
CAiFuncMap x110_aiFuncMap; CAiFuncMap x110_aiFuncMap;
CGraphicsSys x130_graphicsSys; CGraphicsSys x130_graphicsSys;
rstl::single_ptr< CGameState > x134_gameState; rstl::single_ptr< CGameState > x134_gameState;
u32 x138_; uint x138_;
rstl::optional_object< TCachedToken< unkptr > > x13c_; rstl::optional_object< TCachedToken< unkptr > > x13c_;
u32 x14c_; uint x14c_;
rstl::single_ptr< CInGameTweakManager > x150_inGameTweakManager; rstl::single_ptr< CInGameTweakManager > x150_inGameTweakManager;
TToken< CRasterFont > x154_defaultFont; TToken< CRasterFont > x154_defaultFont;
}; };

View File

@ -19,7 +19,7 @@ class TSegIdMap {
private: private:
CSegId x0_boneCount; CSegId x0_boneCount;
CSegId x1_capacity; CSegId x1_capacity;
u32 x4_maxCapacity; uint x4_maxCapacity;
CSegId x8_indirectionMap[200]; CSegId x8_indirectionMap[200];
T* xd0_nodes; T* xd0_nodes;
CSegId xd4_curPrevBone; CSegId xd4_curPrevBone;

View File

@ -12,8 +12,8 @@ public:
inline bool IsEmpty() const { return x4_ == 0 && x0_ == 0; } inline bool IsEmpty() const { return x4_ == 0 && x0_ == 0; }
private: private:
u32 x0_; uint x0_;
u32 x4_; uint x4_;
rstl::list< unkptr > x8_; rstl::list< unkptr > x8_;
}; };

View File

@ -23,7 +23,7 @@ public:
void StreamNewGameState(CInputStream& in, int saveIdx); void StreamNewGameState(CInputStream& in, int saveIdx);
void RefreshGameState(); void RefreshGameState();
void AddWorldPaks(); void AddWorldPaks();
void AsyncIdle(u32 time); void AsyncIdle(uint time);
int RsMain(int argc, const char* const* argv); int RsMain(int argc, const char* const* argv);
void InitializeSubsystems(); void InitializeSubsystems();
void FillInAssetIDs(); void FillInAssetIDs();
@ -50,9 +50,9 @@ private:
f32 x120_; f32 x120_;
f32 x124_; f32 x124_;
CGameGlobalObjects* x128_gameGlobalObjects; CGameGlobalObjects* x128_gameGlobalObjects;
u32 x12c_flowState; // EFlowState uint x12c_flowState; // EFlowState
rstl::reserved_vector< u32, 10 > x130_frameTimes; rstl::reserved_vector< uint, 10 > x130_frameTimes;
s32 x15c_frameTimeIdx; int x15c_frameTimeIdx;
bool x160_24_finished : 1; bool x160_24_finished : 1;
bool x160_25_mfGameBuilt : 1; bool x160_25_mfGameBuilt : 1;
bool x160_26_screenFading : 1; bool x160_26_screenFading : 1;

View File

@ -37,10 +37,10 @@ public:
const CEntity* GetObjectById() const; const CEntity* GetObjectById() const;
CEntity* GetValidObjectById(TUniqueId uid); CEntity* GetValidObjectById(TUniqueId uid);
const CEntity* GetValidObjectById(TUniqueId uid) const; const CEntity* GetValidObjectById(TUniqueId uid) const;
CEntity* operator[](s32 idx); CEntity* operator[](int idx);
const CEntity* operator[](s32 idx) const; const CEntity* operator[](int idx) const;
const CEntity* GetValidObjectByIndex(s32 idx) const; const CEntity* GetValidObjectByIndex(int idx) const;
s32 size() const { return mCount; } int size() const { return mCount; }
private: private:
SObjectListEntry mObjects[1024]; SObjectListEntry mObjects[1024];

View File

@ -47,8 +47,8 @@ public:
kPT_Enum = 4, kPT_Enum = 4,
}; };
union UParmValue { union UParmValue {
s32 m_int; int m_int;
u32 m_uint; uint m_uint;
f32 m_float; f32 m_float;
bool m_bool; bool m_bool;
}; };
@ -77,7 +77,7 @@ private:
class CPASAnimInfo { class CPASAnimInfo {
private: private:
u32 x0_id; uint x0_id;
rstl::reserved_vector< CPASAnimParm::UParmValue, 8 > x4_parms; rstl::reserved_vector< CPASAnimParm::UParmValue, 8 > x4_parms;
}; };
@ -86,7 +86,7 @@ private:
pas::EAnimationState x0_id; pas::EAnimationState x0_id;
rstl::vector< CPASParmInfo > x4_parms; rstl::vector< CPASParmInfo > x4_parms;
rstl::vector< CPASAnimInfo > x14_anims; rstl::vector< CPASAnimInfo > x14_anims;
rstl::vector< s32 > x24_selectionCache; rstl::vector< int > x24_selectionCache;
}; };
CHECK_SIZEOF(CPASAnimState, 0x34) CHECK_SIZEOF(CPASAnimState, 0x34)

View File

@ -10,7 +10,7 @@
class CPASDatabase { class CPASDatabase {
private: private:
rstl::vector< CPASAnimState > x0_states; rstl::vector< CPASAnimState > x0_states;
s32 x10_defaultState; int x10_defaultState;
}; };
CHECK_SIZEOF(CPASDatabase, 0x14) CHECK_SIZEOF(CPASDatabase, 0x14)

View File

@ -27,19 +27,19 @@ public:
EPOIType GetPoiType() const { return static_cast< EPOIType >(x18_type); } EPOIType GetPoiType() const { return static_cast< EPOIType >(x18_type); }
const CCharAnimTime& GetTime() const { return x1c_time; } const CCharAnimTime& GetTime() const { return x1c_time; }
f32 GetWeight() const { return x2c_weight; } f32 GetWeight() const { return x2c_weight; }
s32 GetCharacterIndex() const { return x30_charIdx; } int GetCharacterIndex() const { return x30_charIdx; }
s32 GetFlags() const { return x34_flags; } int GetFlags() const { return x34_flags; }
protected: protected:
u16 x4_; u16 x4_;
rstl::string x8_name; rstl::string x8_name;
u16 x18_type; u16 x18_type;
CCharAnimTime x1c_time; CCharAnimTime x1c_time;
s32 x24_index; int x24_index;
bool x28_unique; bool x28_unique;
f32 x2c_weight; f32 x2c_weight;
s32 x30_charIdx; int x30_charIdx;
s32 x34_flags; int x34_flags;
}; };
CHECK_SIZEOF(CPOINode, 0x38) CHECK_SIZEOF(CPOINode, 0x38)
@ -60,11 +60,11 @@ public:
// __ct__13CInt32POINodeFQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>UsRC13CCharAnimTimeibfiiiRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator> // __ct__13CInt32POINodeFQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>UsRC13CCharAnimTimeibfiiiRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>
// CopyNodeMinusStartTime__13CInt32POINodeFRC13CInt32POINodeRC13CCharAnimTime // CopyNodeMinusStartTime__13CInt32POINodeFRC13CInt32POINodeRC13CCharAnimTime
s32 GetValue() const { return x38_val; } int GetValue() const { return x38_val; }
const rstl::string& GetLocatorName() const { return x3c_lctrName; } const rstl::string& GetLocatorName() const { return x3c_lctrName; }
private: private:
s32 x38_val; int x38_val;
rstl::string x3c_lctrName; rstl::string x3c_lctrName;
}; };
@ -75,12 +75,12 @@ private:
class CSoundPOINode : public CPOINode { class CSoundPOINode : public CPOINode {
public: public:
u32 GetSoundId() const { return x38_sfxId; } uint GetSoundId() const { return x38_sfxId; }
f32 GetFallOff() const { return x3c_falloff; } f32 GetFallOff() const { return x3c_falloff; }
f32 GetMaxDistance() const { return x40_maxDist; } f32 GetMaxDistance() const { return x40_maxDist; }
private: private:
u32 x38_sfxId; uint x38_sfxId;
f32 x3c_falloff; f32 x3c_falloff;
f32 x40_maxDist; f32 x40_maxDist;
}; };

View File

@ -17,7 +17,7 @@ public:
}; };
private: private:
u32 x0_duration; uint x0_duration;
SObjectTag x4_particle; SObjectTag x4_particle;
rstl::string xc_boneName; rstl::string xc_boneName;
f32 x1c_scale; f32 x1c_scale;
@ -26,7 +26,7 @@ private:
class CAuxiliaryParticleData { class CAuxiliaryParticleData {
private: private:
u32 x0_duration; uint x0_duration;
SObjectTag x4_particle; SObjectTag x4_particle;
CVector3f xc_translation; CVector3f xc_translation;
f32 x18_scale; f32 x18_scale;

View File

@ -21,7 +21,7 @@ CHECK_SIZEOF(SNode, 0x2c);
struct SSortedList { struct SSortedList {
s16 x0_ids[kMaxObjects]; s16 x0_ids[kMaxObjects];
u32 x800_size; uint x800_size;
}; };
CHECK_SIZEOF(SSortedList, 0x804); CHECK_SIZEOF(SSortedList, 0x804);

View File

@ -10,7 +10,7 @@
class CWeaponMgr { class CWeaponMgr {
private: 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); CHECK_SIZEOF(CWeaponMgr, 0x14);

View File

@ -25,7 +25,7 @@ public:
virtual TAreaId IGetAreaId(CAssetId id) const = 0; virtual TAreaId IGetAreaId(CAssetId id) const = 0;
virtual bool ICheckWorldComplete() = 0; virtual bool ICheckWorldComplete() = 0;
virtual rstl::string IGetDefaultAudioTrack() const = 0; virtual rstl::string IGetDefaultAudioTrack() const = 0;
virtual s32 IGetAreaCount() const = 0; virtual int IGetAreaCount() const = 0;
}; };
class CGameArea; class CGameArea;
@ -55,7 +55,7 @@ public:
TAreaId IGetAreaId(CAssetId id) const override; TAreaId IGetAreaId(CAssetId id) const override;
bool ICheckWorldComplete() override; bool ICheckWorldComplete() override;
rstl::string IGetDefaultAudioTrack() const override; rstl::string IGetDefaultAudioTrack() const override;
s32 IGetAreaCount() const override; int IGetAreaCount() const override;
const CGameArea& GetAreaAlways(TAreaId id) const { const CGameArea& GetAreaAlways(TAreaId id) const {
return *x18_areas[id.Value()]; return *x18_areas[id.Value()];
@ -87,13 +87,13 @@ private:
rstl::vector< CRelay > x2c_relays; rstl::vector< CRelay > x2c_relays;
rstl::rc_ptr< IDvdRequest > x3c_loadToken; rstl::rc_ptr< IDvdRequest > x3c_loadToken;
rstl::single_ptr< u8 > x40_loadBuf; rstl::single_ptr< u8 > x40_loadBuf;
u32 x44_bufSz; uint x44_bufSz;
u32 x48_chainCount; uint x48_chainCount;
CGameArea* x4c_chainHeads[5]; CGameArea* x4c_chainHeads[5];
IObjectStore* x60_objectStore; IObjectStore* x60_objectStore;
IFactory* x64_resFactory; IFactory* x64_resFactory;
TAreaId x68_curAreaId; TAreaId x68_curAreaId;
u32 x6c_loadedAudioGrpCount; uint x6c_loadedAudioGrpCount;
bool x70_24_currentAreaNeedsAllocation : 1; bool x70_24_currentAreaNeedsAllocation : 1;
bool x70_25_loadPaused : 1; bool x70_25_loadPaused : 1;
bool x70_26_skyboxActive : 1; bool x70_26_skyboxActive : 1;

View File

@ -7,7 +7,7 @@
class CCameraHint { class CCameraHint {
public: 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, f32 backwardsDist, const CVector3f& lookAtOffset, const CVector3f& chaseLookAtOffset,
const CVector3f& ballToCam, f32 fov, f32 attitudeRange, f32 azimuthRange, const CVector3f& ballToCam, f32 fov, f32 attitudeRange, f32 azimuthRange,
f32 anglePerSecond, f32 clampVelRange, f32 clampRotRange, f32 elevation, f32 interpolateTime, f32 anglePerSecond, f32 clampVelRange, f32 clampRotRange, f32 elevation, f32 interpolateTime,
@ -15,7 +15,7 @@ public:
virtual ~CCameraHint(); virtual ~CCameraHint();
private: private:
u32 mOverrideFlags; uint mOverrideFlags;
CBallCamera::EBallCameraBehaviour mBehaviour; CBallCamera::EBallCameraBehaviour mBehaviour;
f32 mMinDist; f32 mMinDist;
f32 mMaxDist; f32 mMaxDist;

View File

@ -28,14 +28,14 @@ private:
TUniqueId x0_curCameraId; TUniqueId x0_curCameraId;
rstl::vector< TUniqueId > x4_cineCameras; rstl::vector< TUniqueId > x4_cineCameras;
rstl::list< CCameraShakeData > x14_shakers; rstl::list< CCameraShakeData > x14_shakers;
u32 x2c_lastShakeId; uint x2c_lastShakeId;
CVector3f x30_shakeOffset; CVector3f x30_shakeOffset;
CAreaFog x3c_fog; CAreaFog x3c_fog;
s32 x74_fluidCounter; int x74_fluidCounter;
TUniqueId x78_fluidId; TUniqueId x78_fluidId;
CFirstPersonCamera* x7c_fpCamera; CFirstPersonCamera* x7c_fpCamera;
CBallCamera* x80_ballCamera; CBallCamera* x80_ballCamera;
s32 x84_rumbleId; int x84_rumbleId;
CInterpolationCamera* x88_interpCamera; CInterpolationCamera* x88_interpCamera;
s16 x8c_; s16 x8c_;
f32 x90_rumbleCooldown; f32 x90_rumbleCooldown;
@ -48,8 +48,8 @@ private:
TUniqueId xa2_spindleCamId; TUniqueId xa2_spindleCamId;
TUniqueId xa4_pathCamId; TUniqueId xa4_pathCamId;
TUniqueId xa6_camHintId; TUniqueId xa6_camHintId;
s32 xa8_hintPriority; int xa8_hintPriority;
rstl::reserved_vector< rstl::pair< s32, TUniqueId >, 64 > xac_cameraHints; rstl::reserved_vector< rstl::pair< int, TUniqueId >, 64 > xac_cameraHints;
rstl::reserved_vector< TUniqueId, 64 > x2b0_inactiveCameraHints; rstl::reserved_vector< TUniqueId, 64 > x2b0_inactiveCameraHints;
rstl::reserved_vector< TUniqueId, 64 > x334_activeCameraHints; rstl::reserved_vector< TUniqueId, 64 > x334_activeCameraHints;
bool x3b8_24_ : 1; bool x3b8_24_ : 1;

View File

@ -34,8 +34,8 @@ private:
CCameraShakerComponent x8_shakerX; CCameraShakerComponent x8_shakerX;
CCameraShakerComponent x44_shakerY; CCameraShakerComponent x44_shakerY;
CCameraShakerComponent x80_shakerZ; CCameraShakerComponent x80_shakerZ;
u32 xbc_shakerId; uint xbc_shakerId;
u32 xc0_flags; uint xc0_flags;
CVector3f xc4_sfxPos; CVector3f xc4_sfxPos;
f32 xd0_sfxDist; f32 xd0_sfxDist;
}; };

View File

@ -22,7 +22,7 @@ private:
f32 x160_znear; f32 x160_znear;
f32 x164_zfar; f32 x164_zfar;
f32 x168_aspect; f32 x168_aspect;
u32 x16c_controllerIdx; uint x16c_controllerIdx;
mutable bool x170_24_perspDirty : 1; mutable bool x170_24_perspDirty : 1;
bool x170_25_disablesInput : 1; bool x170_25_disablesInput : 1;
f32 x174_delayTime; f32 x174_delayTime;

View File

@ -19,15 +19,15 @@ public:
private: private:
rstl::reserved_vector< bool, 64 > x0_; rstl::reserved_vector< bool, 64 > x0_;
s32 x44_soundMode; // CAudioSys::ESurroundModes int x44_soundMode; // CAudioSys::ESurroundModes
u32 x48_screenBrightness; uint x48_screenBrightness;
s32 x4c_screenXOffset; int x4c_screenXOffset;
s32 x50_screenYOffset; int x50_screenYOffset;
s32 x54_screenStretch; int x54_screenStretch;
u32 x58_sfxVol; uint x58_sfxVol;
u32 x5c_musicVol; uint x5c_musicVol;
u32 x60_hudAlpha; uint x60_hudAlpha;
u32 x64_helmetAlpha; uint x64_helmetAlpha;
bool x68_24_hudLag : 1; bool x68_24_hudLag : 1;
bool x68_25_invertY : 1; bool x68_25_invertY : 1;
bool x68_26_rumble : 1; bool x68_26_rumble : 1;

View File

@ -26,7 +26,7 @@ public:
CSystemOptions& SystemOptions() { return xa8_systemOptions; } CSystemOptions& SystemOptions() { return xa8_systemOptions; }
CGameOptions& GameOptions() { return x17c_gameOptions; } CGameOptions& GameOptions() { return x17c_gameOptions; }
CHintOptions& HintOptions() { return x1f8_hintOptions; } CHintOptions& HintOptions() { return x1f8_hintOptions; }
u32& SaveIdx() { return x20c_saveIdx; } uint& SaveIdx() { return x20c_saveIdx; }
u64& CardSerial() { return x210_cardSerial; } u64& CardSerial() { return x210_cardSerial; }
rstl::vector< u8 >& BackupBuf() { return x218_backupBuf; } rstl::vector< u8 >& BackupBuf() { return x218_backupBuf; }
@ -40,7 +40,7 @@ private:
CSystemOptions xa8_systemOptions; CSystemOptions xa8_systemOptions;
CGameOptions x17c_gameOptions; CGameOptions x17c_gameOptions;
CHintOptions x1f8_hintOptions; CHintOptions x1f8_hintOptions;
u32 x20c_saveIdx; uint x20c_saveIdx;
u64 x210_cardSerial; u64 x210_cardSerial;
rstl::vector< u8 > x218_backupBuf; rstl::vector< u8 > x218_backupBuf;
bool x228_24_hardMode : 1; bool x228_24_hardMode : 1;

View File

@ -12,11 +12,11 @@ extern TEditorId kInvalidEditorId;
extern TUniqueId kInvalidUniqueId; extern TUniqueId kInvalidUniqueId;
struct TAreaId { struct TAreaId {
s32 value; int value;
TAreaId() : value(-1) {} TAreaId() : value(-1) {}
TAreaId(s32 value) : value(value) {} TAreaId(int value) : value(value) {}
s32 Value() const { return 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; }
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) CHECK_SIZEOF(TAreaId, 0x4)
struct TEditorId { struct TEditorId {
u32 value; uint value;
TEditorId() : value(-1) {} TEditorId() : value(-1) {}
TEditorId(u32 value) : value(value) {} TEditorId(uint value) : value(value) {}
u32 Value() const { return 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; }
bool operator!=(const TEditorId& other) const { return value != other.value; } bool operator!=(const TEditorId& other) const { return value != other.value; }

View File

@ -10,7 +10,7 @@ public:
const rstl::string& GetWorldPrefix() { return x4_worldPrefix; } const rstl::string& GetWorldPrefix() { return x4_worldPrefix; }
private: private:
u32 x0_; uint x0_;
rstl::string x4_worldPrefix; rstl::string x4_worldPrefix;
}; };

View File

@ -9,7 +9,7 @@ public:
void RegisterTweaks(); void RegisterTweaks();
private: private:
u32 x0_unk; uint x0_unk;
}; };
#endif #endif

View File

@ -14,11 +14,11 @@ typedef uint64_t u64;
#else #else
typedef signed char s8; typedef signed char s8;
typedef signed short int s16; typedef signed short int s16;
typedef signed int s32; typedef signed long s32;
typedef signed long long int s64; typedef signed long long int s64;
typedef unsigned char u8; typedef unsigned char u8;
typedef unsigned short int u16; typedef unsigned short int u16;
typedef unsigned int u32; typedef unsigned long u32;
typedef unsigned long long int u64; typedef unsigned long long int u64;
#endif #endif

View File

@ -7,9 +7,9 @@
#include "rstl/pointer_iterator.hpp" #include "rstl/pointer_iterator.hpp"
namespace rstl { namespace rstl {
template < typename T, s32 N > template < typename T, int N >
class reserved_vector { class reserved_vector {
s32 x0_count; int x0_count;
u8 x4_data[N * sizeof(T)]; u8 x4_data[N * sizeof(T)];
public: public:
@ -36,7 +36,7 @@ public:
return *this; return *this;
} }
void clear() { void clear() {
for (s32 i = 0; i < x0_count; ++i) { for (int i = 0; i < x0_count; ++i) {
rstl::destroy(&data()[i]); rstl::destroy(&data()[i]);
} }
x0_count = 0; x0_count = 0;
@ -54,14 +54,14 @@ public:
inline T* data() { return reinterpret_cast< T* >(x4_data); } inline T* data() { return reinterpret_cast< T* >(x4_data); }
inline const T* data() const { return reinterpret_cast< const T* >(x4_data); } inline const T* data() const { return reinterpret_cast< const T* >(x4_data); }
inline s32 size() const { return x0_count; } inline int size() const { return x0_count; }
inline s32 capacity() const { return N; } inline int capacity() const { return N; }
inline T& front() { return data()[0]; } inline T& front() { return data()[0]; }
inline const T& front() const { return data()[0]; } inline const T& front() const { return data()[0]; }
inline T& back() { return data()[x0_count - 1]; } inline T& back() { return data()[x0_count - 1]; }
inline const T& back() const { return data()[x0_count - 1]; } inline const T& back() const { return data()[x0_count - 1]; }
inline T& operator[](s32 idx) { return data()[idx]; } inline T& operator[](int idx) { return data()[idx]; }
inline const T& operator[](s32 idx) const { return data()[idx]; } inline const T& operator[](int idx) const { return data()[idx]; }
}; };
} // namespace rstl } // namespace rstl

View File

@ -8,7 +8,7 @@
namespace rstl { namespace rstl {
struct rmemory_allocator { struct rmemory_allocator {
template < typename T > template < typename T >
static void allocate(T*& out, s32 sz) { static void allocate(T*& out, int sz) {
out = reinterpret_cast< T* >(new u8[sz]); out = reinterpret_cast< T* >(new u8[sz]);
} }
template < typename T > template < typename T >

View File

@ -10,8 +10,8 @@ namespace rstl {
template < typename T, typename Alloc = rmemory_allocator > template < typename T, typename Alloc = rmemory_allocator >
class vector { class vector {
Alloc x0_allocator; Alloc x0_allocator;
s32 x4_count; int x4_count;
s32 x8_capacity; int x8_capacity;
T* xc_items; T* xc_items;
public: public:
@ -23,14 +23,14 @@ public:
inline iterator end() { return iterator(xc_items + x4_count); } inline iterator end() { return iterator(xc_items + x4_count); }
inline const_iterator end() const { return const_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() : 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) { vector(const vector& other) {
x4_count = other.x4_count; x4_count = other.x4_count;
x8_capacity = other.x8_capacity; x8_capacity = other.x8_capacity;
if (other.x4_count == 0 && other.x8_capacity == 0) { if (other.x4_count == 0 && other.x8_capacity == 0) {
xc_items = NULL; xc_items = NULL;
} else { } else {
s32 sz = x8_capacity * sizeof(T); int sz = x8_capacity * sizeof(T);
if (sz == 0) { if (sz == 0) {
xc_items = NULL; xc_items = NULL;
} else { } else {
@ -44,7 +44,7 @@ public:
x0_allocator.deallocate(xc_items); x0_allocator.deallocate(xc_items);
} }
void reserve(s32 size); void reserve(int size);
void push_back(const T& in) { void push_back(const T& in) {
if (x4_count >= x8_capacity) { if (x4_count >= x8_capacity) {
@ -79,21 +79,21 @@ public:
inline T* data() { return xc_items; } inline T* data() { return xc_items; }
inline const T* data() const { return xc_items; } inline const T* data() const { return xc_items; }
inline s32 size() const { return x4_count; } inline int size() const { return x4_count; }
inline s32 capacity() const { return x8_capacity; } inline int capacity() const { return x8_capacity; }
inline T& front() { return xc_items[0]; } inline T& front() { return xc_items[0]; }
inline const T& front() const { return xc_items[0]; } inline const T& front() const { return xc_items[0]; }
inline T& back() { return xc_items[x4_count - 1]; } inline T& back() { return xc_items[x4_count - 1]; }
inline const T& back() const { 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 T& operator[](int idx) { return xc_items[idx]; }
inline const T& operator[](s32 idx) const { return xc_items[idx]; } inline const T& operator[](int idx) const { return xc_items[idx]; }
}; };
template < typename T, typename Alloc > template < typename T, typename Alloc >
void vector< T, Alloc >::reserve(s32 size) { void vector< T, Alloc >::reserve(int size) {
if (size <= x8_capacity) if (size <= x8_capacity)
return; return;
s32 sz = size * sizeof(T); int sz = size * sizeof(T);
T* newData; T* newData;
if (sz == 0) { if (sz == 0) {
newData = nullptr; newData = nullptr;

View File

@ -9,6 +9,9 @@ extern "C" {
#include <dolphin/types.h> #include <dolphin/types.h>
// Dolphin u32 is unsigned long
typedef unsigned int uint;
// Pointer to unknown, to be determined at a later date. // Pointer to unknown, to be determined at a later date.
typedef void* unkptr; typedef void* unkptr;

View File

@ -2,10 +2,10 @@
#include "Kyoto/Basics/COsContext.hpp" #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, IAllocator::SMetrics::SMetrics(uint heapSize, uint unk1, uint unk2, uint unk3, uint unk4, uint heapSize2, uint unk5, uint unk6, uint unk7, uint unk8,
u32 unk9, u32 smallAllocNumAllocs, u32 smallAllocAllocatedSize, u32 smallAllocRemainingSize, uint unk9, uint smallAllocNumAllocs, uint smallAllocAllocatedSize, uint smallAllocRemainingSize,
u32 mediumAllocNumAllocs, u32 mediumAllocAllocatedSize, u32 mediumAllocBlocksAvailable, u32 unk10, u32 unk11, uint mediumAllocNumAllocs, uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable, uint unk10, uint unk11,
u32 unk12, u32 mediumAllocTotalAllocated, u32 fakeStatics) uint unk12, uint mediumAllocTotalAllocated, uint fakeStatics)
: x0_heapSize(heapSize) : x0_heapSize(heapSize)
, x4_(unk1) , x4_(unk1)
, x8_(unk2) , x8_(unk2)

View File

@ -6,7 +6,7 @@ void CStopwatch::CSWData::Wait(f32 v) const {
OSTime duration = OSSecondsToTicks(v); OSTime duration = OSSecondsToTicks(v);
OSTime end = OSGetTime() + duration; OSTime end = OSGetTime() + duration;
volatile OSTime current; volatile OSTime current;
volatile s32 diff; volatile int diff;
do { do {
current = OSGetTime(); current = OSGetTime();
diff = current - end; diff = current - end;

View File

@ -1,6 +1,6 @@
#include "Kyoto/CCrc32.hpp" #include "Kyoto/CCrc32.hpp"
static const u32 gkCRC32Table[256] = { static const uint gkCRC32Table[256] = {
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832,
0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A,
@ -32,8 +32,8 @@ static const u32 gkCRC32Table[256] = {
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D,
}; };
u32 CCRC32::Calculate(const void* data, u32 length) { uint CCRC32::Calculate(const void* data, uint length) {
u32 checksum = 0xFFFFFFFF; uint checksum = 0xFFFFFFFF;
const s8* buf = static_cast<const s8*>(data); const s8* buf = static_cast<const s8*>(data);
while ((length--) > 0) { while ((length--) > 0) {
checksum = (checksum >> 8) ^ gkCRC32Table[(checksum ^ *(buf++)) & 0xFF]; checksum = (checksum >> 8) ^ gkCRC32Table[(checksum ^ *(buf++)) & 0xFF];

View File

@ -29,20 +29,20 @@ CRandom16* CRandom16::GetRandomNumber() { return gRandomNumber; }
void CRandom16::_SetRandomNumber(CRandom16* rnd) { gRandomNumber = rnd; } 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; } float CRandom16::Range(float min, float max) { return ((max - min) * Float()) + min; }
s32 CRandom16::Next() { int CRandom16::Next() {
mSeed = (mSeed * 0x41c64e6d) + 0x00003039; mSeed = (mSeed * 0x41c64e6d) + 0x00003039;
return (mSeed >> 16) & 0xffff; return (mSeed >> 16) & 0xffff;
} }
f32 CRandom16::Float() { f32 CRandom16::Float() {
s32 next = Next(); int next = Next();
return 1.52590222E-5f * next; return 1.52590222E-5f * next;
} }

View File

@ -7,7 +7,7 @@
#include <dolphin/mtx.h> #include <dolphin/mtx.h>
inline void CGX::SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1) { 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); MaskAndShiftLeft(comp1, 7, 14) | MaskAndShiftLeft(ref1, 0xFF, 17);
if (sGXState.x248_alphaCompare != flags) { if (sGXState.x248_alphaCompare != flags) {
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) { 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) { if (flags != sGXState.x56_blendMode) {
update_fog(flags); update_fog(flags);
sGXState.x56_blendMode = 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) { inline void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color) {
STevState& state = sGXState.x68_tevStates[stageId]; 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) { if (state.x14_tevOrderFlags != flags) {
state.x14_tevOrderFlags = flags; state.x14_tevOrderFlags = flags;
GXSetTevOrder(stageId, texCoord, texMap, color); GXSetTevOrder(stageId, texCoord, texMap, color);
@ -52,7 +52,7 @@ CVector3f sPlayerPosition;
CVector3f CCubeMaterial::sViewingFrom; CVector3f CCubeMaterial::sViewingFrom;
static CTransform4f sTextureProjectionTransform = CTransform4f::Identity(); 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 newSrcFactor = static_cast< GXBlendFactor >(blendFactors & 0xFFFF);
GXBlendFactor newDstFactor = static_cast< GXBlendFactor >(blendFactors >> 0x10); GXBlendFactor newDstFactor = static_cast< GXBlendFactor >(blendFactors >> 0x10);
CModelFlags::ETrans blendMode = flags.GetTrans(); 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); 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 GXTevStageID stage = static_cast< GXTevStageID >(tevCur);
const u32 colorArgs = shadowMapsEnabled ? 0x7a04f : SBig(materialDataCur[0]); const uint colorArgs = shadowMapsEnabled ? 0x7a04f : SBig(materialDataCur[0]);
const u32 alphaArgs = SBig(materialDataCur[1]); const uint alphaArgs = SBig(materialDataCur[1]);
const u32 colorOps = SBig(materialDataCur[2]); const uint colorOps = SBig(materialDataCur[2]);
const u32 alphaOps = SBig(materialDataCur[3]); const uint alphaOps = SBig(materialDataCur[3]);
CGX::SetStandardDirectTev_Compressed(stage, colorArgs, alphaArgs, colorOps, alphaOps); CGX::SetStandardDirectTev_Compressed(stage, colorArgs, alphaArgs, colorOps, alphaOps);
u32 tmtcFlags = SBig(*texMapTexCoordFlags); uint tmtcFlags = SBig(*texMapTexCoordFlags);
u32 matFlags = SBig(materialDataCur[4]); uint matFlags = SBig(materialDataCur[4]);
CGX::SetTevOrder(stage, static_cast< GXTexCoordID >(tmtcFlags & 0xFF), static_cast< GXTexMapID >(tmtcFlags >> 8 & 0xFF), CGX::SetTevOrder(stage, static_cast< GXTexCoordID >(tmtcFlags & 0xFF), static_cast< GXTexMapID >(tmtcFlags >> 8 & 0xFF),
static_cast< GXChannelID >(matFlags & 0xFF)); static_cast< GXChannelID >(matFlags & 0xFF));
CGX::SetTevKColorSel(stage, static_cast< GXTevKColorSel >(matFlags >> 0x8 & 0xFF)); CGX::SetTevKColorSel(stage, static_cast< GXTevKColorSel >(matFlags >> 0x8 & 0xFF));
CGX::SetTevKAlphaSel(stage, static_cast< GXTevKAlphaSel >(matFlags >> 0x10 & 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 = { static const Mtx postMtx = {
{0.5f, 0.0f, 0.0f, 0.5f}, {0.5f, 0.0f, 0.0f, 0.5f},
{0.0f, 0.0f, 0.5f, 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.5f, 0.5f},
{0.0f, 0.0f, 0.0f, 1.0f}, {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); const f32* params = reinterpret_cast< const f32* >(uvAnim + 1);
switch (type) { switch (type) {
case 0: { case 0: {

View File

@ -48,7 +48,7 @@ void CGX::SetChanCtrl(EChannelId channel, GXBool enable, GXColorSrc ambSrc, GXCo
if (lights == GX_LIGHT_NULL) { if (lights == GX_LIGHT_NULL) {
enable = GX_FALSE; 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); MaskAndShiftLeft(lights, 0xFF, 3) | MaskAndShiftLeft(diffFn, 3, 11) | MaskAndShiftLeft(attnFn, 3, 13);
state = flags; state = flags;
sGXState.x4c_chanFlags = ((flags != prevFlags) << (channel + 1)) | (sGXState.x4c_chanFlags & ~(1 << (channel + 1))); 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) { 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]; STevState& state = sGXState.x68_tevStates[stageId];
if (flags != state.x0_colorInArgs) { if (flags != state.x0_colorInArgs) {
state.x0_colorInArgs = flags; 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) { 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]; STevState& state = sGXState.x68_tevStates[stageId];
if (flags != state.x4_alphaInArgs) { if (flags != state.x4_alphaInArgs) {
state.x4_alphaInArgs = flags; 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) { 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); MaskAndShiftLeft(outReg, 3, 9);
STevState& state = sGXState.x68_tevStates[stageId]; STevState& state = sGXState.x68_tevStates[stageId];
if (flags != state.x8_colorOps) { 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]; STevState& state = sGXState.x68_tevStates[stageId];
if (flags != state.x8_colorOps) { if (flags != state.x8_colorOps) {
state.x8_colorOps = flags; 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) { 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); MaskAndShiftLeft(outReg, 3, 9);
STevState& state = sGXState.x68_tevStates[stageId]; STevState& state = sGXState.x68_tevStates[stageId];
if (flags != state.xc_alphaOps) { 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]; STevState& state = sGXState.x68_tevStates[stageId];
if (flags != state.xc_alphaOps) { if (flags != state.xc_alphaOps) {
state.xc_alphaOps = flags; 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) { void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color) {
STevState& state = sGXState.x68_tevStates[stageId]; 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) { if (state.x14_tevOrderFlags != flags) {
state.x14_tevOrderFlags = flags; state.x14_tevOrderFlags = flags;
GXSetTevOrder(stageId, texCoord, texMap, color); 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) { 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) { if (flags != sGXState.x56_blendMode) {
update_fog(flags); update_fog(flags);
sGXState.x56_blendMode = 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) { 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); MaskAndShiftLeft(comp1, 7, 14) | MaskAndShiftLeft(ref1, 0xFF, 17);
if (sGXState.x248_alphaCompare != flags) { if (sGXState.x248_alphaCompare != flags) {
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, void CGX::SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt, GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel,
GXIndTexWrap wrapS, GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod, GXIndTexAlphaSel alphaSel) { GXIndTexWrap wrapS, GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod, GXIndTexAlphaSel alphaSel) {
STevState& state = sGXState.x68_tevStates[stageId]; 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(mtxSel, 15, 7) | MaskAndShiftLeft(wrapS, 7, 11) | MaskAndShiftLeft(wrapT, 7, 14) |
MaskAndShiftLeft(addPrev, 1, 17) | MaskAndShiftLeft(indLod, 1, 18) | MaskAndShiftLeft(alphaSel, 3, 19); MaskAndShiftLeft(addPrev, 1, 17) | MaskAndShiftLeft(indLod, 1, 18) | MaskAndShiftLeft(alphaSel, 3, 19);
if (state.x10_indFlags != flags) { 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) { void CGX::SetTexCoordGen(GXTexCoordID dstCoord, GXTexGenType fn, GXTexGenSrc src, GXTexMtx mtx, GXBool normalize, GXPTTexMtx postMtx) {
STexState& state = sGXState.x228_texStates[dstCoord]; STexState& state = sGXState.x228_texStates[dstCoord];
u32 vm = (mtx - GX_TEXMTX0) / 3; uint vm = (mtx - GX_TEXMTX0) / 3;
u32 vp = postMtx - GX_PTTEXMTX0; uint vp = postMtx - GX_PTTEXMTX0;
#if NONMATCHING #if NONMATCHING
// Similarly to GXTexMtx, this should also be divided by 3 // Similarly to GXTexMtx, this should also be divided by 3
vp /= 3; vp /= 3;
#endif #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); MaskAndShiftLeft(normalize, 1, 14) | MaskAndShiftLeft(vp, 0x3F, 15);
if (state.x0_coordGen != flags) { if (state.x0_coordGen != flags) {
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) { 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) { if (data == nullptr || sGXState.x0_arrayPtrs[idx] == data) {
return; return;
} }
@ -291,13 +291,13 @@ CGX::SGXState::SGXState()
, x248_alphaCompare(UINT_MAX) { , x248_alphaCompare(UINT_MAX) {
const GXColor sGXClear = {0, 0, 0, 0}; const GXColor sGXClear = {0, 0, 0, 0};
const GXColor sGXWhite = {255, 255, 255, 255}; 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; x30_prevChanCtrls[i] = USHRT_MAX;
x34_chanCtrls[i] = USHRT_MAX; x34_chanCtrls[i] = USHRT_MAX;
x38_chanAmbColors[i] = sGXClear; x38_chanAmbColors[i] = sGXClear;
x40_chanMatColors[i] = sGXWhite; x40_chanMatColors[i] = sGXWhite;
} }
for (s32 i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
x58_kColors[i] = sGXClear; x58_kColors[i] = sGXClear;
} }
SetChanCtrl(Channel0, false, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); 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() { void CGX::ResetGXStates() {
sGXState.x48_descList = 0; sGXState.x48_descList = 0;
GXClearVtxDesc(); GXClearVtxDesc();
for (s32 i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
sGXState.x0_arrayPtrs[i] = reinterpret_cast< const void* >(1); 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)); 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]); 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); 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); SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
GXSetCurrentMtx(GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0);
SetNumIndStages(0); 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); 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)); 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); GXSetTexCoordScaleManually(static_cast< GXTexCoordID >(i), false, 0, 0);
} }
GXSetZTexture(GX_ZT_DISABLE, GX_TF_Z8, 0); GXSetZTexture(GX_ZT_DISABLE, GX_TF_Z8, 0);
@ -349,7 +349,7 @@ void CGX::FlushState() {
GXBool enable = ShiftRightAndMask(flags, 1, 0); GXBool enable = ShiftRightAndMask(flags, 1, 0);
GXColorSrc ambSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 1)); GXColorSrc ambSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 1));
GXColorSrc matSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 2)); 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)); GXDiffuseFn diffFn = static_cast< GXDiffuseFn >(ShiftRightAndMask(flags, 3, 11));
GXAttnFn attnFn = static_cast< GXAttnFn >(ShiftRightAndMask(flags, 3, 13)); GXAttnFn attnFn = static_cast< GXAttnFn >(ShiftRightAndMask(flags, 3, 13));
GXSetChanCtrl(GX_COLOR0, enable, ambSrc, matSrc, lightMask, diffFn, attnFn); GXSetChanCtrl(GX_COLOR0, enable, ambSrc, matSrc, lightMask, diffFn, attnFn);
@ -360,7 +360,7 @@ void CGX::FlushState() {
GXBool enable = ShiftRightAndMask(flags, 1, 0); GXBool enable = ShiftRightAndMask(flags, 1, 0);
GXColorSrc ambSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 1)); GXColorSrc ambSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 1));
GXColorSrc matSrc = static_cast< GXColorSrc >(ShiftRightAndMask(flags, 1, 2)); 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)); GXDiffuseFn diffFn = static_cast< GXDiffuseFn >(ShiftRightAndMask(flags, 3, 11));
GXAttnFn attnFn = static_cast< GXAttnFn >(ShiftRightAndMask(flags, 3, 13)); GXAttnFn attnFn = static_cast< GXAttnFn >(ShiftRightAndMask(flags, 3, 13));
GXSetChanCtrl(GX_COLOR1, enable, ambSrc, matSrc, lightMask, diffFn, attnFn); 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); 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) { if (flags == sGXState.x48_descList) {
return; return;
} }
GXVtxDescList* list = sVtxDescList; GXVtxDescList* list = sVtxDescList;
for (u32 idx = 0; idx < 11; ++idx) { for (uint idx = 0; idx < 11; ++idx) {
u32 shift = idx * 2; uint shift = idx * 2;
if ((flags & 3 << shift) == (sGXState.x48_descList & 3 << shift)) { if ((flags & 3 << shift) == (sGXState.x48_descList & 3 << shift)) {
continue; continue;
} }
@ -398,9 +398,9 @@ void CGX::SetVtxDescv_Compressed(u32 flags) {
} }
void CGX::SetVtxDesc(GXAttr attr, GXAttrType type) { void CGX::SetVtxDesc(GXAttr attr, GXAttrType type) {
u32 lshift = (attr - GX_VA_POS) * 2; uint lshift = (attr - GX_VA_POS) * 2;
u32 rshift = 3 << lshift; uint rshift = 3 << lshift;
u32 flags = type << lshift; uint flags = type << lshift;
if (flags != (sGXState.x48_descList & rshift)) { if (flags != (sGXState.x48_descList & rshift)) {
sGXState.x48_descList = flags | (sGXState.x48_descList & ~rshift); sGXState.x48_descList = flags | (sGXState.x48_descList & ~rshift);
GXSetVtxDesc(attr, type); GXSetVtxDesc(attr, type);
@ -416,14 +416,14 @@ void CGX::ResetVtxDescv() {
} }
void CGX::SetVtxDescv(const GXVtxDescList* list) { void CGX::SetVtxDescv(const GXVtxDescList* list) {
u32 flags = 0; uint flags = 0;
for (; list->attr != GX_VA_NULL; ++list) { for (; list->attr != GX_VA_NULL; ++list) {
flags |= (list->type & 3) << (list->attr - GX_VA_POS) * 2; flags |= (list->type & 3) << (list->attr - GX_VA_POS) * 2;
} }
SetVtxDescv_Compressed(flags); 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]; STevState& state = sGXState.x68_tevStates[stageId];
if (state.x10_indFlags != 0) { if (state.x10_indFlags != 0) {
state.x10_indFlags = 0; state.x10_indFlags = 0;

View File

@ -44,25 +44,25 @@ CColor CColor::Lerp(const CColor& a, const CColor& b, float t) {
omt * a.GetAlpha() + t * b.GetAlpha()); omt * a.GetAlpha() + t * b.GetAlpha());
} }
u32 CColor::Lerp(u32 a, u32 b, float t) { uint CColor::Lerp(uint a, uint b, float t) {
u32 alpha = t * 256.f; uint alpha = t * 256.f;
u32 dstrb = a & 0xff00ff; uint dstrb = a & 0xff00ff;
u32 dstag = a >> 8 & 0xff00ff; uint dstag = a >> 8 & 0xff00ff;
u32 srcrb = b & 0xff00ff; uint srcrb = b & 0xff00ff;
u32 srcag = b >> 8 & 0xff00ff; uint srcag = b >> 8 & 0xff00ff;
u32 drb = srcrb - dstrb; uint drb = srcrb - dstrb;
u32 dag = srcag - dstag; uint dag = srcag - dstag;
drb *= alpha; drb *= alpha;
dag *= alpha; dag *= alpha;
drb >>= 8; drb >>= 8;
dag >>= 8; dag >>= 8;
const u32 rb = (drb + dstrb) & 0x00ff00ff; const uint rb = (drb + dstrb) & 0x00ff00ff;
const u32 ag = (dag + dstag) << 8 & 0xff00ff00; const uint ag = (dag + dstag) << 8 & 0xff00ff00;
return rb | ag; 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) { CColor CColor::Add(const CColor& arg0, const CColor& arg1) {
return CColor((u8)rstl::min_val< u32 >(255, arg0.GetRedu8() + arg1.GetRedu8()), return CColor((u8)rstl::min_val< uint >(255, arg0.GetRedu8() + arg1.GetRedu8()),
(u8)rstl::min_val< u32 >(255, arg0.GetGreenu8() + arg1.GetGreenu8()), (u8)rstl::min_val< uint >(255, arg0.GetGreenu8() + arg1.GetGreenu8()),
(u8)rstl::min_val< u32 >(255, arg0.GetBlueu8() + arg1.GetBlueu8()), (u8)rstl::min_val< uint >(255, arg0.GetBlueu8() + arg1.GetBlueu8()),
(u8)rstl::min_val< u32 >(255, arg0.GetAlphau8() + arg1.GetAlphau8())); (u8)rstl::min_val< uint >(255, arg0.GetAlphau8() + arg1.GetAlphau8()));
} }
u16 CColor::ToRGB5A3() const { u16 CColor::ToRGB5A3() const {

View File

@ -4,7 +4,7 @@
#include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/Alloc/CMemory.hpp"
CInputStream::CInputStream(s32 len) CInputStream::CInputStream(int len)
: x4_blockOffset(0) : x4_blockOffset(0)
, x8_blockLen(0) , x8_blockLen(0)
, xc_len(len) , xc_len(len)
@ -14,7 +14,7 @@ CInputStream::CInputStream(s32 len)
, x1c_bitWord(0) , x1c_bitWord(0)
, x20_bitOffset(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) : x4_blockOffset(0)
, x8_blockLen(len) , x8_blockLen(len)
, xc_len(len) , xc_len(len)
@ -39,12 +39,12 @@ bool CInputStream::InternalReadNext() {
bool CInputStream::GrabAnotherBlock() { return InternalReadNext(); } bool CInputStream::GrabAnotherBlock() { return InternalReadNext(); }
void CInputStream::Get(void* dest, unsigned long len) { void CInputStream::Get(void* dest, unsigned long len) {
u32 remain = len; uint remain = len;
u32 readCount = 0; uint readCount = 0;
x20_bitOffset = 0; x20_bitOffset = 0;
while (remain != 0) { while (remain != 0) {
u32 blockLen = x8_blockLen - x4_blockOffset; uint blockLen = x8_blockLen - x4_blockOffset;
blockLen = remain < blockLen ? remain : blockLen; blockLen = remain < blockLen ? remain : blockLen;
if (blockLen != 0) { if (blockLen != 0) {
@ -53,7 +53,7 @@ void CInputStream::Get(void* dest, unsigned long len) {
readCount += blockLen; readCount += blockLen;
x4_blockOffset += blockLen; x4_blockOffset += blockLen;
} else if (remain > 256) { } else if (remain > 256) {
u32 readLen = Read(reinterpret_cast< u8* >(dest) + readCount, remain); uint readLen = Read(reinterpret_cast< u8* >(dest) + readCount, remain);
remain -= readLen; remain -= readLen;
readCount += readLen; readCount += readLen;
} else { } else {
@ -64,7 +64,7 @@ void CInputStream::Get(void* dest, unsigned long len) {
x18_readPosition += readCount; x18_readPosition += readCount;
} }
u32 CInputStream::ReadBytes(void* dest, unsigned long len) { uint CInputStream::ReadBytes(void* dest, unsigned long len) {
if (len == 0) { if (len == 0) {
return 0; return 0;
} }
@ -73,11 +73,11 @@ u32 CInputStream::ReadBytes(void* dest, unsigned long len) {
GrabAnotherBlock(); GrabAnotherBlock();
} }
u32 curLen = len; uint curLen = len;
u32 curReadLen = 0; uint curReadLen = 0;
while (curReadLen < len) { while (curReadLen < len) {
u32 remain = x8_blockLen - x4_blockOffset; uint remain = x8_blockLen - x4_blockOffset;
if (remain == 0) { if (remain == 0) {
if (InternalReadNext()) { if (InternalReadNext()) {
continue; 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); memcpy(reinterpret_cast< u8* >(dest) + curReadLen, x10_ptr + x4_blockOffset, sz);
curReadLen += sz; curReadLen += sz;
curLen -= sz; curLen -= sz;
@ -97,41 +97,41 @@ u32 CInputStream::ReadBytes(void* dest, unsigned long len) {
return curReadLen; 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) { if (x20_bitOffset >= bitCount) {
u32 mask = 0xffffffff; uint mask = 0xffffffff;
u32 bwShift = 32 - bitCount; uint bwShift = 32 - bitCount;
if (bitCount != 0x20) { if (bitCount != 0x20) {
mask = (1 << bitCount) - 1; mask = (1 << bitCount) - 1;
} }
u32 ret = mask & (x1c_bitWord >> bwShift); uint ret = mask & (x1c_bitWord >> bwShift);
x20_bitOffset -= bitCount; x20_bitOffset -= bitCount;
x1c_bitWord <<= bitCount; x1c_bitWord <<= bitCount;
return ret; return ret;
} }
u32 shiftAmt = bitCount - x20_bitOffset; uint shiftAmt = bitCount - x20_bitOffset;
u32 ret = 0; uint ret = 0;
{ {
u32 mask = 0xffffffff; uint mask = 0xffffffff;
u32 bwShift = 32 - x20_bitOffset; uint bwShift = 32 - x20_bitOffset;
if (x20_bitOffset != 0x20) { if (x20_bitOffset != 0x20) {
mask = (1 << x20_bitOffset) - 1; mask = (1 << x20_bitOffset) - 1;
} }
ret = (mask & (x1c_bitWord >> bwShift)) << shiftAmt; ret = (mask & (x1c_bitWord >> bwShift)) << shiftAmt;
} }
u32 len = BitsToBytes(shiftAmt); uint len = BitsToBytes(shiftAmt);
x20_bitOffset = 0; x20_bitOffset = 0;
Get(&x1c_bitWord, len); Get(&x1c_bitWord, len);
{ {
u32 mask = 0xffffffff; uint mask = 0xffffffff;
u32 bwShift = 32 - shiftAmt; uint bwShift = 32 - shiftAmt;
if (shiftAmt != 0x20) { if (shiftAmt != 0x20) {
mask = (1 << shiftAmt) - 1; mask = (1 << shiftAmt) - 1;
} }
@ -158,9 +158,9 @@ u16 CInputStream::ReadShort() {
return s; return s;
} }
u32 CInputStream::ReadLong() { uint CInputStream::ReadLong() {
static u32 l; static uint l;
Get(&l, sizeof(u32)); Get(&l, sizeof(uint));
return l; return l;
} }

View File

@ -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) {} 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; }

View File

@ -11,34 +11,34 @@ static const wchar_t skInvalidString[] = L"Invalid";
CStringTable::CStringTable(CInputStream& in) : x0_stringCount(0), x4_data(NULL) { CStringTable::CStringTable(CInputStream& in) : x0_stringCount(0), x4_data(NULL) {
in.ReadLong(); in.ReadLong();
in.ReadLong(); in.ReadLong();
s32 langCount = in.Get(TType< s32 >()); int langCount = in.Get(TType< int >());
x0_stringCount = in.Get(TType< u32 >()); x0_stringCount = in.Get(TType< uint >());
rstl::vector< rstl::pair< FourCC, u32 > > langOffsets(langCount); rstl::vector< rstl::pair< FourCC, uint > > langOffsets(langCount);
for (s32 i = 0; i < langCount; ++i) { for (int i = 0; i < langCount; ++i) {
langOffsets.push_back(in.Get(TType< rstl::pair< FourCC, u32 > >())); langOffsets.push_back(in.Get(TType< rstl::pair< FourCC, uint > >()));
} }
s32 offset = langOffsets.front().second; int offset = langOffsets.front().second;
for (s32 i = 0; i < langCount; ++i) { for (int i = 0; i < langCount; ++i) {
if (langOffsets[i].first == mCurrentLanguage) { if (langOffsets[i].first == mCurrentLanguage) {
offset = langOffsets[i].second; offset = langOffsets[i].second;
break; break;
} }
} }
for (u32 i = 0; i < offset; ++i) { for (uint i = 0; i < offset; ++i) {
in.ReadChar(); in.ReadChar();
} }
u32 dataLen = in.Get(TType< u32 >()); uint dataLen = in.Get(TType< uint >());
x4_data = new u8[dataLen]; x4_data = new u8[dataLen];
in.ReadBytes(x4_data.get(), 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) { if (idx < 0 || idx >= x0_stringCount) {
return skInvalidString; 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); return reinterpret_cast< const wchar_t* >(x4_data.get() + offset);
} }

View File

@ -102,7 +102,7 @@ SAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool ad
UpdateSfxEmitters(); UpdateSfxEmitters();
if (HasAnimation()) { if (HasAnimation()) {
u16 maxVol = xd4_maxVol; u16 maxVol = xd4_maxVol;
s32 aid = x4_areaId.Value(); int aid = x4_areaId.Value();
const CGameCamera* camera = mgr.GetCameraManager()->GetCurrentCamera(mgr); const CGameCamera* camera = mgr.GetCameraManager()->GetCurrentCamera(mgr);
const CVector3f origin = GetTranslation(); const CVector3f origin = GetTranslation();
@ -112,15 +112,15 @@ SAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool ad
const CSoundPOINode* soundNode; const CSoundPOINode* soundNode;
const CParticlePOINode* particleNode; const CParticlePOINode* particleNode;
s32 soundNodeCount = 0; int soundNodeCount = 0;
if (HasAnimation()) { if (HasAnimation()) {
soundNode = GetAnimationData()->GetSoundPOIList(soundNodeCount); soundNode = GetAnimationData()->GetSoundPOIList(soundNodeCount);
} else { } else {
soundNode = nullptr; soundNode = nullptr;
} }
if (soundNodeCount > 0 && soundNode != nullptr) { if (soundNodeCount > 0 && soundNode != nullptr) {
for (s32 i = 0; i < soundNodeCount; ++soundNode, ++i) { for (int i = 0; i < soundNodeCount; ++soundNode, ++i) {
s32 charIdx = soundNode->GetCharacterIndex(); int charIdx = soundNode->GetCharacterIndex();
if (soundNode->GetPoiType() != kPT_Sound || GetMuted()) if (soundNode->GetPoiType() != kPT_Sound || GetMuted())
continue; continue;
if (charIdx != -1 && GetAnimationData()->GetCharacterIndex() != charIdx) 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()) { if (HasAnimation()) {
intNode = GetAnimationData()->GetInt32POIList(intNodeCount); intNode = GetAnimationData()->GetInt32POIList(intNodeCount);
} else { } else {
intNode = nullptr; intNode = nullptr;
} }
if (intNodeCount > 0 && intNode != nullptr) { if (intNodeCount > 0 && intNode != nullptr) {
for (s32 i = 0; i < intNodeCount; ++intNode, ++i) { for (int i = 0; i < intNodeCount; ++intNode, ++i) {
s32 charIdx = intNode->GetCharacterIndex(); int charIdx = intNode->GetCharacterIndex();
if (intNode->GetPoiType() == kPT_SoundInt32 && !GetMuted() && if (intNode->GetPoiType() == kPT_SoundInt32 && !GetMuted() &&
(charIdx == -1 || GetAnimationData()->GetCharacterIndex() == charIdx)) { (charIdx == -1 || GetAnimationData()->GetCharacterIndex() == charIdx)) {
ProcessSoundEvent(intNode->GetValue(), intNode->GetWeight(), intNode->GetFlags(), 0.1f, 150.f, 20, maxVol, toCamera, origin, aid, 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()) { if (HasAnimation()) {
particleNode = GetAnimationData()->GetParticlePOIList(particleNodeCount); particleNode = GetAnimationData()->GetParticlePOIList(particleNodeCount);
} else { } else {
particleNode = nullptr; particleNode = nullptr;
} }
if (particleNodeCount > 0 && particleNode != nullptr) { if (particleNodeCount > 0 && particleNode != nullptr) {
for (s32 i = 0; i < particleNodeCount; ++particleNode, ++i) { for (int i = 0; i < particleNodeCount; ++particleNode, ++i) {
s32 charIdx = particleNode->GetCharacterIndex(); int charIdx = particleNode->GetCharacterIndex();
if (charIdx != -1 && GetAnimationData()->GetCharacterIndex() != charIdx) if (charIdx != -1 && GetAnimationData()->GetCharacterIndex() != charIdx)
continue; continue;
AnimationData()->SetParticleEffectState(particleNode->GetString(), true, mgr); 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() { void CActor::CalculateRenderBounds() {
if (HasModelData()) { if (HasModelData()) {

View File

@ -6,7 +6,7 @@ CObjectList::CObjectList(EGameObjectList list)
: mListType(list) : mListType(list)
, mFirstId(-1) , mFirstId(-1)
, mCount(0) { , mCount(0) {
for (s32 i = 0; i < kMaxObjects; ++i) { for (int i = 0; i < kMaxObjects; ++i) {
mObjects[i] = SObjectListEntry(); mObjects[i] = SObjectListEntry();
} }
} }
@ -39,8 +39,8 @@ CEntity* CObjectList::GetValidObjectById(TUniqueId uid) {}
const CEntity* CObjectList::GetValidObjectById(TUniqueId uid) const {} 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 {}

View File

@ -1,7 +1,7 @@
#include "MetroidPrime/Cameras/CCameraHint.hpp" #include "MetroidPrime/Cameras/CCameraHint.hpp"
#include "Kyoto/Alloc/CMemory.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, CVector3f* lookAtOffset, CVector3f* chaseLookAtOffset, CVector3f* ballToCam, float fov, float attitudeRange,
float azimuthRange, float anglePerSecond, float clampVelRange, float clampRotRange, float elevation, float azimuthRange, float anglePerSecond, float clampVelRange, float clampRotRange, float elevation,
float InterpolationTime, float clampVelTime, float controlInterpDur) float InterpolationTime, float clampVelTime, float controlInterpDur)

View File

@ -111,7 +111,7 @@ void CMain::RefreshGameState() {
// 8000487C // 8000487C
void CMain::EnsureWorldPaksReady(void) { void CMain::EnsureWorldPaksReady(void) {
CResLoader& resLoader = gpResourceFactory->GetResLoader(); 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); CPakFile& file = resLoader.GetPakFile(i);
if (file.IsWorldPak()) { if (file.IsWorldPak()) {
file.EnsureWorldPakReady(); file.EnsureWorldPakReady();
@ -132,9 +132,9 @@ void CMain::AddWorldPaks() {
} }
// 80004CE8 // 80004CE8
void CMain::AsyncIdle(u32 time) { void CMain::AsyncIdle(uint time) {
if (time < 500) { if (time < 500) {
u32 total = 0; uint total = 0;
for (int i = 0; i < x130_frameTimes.capacity(); ++i) { for (int i = 0; i < x130_frameTimes.capacity(); ++i) {
total += x130_frameTimes[i]; total += x130_frameTimes[i];
} }
@ -233,7 +233,7 @@ int CMain::RsMain(int argc, const char* const* argv) {
x104_.AddValue(t2 / dt); x104_.AddValue(t2 / dt);
x11c_ = x104_.GetAverage().data(); x11c_ = x104_.GetAverage().data();
u32 idleMicros; uint idleMicros;
f64 idleTime = (dt - (t1 + t2)) - 0.00075; f64 idleTime = (dt - (t1 + t2)) - 0.00075;
if (idleTime > 0) if (idleTime > 0)
idleMicros = idleTime * 1000000; idleMicros = idleTime * 1000000;