Skip to content

Commit

Permalink
Rename typedefs in types.h to match Ratatouille (#296)
Browse files Browse the repository at this point in the history
* Part 1

* Add signed qualifier to S* types

* Fix compile errors
  • Loading branch information
seilweiss authored Jul 7, 2024
1 parent ec6f849 commit 7e63f29
Show file tree
Hide file tree
Showing 395 changed files with 10,013 additions and 10,013 deletions.
6 changes: 3 additions & 3 deletions include/dolphin/dolphin.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct DVDFileInfo
// idk what this is
struct _AXVPB
{
int32 i;
s32 i;
};

#define DVD_STATE_FATAL_ERROR -1
Expand Down Expand Up @@ -199,11 +199,11 @@ void PADControlMotor(int chan, u32 command);
void AXQuit();
void AXFreeVoice(_AXVPB*);
void OSSetSoundMode(u32 mode);
int32 CARDProbeEx(int32, int32*, int32*);
s32 CARDProbeEx(s32, s32*, s32*);
void VIWaitForRetrace();

#ifdef __cplusplus
}
#endif

#endif
#endif
4 changes: 2 additions & 2 deletions include/inline/fastmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

typedef struct
{
float32 x, y, z;
F32 x, y, z;
} Vec;

// All this essentially does is do "*dst = *src;"
Expand All @@ -43,4 +43,4 @@ typedef struct
ps_sum0 fp1, fp3, fp2, fp2; \
blr;

#endif
#endif
29 changes: 12 additions & 17 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,18 @@
// Don't include this in any RenderWare, system, bink, etc. files

#ifdef GAMECUBE
typedef char int8;
typedef short int16;
typedef int int32;
typedef long long int64;

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;

typedef float float32;
typedef double float64;

typedef long long32;
typedef unsigned long ulong32;

typedef int32 bool32;
typedef signed char S8;
typedef signed short S16;
typedef signed int S32;
typedef signed long long S64;

typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned int U32;
typedef unsigned long long U64;

typedef float F32;
typedef double F64;
#endif

#ifdef NULL
Expand Down
26 changes: 13 additions & 13 deletions src/SB/Core/gc/iAnim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
#include <rwcore.h>
#include <rtslerp.h>

static uint8 scratchBuffer[9120];
static U8 scratchBuffer[9120];

uint8* giAnimScratch = scratchBuffer;
U8* giAnimScratch = scratchBuffer;

void iAnimInit()
{
return;
}

void iAnimEval(void* RawData, float32 time, uint32 flags, xVec3* tran, xQuat* quat)
void iAnimEval(void* RawData, F32 time, U32 flags, xVec3* tran, xQuat* quat)
{
iAnimEvalSKB((iAnimSKBHeader*)RawData, time, flags, tran, quat);
}

float32 iAnimDuration(void* RawData)
F32 iAnimDuration(void* RawData)
{
return iAnimDurationSKB((iAnimSKBHeader*)RawData);
}

uint32 iAnimBoneCount(void* RawData)
U32 iAnimBoneCount(void* RawData)
{
if (*(uint32*)RawData == '1BKS')
if (*(U32*)RawData == '1BKS')
{
return ((iAnimSKBHeader*)RawData)->BoneCount;
}
Expand All @@ -36,12 +36,12 @@ uint32 iAnimBoneCount(void* RawData)
}

