Fix building all source files & clangd warning fixes

This commit is contained in:
Luke Street 2024-10-18 19:49:07 -06:00
parent 5aecbcf2a1
commit e7a4aaa81f
24 changed files with 402 additions and 188 deletions

View File

@ -8,12 +8,15 @@
#include "JSystem/JAudio/System/JASHeapCtrl.h"
#include "JSystem/JAudio/System/JASTrack.h"
template <>
JASMemPool_MultiThreaded<JASTrack::TChannelMgr> JASPoolAllocObject_MultiThreaded<JASTrack::TChannelMgr>::memPool_;
template <>
JASMemPool_MultiThreaded<JASTrack> JASPoolAllocObject_MultiThreaded<JASTrack>::memPool_;
template <>
JASMemPool_MultiThreaded<JASChannel> JASPoolAllocObject_MultiThreaded<JASChannel>::memPool_;
#endif
#endif
#endif

View File

@ -7,8 +7,9 @@
class JAISe;
#include "JSystem/JAudio/JASFakeMatch.h"
template <>
JASMemPool<JAISe> JASPoolAllocObject<JAISe>::memPool_;
#endif
#endif
#endif

View File

@ -10,11 +10,15 @@ class JAISeq;
class JAISe;
#include "JSystem/JAudio/JASFakeMatch.h"
template <>
JASMemPool<JAIStream> JASPoolAllocObject<JAIStream>::memPool_;
template <>
JASMemPool<JAISoundChild> JASPoolAllocObject<JAISoundChild>::memPool_;
template <>
JASMemPool<JAISeq> JASPoolAllocObject<JAISeq>::memPool_;
template <>
JASMemPool<JAISe> JASPoolAllocObject<JAISe>::memPool_;
#endif
#endif
#endif

View File

@ -136,10 +136,11 @@ JAUSectionHeap *JAUNewSectionHeap(bool);
// TODO: probably move this to a different file(JASFakeMatch?)
#define createJASInstance(TYPE) \
template <> \
DECL_WEAK TYPE *JASGlobalInstance<TYPE>::sInstance
createJASInstance(JAUSectionHeap);
createJASInstance(JAUSoundNameTable);
createJASInstance(JAUSoundTable);
#endif
#endif

View File

