summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorYanis002 <35189056+Yanis002@users.noreply.github.com>2025-06-29 21:29:34 +0200
committerYanis002 <35189056+Yanis002@users.noreply.github.com>2025-06-29 21:29:34 +0200
commit0f53991581f38ff989aec005414d46a4ace702d1 (patch)
tree305793c706925ee7328b4a1a9a3fe4dab08d01c7 /libs
parent1c9bf116969f08fbca76f1b8630f17f683519c7f (diff)
parent3fe49695b4936ea29526eb8b7d07250a69a06c38 (diff)
Merge remote-tracking branch 'upstream/main' into displaytext
Diffstat (limited to 'libs')
-rw-r--r--libs/c/include/stddef.h2
-rw-r--r--libs/c/include/stdio.h6
-rw-r--r--libs/nds/include/nds/math.h9
-rw-r--r--libs/nds/include/nds/overlay.h (renamed from libs/nds/include/nds/Overlay.h)11
-rw-r--r--libs/nds/src/itcm/math_1.c2
5 files changed, 26 insertions, 4 deletions
diff --git a/libs/c/include/stddef.h b/libs/c/include/stddef.h
index 4986043a..4858fe46 100644
--- a/libs/c/include/stddef.h
+++ b/libs/c/include/stddef.h
@@ -5,4 +5,6 @@
typedef unsigned int size_t;
+#define offsetof(type, member) ((size_t) &((type *) NULL)->member)
+
#endif
diff --git a/libs/c/include/stdio.h b/libs/c/include/stdio.h
new file mode 100644
index 00000000..3b49b3aa
--- /dev/null
+++ b/libs/c/include/stdio.h
@@ -0,0 +1,6 @@
+#ifndef _C_STDIO_H
+#define _C_STDIO_H
+
+int sprintf(char *__restrict s, const char *__restrict format, ...);
+
+#endif
diff --git a/libs/nds/include/nds/math.h b/libs/nds/include/nds/math.h
index 517cbde2..18332db1 100644
--- a/libs/nds/include/nds/math.h
+++ b/libs/nds/include/nds/math.h
@@ -8,6 +8,8 @@
extern "C" {
#endif
+#define ABS(x) ((x) < 0 ? -(x) : (x))
+
// Q20.12 fixed point number
typedef s32 q20;
// Q4.12 fixed point number
@@ -19,6 +21,7 @@ typedef s16 q4;
#define FLOAT_TO_Q19(n) ((s32) (((n) * 8192 + 1)))
#define ROUND_Q20(n) (((s32) (n) + 0x800) >> 12)
#define MUL_Q20(a, b) (q20)((((s64) (a)) * ((s64) (b)) + 0x800) >> 12)
+#define DIV_Q20(a, b) (((a) << 12) / (b))
#define DEG_TO_ANG(n) ((n) * 0x10000 / 360)
#define SIN(n) (gSinCosTable[2 * ((n) >> 4)])
@@ -31,7 +34,7 @@ u32 SoftDivide(u32 a, u32 b);
u32 CoDivide64By32(u32 a, u32 b);
u32 func_01ff98f0(u32 a, u32 b);
u32 CoReciprocal(u32 x);
-u32 func_01ff992c(u32 x);
+u64 func_01ff992c(u32 x);
u32 CoSqrt(u32 x);
u32 CoInvSqrt(u32 x);
u32 AwaitDivisionResult();
@@ -49,8 +52,8 @@ bool Approach_thunk(unk32 *src, unk32 dest, unk32 step);
extern q4 gSinCosTable[];
typedef struct {
- /* 0 */ s8 x;
- /* 1 */ s8 y;
+ /* 0 */ u8 x;
+ /* 1 */ u8 y;
/* 2 */
} Vec2b;
diff --git a/libs/nds/include/nds/Overlay.h b/libs/nds/include/nds/overlay.h
index 7a8c6fa9..254253bd 100644
--- a/libs/nds/include/nds/Overlay.h
+++ b/libs/nds/include/nds/overlay.h
@@ -1,6 +1,13 @@
#ifndef _NDS_OVERLAY_H
#define _NDS_OVERLAY_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define EXTERN_OVERLAY_ID(name_or_index) extern u32 OVERLAY_##name_or_index##_ID;
+#define OVERLAY_ID(name_or_index) ((u32) & OVERLAY_##name_or_index##_ID)
+
typedef struct Overlay {
/* 00 */ unk32 mId;
/* 04 */ void *mBaseAddress;
@@ -27,4 +34,8 @@ bool Overlay_Destroy(Overlay *overlay);
bool Overlay_Load(Overlay *overlay, unk32 param2);
bool Overlay_Unload(Overlay *overlay, unk32 param2);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libs/nds/src/itcm/math_1.c b/libs/nds/src/itcm/math_1.c
index ee452869..bbc5f740 100644
--- a/libs/nds/src/itcm/math_1.c
+++ b/libs/nds/src/itcm/math_1.c
@@ -37,7 +37,7 @@ void Mat4p_Multiply(Mat4p *a, Mat4p *b, Mat4p *out) {}
u32 CoDivide64By32(u32 a, u32 b) {}
u32 func_01ff98f0(u32 a, u32 b) {}
u32 CoReciprocal(u32 x) {}
-u32 func_01ff992c(u32 x) {}
+u64 func_01ff992c(u32 x) {}
u32 CoSqrt(u32 x) {}
u32 CoInvSqrt(u32 x) {}
u32 AwaitDivisionResult() {}