summaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/O2/sprintf.c30
-rw-r--r--src/boot/boot_main.c2
-rw-r--r--src/boot/carthandle.c3
-rw-r--r--src/boot/viconfig.c2
-rw-r--r--src/boot/z_std_dma.c2
5 files changed, 37 insertions, 2 deletions
diff --git a/src/boot/O2/sprintf.c b/src/boot/O2/sprintf.c
new file mode 100644
index 000000000..773b982ff
--- /dev/null
+++ b/src/boot/O2/sprintf.c
@@ -0,0 +1,30 @@
+#include "ultra64.h"
+#include "libc/stdlib.h"
+#include "libc/string.h"
+
+void* proutSprintf(void* dst, const char* fmt, size_t size) {
+ return (void*)((uintptr_t)memcpy(dst, fmt, size) + size);
+}
+
+int vsprintf(char* dst, char* fmt, va_list args) {
+ int ans = _Printf(proutSprintf, dst, fmt, args);
+ if (ans > -1) {
+ dst[ans] = 0;
+ }
+ return ans;
+}
+
+int sprintf(char* dst, const char* fmt, ...) {
+ int ans;
+ va_list args;
+ va_start(args, fmt);
+
+ ans = _Printf(&proutSprintf, dst, fmt, args);
+ if (ans > -1) {
+ dst[ans] = 0;
+ }
+
+ va_end(args);
+
+ return ans;
+}
diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c
index cc2097f0f..0f95871ea 100644
--- a/src/boot/boot_main.c
+++ b/src/boot/boot_main.c
@@ -1,5 +1,5 @@
#include "prevent_bss_reordering.h"
-#include "global.h"
+#include "carthandle.h"
#include "idle.h"
#include "stack.h"
#include "stackcheck.h"
diff --git a/src/boot/carthandle.c b/src/boot/carthandle.c
new file mode 100644
index 000000000..9a4cf542d
--- /dev/null
+++ b/src/boot/carthandle.c
@@ -0,0 +1,3 @@
+#include "carthandle.h"
+
+OSPiHandle* gCartHandle = NULL;
diff --git a/src/boot/viconfig.c b/src/boot/viconfig.c
index ccba4e932..1b9f1135c 100644
--- a/src/boot/viconfig.c
+++ b/src/boot/viconfig.c
@@ -1,4 +1,4 @@
-#include "global.h"
+#include "libc/stdbool.h"
#include "idle.h"
void ViConfig_UpdateVi(u32 black) {
diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c
index ac4992264..5b5265629 100644
--- a/src/boot/z_std_dma.c
+++ b/src/boot/z_std_dma.c
@@ -1,8 +1,10 @@
#include "prevent_bss_reordering.h"
#include "global.h"
+#include "carthandle.h"
#include "fault.h"
#include "stack.h"
#include "stackcheck.h"
+#include "z64dma.h"
#include "z64thread.h"
size_t gDmaMgrDmaBuffSize = 0x2000;