mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-12 01:40:47 +00:00
GCC support.
This commit is contained in:
parent
4390dd74b6
commit
45ccb7fd05
7 changed files with 237 additions and 14 deletions
68
src/boot/missing_gcc_functions.c
Normal file
68
src/boot/missing_gcc_functions.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include "global.h"
|
||||
|
||||
// Define functions needed for the GCC build here.
|
||||
|
||||
// Self-hosted memcmp.
|
||||
int memcmp(void *s1, const void *s2, size_t n) {
|
||||
u8 *m1 = (u8 *)s1;
|
||||
u8 *m2 = (u8 *)s2;
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
if (m1[i] < m2[i]) {
|
||||
return -1;
|
||||
} else if (m1[i] > m2[i]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *memset(void *str, int c, size_t n) {
|
||||
u8 *m1 = (u8 *)str;
|
||||
int i;
|
||||
for(i = 0; i < n; i++) {
|
||||
m1[i] = c;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
// These functions convert c to an unsigned integer, rounding toward zero. Negative values
|
||||
// all become zero.
|
||||
u32 __fixunssfdi(f32 a) {
|
||||
if (a < 0.0f)
|
||||
a = 0.0f;
|
||||
return (u32)a;
|
||||
}
|
||||
|
||||
u32 __fixunsdfdi(f64 a) {
|
||||
if (a < 0.0)
|
||||
a = 0.0;
|
||||
return (u32)a;
|
||||
}
|
||||
|
||||
// These functions convert c to a signed integer, rounding toward zero.
|
||||
s32 __fixsfdi(f32 c) {
|
||||
return (s32)c;
|
||||
}
|
||||
|
||||
s32 __fixdfdi(f64 c) {
|
||||
return (s32)c;
|
||||
}
|
||||
|
||||
// These functions convert c, a signed integer, to floating point.
|
||||
f32 __floatdisf(s32 c) {
|
||||
return (f32)c;
|
||||
}
|
||||
|
||||
f64 __floatdidf(s32 c) {
|
||||
return (f64)c;
|
||||
}
|
||||
|
||||
// These functions convert c, an unsigned integer, to floating point.
|
||||
f32 __floatundisf(u32 c) {
|
||||
return (f32)c;
|
||||
}
|
||||
|
||||
f64 __floatundidf(u32 c) {
|
||||
return (f64)c;
|
||||
}
|
|
@ -1021,7 +1021,9 @@ void* AudioHeap_AllocPermanent(s32 tableType, s32 id, u32 size) {
|
|||
gAudioContext.permanentCache[index].size = size;
|
||||
//! @bug UB: missing return. "ret" is in v0 at this point, but doing an
|
||||
// explicit return uses an additional register.
|
||||
// return ret;
|
||||
#ifdef AVOID_UB
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
void* AudioHeap_AllocSampleCache(u32 size, s32 fontId, void* sampleAddr, s8 medium, s32 cache) {
|
||||
|
|
|
@ -35,6 +35,9 @@ const ActorInit En_Tana_InitVars = {
|
|||
static const char* sShelfTypes[] = {
|
||||
"木の棚", // "Wooden Shelves"
|
||||
"石の棚", // "Stone Shelves"
|
||||
#ifdef AVOID_UB
|
||||
"",
|
||||
#endif
|
||||
};
|
||||
|
||||
static const ActorFunc sDrawFuncs[] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue