Skip to content

Commit

Permalink
resolve #50
Browse files Browse the repository at this point in the history
left float and double in MSL headers/files where it makes sense to use them rather than typedefs
  • Loading branch information
EpochFlame committed Sep 13, 2023
1 parent 637b567 commit 0f30e3b
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 42 deletions.
8 changes: 3 additions & 5 deletions docs/recommended_todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/object-id.cpp">JStudio/object-id.cpp</a> | 2697 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAChildShape.cpp">JParticle/JPAChildShape.cpp</a> | 3414 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JGadget/binary.cpp">JGadget/binary.cpp</a> | 3595 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAS/JASInstSense.cpp">JAudio/JAS/JASInstSense.cpp</a> | 3632 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JAudio/control.cpp">JStudio_JAudio/control.cpp</a> | 3648 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAS/JASCmdStack.cpp">JAudio/JAS/JASCmdStack.cpp</a> | 3709 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/dsp/dspproc.c">JAudio/dsp/dspproc.c</a> | 3983 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JParticle/control.cpp">JStudio_JParticle/control.cpp</a> | 4098 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/dsp/dspproc.c">JAudio/dsp/dspproc.c</a> | 3981 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JParticle/control.cpp">JStudio_JParticle/control.cpp</a> | 4098 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3DU/J3DUMtxCache.cpp">J3DU/J3DUMtxCache.cpp</a> | 4160 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JStage/object.cpp">JStudio_JStage/object.cpp</a> | 4322 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAS/JASSeqCtrl.cpp">JAudio/JAS/JASSeqCtrl.cpp</a> | 4524 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAResourceManager.cpp">JParticle/JPAResourceManager.cpp</a> | 4849 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JGadget/linklist.cpp">JGadget/linklist.cpp</a> | 5250 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAU/JAUData.cpp">JAudio/JAU/JAUData.cpp</a> | 5463 |
Expand Down Expand Up @@ -183,17 +183,15 @@
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectSpecialActor.cpp">JSTObjectSpecialActor.cpp</a> | 2289 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/illustratedBookMessage.cpp">illustratedBookMessage.cpp</a> | 2964 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/captionMessage.cpp">captionMessage.cpp</a> | 3528 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPRead.c">THPRead.c</a> | 3743 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageObj.cpp">messageObj.cpp</a> | 4504 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/aramMgr.cpp">aramMgr.cpp</a> | 4920 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/gameflow.cpp">gameflow.cpp</a> | 5333 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPVideoDecode.c">THPVideoDecode.c</a> | 6107 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/captionMessage.cpp">captionMessage.cpp</a> | 3528 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageObj.cpp">messageObj.cpp</a> | 4504 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/aramMgr.cpp">aramMgr.cpp</a> | 4920 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/gameflow.cpp">gameflow.cpp</a> | 5333 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageMgr.cpp">messageMgr.cpp</a> | 6825 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/section.cpp">section.cpp</a> | 7072 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/moviePlayerPauseAndDraw.cpp">moviePlayerPauseAndDraw.cpp</a> | 8587 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/screenScene.cpp">screenScene.cpp</a> | 9274 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectParticleActor.cpp">JSTObjectParticleActor.cpp</a> | 11032 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/loadResource.cpp">loadResource.cpp</a> | 11781 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/heapStatus.cpp">heapStatus.cpp</a> | 12405 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/dvdThread.cpp">dvdThread.cpp</a> | 12535 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectCamera.cpp">JSTObjectCamera.cpp</a> | 12894 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/P2DScreen.cpp">P2DScreen.cpp</a> | 12998 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/modelEffect.cpp">modelEffect.cpp</a> | 13173 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectGameActor.cpp">JSTObjectGameActor.cpp</a> | 16832 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/light.cpp">light.cpp</a> | 17447 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/wipe.cpp">wipe.cpp</a> | 17624 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/screenObj.cpp">screenObj.cpp</a> | 17806 |

### <section id="utilityU">utilityU</section>
| File | Size (bytes) | File | Size (bytes) |
Expand Down
16 changes: 8 additions & 8 deletions include/Dolphin/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ f64 ceil(f64);