// non-matching: incorrect instruction order and regalloc
void iAnimBlend(float32 BlendFactor, float32 BlendRecip, uint16* BlendTimeOffset,
float32* BoneTable, uint32 BoneCount, xVec3* Tran1, xQuat* Quat1, xVec3* Tran2,
void iAnimBlend(F32 BlendFactor, F32 BlendRecip, U16* BlendTimeOffset,
F32* BoneTable, U32 BoneCount, xVec3* Tran1, xQuat* Quat1, xVec3* Tran2,
xQuat* Quat2, xVec3* TranDest, xQuat* QuatDest)
{
uint32 i;
uint32 invert = 0;
U32 i;
U32 invert = 0;
RtQuat* q2;
RtQuat ident = { 0.0f, 0.0f, 0.0f, 1.0f };
xVec3* t2;
Expand All @@ -66,7 +66,7 @@ void iAnimBlend(float32 BlendFactor, float32 BlendRecip, uint16* BlendTimeOffset

if (!BoneTable && !BlendTimeOffset)
{
float32 lerp = BlendFactor * BlendRecip;
F32 lerp = BlendFactor * BlendRecip;

if (lerp < 0.0f)
{
Expand Down Expand Up @@ -128,7 +128,7 @@ void iAnimBlend(float32 BlendFactor, float32 BlendRecip, uint16* BlendTimeOffset
}
else
{
float32 baselerp;
F32 baselerp;

if (!BlendTimeOffset)
{
Expand All @@ -151,7 +151,7 @@ void iAnimBlend(float32 BlendFactor, float32 BlendRecip, uint16* BlendTimeOffset

for (i = 0; i < BoneCount; i++)
{
float32 lerp;
F32 lerp;

if (BlendTimeOffset)
{
Expand Down
8 changes: 4 additions & 4 deletions src/SB/Core/gc/iAnim.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

#include "xMath3.h"

extern uint8* giAnimScratch;
extern U8* giAnimScratch;

void iAnimInit();
uint32 iAnimBoneCount(void* RawData);
void iAnimBlend(float32 BlendFactor, float32 BlendRecip, uint16* BlendTimeOffset,
float32* BoneTable, uint32 BoneCount, xVec3* Tran1, xQuat* Quat1, xVec3* Tran2,
U32 iAnimBoneCount(void* RawData);
void iAnimBlend(F32 BlendFactor, F32 BlendRecip, U16* BlendTimeOffset,
F32* BoneTable, U32 BoneCount, xVec3* Tran1, xQuat* Quat1, xVec3* Tran2,
xQuat* Quat2, xVec3* TranDest, xQuat* QuatDest);

#endif
22 changes: 11 additions & 11 deletions src/SB/Core/gc/iAnimSKB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
#include <limits.h>

#ifdef NON_MATCHING
void iAnimEvalSKB(iAnimSKBHeader* data, float32 time, uint32 flags, xVec3* tran, xQuat* quat)
void iAnimEvalSKB(iAnimSKBHeader* data, F32 time, U32 flags, xVec3* tran, xQuat* quat)
{
uint32 i, tidx, bcount, tcount;
U32 i, tidx, bcount, tcount;
iAnimSKBKey* keys;
float32* times;
uint16* offsets;
int32 asdf; // unused
float32 scalex, scaley, scalez;
F32* times;
U16* offsets;
S32 asdf; // unused
F32 scalex, scaley, scalez;

tcount = data->TimeCount;
bcount = data->BoneCount;

keys = (iAnimSKBKey*)(data + 1);
times = (float32*)(keys + data->KeyCount);
offsets = (uint16*)(times + tcount);
times = (F32*)(keys + data->KeyCount);
offsets = (U16*)(times + tcount);

if (time < 0.0f)
{
Expand Down Expand Up @@ -96,7 +96,7 @@ void iAnimEvalSKB(iAnimSKBHeader* data, float32 time, uint32 flags, xVec3* tran,
RtQuat q1, q2;
RwReal time1, time2, lerp;
iAnimSKBKey* k = &keys[*offsets];
uint32 costheta, theta; // unused
U32 costheta, theta; // unused

offsets++;

Expand Down Expand Up @@ -128,7 +128,7 @@ void iAnimEvalSKB(iAnimSKBHeader* data, float32 time, uint32 flags, xVec3* tran,
}
#endif

float32 iAnimDurationSKB(iAnimSKBHeader* data)
F32 iAnimDurationSKB(iAnimSKBHeader* data)
{
return ((float32*)((iAnimSKBKey*)(data + 1) + data->KeyCount))[data->TimeCount - 1];
return ((F32*)((iAnimSKBKey*)(data + 1) + data->KeyCount))[data->TimeCount - 1];
}
22 changes: 11 additions & 11 deletions src/SB/Core/gc/iAnimSKB.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

struct iAnimSKBHeader
{
uint32 Magic;
uint32 Flags;
uint16 BoneCount;
uint16 TimeCount;
uint32 KeyCount;
float32 Scale[3];
U32 Magic;
U32 Flags;
U16 BoneCount;
U16 TimeCount;
U32 KeyCount;
F32 Scale[3];
};

struct iAnimSKBKey
{
uint16 TimeIndex;
int16 Quat[4];
int16 Tran[3];
U16 TimeIndex;
S16 Quat[4];
S16 Tran[3];
};

void iAnimEvalSKB(iAnimSKBHeader* data, float32 time, uint32 flags, xVec3* tran, xQuat* quat);
float32 iAnimDurationSKB(iAnimSKBHeader* data);
void iAnimEvalSKB(iAnimSKBHeader* data, F32 time, U32 flags, xVec3* tran, xQuat* quat);
F32 iAnimDurationSKB(iAnimSKBHeader* data);

#endif
6 changes: 3 additions & 3 deletions src/SB/Core/gc/iCollide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v)
{
float32 x = m->right.x * v->x + m->up.x * v->y + m->at.x * v->z;
float32 y = m->right.y * v->x + m->up.y * v->y + m->at.y * v->z;
float32 z = m->right.z * v->x + m->up.z * v->y + m->at.z * v->z;
F32 x = m->right.x * v->x + m->up.x * v->y + m->at.x * v->z;
F32 y = m->right.y * v->x + m->up.y * v->y + m->at.y * v->z;
F32 z = m->right.z * v->x + m->up.z * v->y + m->at.z * v->z;

o->x = x;
o->y = y;
Expand Down
8 changes: 4 additions & 4 deletions src/SB/Core/gc/iCollide.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

void iBoxForModelLocal(xBox* o, const xModelInstance* m);
void iBoxForModel(xBox* o, const xModelInstance* m);
int32 iSphereHitsEnv3(const xSphere* b, const xEnv* env, xCollis* colls, uint8 ncolls, float32 sth);
int32 iSphereHitsModel3(const xSphere* b, const xModelInstance* m, xCollis* colls, uint8 ncolls,
float32 sth);
uint32 iRayHitsModel(const xRay3* r, const xModelInstance* m, xCollis* coll);
S32 iSphereHitsEnv3(const xSphere* b, const xEnv* env, xCollis* colls, U8 ncolls, F32 sth);
S32 iSphereHitsModel3(const xSphere* b, const xModelInstance* m, xCollis* colls, U8 ncolls,
F32 sth);
U32 iRayHitsModel(const xRay3* r, const xModelInstance* m, xCollis* coll);
void iCollideInit(xScene* sc);

#endif
8 changes: 4 additions & 4 deletions src/SB/Core/gc/iColor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

struct iColor_tag
{
uint8 r;
uint8 g;
uint8 b;
uint8 a;
U8 r;
U8 g;
U8 b;
U8 a;
};

#endif
Loading

0 comments on commit 7e63f29

Please sign in to comment.