math_double.c

This commit is contained in:
Charlotte 🦝 Delenk 2022-01-03 10:43:38 +01:00
parent 87050e5f85
commit 8531a087ee
Signed by: darkkirb
GPG key ID: 015E3768A70AFBC5
9 changed files with 59 additions and 2 deletions

View file

@ -19,6 +19,7 @@
"iosfwd": "cpp", "iosfwd": "cpp",
"sstream": "cpp", "sstream": "cpp",
"tuple": "cpp", "tuple": "cpp",
"defines.h": "c" "defines.h": "c",
"math.h": "c"
}, },
} }

View file

@ -2,9 +2,10 @@
,,,,,,,,80406540,80406544,,,,,,,,,,,,,,,,, ,,,,,,,,80406540,80406544,,,,,,,,,,,,,,,,,
80004000,80004380,,,,,80006a8c,80006aa8,,,,,,,,,,,,,,,,,,,sdk/msl/runtime/__mem.o 80004000,80004380,,,,,80006a8c,80006aa8,,,,,,,,,,,,,,,,,,,sdk/msl/runtime/__mem.o
,,,,,,80007214,800079fc,,,,,80406580,80406598,,,,,,,,,,,,,sdk/msl/runtime/runtime.o ,,,,,,80007214,800079fc,,,,,80406580,80406598,,,,,,,,,,,,,sdk/msl/runtime/runtime.o
,,,,,,80010574,800105e0,,,,,,,,,,,,,,,,,,,sdk/msl/c/math_double.o
80004380,800062c0,,,,,,,,,,,,,,,,,,,,,,,,,sdk/trk/__exception.o 80004380,800062c0,,,,,,,,,,,,,,,,,,,,,,,,,sdk/trk/__exception.o
,,,,,,8001a0b0,8001a2c0,,,,,,,80421da0,80421dd7,,,,,,,,,,,sdk/rvl/base/PPCArch.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 ,,,,,,8001c930,8001cf90,,,,,,,80422278,80422400,,,,,,,,,,,sdk/rvl/os/OSCache.o
,,,,,,8001cf90,8001d98c,,,,,,,80422400,804225b8,,,,,,,,,,,sdk/rvl/os/OSContext.o ,,,,,,8001cf90,8001d98c,,,,,,,80422400,804225b8,,,,,,,,,,,sdk/rvl/os/OSContext.o
800062c0,80006620,,,,,,,,,,,,,,,,,,,8055c878,8055c879,,,,,sdk/rvl/os/__start.o 800062c0,80006620,,,,,,,,,,,,,,,,,,,8055c878,8055c879,,,,,sdk/rvl/os/__start.o

1 .init start .init end extab start extab end extabindex start extabindex end .text start .text end .ctors start .ctors end .dtors start .dtors end .rodata start .rodata end .data start .data end .bss start .bss end .sdata start .sdata end .sbss start .sbss end .sdata2 start .sdata2 end .sbss2 start .sbss2 end File
2 80406540 80406544
3 80004000 80004380 80006a8c 80006aa8 sdk/msl/runtime/__mem.o
4 80007214 800079fc 80406580 80406598 sdk/msl/runtime/runtime.o
5 80010574 800105e0 sdk/msl/c/math_double.o
6 80004380 800062c0 sdk/trk/__exception.o
7 8001a0b0 8001a2c0 80421da0 80421dd7 sdk/rvl/base/PPCArch.o
8 8001a2c0 8001a45c 8055c778 8055c798 8055c7b4 sdk/rvl/os/OS.o
9 8001c930 8001cf90 80422278 80422400 sdk/rvl/os/OSCache.o
10 8001cf90 8001d98c 80422400 804225b8 sdk/rvl/os/OSContext.o
11 800062c0 80006620 8055c878 8055c879 sdk/rvl/os/__start.o

View file

@ -4,6 +4,9 @@ Address,SymbolName
800079fc,__init_cpp_exceptions 800079fc,__init_cpp_exceptions
80007a38,__fini_cpp_exceptions 80007a38,__fini_cpp_exceptions
8000db3c,strcmp 8000db3c,strcmp
80014004,floor
80014444,sin
80014588,acos
80015a14,InitMetroTRK 80015a14,InitMetroTRK
80015aac,InitMetroTRK_BBA 80015aac,InitMetroTRK_BBA
80015d28,__TRKreset 80015d28,__TRKreset

1 Address SymbolName
4 800079fc __init_cpp_exceptions
5 80007a38 __fini_cpp_exceptions
6 8000db3c strcmp
7 80014004 floor
8 80014444 sin
9 80014588 acos
10 80015a14 InitMetroTRK
11 80015aac InitMetroTRK_BBA
12 80015d28 __TRKreset

View file

@ -1,11 +1,24 @@
#pragma once #pragma once
#include <types.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void DVDInit(void); 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 #ifdef __cplusplus
} }
#endif #endif

13
include/math.h Normal file
View file

@ -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

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <dvd.h>
#include <types.h> #include <types.h>
#ifdef __cplusplus #ifdef __cplusplus
@ -30,6 +31,18 @@ typedef struct OSIOSRev {
u16 year; u16 year;
} OSIOSRev; } 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 #ifdef __cplusplus
} }
#endif #endif

6
sdk/msl/c/math_double.c Normal file
View file

@ -0,0 +1,6 @@
#include <defines.h>
#include <math.h>
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); }

View file

@ -8,6 +8,12 @@ USED BOOL __OSInNandBoot = 0;
USED BOOL __OSIsGcam = 0; USED BOOL __OSIsGcam = 0;
static f64 ZeroF = 0.0; static f64 ZeroF = 0.0;
static f32 ZeroPS[2] = {0.0f, 0.0f}; 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__ #ifdef __CWCC__

View file

@ -14,6 +14,7 @@ fn parse_hex(s: &str) -> Result<u32, ParseIntError> {
const SOURCES: &[(&str, &str)] = &[ const SOURCES: &[(&str, &str)] = &[
("sdk/msl/runtime/__mem.c", "msl"), ("sdk/msl/runtime/__mem.c", "msl"),
("sdk/msl/runtime/runtime.c", "msl"), ("sdk/msl/runtime/runtime.c", "msl"),
("sdk/msl/c/math_double.c", "msl"),
("sdk/rvl/base/PPCArch.c", "sdk"), ("sdk/rvl/base/PPCArch.c", "sdk"),
("sdk/rvl/os/OS.c", "sdk"), ("sdk/rvl/os/OS.c", "sdk"),
("sdk/rvl/os/OSCache.c", "sdk"), ("sdk/rvl/os/OSCache.c", "sdk"),