static inline f32 dolsqrtf(f32 x)
{
static const double _half = .5;
static const double _three = 3.0;
volatile float y;
static const f64 _half = .5;
static const f64 _three = 3.0;
volatile f32 y;
if (x > 0.0f) {

double guess = __frsqrte((double)x); // returns an approximation to
guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits
y = (float)(x * guess);
f64 guess = __frsqrte((f64)x); // returns an approximation to
guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits
y = (f32)(x * guess);
return y;
}
return x;
Expand Down
2 changes: 1 addition & 1 deletion include/PSM/Director.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ struct PikAttackDirector : public TrackOnDirectorBase {
};

struct TrackOnDirector_Scaled : public TrackOnDirectorBase {
inline TrackOnDirector_Scaled(const char* name, int p2, float p3, float p4, long p5, long p6, unsigned long p7)
inline TrackOnDirector_Scaled(const char* name, int p2, f32 p3, f32 p4, s32 p5, s32 p6, u32 p7)
: TrackOnDirectorBase(p2, name, p5, p6)
, _54(p3)
, _58(p4)
Expand Down
14 changes: 7 additions & 7 deletions include/PSM/Se.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct PersEnvManager {
};

struct EnvSeObjBuilder : public PSGame::Builder_EvnSe_Perspective {
EnvSeObjBuilder(JGeometry::TBox3<float>);
EnvSeObjBuilder(JGeometry::TBox3<f32>);

virtual ~EnvSeObjBuilder(); // _08
virtual void onBuild(PSSystem::EnvSeBase*); // _0C
Expand Down Expand Up @@ -91,7 +91,7 @@ struct SeSound : public JAISe {
static SeSound* makeSeSound();
void specializePerspCalc(const PSGame::SoundTable::SePerspInfo&);
void calcVolumeSpecialized(f32);
f32 calcVolume(f32, unsigned char, unsigned char);
f32 calcVolume(f32, u8, u8);
void calcPan(const Vec&, f32);
void calcDolby(const Vec&, f32);

Expand All @@ -101,11 +101,11 @@ struct SeSound : public JAISe {
u8 _49C; // _49C
f32 _4A0; // _4A0

static float cDol_0Rad;
static float cDol_HalfRad;
static float cDol_FullRad;
static float cPan_MaxAmp;
static float cCenterRad;
static f32 cDol_0Rad;
static f32 cDol_HalfRad;
static f32 cDol_FullRad;
static f32 cPan_MaxAmp;
static f32 cCenterRad;
};
} // namespace PSM

Expand Down
12 changes: 6 additions & 6 deletions include/PowerPC_EABI_Support/MSL_C/MSL_Common/ansi_fp.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ typedef struct decimal {
typedef struct decform {
char style;
char unk1;
short digits;
s16 digits;
} decform;

void __ull2dec(decimal*, u64);
void __timesdec(decimal*, const decimal*, const decimal*);
void __str2dec(decimal*, const char*, short);
void __two_exp(decimal*, long);
void __str2dec(decimal*, const char*, s16);
void __two_exp(decimal*, s32);
BOOL __equals_dec(const decimal*, const decimal*);
BOOL __less_dec(const decimal*, const decimal*);
void __minus_dec(decimal*, const decimal*, const decimal*);
void __num2dec_internal(decimal*, double);
void __num2dec(const decform*, double, decimal*);
double __dec2num(const decimal*);
void __num2dec_internal(decimal*, f64);
void __num2dec(const decform*, f64, decimal*);
f64 __dec2num(const decimal*);

#endif
6 changes: 3 additions & 3 deletions include/PowerPC_EABI_Support/MSL_C/MSL_Common/math_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
extern "C" {
#endif // ifdef __cplusplus

// int __fpclassifyf(float);
// int __signbitd(double);
// int __fpclassifyd(double);
// int __fpclassifyf(f32);
// int __signbitd(f64);
// int __fpclassifyd(f64);

inline int __fpclassifyf(f32 x)
{
Expand Down
2 changes: 1 addition & 1 deletion include/Sys/OBBTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct OBBTree : public TriDivider {
void findRayIntersection(RayIntersectInfo&, Matrixf&, Matrixf&);
void traceMove_new(Matrixf&, Matrixf&, Game::MoveInfo&, f32);
void traceMove_new_global(Game::MoveInfo&, f32);
void traceMove_original(Matrixf&, Matrixf&, Game::MoveInfo&, float);
void traceMove_original(Matrixf&, Matrixf&, Game::MoveInfo&, f32);

void draw(Graphics&);
void write(Stream&);
Expand Down
2 changes: 1 addition & 1 deletion include/sysMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ inline f32 qdist3(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2)
return dist;
}

inline f32 log(f32& a, double b)
inline f32 log(f32& a, f64 b)
{
f32 divisor = log10(b);
f32 dividend = log10(a);
Expand Down
12 changes: 6 additions & 6 deletions src/Dolphin/MSL_C/PPC_EABI/math_ppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void __fpclassifyd(void)
* Address: ........
* Size: 000020
*/
double scalbn(double x, int y)
f64 scalbn(f64 x, int y)
{
// UNUSED FUNCTION
}
Expand Down Expand Up @@ -576,21 +576,21 @@ void atan2f(void)
* Address: 800CFC98
* Size: 000024
*/
__declspec(weak) float cosf(float __x) { return cos((double)__x); }
__declspec(weak) f32 cosf(f32 __x) { return cos((f64)__x); }

/*
* --INFO--
* Address: 800CFC74
* Size: 000024
*/
__declspec(weak) float sinf(float __x) { return sin((double)__x); }
__declspec(weak) f32 sinf(f32 __x) { return sin((f64)__x); }

/*
* --INFO--
* Address: 800CFC50
* Size: 000024
*/
__declspec(weak) float tanf(float __x) { return tan((double)__x); }
__declspec(weak) f32 tanf(f32 __x) { return tan((f64)__x); }

/*
* --INFO--
Expand Down Expand Up @@ -757,7 +757,7 @@ void _inv_sqrtf(void)
* Address: ........
* Size: 000008
*/
double fabs(double x)
f64 fabs(f64 x)
{
// UNUSED FUNCTION
}
Expand All @@ -767,7 +767,7 @@ double fabs(double x)
* Address: ........
* Size: 000130
*/
void modff(float f1, float* fp)
void modff(f32 f1, f32* fp)
{
// UNUSED FUNCTION
}
Expand Down
2 changes: 1 addition & 1 deletion src/Dolphin/gx/GXBump.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void GXSetIndTexMtx(GXIndTexMtxID id, const Mtx23 mtx, s8 scale_exp)
{
u32 val;
u32 field;
float mtx2[6];
f32 mtx2[6];

// scale_exp range is -17..46
// we need it in range 0..63
Expand Down
4 changes: 2 additions & 2 deletions src/Dolphin/mtx/mtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ void C_MTXLightFrustum(void)
* Address: 800EAA84
* Size: 0000CC
*/
void C_MTXLightPerspective(Mtx m, f32 fovY, f32 aspect, float scaleS, float scaleT, float transS, float transT)
void C_MTXLightPerspective(Mtx m, f32 fovY, f32 aspect, f32 scaleS, f32 scaleT, f32 transS, f32 transT)
{
f32 angle;
f32 cot;
Expand Down Expand Up @@ -901,7 +901,7 @@ void C_MTXLightPerspective(Mtx m, f32 fovY, f32 aspect, float scaleS, float scal
* Address: 800EAB50
* Size: 000088
*/
void C_MTXLightOrtho(Mtx m, f32 t, f32 b, f32 l, f32 r, float scaleS, float scaleT, float transS, float transT)
void C_MTXLightOrtho(Mtx m, f32 t, f32 b, f32 l, f32 r, f32 scaleS, f32 scaleT, f32 transS, f32 transT)
{
f32 tmp;

Expand Down
2 changes: 1 addition & 1 deletion src/JSystem/JAudio/dsp/dspproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void DsetupTable(u32 p1, u32 p2, u32 p3, u32 p4, u32 p5)
* Address: 800AA860
* Size: 000024
*/
void DsetMixerLevel(float mixerLevel) { DSP_MIXERLEVEL = 4096.0f * mixerLevel; }
void DsetMixerLevel(f32 mixerLevel) { DSP_MIXERLEVEL = 4096.0f * mixerLevel; }

/*
* --INFO--
Expand Down

0 comments on commit 0f30e3b

Please sign in to comment.