@ -54,10 +54,10 @@ struct TBox2 : TBox<TVec2<T> > {
TBox2(f32 x0, f32 y0, const TVec2<f32>& f) { set(x0, y0, x0 + f.x, y0 + f.y); }
TBox2(f32 val)
{
f.y = val;
f.x = val;
i.y = val;
i.x = val;
this->f.y = val;
this->f.x = val;
this->i.y = val;
this->i.x = val;
}
void absolute() {
@ -77,7 +77,7 @@ struct TBox2 : TBox<TVec2<T> > {
void set(const TBox2& other) { set(other.i, other.f); }
void set(const TVec2<f32>& i, const TVec2<f32>& f) { this->i.set(i), this->f.set(f); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { i.set(x0, y0); f.set(x1, y1); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { this->i.set(x0, y0); this->f.set(x1, y1); }
};
// clang-format on

View File

@ -139,22 +139,22 @@ namespace JGeometry {
void identity() // TODO: OK?
{
const T zero = (T)0;
ref(2, 3) = zero;
ref(1, 3) = zero;
ref(0, 3) = zero;
this->ref(2, 3) = zero;
this->ref(1, 3) = zero;
this->ref(0, 3) = zero;
ref(1, 2) = zero;
ref(0, 2) = zero;
this->ref(1, 2) = zero;
this->ref(0, 2) = zero;
ref(2, 1) = zero;
ref(0, 1) = zero;
ref(2, 0) = zero;
ref(1, 0) = zero;
this->ref(2, 1) = zero;
this->ref(0, 1) = zero;
this->ref(2, 0) = zero;
this->ref(1, 0) = zero;
const T one = TUtil<T>::one();
ref(2, 2) = one;
ref(1, 1) = one;
ref(0, 0) = one;
this->ref(2, 2) = one;
this->ref(1, 1) = one;
this->ref(0, 0) = one;
}
void concat(const T &rSrcA, const T &rSrcB);
void concat(const T &rSrc);
@ -174,17 +174,17 @@ namespace JGeometry {
void getXDir(TVec3f &rDest) const
{
rDest.set<f32>(mMtx[0][0], mMtx[1][0], mMtx[2][0]);
rDest.set<f32>(this->mMtx[0][0], this->mMtx[1][0], this->mMtx[2][0]);
};
void getYDir(TVec3f &rDest) const
{
rDest.set<f32>(mMtx[0][1], mMtx[1][1], mMtx[2][1]);
rDest.set<f32>(this->mMtx[0][1], this->mMtx[1][1], this->mMtx[2][1]);
};
void getZDir(TVec3f &rDest) const
{
rDest.set<f32>(mMtx[0][2], mMtx[1][2], mMtx[2][2]);
rDest.set<f32>(this->mMtx[0][2], this->mMtx[1][2], this->mMtx[2][2]);
};
void getXYZDir(TVec3f &rDestX, TVec3f &rDestY, TVec3f &rDestZ) const;
@ -196,15 +196,15 @@ namespace JGeometry {
void setZDir(f32 x, f32 y, f32 z);
void setXYZDir(const TVec3f &rSrcX, const TVec3f &rSrcY, const TVec3f &rSrcZ)
{
ref(0, 0) = rSrcX.x;
ref(1, 0) = rSrcX.y;
ref(2, 0) = rSrcX.z;
ref(0, 1) = rSrcY.x;
ref(1, 1) = rSrcY.y;
ref(2, 1) = rSrcY.z;
ref(0, 2) = rSrcZ.x;
ref(1, 2) = rSrcZ.y;
ref(2, 2) = rSrcZ.z;
this->ref(0, 0) = rSrcX.x;
this->ref(1, 0) = rSrcX.y;
this->ref(2, 0) = rSrcX.z;
this->ref(0, 1) = rSrcY.x;
this->ref(1, 1) = rSrcY.y;
this->ref(2, 1) = rSrcY.z;
this->ref(0, 2) = rSrcZ.x;
this->ref(1, 2) = rSrcZ.y;
this->ref(2, 2) = rSrcZ.z;
}
void getEuler(TVec3f &rDest) const;
@ -226,9 +226,9 @@ namespace JGeometry {
inline void getXDirInline(TVec3f &rDest) const
{
f32 z = mMtx[2][0];
f32 y = mMtx[1][0];
f32 x = mMtx[0][0];
f32 z = this->mMtx[2][0];
f32 y = this->mMtx[1][0];
f32 x = this->mMtx[0][0];
rDest.set(x, y, z);
}
@ -253,9 +253,9 @@ namespace JGeometry {
void setTrans(f32 x, f32 y, f32 z);
void zeroTrans()
{
ref(0, 3) = 0.0f;
ref(1, 3) = 0.0f;
ref(2, 3) = 0.0f;
this->ref(0, 3) = 0.0f;
this->ref(1, 3) = 0.0f;
this->ref(2, 3) = 0.0f;
}
void makeRotate(const TVec3f &, f32);
@ -265,9 +265,9 @@ namespace JGeometry {
inline void getTransInline(TVec3f &rDest) const
{
f32 z = mMtx[2][3];
f32 y = mMtx[1][3];
f32 x = mMtx[0][3];
f32 z = this->mMtx[2][3];
f32 y = this->mMtx[1][3];
f32 x = this->mMtx[0][3];
rDest.set(x, y, z);
}
};

View File

@ -12,8 +12,8 @@ namespace JGeometry {
/* Constructors */
inline TQuat4() {}
template <typename T>
TQuat4(T _x, T _y, T _z, T _w)
template <typename A>
TQuat4(A _x, A _y, A _z, A _w)
{
x = _x;
y = _y;

View File

@ -28,7 +28,7 @@ namespace JGeometry {
return equal;
}
f32 invert(f32 x) { return 1.0f/x; }
static f32 invert(f32 x) { return 1.0f/x; }
static f32 sqrt(f32 x)
{

View File

@ -7,6 +7,7 @@
namespace JGeometry {
inline void setTVec3f(register const f32 *src, register f32 *dst)
{
#ifdef __MWERKS__
register f32 xy, z;
__asm {
// clang-format off
@ -16,10 +17,12 @@ namespace JGeometry {
stfs z, 8(dst)
// clang-format on
}
#endif
}
inline void negateInternal(register const f32 *src, register f32 *dst)
{
#ifdef __MWERKS__
register f32 xy;
__asm {
// clang-format off
@ -29,10 +32,12 @@ namespace JGeometry {
// clang-format on
}
dst[2] = -src[2];
#endif
}
inline void mulInternal(register const f32 *vec1, register const f32 *vec2, register f32 *dst)
{
#ifdef __MWERKS__
register f32 xy1, xy2, res;
__asm {
// clang-format off
@ -43,6 +48,7 @@ namespace JGeometry {
// clang-format on
}
dst[2] = vec1[2] * vec2[2];
#endif
}
template <typename T>

View File

@ -12,7 +12,7 @@ public:
void getTagName(u32); // UNUSED
virtual ~RaceSceneLight(); // overide
virtual Mtx *getEffectMtx(); // overide
virtual MtxPtr getEffectMtx(); // overide
virtual void calc(); // overide
private:
u8 _90[0xf4 - 0x90];
@ -23,7 +23,7 @@ class RaceBalloonLight : public LtObjDiffuse
public:
RaceBalloonLight(u32);
virtual ~RaceBalloonLight(); // overide
virtual Mtx *getEffectMtx(); // overide
virtual MtxPtr getEffectMtx(); // overide
virtual void draw(); // overide
private:
@ -36,7 +36,7 @@ public:
RaceKartLight(RaceSceneLight *, int);
virtual ~RaceKartLight(); // overide
virtual Mtx *getEffectMtx(); // overide
virtual MtxPtr getEffectMtx(); // overide
virtual void draw(); // overide
virtual void calc(); // overide
@ -57,4 +57,4 @@ private:
u8 _90[0xd0 - 0x90];
};
#endif
#endif

View File

@ -87,7 +87,7 @@ public:
// Virtual Table
virtual void update(u16); // override
virtual void createModel(JKRSolidHeap *, u32, u32); // override
virtual bool createModel(JKRSolidHeap *, u32, u32); // override
virtual void setCurrentViewNo(u32); // override
virtual ~DriverModel();

View File

@ -20,9 +20,15 @@
#define CLEAR_PATH(x) __memclr((x), sizeof((x)))
#define ALIGN(x) __attribute__((aligned(x)))
#ifdef __MWERKS__
#define DECL_SECTION(x) __declspec(section x)
#define DECL_WEAK __declspec(weak)
#define DONT_INLINE __attribute__((never_inline))
#else
#define DECL_SECTION(x)
#define DECL_WEAK __attribute__((weak))
#define DONT_INLINE __attribute__((noinline))
#endif
// Align X to the previous N bytes (N must be power of two)
#define ALIGN_PREV(X, N) ((X) & ~((N)-1))
@ -70,4 +76,4 @@
#define __declspec(x)
#endif
#endif
#endif

View File

@ -12,7 +12,11 @@ int __fpclassifyf(float);
int __signbitd(double);
int __fpclassifyd(double);
inline int __fpclassifyf(f32 x)
#ifndef MATH_INLINE
#define MATH_INLINE inline
#endif
MATH_INLINE int __fpclassifyf(f32 x)
{
switch ((*(s32*)&x) & 0x7f800000) {
case 0x7f800000: {
@ -32,7 +36,8 @@ inline int __fpclassifyf(f32 x)
}
return 4;
}
inline int __fpclassifyd(f64 x)
MATH_INLINE int __fpclassifyd(f64 x)
{
switch (__HI(x) & 0x7ff00000) {
case 0x7ff00000: {

View File

@ -0,0 +1,231 @@
#ifndef _RUNTIME_GECKO_EXCEPTIONPPC_H
#define _RUNTIME_GECKO_EXCEPTIONPPC_H
#include "types.h"
typedef u8 exaction_type;
#define EXACTION_ENDBIT 0x80
#define EXACTION_MASK 0x7F
// EXAction structs
#define EXACTION_ENDOFLIST 0
#define EXACTION_BRANCH 1
typedef struct ex_branch {
exaction_type action;
u8 unused;
u16 target;
} ex_branch;
#define EXACTION_DESTROYLOCAL 2
typedef struct ex_destroylocal {
exaction_type action;
u8 unused;
s16 local;
void* dtor;
} ex_destroylocal;
#define EXACTION_DESTROYLOCALCOND 3
typedef struct ex_destroylocalcond {
exaction_type action;
u8 dlc_field;
s16 cond;
s16 local;
void* dtor;
} ex_destroylocalcond;
#define ex_destroylocalcond_MakeField(regcond) (((regcond) << 7))
#define ex_destroylocalcond_GetRegCond(field) ((field) >> 7)
#define EXACTION_DESTROYLOCALPOINTER 4
typedef struct ex_destroylocalpointer {
exaction_type action;
u8 dlp_field;
s16 pointer;
void* dtor;
} ex_destroylocalpointer;
#define ex_destroylocalpointer_MakeField(regpointer) (((regpointer) << 7))
#define ex_destroylocalpointer_GetRegPointer(field) ((field) >> 7)
#define EXACTION_DESTROYLOCALARRAY 5
typedef struct ex_destroylocalarray {
exaction_type action;
u8 unused;
s16 localarray;
u16 elements;
u16 element_size;
void* dtor;
} ex_destroylocalarray;
#define EXACTION_DESTROYBASE 6
#define EXACTION_DESTROYMEMBER 7
typedef struct ex_destroymember {
exaction_type action;
u8 dm_field;
s16 objectptr;
s32 offset;
void* dtor;
} ex_destroymember;
#define ex_destroymember_MakeField(regpointer) (((regpointer) << 7))
#define ex_destroymember_GetRegPointer(field) ((field) >> 7)
#define EXACTION_DESTROYMEMBERCOND 8
typedef struct ex_destroymembercond {
exaction_type action;
u8 dmc_field;
s16 cond;
s16 objectptr;
s32 offset;
void* dtor;
} ex_destroymembercond;
#define ex_destroymembercond_MakeField(regcond, regpointer) (((regcond) << 7) | (((regpointer)&0x1) << 6))
#define ex_destroymembercond_GetRegCond(field) ((field) >> 7)
#define ex_destroymembercond_GetRegPointer(field) (((field) >> 6) & 0x1)
#define EXACTION_DESTROYMEMBERARRAY 9
typedef struct ex_destroymemberarray {
exaction_type action;
u8 dma_field;
s16 objectptr;
s32 offset;
s32 elements;
s32 element_size;
void* dtor;
} ex_destroymemberarray;
#define ex_destroymemberarray_MakeField(regpointer) (((regpointer) << 7))
#define ex_destroymemberarray_GetRegPointer(field) ((field) >> 7)
#define EXACTION_DELETEPOINTER 10
typedef struct ex_deletepointer {
exaction_type action;
u8 dp_field;
s16 objectptr;
void* deletefunc;
} ex_deletepointer;
#define ex_deletepointer_MakeField(regpointer) (((regpointer) << 7))
#define ex_deletepointer_GetRegPointer(field) ((field) >> 7)
#define EXACTION_DELETEPOINTERCOND 11
typedef struct ex_deletepointercond {
exaction_type action;
u8 dpc_field;
s16 cond;
s16 objectptr;
void* deletefunc;
} ex_deletepointercond;
#define ex_deletepointercond_MakeField(regcond, regpointer) (((regcond) << 7) | (((regpointer)&0x1) << 6))
#define ex_deletepointercond_GetRegCond(field) ((field) >> 7)
#define ex_deletepointercond_GetRegPointer(field) (((field) >> 6) & 0x1)
#define EXACTION_CATCHBLOCK 12
typedef struct ex_catchblock {
exaction_type action;
u8 unused;
char* catch_type;
u16 catch_pcoffset;
s16 cinfo_ref;
} ex_catchblock;
#define EXACTION_ACTIVECATCHBLOCK 13
typedef struct ex_activecatchblock {
exaction_type action;
u8 unused;
s16 cinfo_ref;
} ex_activecatchblock;
#define EXACTION_TERMINATE 14
typedef struct ex_terminate {
exaction_type action;
u8 unused;
} ex_terminate;
#define EXACTION_SPECIFICATION 15
typedef struct ex_specification {
exaction_type action;
u8 unused;
u16 specs;
s32 pcoffset;
s32 cinfo_ref;
char* spec[];
} ex_specification;
#define EXACTION_CATCHBLOCK_32 16
typedef struct ex_catchblock_32 {
exaction_type action;
u8 unused;
char* catch_type;
s32 catch_pcoffset;
s32 cinfo_ref;
} ex_catchblock_32;
// Other structs
typedef struct ExceptionRangeSmall {
u16 start;
u16 end;
u16 action;
} ExceptionRangeSmall;
typedef struct ExceptionTableSmall {
u16 et_field;
ExceptionRangeSmall ranges[0];
} ExceptionTableSmall;
typedef struct ExceptionRangeLarge {
u32 start;
u16 size;
u16 action;
} ExceptionRangeLarge;
typedef struct ExceptionTableLarge {
u16 et_field;
u16 et_field2;
ExceptionRangeLarge ranges[];
} ExceptionTableLarge;
#define ET_MakeField(savedGPRs, savedFPRs, savedCR, hasframeptr, isLarge) \
(((savedGPRs) << 11) | ((savedFPRs & 0x1f) << 6) | ((savedCR & 0x1) << 5) | ((hasframeptr & 0x1) << 4) | ((isLarge & 1) << 3))
#define ET_GetSavedGPRs(field) ((field) >> 11)
#define ET_GetSavedFPRs(field) (((field) >> 6) & 0x1f)
#define ET_GetSavedCR(field) (((field) >> 5) & 0x1)
#define ET_GetHasFramePtr(field) (((field) >> 4) & 0x1)
#define ET_IsLargeTable(field) (((field) >> 3) & 0x1)
#define ET_ClearLargeBit(field) ((field) & ~(1 << 3))
#define ET_SetLargeBit(field) ((field) | (1 << 3))
#define ET_HasElfVector(field) (((field) >> 1) & 0x1)
typedef struct ExceptionTableIndex {
u32 functionoffset;
u32 eti_field;
u32 exceptionoffset;
} ExceptionTableIndex;
#define ETI_MakeField(direct, fsize) ((((s32)(direct)) << 31) | ((fsize)&0x7fffffff))
#define ETI_GetDirectStore(field) ((field) >> 31)
#define ETI_GetFunctionSize(field) ((field)&0x7fffffff)
#endif

View File

@ -8,21 +8,24 @@
extern "C" {
#endif
#define CTORARG_TYPE int
#define CTORARG_PARTIAL (0)
#define CTORARG_COMPLETE (1)
typedef s16 vbase_ctor_arg_type;
typedef char local_cond_type;
#define CTORCALL_COMPLETE(ctor, objptr) (((void (*)(void*, CTORARG_TYPE))ctor)(objptr, CTORARG_COMPLETE))
#define DTORARG_TYPE int
#define DTORCALL_COMPLETE(dtor, objptr) (((void (*)(void*, DTORARG_TYPE))dtor)(objptr, -1))
typedef struct CatchInfo {
void* location;
void* typeinfo;
void* dtor;
void* sublocation;
s32 pointercopy;
void* stacktop;
} CatchInfo;
void __unregister_fragment(int fragmentID);
// struct __eti_init_info* info
int __register_fragment(void* info, char* TOC);
void* __register_global_object(void* object, void* destructor, void* regmem);
void __destroy_global_chain(void);
extern char __throw_catch_compare(const char* throwtype, const char* catchtype, s32* offset_result);
#ifdef __cplusplus
}

View File

@ -1,13 +1,14 @@
#ifndef RUNTIME_MEM_H
#define RUNTIME_MEM_H
#include "macros.h"
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
__declspec(section ".init") void* memcpy(void* dest, const void* src, size_t n);
__declspec(section ".init") void __fill_mem(void* dest, int val, size_t count);
__declspec(section ".init") void* memset(void* dest, int val, size_t count);
DECL_SECTION(".init") void* memcpy(void* dest, const void* src, size_t n);
DECL_SECTION(".init") void __fill_mem(void* dest, int val, size_t count);
DECL_SECTION(".init") void* memset(void* dest, int val, size_t count);
#ifdef __cplusplus
}

View File

@ -1,17 +1,19 @@
#ifndef __PPC_EABI_LINKER
#define __PPC_EABI_LINKER
#define __ppc_eabi_linker
__declspec(section ".init") extern char _stack_addr[];
__declspec(section ".init") extern char _stack_end[];
__declspec(section ".init") extern char _heap_addr[];
__declspec(section ".init") extern char _heap_end[];
__declspec(section ".init") extern const char _fextabindex_rom[];
__declspec(section ".init") extern char _fextabindex[];
__declspec(section ".init") extern char _eextabindex[];
#include "macros.h"
__declspec(section ".init") extern char _SDA_BASE_[];
DECL_SECTION(".init") extern char _stack_addr[];
DECL_SECTION(".init") extern char _stack_end[];
DECL_SECTION(".init") extern char _heap_addr[];
DECL_SECTION(".init") extern char _heap_end[];
DECL_SECTION(".init") extern const char _fextabindex_rom[];
DECL_SECTION(".init") extern char _fextabindex[];
DECL_SECTION(".init") extern char _eextabindex[];
__declspec(section ".init") extern char _SDA2_BASE_[];
DECL_SECTION(".init") extern char _SDA_BASE_[];
DECL_SECTION(".init") extern char _SDA2_BASE_[];
typedef struct __rom_copy_info {
char* rom;
@ -19,14 +21,14 @@ typedef struct __rom_copy_info {
unsigned int size;
} __rom_copy_info;
__declspec(section ".init") extern __rom_copy_info _rom_copy_info[];
DECL_SECTION(".init") extern __rom_copy_info _rom_copy_info[];
typedef struct __bss_init_info {
char* addr;
unsigned int size;
} __bss_init_info;
__declspec(section ".init") extern __bss_init_info _bss_init_info[];
DECL_SECTION(".init") extern __bss_init_info _bss_init_info[];
typedef struct __eti_init_info {
void* eti_start;
@ -35,38 +37,38 @@ typedef struct __eti_init_info {
unsigned long code_size;
} __eti_init_info;
__declspec(section ".init") extern __eti_init_info _eti_init_info[];
__declspec(section ".init") extern const char _f_init_rom[];
__declspec(section ".init") extern char _f_init[];
__declspec(section ".init") extern char _e_init[];
__declspec(section ".init") extern const char _f_text_rom[];
__declspec(section ".init") extern char _f_text[];
__declspec(section ".init") extern char _e_text[];
__declspec(section ".init") extern const char _f_rodata_rom[];
__declspec(section ".init") extern char _f_rodata[];
__declspec(section ".init") extern char _e_rodata[];
__declspec(section ".init") extern const char _fextab_rom[];
__declspec(section ".init") extern char _fextab[];
__declspec(section ".init") extern char _eextab[];
__declspec(section ".init") extern const char _f_data_rom[];
__declspec(section ".init") extern char _f_data[];
__declspec(section ".init") extern char _e_data[];
__declspec(section ".init") extern char _f_bss[];
__declspec(section ".init") extern char _e_bss[];
__declspec(section ".init") extern const char _f_sdata_rom[];
__declspec(section ".init") extern char _f_sdata[];
__declspec(section ".init") extern char _e_sdata[];
__declspec(section ".init") extern char _f_sbss[];
__declspec(section ".init") extern char _e_sbss[];
__declspec(section ".init") extern const char _f_sdata2_rom[];
__declspec(section ".init") extern char _f_sdata2[];
__declspec(section ".init") extern char _e_sdata2[];
__declspec(section ".init") extern char _f_sbss2[];
__declspec(section ".init") extern char _e_sbss2[];
__declspec(section ".init") extern const char _f_PPC_EMB_sdata0_rom[];
__declspec(section ".init") extern char _f_PPC_EMB_sdata0[];
__declspec(section ".init") extern char _e_PPC_EMB_sdata0[];
__declspec(section ".init") extern char _f_PPC_EMB_sbss0[];
__declspec(section ".init") extern char _e_PPC_EMB_sbss0[];
DECL_SECTION(".init") extern __eti_init_info _eti_init_info[];
DECL_SECTION(".init") extern const char _f_init_rom[];
DECL_SECTION(".init") extern char _f_init[];
DECL_SECTION(".init") extern char _e_init[];
DECL_SECTION(".init") extern const char _f_text_rom[];
DECL_SECTION(".init") extern char _f_text[];
DECL_SECTION(".init") extern char _e_text[];
DECL_SECTION(".init") extern const char _f_rodata_rom[];
DECL_SECTION(".init") extern char _f_rodata[];
DECL_SECTION(".init") extern char _e_rodata[];
DECL_SECTION(".init") extern const char _fextab_rom[];
DECL_SECTION(".init") extern char _fextab[];
DECL_SECTION(".init") extern char _eextab[];
DECL_SECTION(".init") extern const char _f_data_rom[];
DECL_SECTION(".init") extern char _f_data[];
DECL_SECTION(".init") extern char _e_data[];
DECL_SECTION(".init") extern char _f_bss[];
DECL_SECTION(".init") extern char _e_bss[];
DECL_SECTION(".init") extern const char _f_sdata_rom[];
DECL_SECTION(".init") extern char _f_sdata[];
DECL_SECTION(".init") extern char _e_sdata[];
DECL_SECTION(".init") extern char _f_sbss[];
DECL_SECTION(".init") extern char _e_sbss[];
DECL_SECTION(".init") extern const char _f_sdata2_rom[];
DECL_SECTION(".init") extern char _f_sdata2[];
DECL_SECTION(".init") extern char _e_sdata2[];
DECL_SECTION(".init") extern char _f_sbss2[];
DECL_SECTION(".init") extern char _e_sbss2[];
DECL_SECTION(".init") extern const char _f_PPC_EMB_sdata0_rom[];
DECL_SECTION(".init") extern char _f_PPC_EMB_sdata0[];
DECL_SECTION(".init") extern char _e_PPC_EMB_sdata0[];
DECL_SECTION(".init") extern char _f_PPC_EMB_sbss0[];
DECL_SECTION(".init") extern char _e_PPC_EMB_sbss0[];
#endif // __PPC_EABI_LINKER

View File

@ -7,16 +7,6 @@
extern "C" {
#endif
#define CTORARG_TYPE int
#define CTORARG_PARTIAL (0)
#define CTORARG_COMPLETE (1)
#define CTORCALL_COMPLETE(ctor, objptr) (((void (*)(void*, CTORARG_TYPE))ctor)(objptr, CTORARG_COMPLETE))
#define DTORARG_TYPE int
#define DTORCALL_COMPLETE(dtor, objptr) (((void (*)(void*, DTORARG_TYPE))dtor)(objptr, -1))
typedef struct DestructorChain {
struct DestructorChain* next;
void* destructor;

View File

@ -1,53 +1,12 @@
#define MATH_INLINE
#include "PowerPC_EABI_Support/MSL_C/PPC_EABI/math_ppc.h"
#include "fdlibm.h"
int __fpclassifyf(float x)
{
switch ((*(s32 *)&x) & 0x7f800000)
{
case 0x7f800000:
{
if ((*(s32 *)&x) & 0x007fffff)
return 1;
else
return 2;
break;
}
case 0:
{
if ((*(s32 *)&x) & 0x007fffff)
return 5;
else
return 3;
break;
}
}
return 4;
}
// Generated via math_api.h
// int __fpclassifyf(float x);
int __fpclassifyd(double x)
{
switch (__HI(x) & 0x7ff00000)
{
case 0x7ff00000:
{
if ((__HI(x) & 0x000fffff) || (__LO(x) & 0xffffffff))
return 1;
else
return 2;
break;
}
case 0:
{
if ((__HI(x) & 0x000fffff) || (__LO(x) & 0xffffffff))
return 5;
else
return 3;
break;
}
}
return 4;
}
// Generated via math_api.h
// int __fpclassifyd(double x);
/*double scalbn(double x, int y)
{
@ -324,11 +283,11 @@ void atan2f(void)
// UNUSED FUNCTION
}*/
__declspec(weak) float cosf(float __x) { return cos((double)__x); }
DECL_WEAK float cosf(float __x) { return cos((double)__x); }
__declspec(weak) float sinf(float __x) { return sin((double)__x); }
DECL_WEAK float sinf(float __x) { return sin((double)__x); }
__declspec(weak) float tanf(float __x) { return tan((double)__x); }
DECL_WEAK float tanf(float __x) { return tan((double)__x); }
/*void coshf(void)
{

View File

@ -1,6 +1,5 @@
#include "PowerPC_EABI_Support/Runtime/MWCPlusLib.h"
#include <exception.h>
#include "PowerPC_EABI_Support/Runtime/Gecko_ExceptionPPC.h"
#include "PowerPC_EABI_Support/Runtime/MWCPlusPlusLib.h"
#include "PowerPC_EABI_Support/Runtime/NMWException.h"
#include "PowerPC_EABI_Support/Runtime/__ppc_eabi_linker.h"
@ -238,7 +237,7 @@ static exaction_type ExPPC_NextAction(ActionIterator* iter){
ExPPC_FindExceptionRecord(return_addr, &iter->info);
if(iter->info.exception_record == 0){
terminate();
std::terminate();
}
iter->current_SP = callers_SP;
@ -288,7 +287,7 @@ static exaction_type ExPPC_NextAction(ActionIterator* iter){
iter->info.action_pointer += sizeof(ex_specification) + ((ex_specification*)iter->info.action_pointer)->specs * sizeof(void*);
break;
default:
terminate();
std::terminate();
}
}
@ -436,7 +435,7 @@ static void ExPPC_UnwindStack(ThrowContext* context, MWExceptionInfo* info, void
ExPPC_FindExceptionRecord(return_addr, info);
if(info->exception_record == 0){
terminate();
std::terminate();
}
context->FP = (ET_GetHasFramePtr(info->exception_record->et_field)) ? (char*)context->GPR[31] : context->SP;
@ -518,7 +517,7 @@ static void ExPPC_UnwindStack(ThrowContext* context, MWExceptionInfo* info, void
info->action_pointer += sizeof(ex_specification) + ((ex_specification*)info->action_pointer)->specs * sizeof(void*);
break;
default:
terminate();
std::terminate();
}
if(action & EXACTION_ENDBIT) info->action_pointer = 0;
@ -656,7 +655,7 @@ static void ExPPC_ThrowHandler(ThrowContext* context){
ExPPC_FindExceptionRecord(context->returnaddr, &info);
if(info.exception_record == 0){
terminate();
std::terminate();
}
context->FP = (ET_GetHasFramePtr(info.exception_record->et_field)) ? (char*)context->GPR[31] : context->SP;
@ -688,7 +687,7 @@ static void ExPPC_ThrowHandler(ThrowContext* context){
continue;
case EXACTION_TERMINATE:
default:
terminate();
std::terminate();
}
break;
}
@ -739,7 +738,7 @@ static void ExPPC_ThrowHandler(ThrowContext* context){
continue;
case EXACTION_TERMINATE:
default:
terminate();
std::terminate();
}
break;
}
@ -889,4 +888,4 @@ asm void __throw(char* throwtype, void* location, void* dtor){
//unused
void __end__catch(CatchInfo* catchinfo){
}
}

View File

@ -1,4 +1,5 @@
#include "PowerPC_EABI_Support/Runtime/NMWException.h"
#include "PowerPC_EABI_Support/Runtime/MWCPlusPlusLib.h"
#pragma exceptions on
@ -14,14 +15,14 @@ namespace std
abort();
}
static terminate_handler thandler = dthandler;
terminate_handler thandler = dthandler;
static void duhandler()
{
terminate();
}
static unexpected_handler uhandler = duhandler;
unexpected_handler uhandler = duhandler;
extern void terminate()
{
@ -33,11 +34,11 @@ namespace std
}
}
extern "C" void __throw_catch_compare() {
extern "C" char __throw_catch_compare(const char* throwtype, const char* catchtype, s32* offset_result) {
}
extern "C" void __construct_new_array()
extern "C" void *__construct_new_array(void *block, ConstructorDestructor ctor, ConstructorDestructor dtor_arg, size_t size, size_t n)
{
}
@ -83,7 +84,7 @@ extern "C" void __construct_array(void *ptr, void *ctor, void *dtor, size_t size
}
extern "C" void __destroy_arr(void *block, void *dtor, size_t size, size_t n)
extern "C" void __destroy_arr(void *block, ConstructorDestructor *dtor, size_t size, size_t n)
{
}
}

View File

@ -1,4 +1,5 @@
#include "PowerPC_EABI_Support/Runtime/global_destructor_chain.h"
#include "PowerPC_EABI_Support/Runtime/MWCPlusPlusLib.h"
DestructorChain *__global_destructor_chain;
@ -28,4 +29,4 @@ int __register_atexit(void (*func)(void))
{
}
__declspec(section ".dtors") static void *const __destroy_global_chain_reference = __destroy_global_chain;
__declspec(section ".dtors") static void *const __destroy_global_chain_reference = __destroy_global_chain;

View File

@ -122,4 +122,4 @@ DECL_WEAK DSPTaskInfo *DSPAddTask(DSPTaskInfo *task)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1867,13 +1867,14 @@ bool Course::Area::check(TVec3f *areaCoord, const TVec3f &worldPos)
switch (mData->shape)
{
case 1:
case 1: {
f32 lenXZ = (areaCoord->x * areaCoord->x) + (areaCoord->z * areaCoord->z);
if (lenXZ > mScale.x * mScale.x)
return false;
if (areaCoord->y < -100.0f || areaCoord->y > mScale.y)
return false;
break;
}
default:
if ((areaCoord->x < -mScale.x) || (areaCoord->x > mScale.x))
return false;
@ -2013,4 +2014,4 @@ bool Course::searchAppendGround(const TVec3f &pos)
}
return ret;
}
}