1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 01:34:18 +00:00

[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
This commit is contained in:
Dragorn421 2024-09-08 23:11:41 +02:00 committed by GitHub
parent a903f8b8bc
commit c7ec814d78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 52 additions and 49 deletions

View file

@ -421,15 +421,9 @@ endif
ifeq ($(COMPILER),ido) ifeq ($(COMPILER),ido)
$(BUILD_DIR)/src/boot/driverominit.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/boot/driverominit.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/boot/logutils.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/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/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/gfxprint.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/jpegdecoder.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/mtxuty-cvt.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/padsetup.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/padsetup.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/padutils.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/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_n64.o: CFLAGS += -trapuv
$(BUILD_DIR)/src/code/fault_gc.o: CFLAGS += -trapuv $(BUILD_DIR)/src/code/fault_gc.o: CFLAGS += -trapuv
@ -464,6 +456,8 @@ else
$(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -O2
endif endif
$(BUILD_DIR)/src/libc64/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/audio/%.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) # Use signed chars instead of unsigned for this audio file (needed to match AudioDebug_ScrPrt)

View file

@ -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_RequestQuake(PlayState* play, s16 y, s16 duration);
void Actor_RequestQuakeWithSpeed(PlayState* play, s16 y, s16 duration, s16 speed); void Actor_RequestQuakeWithSpeed(PlayState* play, s16 y, s16 duration, s16 speed);
void Actor_RequestQuakeAndRumble(Actor* actor, PlayState* play, s16 quakeY, s16 quakeDuration); 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 Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type);
void func_8003424C(PlayState* play, Vec3f* arg1); void func_8003424C(PlayState* play, Vec3f* arg1);
void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 bufFlag, s16 duration); void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 bufFlag, s16 duration);

18
include/libc64/qrand.h Normal file
View file

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

View file

@ -1,18 +1,9 @@
#ifndef RAND_H #ifndef RAND_H
#define RAND_H #define RAND_H
#include "ultra64.h" #include "libc64/qrand.h"
u32 Rand_Next(void); f32 Rand_ZeroFloat(f32 f);
void Rand_Seed(u32 seed); f32 Rand_CenteredFloat(f32 f);
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 #endif

View file

@ -63,6 +63,7 @@
#include "jpeg.h" #include "jpeg.h"
#include "prerender.h" #include "prerender.h"
#include "rand.h" #include "rand.h"
#include "libc64/qrand.h"
#include "sys_math.h" #include "sys_math.h"
#include "sys_math3d.h" #include "sys_math3d.h"
#include "fp_math.h" #include "fp_math.h"

22
spec
View file

@ -33,10 +33,10 @@ beginseg
include "$(BUILD_DIR)/src/boot/stackcheck.o" include "$(BUILD_DIR)/src/boot/stackcheck.o"
include "$(BUILD_DIR)/src/boot/logutils.o" include "$(BUILD_DIR)/src/boot/logutils.o"
#if PLATFORM_N64 #if PLATFORM_N64
include "$(BUILD_DIR)/src/boot/sleep.o" include "$(BUILD_DIR)/src/libc64/sleep.o"
#endif #endif
#if OOT_DEBUG #if OOT_DEBUG
include "$(BUILD_DIR)/src/boot/sprintf.o" include "$(BUILD_DIR)/src/libc64/sprintf.o"
#endif #endif
include "$(BUILD_DIR)/src/libultra/io/piacs.o" include "$(BUILD_DIR)/src/libultra/io/piacs.o"
include "$(BUILD_DIR)/src/libultra/os/sendmesg.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/padutils.o"
include "$(BUILD_DIR)/src/code/padsetup.o" include "$(BUILD_DIR)/src/code/padsetup.o"
#endif #endif
include "$(BUILD_DIR)/src/code/fp_math.o" include "$(BUILD_DIR)/src/libc64/math64.o"
include "$(BUILD_DIR)/src/code/fp.o" include "$(BUILD_DIR)/src/libc64/fp.o"
include "$(BUILD_DIR)/src/code/system_malloc.o" include "$(BUILD_DIR)/src/libc64/malloc.o"
include "$(BUILD_DIR)/src/code/rand.o" include "$(BUILD_DIR)/src/libc64/qrand.o"
#if PLATFORM_N64 #if PLATFORM_N64
include "$(BUILD_DIR)/src/code/__osMalloc_n64.o" include "$(BUILD_DIR)/src/libc64/__osMalloc_n64.o"
#else #else
include "$(BUILD_DIR)/src/code/__osMalloc_gc.o" include "$(BUILD_DIR)/src/libc64/__osMalloc_gc.o"
#endif #endif
#if !OOT_DEBUG #if !OOT_DEBUG
include "$(BUILD_DIR)/src/boot/sprintf.o" include "$(BUILD_DIR)/src/libc64/sprintf.o"
#endif #endif
include "$(BUILD_DIR)/src/code/printutils.o" include "$(BUILD_DIR)/src/libc64/aprintf.o"
#if !PLATFORM_N64 #if !PLATFORM_N64
include "$(BUILD_DIR)/src/boot/sleep.o" include "$(BUILD_DIR)/src/libc64/sleep.o"
#endif #endif
include "$(BUILD_DIR)/src/code/jpegutils.o" include "$(BUILD_DIR)/src/code/jpegutils.o"
include "$(BUILD_DIR)/src/code/jpegdecoder.o" include "$(BUILD_DIR)/src/code/jpegdecoder.o"

