1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-12 01:40:47 +00:00

GCC support.

This commit is contained in:
ProjectRevoTPP 2021-12-02 21:00:42 -05:00
parent 4390dd74b6
commit 45ccb7fd05
7 changed files with 237 additions and 14 deletions

View 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;
}

View file

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

View file

@ -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[] = {