diff --git a/Makefile b/Makefile index 8f1cba73d9..2b098b6726 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 4bcd52766b..6e2dbe87e6 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 0000000000..cc66d4f43b --- /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 0f4f4d9cd3..d6844f4b74 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 9fbb9b6a94..a4871aa830 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 13a77dec9a..ecb96a20d9 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 e45d96552e..8e1e39f78d 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 similarity index 100% rename from src/code/__osMalloc_gc.c rename to src/libc64/__osMalloc_gc.c diff --git a/src/code/__osMalloc_n64.c b/src/libc64/__osMalloc_n64.c similarity index 100% rename from src/code/__osMalloc_n64.c rename to src/libc64/__osMalloc_n64.c diff --git a/src/code/printutils.c b/src/libc64/aprintf.c similarity index 100% rename from src/code/printutils.c rename to src/libc64/aprintf.c diff --git a/src/code/fp.s b/src/libc64/fp.s similarity index 100% rename from src/code/fp.s rename to src/libc64/fp.s diff --git a/src/code/system_malloc.c b/src/libc64/malloc.c similarity index 100% rename from src/code/system_malloc.c rename to src/libc64/malloc.c diff --git a/src/code/fp_math.c b/src/libc64/math64.c similarity index 100% rename from src/code/fp_math.c rename to src/libc64/math64.c diff --git a/src/code/rand.c b/src/libc64/qrand.c similarity index 99% rename from src/code/rand.c rename to src/libc64/qrand.c index d6199b1890..69bfa11d72 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 similarity index 100% rename from src/boot/sleep.c rename to src/libc64/sleep.c diff --git a/src/boot/sprintf.c b/src/libc64/sprintf.c similarity index 100% rename from src/boot/sprintf.c rename to 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 b60c3ee476..f862b6aec2 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 dcb6f0bf87..66aaa08b36 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 dd1ac65e8b..6b8f61f0a2 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