diff --git a/.vscode/settings.json b/.vscode/settings.json index 3e57c050..f9a906b3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,6 +19,7 @@ "iosfwd": "cpp", "sstream": "cpp", "tuple": "cpp", - "defines.h": "c" + "defines.h": "c", + "math.h": "c" }, } \ No newline at end of file diff --git a/data/ranges.csv b/data/ranges.csv index 52f9122c..ca06a53f 100644 --- a/data/ranges.csv +++ b/data/ranges.csv @@ -2,9 +2,10 @@ ,,,,,,,,80406540,80406544,,,,,,,,,,,,,,,,, 80004000,80004380,,,,,80006a8c,80006aa8,,,,,,,,,,,,,,,,,,,sdk/msl/runtime/__mem.o ,,,,,,80007214,800079fc,,,,,80406580,80406598,,,,,,,,,,,,,sdk/msl/runtime/runtime.o +,,,,,,80010574,800105e0,,,,,,,,,,,,,,,,,,,sdk/msl/c/math_double.o 80004380,800062c0,,,,,,,,,,,,,,,,,,,,,,,,,sdk/trk/__exception.o ,,,,,,8001a0b0,8001a2c0,,,,,,,80421da0,80421dd7,,,,,,,,,,,sdk/rvl/base/PPCArch.o -,,,,,,8001a2c0,8001a45c,,,,,,,,,,,,,8055c778,8055c798,,,,,sdk/rvl/os/OS.o +,,,,,,8001a2c0,8001a45c,,,,,,,,,,,,,8055c778,8055c7b4,,,,,sdk/rvl/os/OS.o ,,,,,,8001c930,8001cf90,,,,,,,80422278,80422400,,,,,,,,,,,sdk/rvl/os/OSCache.o ,,,,,,8001cf90,8001d98c,,,,,,,80422400,804225b8,,,,,,,,,,,sdk/rvl/os/OSContext.o 800062c0,80006620,,,,,,,,,,,,,,,,,,,8055c878,8055c879,,,,,sdk/rvl/os/__start.o diff --git a/data/symbols.csv b/data/symbols.csv index 20bf5aaa..efb31d84 100644 --- a/data/symbols.csv +++ b/data/symbols.csv @@ -4,6 +4,9 @@ Address,SymbolName 800079fc,__init_cpp_exceptions 80007a38,__fini_cpp_exceptions 8000db3c,strcmp +80014004,floor +80014444,sin +80014588,acos 80015a14,InitMetroTRK 80015aac,InitMetroTRK_BBA 80015d28,__TRKreset diff --git a/include/dvd.h b/include/dvd.h index bf784b9c..51ab4480 100644 --- a/include/dvd.h +++ b/include/dvd.h @@ -1,11 +1,24 @@ #pragma once +#include + #ifdef __cplusplus extern "C" { #endif void DVDInit(void); +/* from libogc */ +typedef struct DVDDiskID { + u8 gamename[4]; + u8 company[2]; + u8 disknum; + u8 gamever; + u8 streaming; + u8 streambufsize; + u8 pad[22]; +} DVDDiskID; + #ifdef __cplusplus } #endif \ No newline at end of file diff --git a/include/math.h b/include/math.h new file mode 100644 index 00000000..086bb2d7 --- /dev/null +++ b/include/math.h @@ -0,0 +1,13 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +double acos(double x); +double floor(double x); +double sin(double x); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/include/os.h b/include/os.h index 4bfeb981..52559783 100644 --- a/include/os.h +++ b/include/os.h @@ -1,5 +1,6 @@ #pragma once +#include #include #ifdef __cplusplus @@ -30,6 +31,18 @@ typedef struct OSIOSRev { u16 year; } OSIOSRev; +typedef struct OSBootInfo { + DVDDiskID diskId; + u32 bootCode; + u32 version; + u32 physicalMemorySize; + u32 boardModel; + u32 arenaLo; + u32 arenaHi; + u32 startOfFST; + u32 fstSize; +} OSBootInfo; + #ifdef __cplusplus } #endif \ No newline at end of file diff --git a/sdk/msl/c/math_double.c b/sdk/msl/c/math_double.c new file mode 100644 index 00000000..9a3ef45f --- /dev/null +++ b/sdk/msl/c/math_double.c @@ -0,0 +1,6 @@ +#include +#include + +USED float acosf(float x) { return (float)acos((double)x); } +USED float floorf(float x) { return (float)floor((double)x); } +USED float sinf(float x) { return (float)sin((double)x); } \ No newline at end of file diff --git a/sdk/rvl/os/OS.c b/sdk/rvl/os/OS.c index ef6a586d..6a5fef2a 100644 --- a/sdk/rvl/os/OS.c +++ b/sdk/rvl/os/OS.c @@ -8,6 +8,12 @@ USED BOOL __OSInNandBoot = 0; USED BOOL __OSIsGcam = 0; static f64 ZeroF = 0.0; static f32 ZeroPS[2] = {0.0f, 0.0f}; +USED BOOL AreWeInitialized = 0; +USED void *OSExceptionTable; +USED char GameNameBuffer[5]; +USED BOOL BI2DebugFlagHolder; +USED BOOL *BI2DebugFlag; +USED OSBootInfo *BootInfo; #ifdef __CWCC__ diff --git a/src/bin/buildgen.rs b/src/bin/buildgen.rs index f8021b6b..22fa0f44 100644 --- a/src/bin/buildgen.rs +++ b/src/bin/buildgen.rs @@ -14,6 +14,7 @@ fn parse_hex(s: &str) -> Result { const SOURCES: &[(&str, &str)] = &[ ("sdk/msl/runtime/__mem.c", "msl"), ("sdk/msl/runtime/runtime.c", "msl"), + ("sdk/msl/c/math_double.c", "msl"), ("sdk/rvl/base/PPCArch.c", "sdk"), ("sdk/rvl/os/OS.c", "sdk"), ("sdk/rvl/os/OSCache.c", "sdk"),