View file

@ -1,6 +1,7 @@
#include "global.h" #include "global.h"
#include "fault.h" #include "fault.h"
#include "quake.h" #include "quake.h"
#include "rand.h"
#include "terminal.h" #include "terminal.h"
#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h" #include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"

View file

@ -41,7 +41,7 @@
* *
* @note Original name: qrand.c * @note Original name: qrand.c
*/ */
#include "rand.h" #include "libc64/qrand.h"
#include "z64math.h" #include "z64math.h"
#define RAND_MULTIPLIER 1664525 #define RAND_MULTIPLIER 1664525

View file

@ -15,7 +15,7 @@
#include "cic6105.h" #include "cic6105.h"
#endif #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 #define FLAGS ACTOR_FLAG_4

View file

@ -11,7 +11,7 @@ FD0,80001430,src/boot/z_locale
1530,80001990,src/boot/mio0 1530,80001990,src/boot/mio0
15E0,80001A40,src/boot/stackcheck 15E0,80001A40,src/boot/stackcheck
17F0,80001C50,src/boot/logutils 17F0,80001C50,src/boot/logutils
1910,80001D70,src/boot/sleep 1910,80001D70,src/libc64/sleep
1AB0,80001F10,src/libultra/io/piacs 1AB0,80001F10,src/libultra/io/piacs
1B70,80001FD0,src/libultra/os/sendmesg 1B70,80001FD0,src/libultra/os/sendmesg
1CC0,80002120,src/libultra/os/stopthread 1CC0,80002120,src/libultra/os/stopthread

1 offset vram .text
11 1530 80001990 src/boot/mio0
12 15E0 80001A40 src/boot/stackcheck
13 17F0 80001C50 src/boot/logutils
14 1910 80001D70 src/boot/sleep src/libc64/sleep
15 1AB0 80001F10 src/libultra/io/piacs
16 1B70 80001FD0 src/libultra/os/sendmesg
17 1CC0 80002120 src/libultra/os/stopthread

View file

