* libu64

* libu64 -O2

* Add libu64.md
This commit is contained in:
Dragorn421 2024-11-08 02:27:19 +01:00 committed by GitHub
parent 9cd9099a04
commit fcc5cf828d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
48 changed files with 78 additions and 60 deletions

View File

@ -376,7 +376,7 @@ $(BUILD_DIR)/src/libultra/libc/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/libultra/gu/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/libultra/rmon/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/boot/O2/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/boot/libu64/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/boot/libc/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/boot/libm/%.o: OPTFLAGS := -O2

9
docs/libu64.md Normal file
View File

@ -0,0 +1,9 @@
# libu64
This document explains the reasoning behind organizing the libu64 files.
See Ocarina of Time's document on libu64: https://github.com/zeldaret/oot/blob/main/docs/libu64.md (note: the MM repo is itself referenced by that document)
The same libu64 files from OoT exist in MM.
Additionally MM has `loadfragment.c`, a (unused) near-copy of the libu64 file `loadfragment2.c`, and `loadfragment.c` is in the middle of libu64 files and requires `-O2`. So that file is also taken as part of libu64.

View File

@ -1,5 +1,5 @@
#ifndef DEBUG_H
#define DEBUG_H
#ifndef LIBU64_DEBUG_H
#define LIBU64_DEBUG_H
void _dbg_hungup(const char* file, int lineNum);
void Reset(void);

View File

@ -1,5 +1,5 @@
#ifndef GFXPRINT_H
#define GFXPRINT_H
#ifndef LIBU64_GFXPRINT_H
#define LIBU64_GFXPRINT_H
#include "ultra64.h"

View File

@ -1,5 +1,5 @@
#ifndef LOADFRAGMENT_H
#define LOADFRAGMENT_H
#ifndef LIBU64_LOADFRAGMENT_H
#define LIBU64_LOADFRAGMENT_H
#include "PR/ultratypes.h"
#include "stdint.h"

View File

@ -1,5 +1,5 @@
#ifndef PADUTILS_H
#define PADUTILS_H
#ifndef LIBU64_PAD_H
#define LIBU64_PAD_H
#include "PR/os_cont.h"

View File

@ -0,0 +1,8 @@
#ifndef LIBU64_PADSETUP_H
#define LIBU64_PADSETUP_H
#include "ultra64.h"
s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status);
#endif

View File

@ -1,5 +1,5 @@
#ifndef STACKCHECK_H
#define STACKCHECK_H
#ifndef LIBU64_STACKCHECK_H
#define LIBU64_STACKCHECK_H
#include "ultra64.h"

View File

@ -1,5 +1,5 @@
#ifndef SYSTEM_HEAP_H
#define SYSTEM_HEAP_H
#ifndef LIBU64_SYSTEM_HEAP_H
#define LIBU64_SYSTEM_HEAP_H
#include "stddef.h"
#include "PR/ultratypes.h"

View File

