summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJonathan Wase <jonathan@familjenwase.se>2021-11-09 23:09:38 +0100
committerGitHub <noreply@github.com>2021-11-09 23:09:38 +0100
commit901b222eb877be81bb9043d65b6616bd21152a12 (patch)
treeeed3fccf24c2f73a38484f5eeffb5109ce7771a8 /include
parent5020395dfd34d4dc846e3ea228f6271bfca1c72a (diff)
JUTException (#154)
* JUTException inherit JKRThread * OK __ct__12JUTExceptionFP14JUTDirectPrint * OK create__12JUTExceptionFP14JUTDirectPrint * OK setFPException__12JUTExceptionFUl * OK showFloatSub__12JUTExceptionFif * OK showFloat__12JUTExceptionFP9OSContext * OK searchPartialModule__12JUTExceptionFUlPUlPUlPUlPUl * OK search_name_part__FPUcPUci * OK showStack__12JUTExceptionFP9OSContext * OK showMainInfo__12JUTExceptionFUsP9OSContextUlUl * OK showGPR__12JUTExceptionFP9OSContext * OK __sinit_JUTException_cpp * OK showMapInfo_subroutine__12JUTExceptionFUlb * OK showGPRMap__12JUTExceptionFP9OSContext * OK showSRR0Map__12JUTExceptionFP9OSContext * OK printDebugInfo__12JUTExceptionFQ212JUTException9EInfoPageUsP9OSContextUlUl * OK isEnablePad__12JUTExceptionCFv * OK readPad__12JUTExceptionFPUlPUl * NONMATCHING printContext__12JUTExceptionFUsP9OSContextUlUl * OK printContext__12JUTExceptionFUsP9OSContextUlUl * OK __dt__12JUTExceptionFv * OK waitTime__12JUTExceptionFl * OK createFB__12JUTExceptionFv * OK setPreUserCallback__12JUTExceptionFPFUsP9OSContextUlUl_v * OK __ct__13JUTExternalFBFP16_GXRenderModeObj8_GXGammaPvUl * OK createConsole__12JUTExceptionFPvUl * NONMATCHING queryMapAddress_single__12JUTExceptionFPcUllPUlPUlPcUlbb * OK queryMapAddress__12JUTExceptionFPcUllPUlPUlPcUlbb * OK appendMapFile__12JUTExceptionFPCc * clean up * OK panic_f__12JUTExceptionFPCciPCce * OK panic_f_va__12JUTExceptionFPCciPCcP16__va_list_struct * OK errorHandler__12JUTExceptionFUsP9OSContextUlUl * format * format * fixed requested changes * merged with master and removed *.s files Co-authored-by: Julgodis <>
Diffstat (limited to 'include')
-rw-r--r--include/JSystem/JSupport/JSUList.h2
-rw-r--r--include/JSystem/JUtility/JUTConsole.h27
-rw-r--r--include/JSystem/JUtility/JUTDirectPrint.h2
-rw-r--r--include/JSystem/JUtility/JUTException.h137
-rw-r--r--include/JSystem/JUtility/JUTGamePad.h9
-rw-r--r--include/MSL_C.PPCEABI.bare.H/MSL_Common/Src/float.h42
-rw-r--r--include/dolphin/gx/GX.h9
-rw-r--r--include/dolphin/os/OS.h8
-rw-r--r--include/dolphin/os/OSError.h27
-rw-r--r--include/dolphin/os/OSLink.h30
-rw-r--r--include/global.h4
-rw-r--r--include/msl_c/math.h21
-rw-r--r--include/msl_c/string.h27
13 files changed, 268 insertions, 77 deletions
diff --git a/include/JSystem/JSupport/JSUList.h b/include/JSystem/JSupport/JSUList.h
index 0c7a5e1a4f..f204f239ee 100644
--- a/include/JSystem/JSupport/JSUList.h
+++ b/include/JSystem/JSupport/JSUList.h
@@ -121,7 +121,7 @@ public:
bool operator==(JSULink<T> const* other) const { return this->mLink == other; }
bool operator!=(JSULink<T> const* other) const { return this->mLink != other; }
bool operator==(JSUListIterator<T> const& other) const { return this->mLink == other.mLink; }
- bool operator!=(JSUListIterator<T> const& other) const { return this->mLink != other.other; }
+ bool operator!=(JSUListIterator<T> const& other) const { return this->mLink != other.mLink; }
JSUListIterator<T> operator++(int) {
JSUListIterator<T> prev = *this;
diff --git a/include/JSystem/JUtility/JUTConsole.h b/include/JSystem/JUtility/JUTConsole.h
index 15790da416..274e8de7e7 100644
--- a/include/JSystem/JUtility/JUTConsole.h
+++ b/include/JSystem/JUtility/JUTConsole.h
@@ -14,8 +14,8 @@ public:
UNK_TYPE2 = 2,
};
- /* 802E73E4 */ void create(unsigned int, void*, u32);
- /* 802E7354 */ void create(unsigned int, unsigned int, JKRHeap*);
+ /* 802E73E4 */ static JUTConsole* create(unsigned int, void*, u32);
+ /* 802E7354 */ static JUTConsole* create(unsigned int, unsigned int, JKRHeap*);
/* 802E746C */ JUTConsole(unsigned int, unsigned int, bool);
/* 802E75CC */ static size_t getObjectSizeFromBufferSize(unsigned int, unsigned int);
/* 802E75DC */ static size_t getLineFromObjectSize(u32, unsigned int);
@@ -31,26 +31,31 @@ public:
/* 802E755C */ virtual ~JUTConsole();
void setOutput(u32 output) { mOutput = output; }
-
- u32 getOutput() const { return mOutput; }
-
void setPosition(int x, int y) {
mPositionX = x;
mPositionY = y;
}
+ void setFontSize(f32 x, f32 y) {
+ mFontSizeX = x;
+ mFontSizeY = y;
+ }
+ void setHeight(u32 height) {
+ mHeight = height;
+ if (mHeight > field_0x24) {
+ mHeight = field_0x24;
+ }
+ }
+ u32 getOutput() const { return mOutput; }
int getPositionY() const { return mPositionY; }
-
int getPositionX() const { return mPositionX; }
+ u32 getHeight() const { return mHeight; }
bool isVisible() const { return mVisible; }
-
void setVisible(bool visible) { mVisible = visible; }
void setLineAttr(int param_0, u8 param_1) { mBuf[(field_0x20 + 2) * param_0] = param_1; }
-
u8* getLinePtr(int param_0) const { return &mBuf[(field_0x20 + 2) * param_0 + 1]; }
-
int diffIndex(int param_0, int param_1) const {
int diff = param_1 - param_0;
if (diff >= 0) {
@@ -59,6 +64,10 @@ public:
return diff += field_0x24;
}
+ void scrollToLastLine() { scroll(field_0x24); }
+ void scrollToFirstLine() { scroll(-field_0x24); }
+
+private:
/* 0x18 */ JGadget::TLinkListNode mListNode;
private:
diff --git a/include/JSystem/JUtility/JUTDirectPrint.h b/include/JSystem/JUtility/JUTDirectPrint.h
index 8fac8cf23c..53927bea72 100644
--- a/include/JSystem/JUtility/JUTDirectPrint.h
+++ b/include/JSystem/JUtility/JUTDirectPrint.h
@@ -22,6 +22,8 @@ public:
/* 802E4240 */ static JUTDirectPrint* start();
+ bool isActive() const { return field_0x00 != 0; }
+
static JUTDirectPrint* getManager() { return sDirectPrint; }
private:
diff --git a/include/JSystem/JUtility/JUTException.h b/include/JSystem/JUtility/JUTException.h
index eed808f7ba..769a46a198 100644
--- a/include/JSystem/JUtility/JUTException.h
+++ b/include/JSystem/JUtility/JUTException.h
@@ -2,85 +2,128 @@
#define JUTEXCEPTION_H
#include "JSystem/JKernel/JKRThread.h"
+#include "JSystem/JSupport/JSUList.h"
+#include "JSystem/JUtility/JUTDirectPrint.h"
#include "JSystem/JUtility/JUTGamePad.h"
#include "Runtime.PPCEABI.H/__va_arg.h"
#include "dolphin/gx/GX.h"
#include "dolphin/os/OS.h"
#include "dolphin/types.h"
+#include "global.h"
-struct _GXRenderModeObj;
-struct _GXGamma {};
+class JUTExternalFB {
+public:
+ /* 802E40CC */ JUTExternalFB(_GXRenderModeObj*, GXGamma, void*, u32);
-struct JUTExternalFB {
- /* 802E40CC */ JUTExternalFB(_GXRenderModeObj*, _GXGamma, void*, u32);
+private:
+ /* 0x00 */ _GXRenderModeObj* mRenderMode;
+ /* 0x04 */ u32 mSize;
+ /* 0x08 */ u32 field_0x08;
+ /* 0x0C */ u16 field_0x0C;
+ /* 0x0E */ u16 mGamma;
+ /* 0x10 */ bool field_0x10;
+ /* 0x11 */ u8 field_[3];
};
-struct JUTDirectPrint {
- /* 802E456C */ void changeFrameBuffer(void*, u16, u16);
-};
+STATIC_ASSERT(sizeof(JUTExternalFB) == 0x14);
+
+#define JUT_PRINT_GPR 1
+#define JUT_PRINT_GPR_MAP 2
+#define JUT_PRINT_SRR0_MAP 4
+#define JUT_PRINT_FLOAT 8
+#define JUT_PRINT_STACK 16
-class JUTException /* : public JKRThread */ {
+class JUTException : public JKRThread {
public:
- struct EInfoPage {};
+ enum EInfoPage {
+ EINFO_PAGE_GPR = 1,
+ EINFO_PAGE_FLOAT = 2,
+ EINFO_PAGE_STACK = 3,
+ EINFO_PAGE_GPR_MAP = 4,
+ EINFO_PAGE_SSR0_MAP = 5,
+ };
+
+ class JUTExMapFile {
+ public:
+ JUTExMapFile(char* path) : mLink(this) { mPath = path; }
+
+ public:
+ /* 0x00 */ char* mPath;
+ /* 0x04 */ JSULink<JUTExMapFile> mLink;
+ /* 0x14 */
+ };
- // TODO: return types are probably wrong
/* 802E1D5C */ JUTException(JUTDirectPrint*);
- /* 802E1E40 */ void create(JUTDirectPrint*);
- /* 802E1FCC */ void errorHandler(u16, OSContext*, u32, u32);
- /* 802E20C0 */ void panic_f_va(char const*, int, char const*, va_list);
- /* 802E21FC */ static void panic_f(char const*, int, char const*, ...);
- /* 802E227C */ void setFPException(u32);
+ /* 802E40EC */ virtual ~JUTException();
+
/* 802E22C4 */ void showFloatSub(int, f32);
/* 802E2454 */ void showFloat(OSContext*);
- /* 802E2578 */ void searchPartialModule(u32, u32*, u32*, u32*, u32*);
/* 802E26B0 */ void showStack(OSContext*);
/* 802E27B0 */ void showMainInfo(u16, OSContext*, u32, u32);
/* 802E2A84 */ void showGPR(OSContext*);
- /* 802E2B44 */ void showMapInfo_subroutine(u32, bool);
+ /* 802E2B44 */ bool showMapInfo_subroutine(u32, bool);
/* 802E2CA0 */ void showGPRMap(OSContext*);
/* 802E2DAC */ void showSRR0Map(OSContext*);
- /* 802E2E70 */ void printDebugInfo(JUTException::EInfoPage, u16, OSContext*, u32, u32);
- /* 802E2F18 */ void isEnablePad() const;
+ /* 802E2E70 */ void printDebugInfo(JUTException::EInfoPage, OSError, OSContext*, u32, u32);
+ /* 802E2F18 */ bool isEnablePad() const;
/* 802E2F54 */ bool readPad(u32*, u32*);
/* 802E34C0 */ void printContext(u16, OSContext*, u32, u32);
- /* 802E3980 */ static void waitTime(s32);
/* 802E3A08 */ void createFB();
- /* 802E3AEC */ void setPreUserCallback(void (*)(u16, OSContext*, u32, u32));
- /* 802E3AFC */ void setPostUserCallback(void (*)(u16, OSContext*, u32, u32));
- /* 802E3B0C */ void appendMapFile(char const*);
- /* 802E3BA0 */ void queryMapAddress(char*, u32, s32, u32*, u32*, char*, u32, bool, bool);
- /* 802E3C90 */ void queryMapAddress_single(char*, u32, s32, u32*, u32*, char*, u32, bool, bool);
- /* 802E3FEC */ void createConsole(void*, u32);
- /* 802E40EC */ virtual ~JUTException();
- /* 802E1EA8 */ virtual void run();
+ /* 802E1EA8 */ /* vt[03] */ virtual void* run();
+
+ /* 802E1E40 */ static JUTException* create(JUTDirectPrint*);
+ /* 802E1FCC */ static void errorHandler(OSError, OSContext*, u32, u32);
+ /* 802E20C0 */ static void panic_f_va(char const*, int, char const*, va_list);
+ /* 802E21FC */ static void panic_f(char const*, int, char const*, ...);
+ /* 802E227C */ static void setFPException(u32);
+ /* 802E2578 */ static bool searchPartialModule(u32, u32*, u32*, u32*, u32*);
+ /* 802E3AEC */ static OSErrorHandler setPreUserCallback(OSErrorHandler);
+ /* 802E3AFC */ static OSErrorHandler setPostUserCallback(OSErrorHandler);
+ /* 802E3B0C */ static void appendMapFile(char const*);
+ /* 802E3BA0 */ static bool queryMapAddress(char*, u32, s32, u32*, u32*, char*, u32, bool, bool);
+ /* 802E3C90 */ static bool queryMapAddress_single(char*, u32, s32, u32*, u32*, char*, u32, bool,
+ bool);
+ /* 802E3FEC */ static void createConsole(void*, u32);
+ /* 802E3980 */ static void waitTime(s32);
static JUTException* getManager() { return sErrorManager; }
+
+ JUTExternalFB* getFrameMemory() const { return mFrameMemory; }
+
void setTraceSuppress(u32 param_0) { mTraceSuppress = param_0; }
+ void setGamePad(JUTGamePad* gamePad) {
+ mGamePad = gamePad;
+ mGamePadPort = JUTGamePad::Port_Unknown;
+ }
- static u8 sMessageQueue[32];
- static void* sCpuExpName[17];
- static u8 sMapFileList[12 + 4 /* padding */];
+private:
+ static OSMessageQueue sMessageQueue;
+ static const char* sCpuExpName[17];
+ static JSUList<JUTException::JUTExMapFile> sMapFileList;
static u8 sMessageBuffer[4 + 4 /* padding */];
static JUTException* sErrorManager;
- static u8 sPreUserCallback[4];
- static u8 sPostUserCallback[4];
- static u8 sConsoleBuffer[4];
- static u8 sConsoleBufferSize[4];
- static u8 sConsole[4];
- static u8 msr[4];
- static u8 fpscr[4];
-
- /* 0x00 */ JKRThread field_0x0; // should be inherited
- /* 0x80 */ JUTDirectPrint* field_0x80;
- /* 0x84 */ JUTGamePad* field_0x84;
- /* 0x88 */ s32 field_0x88;
- /* 0x8C */ s32 field_0x8c;
- /* 0x90 */ s32 field_0x90;
+ static OSErrorHandler sPreUserCallback;
+ static OSErrorHandler sPostUserCallback;
+ static void* sConsoleBuffer;
+ static u32 sConsoleBufferSize;
+ static JUTConsole* sConsole;
+ static u32 msr;
+ static u32 fpscr;
+
+private:
+ /* 0x7C */ JUTExternalFB* mFrameMemory;
+ /* 0x80 */ JUTDirectPrint* mDirectPrint;
+ /* 0x84 */ JUTGamePad* mGamePad;
+ /* 0x88 */ JUTGamePad::EPadPort mGamePadPort;
+ /* 0x8C */ s32 mPrintWaitTime0;
+ /* 0x90 */ s32 mPrintWaitTime1;
/* 0x94 */ u32 mTraceSuppress;
/* 0x98 */ u32 field_0x98;
- /* 0x9C */ u32 field_0x9c;
- /* 0xA0 */ u32 field_0xa0;
+ /* 0x9C */ u32 mPrintFlags;
+ /* 0xA0 */ u32 mStackPointer;
};
+STATIC_ASSERT(sizeof(JUTException) == 0xA4);
+
#endif /* JUTEXCEPTION_H */
diff --git a/include/JSystem/JUtility/JUTGamePad.h b/include/JSystem/JUtility/JUTGamePad.h
index dfc87d1ee7..5bfc6e650d 100644
--- a/include/JSystem/JUtility/JUTGamePad.h
+++ b/include/JSystem/JUtility/JUTGamePad.h
@@ -47,7 +47,14 @@ public:
enum EStickMode {};
enum EWhichStick {};
- enum EPadPort { Port_1, Port_2, Port_3, Port_4 };
+ enum EPadPort {
+ Port_Unknown = -1, // used by JUTException
+ Port_1,
+ Port_2,
+ Port_3,
+ Port_4,
+ };
+
JUTGamePad(JUTGamePad::EPadPort port);
virtual ~JUTGamePad();
diff --git a/include/MSL_C.PPCEABI.bare.H/MSL_Common/Src/float.h b/include/MSL_C.PPCEABI.bare.H/MSL_Common/Src/float.h
index f3ccbf7900..9a39ae5743 100644
--- a/include/MSL_C.PPCEABI.bare.H/MSL_Common/Src/float.h
+++ b/include/MSL_C.PPCEABI.bare.H/MSL_Common/Src/float.h
@@ -3,4 +3,46 @@
#include "dolphin/types.h"
+#define FP_SNAN 0
+#define FP_QNAN 1
+#define FP_INFINITE 2
+#define FP_ZERO 3
+#define FP_NORMAL 4
+#define FP_SUBNORMAL 5
+
+#define FP_NAN FP_QNAN
+
+#define fpclassify(x) ((sizeof(x) == sizeof(float)) ? __fpclassifyf(x) : __fpclassifyd(x))
+#define signbit(x) ((sizeof(x) == sizeof(float)) ? __signbitf(x) : __signbitd(x))
+
+#define __signbitf(x) ((*(u8*)&(x)) & 0x80)
+
+// TODO: OK?
+#define __signbitd(x) ((*(u8*)&(x)) & 0x80)
+
+inline int __fpclassifyf(float __value) {
+ u32 integer = *(u32*)&__value;
+
+ switch (integer & 0x7f800000) {
+ case 0x7f800000:
+ if ((integer & 0x7fffff) != 0) {
+ return FP_QNAN;
+ }
+ return FP_INFINITE;
+
+ case 0:
+ if ((integer & 0x7fffff) != 0) {
+ return FP_SUBNORMAL;
+ }
+ return FP_ZERO;
+ }
+
+ return FP_NORMAL;
+}
+
+inline int __fpclassifyd(double __value) {
+ // TODO:
+ return FP_INFINITE;
+}
+
#endif /* MSL_COMMON_SRC_FLOAT_H */
diff --git a/include/dolphin/gx/GX.h b/include/dolphin/gx/GX.h
index 0ca3cc2d5f..98ac75143f 100644
--- a/include/dolphin/gx/GX.h
+++ b/include/dolphin/gx/GX.h
@@ -5,6 +5,7 @@
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx/mtx44.h"
#include "dolphin/types.h"
+#include "global.h"
typedef struct _GXColor {
/* 0x0 */ u8 r;
@@ -36,6 +37,8 @@ typedef struct _GXRenderModeObj {
u8 vfilter[7];
} GXRenderModeObj;
+STATIC_ASSERT(sizeof(_GXRenderModeObj) == 60);
+
typedef struct _GXTexObj {
/* 0x00 */ u32 texture_filter;
/* 0x04 */ u32 texture_lod;
@@ -410,6 +413,12 @@ typedef enum _GXTexFmt {
/* 0x20 */ _GX_TF_CTF = 0x20
} GXTexFmt;
+typedef enum _GXGamma {
+ /* 0x0 */ GX_GM_1_0,
+ /* 0x0 */ GX_GM_1_7,
+ /* 0x0 */ GX_GM_2_2,
+} GXGamma;
+
typedef enum _GXTlutFmt {
/* 0x0 */ GX_TL_IA8,
/* 0x1 */ GX_TL_RGB565,
diff --git a/include/dolphin/os/OS.h b/include/dolphin/os/OS.h
index bdc80cb1cd..e34324bd38 100644
--- a/include/dolphin/os/OS.h
+++ b/include/dolphin/os/OS.h
@@ -7,6 +7,14 @@
#include "Runtime.PPCEABI.H/__va_arg.h"
#include "dolphin/types.h"
+#include "Runtime.PPCEABI.H/__va_arg.h"
+#include "dolphin/os/OSError.h"
+#include "dolphin/os/OSLink.h"
+
+#define OS_BUS_CLOCK (*(u32*)0x800000F8)
+#define OS_CORE_CLOCK (*(u32*)0x800000FC)
+#define OS_TIMER_CLOCK (OS_BUS_CLOCK / 4)
+
/* TODO: more structs, and get rid of the ones that are faked! */
#define OS_MESSAGE_NON_BLOCKING 0
diff --git a/include/dolphin/os/OSError.h b/include/dolphin/os/OSError.h
index 3a56600705..7dc8e04267 100644
--- a/include/dolphin/os/OSError.h
+++ b/include/dolphin/os/OSError.h
@@ -3,4 +3,31 @@
#include "dolphin/types.h"
+struct OSContext;
+
+extern u32 __OSFpscrEnableBits;
+
+typedef u16 OSError;
+typedef void (*OSErrorHandler)(OSError, OSContext*, u32, u32);
+
+#define OS_ERROR_SYSTEM_RESET 0x0
+#define OS_ERROR_MACHINE_CHECK 0x1
+#define OS_ERROR_DSI 0x2
+#define OS_ERROR_ISI 0x3
+#define OS_ERROR_INTERRUPT 0x4
+#define OS_ERROR_ALIGNMENT 0x5
+#define OS_ERROR_PROGRAM 0x6
+#define OS_ERROR_FLOATING_POINT 0x7
+#define OS_ERROR_DECREMENTER 0x8
+#define OS_ERROR_SYSTEM_CALL 0x9
+#define OS_ERROR_TRACE 0xa
+#define OS_ERROR_PERFORMANCE_MONITOR 0xb
+#define OS_ERROR_BREAKPOINT 0xc
+#define OS_ERROR_RESERVED 0xd
+#define OS_ERROR_THERMAL_INTERRUPT 0xe
+#define OS_ERROR_MEMORY_PROTECTION 0xf
+#define OS_ERROR_FLOATING_POINT_EXCEPTION 0x10
+
+extern "C" void OSSetErrorHandler(OSError, OSErrorHandler);
+
#endif /* OSERROR_H */
diff --git a/include/dolphin/os/OSLink.h b/include/dolphin/os/OSLink.h
index d9b0cb85a9..013e2be352 100644
--- a/include/dolphin/os/OSLink.h
+++ b/include/dolphin/os/OSLink.h
@@ -3,4 +3,34 @@
#include "dolphin/types.h"
+struct OSModuleInfo {
+ u32 id;
+ OSModuleInfo* next;
+ OSModuleInfo* prev;
+ u32 num_sections;
+ u32 section_info_offset;
+ u32 name_offset;
+ u32 name_size;
+ u32 version;
+ u32 bss_size;
+ u32 rel_offset;
+ u32 imp_offset;
+ u32 imp_size;
+ u8 prolog_section;
+ u8 epilog_section;
+ u8 unresolved_section;
+ u8 bss_section;
+ u32 prolog;
+ u32 epilog;
+ u32 unresolved;
+ u32 align;
+ u32 bss_align;
+ u32 fix_size;
+};
+
+struct OSSectionInfo {
+ u32 offset;
+ u32 size;
+};
+
#endif /* OSLINK_H */
diff --git a/include/global.h b/include/global.h
index 81c5a657dc..fb78565981 100644
--- a/include/global.h
+++ b/include/global.h
@@ -23,9 +23,13 @@
#define _SDA_BASE_(dummy) 0
#define _SDA2_BASE_(dummy) 0
+#ifndef IN_VSCODE_EDITOR
#define GLUE(a, b) a##b
#define GLUE2(a, b) GLUE(a, b)
#define STATIC_ASSERT(cond) typedef char GLUE2(static_assertion_failed, __LINE__)[(cond) ? 1 : -1]
+#else
+#define STATIC_ASSERT(...)
+#endif
struct JUTWarn {
JUTWarn& operator<<(const char*) { return *this; }
diff --git a/include/msl_c/math.h b/include/msl_c/math.h
index 998f1698c5..a966a8cce0 100644
--- a/include/msl_c/math.h
+++ b/include/msl_c/math.h
@@ -1,6 +1,7 @@
#ifndef MSL_MATH_H_
#define MSL_MATH_H_
+#include "MSL_C.PPCEABI.bare.H/MSL_Common/Src/float.h"
#include "dolphin/types.h"
extern "C" {
@@ -32,25 +33,7 @@ f64 fmod(f64, f64);
inline f32 fmodf(f32 f1, f32 f2) {
return fmod(f1, f2);
}
-inline s32 fpclassify(f32 f) {
- u32 var = *(u32*)&f;
- switch (var & 0x7F800000) {
- case 0x7F800000:
- if ((var & 0x7FFFFF) != 0) {
- return 1;
- } else {
- return 2;
- }
- case 0:
- if ((var & 0x7FFFFF) != 0) {
- return 5;
- } else {
- return 3;
- }
- default:
- return 4;
- }
-}
+
f64 frexp(f64, s32*);
f64 ldexp(f64, s32);
f64 modf(f64, f64*);
diff --git a/include/msl_c/string.h b/include/msl_c/string.h
new file mode 100644
index 0000000000..902f205f09
--- /dev/null
+++ b/include/msl_c/string.h
@@ -0,0 +1,27 @@
+#ifndef MSL_STRING_H_
+#define MSL_STRING_H_
+
+#include "Runtime.PPCEABI.H/__va_arg.h"
+#include "dolphin/types.h"
+
+// TODO: move to MSL_C.PPCEABI.bare.H/
+extern "C" {
+void memcpy(void*, const void*, s32);
+void* memset(void* dest, int ch, u32 count);
+char* strrchr(const char* s, int c);
+char* strchr(const char* s, int c);
+int strncmp(const char* s1, const char* s2, u32 n);
+int strcmp(const char* s1, const char* s2);
+int stricmp(const char*, const char*);
+char* strcat(char* dest, const char* source);
+char* strncpy(char* dest, const char* source, u32 n);
+char* strcpy(char* dest, const char* source);
+u32 strlen(const char* s);
+int tolower(int);
+int sprintf(char*, const char*, ...);
+int printf(const char*, ...);
+int snprintf(char*, u32, const char*, ...);
+size_t vsnprintf(char* buffer, size_t buffer_size, const char* format, va_list args);
+}
+
+#endif \ No newline at end of file