@ -128,13 +128,13 @@ BBA50,800CD130,src/code/loadfragment2_n64
BBF00,800CD5E0,src/code/padutils BBF00,800CD5E0,src/code/padutils
BC110,800CD7F0,src/code/code_800FC620 BC110,800CD7F0,src/code/code_800FC620
BC530,800CDC10,src/code/padsetup BC530,800CDC10,src/code/padsetup
BC670,800CDD50,src/code/fp_math BC670,800CDD50,src/libc64/math64
BCA20,800CE100,src/code/fp BCA20,800CE100,src/libc64/fp
BCB80,800CE260,src/code/system_malloc BCB80,800CE260,src/libc64/malloc
BCDF0,800CE4D0,src/code/rand BCDF0,800CE4D0,src/libc64/qrand
BCEF0,800CE5D0,src/code/__osMalloc_n64 BCEF0,800CE5D0,src/libc64/__osMalloc_n64
BD8A0,800CEF80,src/boot/sprintf BD8A0,800CEF80,src/libc64/sprintf
BD970,800CF050,src/code/printutils BD970,800CF050,src/libc64/aprintf
BD9D0,800CF0B0,src/code/jpegutils BD9D0,800CF0B0,src/code/jpegutils
BDEE0,800CF5C0,src/code/jpegdecoder BDEE0,800CF5C0,src/code/jpegdecoder
BE4D0,800CFBB0,src/libultra/os/getintmask BE4D0,800CFBB0,src/libultra/os/getintmask
@ -291,9 +291,9 @@ F3330,80104A10,src/audio/session_config
F3AD0,801051B0,src/code/gfxprint F3AD0,801051B0,src/code/gfxprint
F4380,80105A60,src/code/loadfragment2_n64 F4380,80105A60,src/code/loadfragment2_n64
F4390,80105A70,src/code/code_800FC620 F4390,80105A70,src/code/code_800FC620
F43A0,80105A80,src/code/rand F43A0,80105A80,src/libc64/qrand
F43B0,80105A90,src/code/__osMalloc_n64 F43B0,80105A90,src/libc64/__osMalloc_n64
F43C0,80105AA0,src/boot/sprintf F43C0,80105AA0,src/libc64/sprintf
F4400,80105AE0,src/libultra/gu/sins F4400,80105AE0,src/libultra/gu/sins
F4C00,801062E0,src/libultra/io/siacs F4C00,801062E0,src/libultra/io/siacs
F4C10,801062F0,src/libultra/io/controller F4C10,801062F0,src/libultra/io/controller
@ -379,8 +379,8 @@ F9180,8010A860,src/audio/session_config
F9190,8010A870,src/code/gfxprint F9190,8010A870,src/code/gfxprint
F91D0,8010A8B0,src/code/rcp_utils F91D0,8010A8B0,src/code/rcp_utils
F9320,8010AA00,src/code/loadfragment2_n64 F9320,8010AA00,src/code/loadfragment2_n64
F94C0,8010ABA0,src/code/fp_math F94C0,8010ABA0,src/libc64/math64
F94E0,8010ABC0,src/code/__osMalloc_n64 F94E0,8010ABC0,src/libc64/__osMalloc_n64
F9690,8010AD70,src/libultra/gu/sinf F9690,8010AD70,src/libultra/gu/sinf
F96E0,8010ADC0,src/libultra/gu/perspective F96E0,8010ADC0,src/libultra/gu/perspective
F96F0,8010ADD0,src/libultra/gu/lookathil F96F0,8010ADD0,src/libultra/gu/lookathil
@ -449,7 +449,7 @@ offset,vram,.bss
1139C0,801250A0,src/audio/sequence 1139C0,801250A0,src/audio/sequence
114780,80125E60,src/audio/data 114780,80125E60,src/audio/data
114820,80125F00,src/audio/session_config 114820,80125F00,src/audio/session_config
11AC90,8012C370,src/code/system_malloc 11AC90,8012C370,src/libc64/malloc
11ACA0,8012C380,src/code/jpegdecoder 11ACA0,8012C380,src/code/jpegdecoder
11ACB0,8012C390,src/libultra/io/sptask 11ACB0,8012C390,src/libultra/io/sptask
11ACF0,8012C3D0,src/libultra/io/motor 11ACF0,8012C3D0,src/libultra/io/motor

1 offset vram .text
128 BBF00 800CD5E0 src/code/padutils
129 BC110 800CD7F0 src/code/code_800FC620
130 BC530 800CDC10 src/code/padsetup
131 BC670 800CDD50 src/code/fp_math src/libc64/math64
132 BCA20 800CE100 src/code/fp src/libc64/fp
133 BCB80 800CE260 src/code/system_malloc src/libc64/malloc
134 BCDF0 800CE4D0 src/code/rand src/libc64/qrand
135 BCEF0 800CE5D0 src/code/__osMalloc_n64 src/libc64/__osMalloc_n64
136 BD8A0 800CEF80 src/boot/sprintf src/libc64/sprintf
137 BD970 800CF050 src/code/printutils src/libc64/aprintf
138 BD9D0 800CF0B0 src/code/jpegutils
139 BDEE0 800CF5C0 src/code/jpegdecoder
140 BE4D0 800CFBB0 src/libultra/os/getintmask
291 F4380 80105A60 src/code/loadfragment2_n64
292 F4390 80105A70 src/code/code_800FC620
293 F43A0 80105A80 src/code/rand src/libc64/qrand
294 F43B0 80105A90 src/code/__osMalloc_n64 src/libc64/__osMalloc_n64
295 F43C0 80105AA0 src/boot/sprintf src/libc64/sprintf
296 F4400 80105AE0 src/libultra/gu/sins
297 F4C00 801062E0 src/libultra/io/siacs
298 F4C10 801062F0 src/libultra/io/controller
299 F4C20 80106300 src/libultra/libc/xprintf
379 F9320 8010AA00 src/code/loadfragment2_n64
380 F94C0 8010ABA0 src/code/fp_math src/libc64/math64
381 F94E0 8010ABC0 src/code/__osMalloc_n64 src/libc64/__osMalloc_n64
382 F9690 8010AD70 src/libultra/gu/sinf
383 F96E0 8010ADC0 src/libultra/gu/perspective
384 F96F0 8010ADD0 src/libultra/gu/lookathil
385 F9700 8010ADE0 src/libultra/libc/xprintf
386 F9800 8010AEE0 src/libultra/gu/position
449 11ACB0 8012C390 src/libultra/io/sptask
450 11ACF0 8012C3D0 src/libultra/io/motor
451 11ADF0 8012C4D0 src/libultra/io/siacs
452 11AE10 8012C4F0 src/libultra/io/controller
453 11AEA0 8012C580 src/libultra/gu/position
454 11AEB0 8012C590 src/libultra/gu/rotate
455 11AEC0 8012C5A0 src/libultra/io/contpfs