diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2023-08-10 11:41:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-10 11:41:19 -0400 |
| commit | 0d54e2ae4c473be47dba69ef6d560c49cc86d053 (patch) | |
| tree | 7d4134acde42d6bfb10dad1260907b08694aefce /include | |
| parent | 04b31d912636eaea12a0b6f3d5e822605da68504 (diff) | |
`libc64.a` identification (#45)
* __osMalloc
* aprintf.c
* math64.c
* qrand.c
* sleep.c
* sprintf.c
* malloc.c
* fixes
* fp and math64 cleanup
* RAD_TO_BINANG
Diffstat (limited to 'include')
| -rw-r--r-- | include/boot_variables.h | 19 | ||||
| -rw-r--r-- | include/libc64/aprintf.h | 9 | ||||
| -rw-r--r-- | include/libc64/fp.h (renamed from include/fp.h) | 8 | ||||
| -rw-r--r-- | include/libc64/malloc.h | 8 | ||||
| -rw-r--r-- | include/libc64/math64.h (renamed from include/mathf.h) | 4 | ||||
| -rw-r--r-- | include/libc64/qrand.h (renamed from include/qrand.h) | 4 | ||||
| -rw-r--r-- | include/libc64/sleep.h (renamed from include/sleep.h) | 4 | ||||
| -rw-r--r-- | include/libc64/sprintf.h (renamed from include/sprintf.h) | 4 | ||||
| -rw-r--r-- | include/printutils.h | 9 | ||||
| -rw-r--r-- | include/z64math.h | 16 |
10 files changed, 40 insertions, 45 deletions
diff --git a/include/boot_variables.h b/include/boot_variables.h index c85f519..ecd5b60 100644 --- a/include/boot_variables.h +++ b/include/boot_variables.h @@ -21,8 +21,8 @@ extern OSPiHandle* gCartHandle; // TODO: Determine where this goes // extern UNK_TYPE D_8003BC94_jp; // extern UNK_TYPE D_8003C560_jp; -// extern UNK_TYPE D_FLT_8003C584_jp; -// extern UNK_TYPE D_8003C590_jp; + +// extern UNK_TYPE __qrand_idum; // .rodata @@ -193,18 +193,7 @@ extern OSPiHandle* gCartHandle; // TODO: Determine where this goes // extern UNK_TYPE RO_STR_8003E27C_jp; // extern UNK_TYPE jtbl_8003E290_jp; // extern UNK_TYPE RO_STR_8003E2B0_jp; -// extern UNK_TYPE RO_FLT_8003E2C0_jp; -// extern UNK_TYPE RO_FLT_8003E2E4_jp; -// extern UNK_TYPE RO_FLT_8003E2E8_jp; -// extern UNK_TYPE RO_FLT_8003E2EC_jp; -// extern UNK_TYPE RO_FLT_8003E2F0_jp; -// extern UNK_TYPE RO_FLT_8003E2F4_jp; -// extern UNK_TYPE RO_FLT_8003E2F8_jp; -// extern UNK_TYPE RO_FLT_8003E2FC_jp; -// extern UNK_TYPE RO_FLT_8003E300_jp; -// extern UNK_TYPE RO_FLT_8003E304_jp; -// extern UNK_TYPE RO_FLT_8003E308_jp; -// extern UNK_TYPE RO_FLT_8003E30C_jp; + // extern UNK_TYPE RO_STR_8003E310_jp; // extern UNK_TYPE RO_STR_8003E328_jp; // extern UNK_TYPE RO_STR_8003E35C_jp; @@ -281,8 +270,6 @@ extern OSPiHandle* gCartHandle; // TODO: Determine where this goes // extern UNK_TYPE B_80041995_jp; // extern UNK_TYPE B_80041998_jp; -// extern UNK_TYPE B_800419F0_jp; - // extern UNK_TYPE B_80044684_jp; diff --git a/include/libc64/aprintf.h b/include/libc64/aprintf.h new file mode 100644 index 0000000..282caa3 --- /dev/null +++ b/include/libc64/aprintf.h @@ -0,0 +1,9 @@ +#ifndef LIBC64_APRINTF_H +#define LIBC64_APRINTF_H + +#include "ultra64.h" + +// void vaprintf(); +// void aprintf(); + +#endif diff --git a/include/fp.h b/include/libc64/fp.h index 6649fba..98de52a 100644 --- a/include/fp.h +++ b/include/libc64/fp.h @@ -1,5 +1,5 @@ -#ifndef FP_H -#define FP_H +#ifndef LIBC64_FP_H +#define LIBC64_FP_H #include "ultra64.h" @@ -24,4 +24,8 @@ f64 nearbyint(f64 x); // void lroundf(); // void lround(); +extern f32 qNaN0x3FFFFF; +extern f32 qNaN0x10000; +extern f32 sNaN0x3FFFFF; + #endif diff --git a/include/libc64/malloc.h b/include/libc64/malloc.h index 47367a3..3ebbb4d 100644 --- a/include/libc64/malloc.h +++ b/include/libc64/malloc.h @@ -1,8 +1,10 @@ -#ifndef MALLOC_H -#define MALLOC_H +#ifndef LIBC64_MALLOC_H +#define LIBC64_MALLOC_H #include "ultra64.h" +struct Arena; + void* malloc(size_t size); void* malloc_r(size_t size); void* realloc(void* ptr, size_t size); @@ -14,4 +16,6 @@ void MallocInit(void* heap, size_t size); void MallocCleanup(void); s32 MallocIsInitialized(void); +extern struct Arena malloc_arena; + #endif diff --git a/include/mathf.h b/include/libc64/math64.h index 01abe31..73b7f62 100644 --- a/include/mathf.h +++ b/include/libc64/math64.h @@ -12,8 +12,8 @@ // void Math_FAtanTaylorQF(); // void Math_FAtanTaylorF(); // void Math_FAtanContFracF(); -// void Math_FAtanF(); -f32 Math_FAtan2F(f32 y, f32 x); +// void fatan(); +f32 fatan2(f32 y, f32 x); // void Math_FAsinF(); // void Math_FAcosF(); diff --git a/include/qrand.h b/include/libc64/qrand.h index 5a4b9d2..0e6ee34 100644 --- a/include/qrand.h +++ b/include/libc64/qrand.h @@ -1,5 +1,5 @@ -#ifndef QRAND_H -#define QRAND_H +#ifndef LIBC64_QRAND_H +#define LIBC64_QRAND_H #include "ultra64.h" diff --git a/include/sleep.h b/include/libc64/sleep.h index 8080a15..17552c6 100644 --- a/include/sleep.h +++ b/include/libc64/sleep.h @@ -1,5 +1,5 @@ -#ifndef SLEEP_H -#define SLEEP_H +#ifndef LIBC64_SLEEP_H +#define LIBC64_SLEEP_H #include "ultra64.h" diff --git a/include/sprintf.h b/include/libc64/sprintf.h index f7ce338..8707f8f 100644 --- a/include/sprintf.h +++ b/include/libc64/sprintf.h @@ -1,5 +1,5 @@ -#ifndef SPRINTF_H -#define SPRINTF_H +#ifndef LIBC64_SPRINTF_H +#define LIBC64_SPRINTF_H #include "ultra64.h" diff --git a/include/printutils.h b/include/printutils.h deleted file mode 100644 index 4e627ef..0000000 --- a/include/printutils.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef PRINT_UTILS_H -#define PRINT_UTILS_H - -#include "ultra64.h" - -// void vaprintf(); -// void PrintUtils_Printf(); - -#endif diff --git a/include/z64math.h b/include/z64math.h index 9def95f..25f2c42 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -67,20 +67,20 @@ typedef union { #define TRUNCF_BINANG(f) (s16)(s32)(f) // Angle conversion macros -#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f)) +#define DEG_TO_RAD(degrees) ((degrees) * ((f32)M_PI / 180.0f)) #define DEG_TO_BINANG(degrees) TRUNCF_BINANG((degrees) * (0x8000 / 180.0f)) #define DEG_TO_BINANG_ALT(degrees) TRUNCF_BINANG(((degrees) / 180.0f) * 0x8000) #define DEG_TO_BINANG_ALT2(degrees) TRUNCF_BINANG(((degrees) * 0x10000) / 360.0f) #define DEG_TO_BINANG_ALT3(degrees) ((degrees) * (0x8000 / 180.0f)) -#define RAD_TO_DEG(radians) ((radians) * (180.0f / M_PI)) -#define RAD_TO_BINANG(radians) TRUNCF_BINANG((radians) * (0x8000 / M_PI)) -#define RAD_TO_BINANG_ALT(radians) TRUNCF_BINANG(((radians) / M_PI) * 0x8000) -#define RAD_TO_BINANG_ALT2(radians) TRUNCF_BINANG(((radians) * 0x8000) / M_PI) +#define RAD_TO_DEG(radians) ((radians) * (180.0f / (f32)M_PI)) +#define RAD_TO_BINANG(radians) TRUNCF_BINANG((radians) * (0x8000 / (f32)M_PI)) +#define RAD_TO_BINANG_ALT(radians) TRUNCF_BINANG(((radians) / (f32)M_PI) * 0x8000) +#define RAD_TO_BINANG_ALT2(radians) TRUNCF_BINANG(((radians) * 0x8000) / (f32)M_PI) #define BINANG_TO_DEG(binang) ((f32)(binang) * (180.0f / 0x8000)) -#define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PI / 0x8000)) -#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * M_PI) -#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PI) / 0x8000) +#define BINANG_TO_RAD(binang) ((f32)(binang) * ((f32)M_PI / 0x8000)) +#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * (f32)M_PI) +#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * (f32)M_PI) / 0x8000) #endif |
