From 8fa1c7dd03f904f20f212c35d4df64efd3176e69 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Wed, 25 Dec 2024 11:40:33 -0800 Subject: [PATCH] Splat and ultralib fixes --- Makefile | 5 ++++- include/gfxprint.h | 4 ++-- requirements.txt | 2 +- src/main/O2/65430.c | 2 +- src/main/O2/aprintf.c | 2 +- src/main/O2/gfxprint.c | 6 +++--- src/main/fault.c | 4 ++-- src/main/vimode.c | 2 +- tools/splat_ext/font.py | 4 ++-- yamls/us/header.yaml | 1 - 10 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index f7dd653..0c0cdf0 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,8 @@ PYTHON ?= $(VENV)/$(VENV_BIN_DIR)/python3 # Emulator w/ flags N64_EMULATOR ?= +PROJECT_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + BASEROM_DIR := baseroms/$(VERSION) BASEROM := $(BASEROM_DIR)/baserom.z64 @@ -106,6 +108,7 @@ endif CC := tools/ido/$(DETECTED_OS)/7.1/cc CC_OLD := tools/ido/$(DETECTED_OS)/5.3/cc +CC_ULTRALIB := $(PROJECT_DIR)/$(CC_OLD) AR := ar AS := $(CROSS)as @@ -306,7 +309,7 @@ $(LIBULTRA_LIB): $(ULTRALIB_LIB) $(LIBDUMP_CMD) $(ULTRALIB_LIB): - $(MAKE) -C lib/ultralib VERSION=$(ULTRALIB_VERSION) TARGET=$(ULTRALIB_TARGET) FIXUPS=1 CROSS=$(CROSS) CC=../../$(CC_OLD) + $(MAKE) -C lib/ultralib VERSION=$(ULTRALIB_VERSION) TARGET=$(ULTRALIB_TARGET) MODERN_LD=1 CROSS=$(CROSS) COMPILER_DIR=$(dir $(CC_ULTRALIB)) AR=$(AR) $(BUILD_DIR)/%.ld: %.ld $(CPP) $(CPPFLAGS) $(BUILD_DEFINES) $(IINC) $< > $@ diff --git a/include/gfxprint.h b/include/gfxprint.h index 4d92ab4..f026a22 100644 --- a/include/gfxprint.h +++ b/include/gfxprint.h @@ -75,9 +75,9 @@ void gfxprint_locate8x8(gfxprint* this, s32 x, s32 y); void gfxprint_setoffset(gfxprint* this, s32 x, s32 y); void gfxprint_putc1(gfxprint* this, char c); void gfxprint_putc(gfxprint* this, char c); -void gfxprint_write(gfxprint* this, const void* buffer, s32 size, s32 n); +void gfxprint_write(gfxprint* this, const void* buffer, size_t size, size_t n); void gfxprint_puts(gfxprint* this, const char* buffer); -void* gfxprint_prout(void* this, const char* buffer, s32 n); +void* gfxprint_prout(void* this, const char* buffer, size_t n); void gfxprint_init(gfxprint* this); void gfxprint_cleanup(gfxprint* this); void gfxprint_open(gfxprint* this, Gfx* gListp); diff --git a/requirements.txt b/requirements.txt index 928a484..a44dbd3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -splat64[mips]>=0.21.11,<1.0.0 +splat64[mips]>=0.32.1,<1.0.0 mapfile-parser>=2.3.5,<3.0.0 # asm-differ diff --git a/src/main/O2/65430.c b/src/main/O2/65430.c index 5628e0b..0c0f41f 100644 --- a/src/main/O2/65430.c +++ b/src/main/O2/65430.c @@ -1,6 +1,6 @@ #include "global.h" -#include "lib/ultralib/src/io/viint.h" +#include "PRinternal/viint.h" #include "fault.h" #include "segment_symbols.h" diff --git a/src/main/O2/aprintf.c b/src/main/O2/aprintf.c index ee2d1ca..5190c78 100644 --- a/src/main/O2/aprintf.c +++ b/src/main/O2/aprintf.c @@ -1,7 +1,7 @@ #include "aprintf.h" s32 vaprintf(PrintCallback* func, const char* fmt, va_list ap) { - return _Printf((outfun*)*func, (char*)func, fmt, ap); + return _Printf(*func, func, fmt, ap); } s32 aprintf(PrintCallback* func, const char* fmt, ...) { diff --git a/src/main/O2/gfxprint.c b/src/main/O2/gfxprint.c index 4977bbf..e36d403 100644 --- a/src/main/O2/gfxprint.c +++ b/src/main/O2/gfxprint.c @@ -173,7 +173,7 @@ void gfxprint_putc(gfxprint* this, char c) { } } -void gfxprint_write(gfxprint* this, const void* buffer, s32 size, s32 n) { +void gfxprint_write(gfxprint* this, const void* buffer, size_t size, size_t n) { const char* buf = (const char*)buffer; s32 i; @@ -188,14 +188,14 @@ void gfxprint_puts(gfxprint* this, const char* buffer) { } } -void* gfxprint_prout(void* this, const char* buffer, s32 n) { +void* gfxprint_prout(void* this, const char* buffer, size_t n) { gfxprint_write(this, buffer, sizeof(char), n); return this; } void gfxprint_init(gfxprint* this) { gfxprint_clrOpened(this); - this->proutFunc = (PrintCallback)gfxprint_prout; + this->proutFunc = gfxprint_prout; this->gListp = NULL; this->posX = 0; this->posY = 0; diff --git a/src/main/fault.c b/src/main/fault.c index 525432a..2769101 100644 --- a/src/main/fault.c +++ b/src/main/fault.c @@ -115,7 +115,7 @@ typedef struct FaultDrawerPos { /* 0x4 */ s32 y; } FaultDrawerPos; -void* Fault_PrintCallback(char* arg, const char* fmt, size_t count) { +void* Fault_PrintCallback(void* arg, const char* fmt, size_t count) { FaultDrawerPos* pos = (FaultDrawerPos*)arg; for (; count > 0; count--) { @@ -135,7 +135,7 @@ s32 Fault_Printf(s32 x, s32 y, const char* fmt, ...) { pos.x = x; pos.y = y; - ret = _Printf((outfun*)*Fault_PrintCallback, (char*)&pos, fmt, ap); + ret = _Printf(*Fault_PrintCallback, (char*)&pos, fmt, ap); va_end(ap); diff --git a/src/main/vimode.c b/src/main/vimode.c index cf47f4d..ca17022 100644 --- a/src/main/vimode.c +++ b/src/main/vimode.c @@ -1,7 +1,7 @@ #include "vimode.h" #include "stdbool.h" -#include "lib/ultralib/src/io/viint.h" +#include "PRinternal/viint.h" #include "attributes.h" #include "macros.h" diff --git a/tools/splat_ext/font.py b/tools/splat_ext/font.py index a161641..19dfb36 100644 --- a/tools/splat_ext/font.py +++ b/tools/splat_ext/font.py @@ -2,10 +2,10 @@ from pathlib import Path from splat.util import options, log -from splat.segtypes.n64.segment import N64Segment +from splat.segtypes.segment import Segment -class N64SegFont(N64Segment): +class N64SegFont(Segment): def __init__(self, rom_start, rom_end, type, name, vram_start, args, yaml): super().__init__( rom_start, rom_end, type, name, vram_start, args=args, yaml=yaml diff --git a/yamls/us/header.yaml b/yamls/us/header.yaml index c7ea330..0f38376 100644 --- a/yamls/us/header.yaml +++ b/yamls/us/header.yaml @@ -43,7 +43,6 @@ options: asm_function_macro: glabel asm_jtbl_label_macro: jlabel asm_data_macro: dlabel - include_macro_inc: False libultra_symbols: True hardware_regs: True asm_emit_size_directive: False