summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2024-09-08 23:11:41 +0200
committerGitHub <noreply@github.com>2024-09-08 17:11:41 -0400
commitc7ec814d7897456ecdf1772e395a13f048b5133d (patch)
treeb9324efea542b5f7402563925195b8797fc063be
parenta903f8b8bcc32d8f6c0a76ce5eeead271c297772 (diff)
[headers 9] Add src/libc64/ and new "z64" rand.h (#2164)
* rand.h -> libc64/qrand.h * Add rand.h with z64 rand wrappers * yeet comment * code/rand.c -> libc64/qrand.c * fixup * move libc64 source to src/libc64/ * fix * bss * update file splits disasm metadata
-rw-r--r--Makefile10
-rw-r--r--include/functions.h2
-rw-r--r--include/libc64/qrand.h18
-rw-r--r--include/rand.h15
-rw-r--r--include/z64.h1
-rw-r--r--spec22
-rw-r--r--src/code/z_actor.c1
-rw-r--r--src/libc64/__osMalloc_gc.c (renamed from src/code/__osMalloc_gc.c)0
-rw-r--r--src/libc64/__osMalloc_n64.c (renamed from src/code/__osMalloc_n64.c)0
-rw-r--r--src/libc64/aprintf.c (renamed from src/code/printutils.c)0
-rw-r--r--src/libc64/fp.s (renamed from src/code/fp.s)0
-rw-r--r--src/libc64/malloc.c (renamed from src/code/system_malloc.c)0
-rw-r--r--src/libc64/math64.c (renamed from src/code/fp_math.c)0
-rw-r--r--src/libc64/qrand.c (renamed from src/code/rand.c)2
-rw-r--r--src/libc64/sleep.c (renamed from src/boot/sleep.c)0
-rw-r--r--src/libc64/sprintf.c (renamed from src/boot/sprintf.c)0
-rw-r--r--src/overlays/actors/ovl_Fishing/z_fishing.c2
-rw-r--r--tools/disasm/ntsc-1.2/files_boot.csv2
-rw-r--r--tools/disasm/ntsc-1.2/files_code.csv26
19 files changed, 52 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index 8f1cba73d..2b098b672 100644
--- a/Makefile
+++ b/Makefile
@@ -421,15 +421,9 @@ endif
ifeq ($(COMPILER),ido)
$(BUILD_DIR)/src/boot/driverominit.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/boot/logutils.o: OPTFLAGS := -O2
-$(BUILD_DIR)/src/boot/sleep.o: OPTFLAGS := -O2
-$(BUILD_DIR)/src/boot/sprintf.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/boot/stackcheck.o: OPTFLAGS := -O2
-$(BUILD_DIR)/src/code/__osMalloc_n64.o: OPTFLAGS := -O2
-$(BUILD_DIR)/src/code/__osMalloc_gc.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/code_800FC620.o: OPTFLAGS := -O2
-$(BUILD_DIR)/src/code/fp_math.o: OPTFLAGS := -O2
-$(BUILD_DIR)/src/code/rand.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/gfxprint.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/jpegdecoder.o: OPTFLAGS := -O2
@@ -439,9 +433,7 @@ $(BUILD_DIR)/src/code/loadfragment2_gc.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/mtxuty-cvt.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/padsetup.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/padutils.o: OPTFLAGS := -O2
-$(BUILD_DIR)/src/code/printutils.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/relocation_gc.o: OPTFLAGS := -O2
-$(BUILD_DIR)/src/code/system_malloc.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/fault_n64.o: CFLAGS += -trapuv
$(BUILD_DIR)/src/code/fault_gc.o: CFLAGS += -trapuv
@@ -464,6 +456,8 @@ else
$(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -O2
endif
+$(BUILD_DIR)/src/libc64/%.o: OPTFLAGS := -O2
+
$(BUILD_DIR)/src/audio/%.o: OPTFLAGS := -O2
# Use signed chars instead of unsigned for this audio file (needed to match AudioDebug_ScrPrt)
diff --git a/include/functions.h b/include/functions.h
index 4bcd52766..6e2dbe87e 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -450,8 +450,6 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play);
void Actor_RequestQuake(PlayState* play, s16 y, s16 duration);
void Actor_RequestQuakeWithSpeed(PlayState* play, s16 y, s16 duration, s16 speed);
void Actor_RequestQuakeAndRumble(Actor* actor, PlayState* play, s16 quakeY, s16 quakeDuration);
-f32 Rand_ZeroFloat(f32 f);
-f32 Rand_CenteredFloat(f32 f);
void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type);
void func_8003424C(PlayState* play, Vec3f* arg1);
void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 bufFlag, s16 duration);
diff --git a/include/libc64/qrand.h b/include/libc64/qrand.h
new file mode 100644
index 000000000..cc66d4f43
--- /dev/null
+++ b/include/libc64/qrand.h
@@ -0,0 +1,18 @@
+#ifndef LIBC64_QRAND_H
+#define LIBC64_QRAND_H
+
+#include "ultra64.h"
+
+u32 Rand_Next(void);
+void Rand_Seed(u32 seed);
+f32 Rand_ZeroOne(void);
+void Rand_Seed_Variable(u32* rndNum, u32 seed);
+u32 Rand_Next_Variable(u32* rndNum);
+f32 Rand_ZeroOne_Variable(u32* rndNum);
+
+#if !PLATFORM_N64
+f32 Rand_Centered(void);
+f32 Rand_Centered_Variable(u32* rndNum);
+#endif
+
+#endif
diff --git a/include/rand.h b/include/rand.h
index 0f4f4d9cd..d6844f4b7 100644
--- a/include/rand.h
+++ b/include/rand.h
@@ -1,18 +1,9 @@
#ifndef RAND_H
#define RAND_H
-#include "ultra64.h"
+#include "libc64/qrand.h"
-u32 Rand_Next(void);
-void Rand_Seed(u32 seed);
-f32 Rand_ZeroOne(void);
-void Rand_Seed_Variable(u32* rndNum, u32 seed);
-u32 Rand_Next_Variable(u32* rndNum);
-f32 Rand_ZeroOne_Variable(u32* rndNum);
-
-#if !PLATFORM_N64
-f32 Rand_Centered(void);
-f32 Rand_Centered_Variable(u32* rndNum);
-#endif
+f32 Rand_ZeroFloat(f32 f);
+f32 Rand_CenteredFloat(f32 f);
#endif
diff --git a/include/z64.h b/include/z64.h
index 9fbb9b6a9..a4871aa83 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -63,6 +63,7 @@
#include "jpeg.h"
#include "prerender.h"
#include "rand.h"
+#include "libc64/qrand.h"
#include "sys_math.h"
#include "sys_math3d.h"
#include "fp_math.h"
diff --git a/spec b/spec
index 13a77dec9..ecb96a20d 100644
--- a/spec
+++ b/spec
@@ -33,10 +33,10 @@ beginseg
include "$(BUILD_DIR)/src/boot/stackcheck.o"
include "$(BUILD_DIR)/src/boot/logutils.o"
#if PLATFORM_N64
- include "$(BUILD_DIR)/src/boot/sleep.o"
+ include "$(BUILD_DIR)/src/libc64/sleep.o"
#endif
#if OOT_DEBUG
- include "$(BUILD_DIR)/src/boot/sprintf.o"
+ include "$(BUILD_DIR)/src/libc64/sprintf.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/piacs.o"
include "$(BUILD_DIR)/src/libultra/os/sendmesg.o"
@@ -614,21 +614,21 @@ beginseg
include "$(BUILD_DIR)/src/code/padutils.o"
include "$(BUILD_DIR)/src/code/padsetup.o"
#endif
- include "$(BUILD_DIR)/src/code/fp_math.o"
- include "$(BUILD_DIR)/src/code/fp.o"
- include "$(BUILD_DIR)/src/code/system_malloc.o"
- include "$(BUILD_DIR)/src/code/rand.o"
+ include "$(BUILD_DIR)/src/libc64/math64.o"
+ include "$(BUILD_DIR)/src/libc64/fp.o"
+ include "$(BUILD_DIR)/src/libc64/malloc.o"
+ include "$(BUILD_DIR)/src/libc64/qrand.o"
#if PLATFORM_N64
- include "$(BUILD_DIR)/src/code/__osMalloc_n64.o"
+ include "$(BUILD_DIR)/src/libc64/__osMalloc_n64.o"
#else
- include "$(BUILD_DIR)/src/code/__osMalloc_gc.o"
+ include "$(BUILD_DIR)/src/libc64/__osMalloc_gc.o"
#endif
#if !OOT_DEBUG
- include "$(BUILD_DIR)/src/boot/sprintf.o"
+ include "$(BUILD_DIR)/src/libc64/sprintf.o"
#endif
- include "$(BUILD_DIR)/src/code/printutils.o"
+ include "$(BUILD_DIR)/src/libc64/aprintf.o"
#if !PLATFORM_N64
- include "$(BUILD_DIR)/src/boot/sleep.o"
+ include "$(BUILD_DIR)/src/libc64/sleep.o"
#endif
include "$(BUILD_DIR)/src/code/jpegutils.o"
include "$(BUILD_DIR)/src/code/jpegdecoder.o"
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index e45d96552..8e1e39f78 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -1,6 +1,7 @@
#include "global.h"
#include "fault.h"
#include "quake.h"
+#include "rand.h"
#include "terminal.h"
#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"
diff --git a/src/code/__osMalloc_gc.c b/src/libc64/__osMalloc_gc.c
index 45e19532f..45e19532f 100644
--- a/src/code/__osMalloc_gc.c
+++ b/src/libc64/__osMalloc_gc.c
diff --git a/src/code/__osMalloc_n64.c b/src/libc64/__osMalloc_n64.c
index bd9c358af..bd9c358af 100644
--- a/src/code/__osMalloc_n64.c
+++ b/src/libc64/__osMalloc_n64.c
diff --git a/src/code/printutils.c b/src/libc64/aprintf.c
index 3fb8cf367..3fb8cf367 100644
--- a/src/code/printutils.c
+++ b/src/libc64/aprintf.c
diff --git a/src/code/fp.s b/src/libc64/fp.s
index d5b42094a..d5b42094a 100644
--- a/src/code/fp.s
+++ b/src/libc64/fp.s
diff --git a/src/code/system_malloc.c b/src/libc64/malloc.c
index de6a56b30..de6a56b30 100644
--- a/src/code/system_malloc.c
+++ b/src/libc64/malloc.c
diff --git a/src/code/fp_math.c b/src/libc64/math64.c
index 85fb4cedf..85fb4cedf 100644
--- a/src/code/fp_math.c
+++ b/src/libc64/math64.c
diff --git a/src/code/rand.c b/src/libc64/qrand.c
index d6199b189..69bfa11d7 100644
--- a/src/code/rand.c
+++ b/src/libc64/qrand.c
@@ -41,7 +41,7 @@
*
* @note Original name: qrand.c
*/
-#include "rand.h"
+#include "libc64/qrand.h"
#include "z64math.h"
#define RAND_MULTIPLIER 1664525
diff --git a/src/boot/sleep.c b/src/libc64/sleep.c
index 2b67088a1..2b67088a1 100644
--- a/src/boot/sleep.c
+++ b/src/libc64/sleep.c
diff --git a/src/boot/sprintf.c b/src/libc64/sprintf.c
index d4af36356..d4af36356 100644
--- a/src/boot/sprintf.c
+++ b/src/libc64/sprintf.c
diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c
index b60c3ee47..f862b6aec 100644
--- a/src/overlays/actors/ovl_Fishing/z_fishing.c
+++ b/src/overlays/actors/ovl_Fishing/z_fishing.c
@@ -15,7 +15,7 @@
#include "cic6105.h"
#endif
-#pragma increment_block_number "gc-eu:141 gc-eu-mq:141 gc-jp:143 gc-jp-ce:143 gc-jp-mq:143 gc-us:143 gc-us-mq:143"
+#pragma increment_block_number "gc-eu:140 gc-eu-mq:140 gc-jp:142 gc-jp-ce:142 gc-jp-mq:142 gc-us:142 gc-us-mq:142"
#define FLAGS ACTOR_FLAG_4
diff --git a/tools/disasm/ntsc-1.2/files_boot.csv b/tools/disasm/ntsc-1.2/files_boot.csv
index dcb6f0bf8..66aaa08b3 100644
--- a/tools/disasm/ntsc-1.2/files_boot.csv
+++ b/tools/disasm/ntsc-1.2/files_boot.csv
@@ -11,7 +11,7 @@ FD0,80001430,src/boot/z_locale
1530,80001990,src/boot/mio0
15E0,80001A40,src/boot/stackcheck
17F0,80001C50,src/boot/logutils
-1910,80001D70,src/boot/sleep
+1910,80001D70,src/libc64/sleep
1AB0,80001F10,src/libultra/io/piacs
1B70,80001FD0,src/libultra/os/sendmesg
1CC0,80002120,src/libultra/os/stopthread
diff --git a/tools/disasm/ntsc-1.2/files_code.csv b/tools/disasm/ntsc-1.2/files_code.csv
index dd1ac65e8..6b8f61f0a 100644
--- a/tools/disasm/ntsc-1.2/files_code.csv
+++ b/tools/disasm/ntsc-1.2/files_code.csv
@@ -128,13 +128,13 @@ BBA50,800CD130,src/code/loadfragment2_n64
BBF00,800CD5E0,src/code/padutils
BC110,800CD7F0,src/code/code_800FC620
BC530,800CDC10,src/code/padsetup
-BC670,800CDD50,src/code/fp_math
-BCA20,800CE100,src/code/fp
-BCB80,800CE260,src/code/system_malloc
-BCDF0,800CE4D0,src/code/rand
-BCEF0,800CE5D0,src/code/__osMalloc_n64
-BD8A0,800CEF80,src/boot/sprintf
-BD970,800CF050,src/code/printutils
+BC670,800CDD50,src/libc64/math64
+BCA20,800CE100,src/libc64/fp
+BCB80,800CE260,src/libc64/malloc
+BCDF0,800CE4D0,src/libc64/qrand
+BCEF0,800CE5D0,src/libc64/__osMalloc_n64
+BD8A0,800CEF80,src/libc64/sprintf
+BD970,800CF050,src/libc64/aprintf
BD9D0,800CF0B0,src/code/jpegutils
BDEE0,800CF5C0,src/code/jpegdecoder
BE4D0,800CFBB0,src/libultra/os/getintmask
@@ -291,9 +291,9 @@ F3330,80104A10,src/audio/session_config
F3AD0,801051B0,src/code/gfxprint
F4380,80105A60,src/code/loadfragment2_n64
F4390,80105A70,src/code/code_800FC620
-F43A0,80105A80,src/code/rand
-F43B0,80105A90,src/code/__osMalloc_n64
-F43C0,80105AA0,src/boot/sprintf
+F43A0,80105A80,src/libc64/qrand
+F43B0,80105A90,src/libc64/__osMalloc_n64
+F43C0,80105AA0,src/libc64/sprintf
F4400,80105AE0,src/libultra/gu/sins
F4C00,801062E0,src/libultra/io/siacs
F4C10,801062F0,src/libultra/io/controller
@@ -379,8 +379,8 @@ F9180,8010A860,src/audio/session_config
F9190,8010A870,src/code/gfxprint
F91D0,8010A8B0,src/code/rcp_utils
F9320,8010AA00,src/code/loadfragment2_n64
-F94C0,8010ABA0,src/code/fp_math
-F94E0,8010ABC0,src/code/__osMalloc_n64
+F94C0,8010ABA0,src/libc64/math64
+F94E0,8010ABC0,src/libc64/__osMalloc_n64
F9690,8010AD70,src/libultra/gu/sinf
F96E0,8010ADC0,src/libultra/gu/perspective
F96F0,8010ADD0,src/libultra/gu/lookathil
@@ -449,7 +449,7 @@ offset,vram,.bss
1139C0,801250A0,src/audio/sequence
114780,80125E60,src/audio/data
114820,80125F00,src/audio/session_config
-11AC90,8012C370,src/code/system_malloc
+11AC90,8012C370,src/libc64/malloc
11ACA0,8012C380,src/code/jpegdecoder
11ACB0,8012C390,src/libultra/io/sptask
11ACF0,8012C3D0,src/libultra/io/motor