@ -6,7 +6,7 @@
#include "stdbool.h"
#include "irqmgr.h"
#include "padutils.h"
#include "libu64/pad.h"
typedef enum {
/* 0 */ PADMGR_CONT_NONE,
@ -54,7 +54,6 @@ typedef struct PadMgr {
// Initialization
s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status);
void PadMgr_Init(OSMesgQueue* siEvtQ, IrqMgr* irqMgr, OSId threadId, OSPri pri, void* stack);
// Fetching inputs

View File

@ -16,13 +16,13 @@
#include "controller.h"
#include "gfx.h"
#include "gfx_setupdl.h"
#include "gfxprint.h"
#include "libu64/gfxprint.h"
#include "ichain.h"
#include "irqmgr.h"
#include "main.h"
#include "message_data_static.h"
#include "padmgr.h"
#include "padutils.h"
#include "libu64/pad.h"
#include "rand.h"
#include "regs.h"
#include "scheduler.h"

View File

@ -4,7 +4,7 @@
#include "PR/ultratypes.h"
#include "stdbool.h"
#include "color.h"
#include "padutils.h"
#include "libu64/pad.h"
#include "z64actor_dlftbls.h"
#include "z64math.h"
#include "z64animation.h"

View File

@ -7,7 +7,7 @@
#include "stdint.h"
#include "gamealloc.h"
#include "padmgr.h"
#include "padutils.h"
#include "libu64/pad.h"
#include "romfile.h"
#include "tha.h"
#include "unk.h"

20
spec
View File

@ -32,16 +32,16 @@ beginseg
include "$(BUILD_DIR)/src/boot/syncprintf.o"
include "$(BUILD_DIR)/src/boot/fault.o"
include "$(BUILD_DIR)/src/boot/fault_drawer.o"
include "$(BUILD_DIR)/src/boot/O2/rcp_utils.o"
include "$(BUILD_DIR)/src/boot/O2/loadfragment.o"
include "$(BUILD_DIR)/src/boot/O2/loadfragment2.o"
include "$(BUILD_DIR)/src/boot/O2/padutils.o"
include "$(BUILD_DIR)/src/boot/O2/stackcheck.o"
include "$(BUILD_DIR)/src/boot/O2/gfxprint.o"
include "$(BUILD_DIR)/src/boot/O2/mtxuty-cvt.o"
include "$(BUILD_DIR)/src/boot/O2/debug.o"
include "$(BUILD_DIR)/src/boot/O2/system_heap.o"
include "$(BUILD_DIR)/src/boot/O2/padsetup.o"
include "$(BUILD_DIR)/src/boot/libu64/rcp_utils.o"
include "$(BUILD_DIR)/src/boot/libu64/loadfragment.o"
include "$(BUILD_DIR)/src/boot/libu64/loadfragment2.o"
include "$(BUILD_DIR)/src/boot/libu64/pad.o"
include "$(BUILD_DIR)/src/boot/libu64/stackcheck.o"
include "$(BUILD_DIR)/src/boot/libu64/gfxprint.o"
include "$(BUILD_DIR)/src/boot/libu64/mtxuty-cvt.o"
include "$(BUILD_DIR)/src/boot/libu64/debug.o"
include "$(BUILD_DIR)/src/boot/libu64/system_heap.o"
include "$(BUILD_DIR)/src/boot/libu64/padsetup.o"
include "$(BUILD_DIR)/src/boot/libc64/math64.o"
include "$(BUILD_DIR)/asm/boot/fp.text.o" // Part of libc64
include "$(BUILD_DIR)/data/boot/fp.data.o"

View File

@ -2,7 +2,7 @@
#include "CIC6105.h"
#include "idle.h"
#include "stack.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "z64thread.h"
StackEntry sBootStackInfo;

View File

@ -50,7 +50,7 @@
#include "macros.h"
#include "main.h"
#include "vt.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "z64thread.h"
FaultMgr* sFaultInstance;

View File

@ -6,7 +6,7 @@
#include "main.h"
#include "segment_symbols.h"
#include "stack.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "viconfig.h"
#include "z64dma.h"
#include "z64thread.h"

View File

@ -38,7 +38,7 @@
#include "macros.h"
#include "scheduler.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "z64thread.h"
vs32 gIrqMgrResetStatus = IRQ_RESET_STATUS_IDLE;

View File

@ -1,4 +1,4 @@
#include "gfxprint.h"
#include "libu64/gfxprint.h"
#include "attributes.h"
#define GFXP_FLAG_HIRAGANA (1 << 0)

View File

@ -12,7 +12,7 @@
#include "global.h"
#include "libc64/malloc.h"
#include "loadfragment.h"
#include "libu64/loadfragment.h"
s32 gFragmentLogSeverity = 2;

View File

@ -8,7 +8,7 @@
*/
#include "global.h"
#include "libc64/malloc.h"
#include "loadfragment.h"
#include "libu64/loadfragment.h"
s32 gOverlayLogSeverity = 2;

View File

@ -1,4 +1,4 @@
#include "padutils.h"
#include "libu64/pad.h"
#include "PR/os_libc.h"

View File

@ -1,4 +1,5 @@
#include "global.h"
#include "ultra64.h"
#include "libu64/padsetup.h"
s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status) {
s32 ret;

View File

@ -1,4 +1,4 @@
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "stdbool.h"
#include "stdint.h"

View File

@ -26,7 +26,7 @@
#include "macros.h"
#include "segment_symbols.h"
#include "stack.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "yaz0.h"
#include "z64thread.h"

View File

@ -18,7 +18,7 @@
#include "gfxalloc.h"
#include "slowly.h"
#include "stack.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "sys_ucode.h"
/**

View File

@ -2,7 +2,7 @@
#include "global.h"
#include "audiomgr.h"
#include "debug.h"
#include "libu64/debug.h"
#include "gfx.h"
#include "gfxalloc.h"
#include "idle.h"

View File

@ -35,10 +35,10 @@ struct PadMgr gPadMgr;
#include "regs.h"
#include "segment_symbols.h"
#include "stack.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "scheduler.h"
#include "sys_initial_check.h"
#include "system_heap.h"
#include "libu64/system_heap.h"
#include "z64nmi_buff.h"
#include "z64thread.h"

View File

@ -34,6 +34,7 @@
#include "padmgr.h"
#include "libc64/sprintf.h"
#include "libu64/padsetup.h"
#include "PR/os_motor.h"
#include "controller.h"

View File

@ -6,7 +6,7 @@
#include "idle.h"
#include "macros.h"
#include "regs.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "viconfig.h"
#include "z64speed_meter.h"
#include "z64thread.h"

View File

@ -6,7 +6,7 @@
#include "fault.h"
#include "macros.h"
#include "stack.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "z64thread.h"
OSMesgQueue sFlashromMesgQueue;

View File

@ -11,7 +11,7 @@
#include "slowly.h"
#include "global.h"
#include "stackcheck.h"
#include "libu64/stackcheck.h"
#include "z64thread.h"
void Slowly_Main(SlowlyMgr* slowly) {

View File

@ -2,7 +2,7 @@
#include "global.h"
#include "libc64/malloc.h"
#include "loadfragment.h"
#include "libu64/loadfragment.h"
void Overlay_LoadGameState(GameStateOverlay* overlayEntry) {
void* vramStart;

View File

@ -6,7 +6,7 @@
#include "fault.h"
#include "attributes.h"
#include "sys_cfb.h"
#include "loadfragment.h"
#include "libu64/loadfragment.h"
// Variables are put before most headers as a hacky way to bypass bss reordering
FaultClient sActorFaultClient; // 2 funcs

View File

@ -3,7 +3,7 @@
#include "color.h"
#include "gfx.h"
#include "gfxalloc.h"
#include "gfxprint.h"
#include "libu64/gfxprint.h"
#include "macros.h"
typedef struct {

View File

@ -1,7 +1,7 @@
#include "z64effect_ss.h"
#include "tha.h"
#include "loadfragment.h"
#include "libu64/loadfragment.h"
#include "zelda_arena.h"
#include "global.h"

View File

@ -2,7 +2,7 @@
#include "global.h"
#include "fault.h"
#include "loadfragment.h"
#include "libu64/loadfragment.h"
#define KALEIDO_OVERLAY(name) \
{ NULL, ROM_FILE(ovl_##name), SEGMENT_START(ovl_##name), SEGMENT_END(ovl_##name), 0, #name }

View File

@ -6,7 +6,7 @@
#include "z64transition.h"
#include "loadfragment.h"
#include "libu64/loadfragment.h"
#include "z64lib.h"
#include "zelda_arena.h"

View File

@ -22,7 +22,7 @@
#include "z64frameadvance.h"
#include "controller.h"
#include "padutils.h"
#include "libu64/pad.h"
#include "stdbool.h"
void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) {

View File

@ -35,7 +35,7 @@ u8 sMotionBlurStatus;
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_opening/z_opening.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"
#include "debug.h"
#include "libu64/debug.h"
s32 gDbgCamEnabled = false;
u8 D_801D0D54 = false;

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "PR/gs2dex.h"
#include "debug.h"
#include "libu64/debug.h"
#include "sys_ucode.h"
void Room_Noop(PlayState* play, Room* room, Input* input, s32 arg3) {

View File

@ -4,10 +4,10 @@
#include "PR/viint.h"
#include "controller.h"
#include "debug.h"
#include "libu64/debug.h"
#include "macros.h"
#include "main.h"
#include "padutils.h"
#include "libu64/pad.h"
#include "regs.h"
typedef struct {

View File

@ -7,7 +7,7 @@
#include "z_en_horse_game_check.h"
#include "z64horse.h"
#include "assets/objects/object_horse_game_check/object_horse_game_check.h"
#include "debug.h"
#include "libu64/debug.h"
#define FLAGS (ACTOR_FLAG_10)

View File

@ -5,7 +5,7 @@
*/
#include "z_eff_ss_kakera.h"
#include "debug.h"
#include "libu64/debug.h"
#define rReg0 regs[0]
#define rGravity regs[1]