recompile from symbol tomls

This commit is contained in:
Sonic Dreamcaster
2025-10-23 16:23:06 -03:00
parent 429c5e73fb
commit cbab90cf5e
9 changed files with 69 additions and 54 deletions
+22
View File
@@ -0,0 +1,22 @@
#ifndef ULTRA64_H
#define ULTRA64_H
#include "PR/ultratypes.h"
#include "PR/gbi.h"
#include "PR/gu.h"
#include "PR/guint.h"
#include "PR/controller_voice.h"
#include "PR/os.h"
#include "PR/osint.h"
#include "PR/piint.h"
#include "PR/siint.h"
#include "PR/sptask.h"
#include "PR/rcp.h"
#include "PR/rdp.h"
#include "PR/R4300.h"
#include "PR/ucode.h"
#include "PR/viint.h"
#include "PR/xstdio.h"
#endif
+3 -3
View File
@@ -10,9 +10,9 @@ single_file_output = true
use_absolute_symbols = true
# Point the recompiler at the symbol files so that it can resolve relocations during recompilation.
# func_reference_syms_file = "MarioKart64RecompSyms/mk64.us.syms.toml"
# data_reference_syms_files = [ "MarioKart64RecompSyms/mk64.us.datasyms.toml" ]
# data_reference_syms_files = [ "MarioKart64RecompSyms/mk64.us.datasyms.toml", "MarioKart64RecompSyms/mk64.us.datasyms_static.toml" ]
func_reference_syms_file = "DNZHRecompSyms/dump.toml"
data_reference_syms_files = [ "DNZHRecompSyms/data_dump.toml" ]
# data_reference_syms_files = [ "DNZHRecompSyms/datasyms.toml", "DNZHRecompSyms/datasyms_static.toml" ]
# Tell the recompiler to write the output binary. Doing this instead of using objcopy allows the recompiler to patch MIPS32 relocs.
output_binary_path = "patches/patches.bin"
+1 -1
View File
@@ -6,7 +6,7 @@ LD ?= ld.lld
CFLAGS := -target mips -mips2 -mabi=32 -O2 -G0 -mno-abicalls -mno-odd-spreg -mno-check-zero-division \
-fomit-frame-pointer -ffast-math -fno-unsafe-math-optimizations -fno-builtin-memset \
-Wall -Wextra -Wno-incompatible-library-redeclaration -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-but-set-variable -Wno-missing-braces -Wno-unsupported-floating-point-opt -Wno-switch
CPPFLAGS := -nostdinc -DTARGET_N64 -DF3DEX_GBI_2 -D_LANGUAGE_C -DMIPS -I ../lib/DukeNukemZeroHour/include -I ../lib/DukeNukemZeroHour/libs/libultra/PR -I../lib/rt64/include
CPPFLAGS := -nostdinc -DTARGET_N64 -DF3DEX_GBI_2 -D_LANGUAGE_C -DMIPS -I ../lib/DukeNukemZeroHour/include -I ../lib/DukeNukemZeroHour/libs/libultra/include/2.0I -I ../lib/rt64/include -I ../lib/N64ModernRuntime/N64Recomp/include
LDFLAGS := -nostdlib -T patches.ld -T syms.ld -Map patches.map --unresolved-symbols=ignore-all --emit-relocs
C_SRCS := $(wildcard *.c)
+2 -2
View File
@@ -12,8 +12,8 @@ DECLARE_FUNC(u16, recomp_get_pending_warp);
DECLARE_FUNC(u32, recomp_get_pending_set_time);
DECLARE_FUNC(s32, recomp_autosave_enabled);
DECLARE_FUNC(void, recomp_load_overlays, u32 rom, void* ram, u32 size);
DECLARE_FUNC(s32, osPiStartDma_recomp, OSIoMesg* mb, s32 priority, s32 direction, uintptr_t devAddr, void* vAddr, size_t nbytes,
OSMesgQueue* mq);
// DECLARE_FUNC(s32, osPiStartDma_recomp, OSIoMesg* mb, s32 priority, s32 direction, u32 devAddr, void* vAddr, size_t nbytes,
// OSMesgQueue* mq);
DECLARE_FUNC(float, recomp_get_aspect_ratio, float);
DECLARE_FUNC(s32, recomp_get_target_framerate, s32);
DECLARE_FUNC(s32, recomp_high_precision_fb_enabled);
+1 -1
View File
@@ -4,7 +4,7 @@
#ifdef MIPS
#include "ultra64.h"
#else
//#include "librecomp/recomp.h"
#include "recomp.h"
#endif
#ifdef __cplusplus
+21 -25
View File
@@ -31,32 +31,28 @@
#include "PR/ultratypes.h"
#include "rt64_extended_gbi.h"
#include "PR/gbi.h"
#include "PR/os_thread.h"
#include "PR/os_message.h"
#include "common_structs.h"
#include "structs.h"
#include "externs.h"
#include "misc_funcs.h"
#include "defines.h"
#include "macros.h"
#include "course.h"
#include "mk64.h"
#include "objects.h"
#include "render_objects.h"
#include "mk64_tagging.h"
#include "actor_types.h"
#include "misc_funcs.h"
#include "menu_items.h"
#include "menus.h"
#include "sounds.h"
#include "objects.h"
#include "debug.h"
// #include "PR/gbi.h"
// #include "PR/os_thread.h"
// #include "PR/os_message.h"
// #include "common_structs.h"
// #include "structs.h"
// #include "externs.h"
// #include "misc_funcs.h"
// #include "defines.h"
// #include "macros.h"
// #include "course.h"
// #include "mk64.h"
// #include "objects.h"
// #include "render_objects.h"
// #include "mk64_tagging.h"
// #include "actor_types.h"
// #include "misc_funcs.h"
// #include "menu_items.h"
// #include "menus.h"
// #include "sounds.h"
// #include "objects.h"
// #include "debug.h"
extern s32 gCamera1Skipped;
extern s32 gCamera2Skipped;
extern s32 gCamera3Skipped;
extern s32 gCamera4Skipped;
#define MAKE_RGB(r, g, b) (((r) << 0x10) | ((g) << 0x08) | (b << 0x00))
+13 -8
View File
@@ -1,8 +1,13 @@
#if 0
#if 1
#include "patches.h"
#include "misc_funcs.h"
#include "libc/stdarg.h"
// #include "libc/stdarg.h"
typedef char *va_list;
#define va_start(vp, parmN) (vp = ((va_list)&parmN + sizeof(parmN)))
#define va_end(__list)
typedef unsigned int size_t;
@@ -25,11 +30,11 @@ RECOMP_EXPORT int recomp_printf(const char* fmt, ...) {
return ret;
}
#else
void dummy_function(void) {
int dummyVar = 0;
#else
void dummy_function(void) {
int dummyVar = 0;
if (dummyVar);
}
#endif
if (dummyVar);
}
#endif
-10
View File
@@ -23,16 +23,6 @@ extern "C" void recomp_sleep_miliseconds(uint8_t* rdram, recomp_context* ctx) {
ultramodern::sleep_milliseconds(time);
}
extern "C" void bzero_recomp(uint8_t* rdram, recomp_context* ctx) {
// Empty
}
// int toupper(int c) {
// if (c >= 'a' && c <= 'z')
// return c - ('a' - 'A');
// return c;
// }
extern "C" void toupper_recomp(uint8_t* rdram, recomp_context* ctx) {
// Empty
s32 c = _arg<0, s32>(rdram, ctx);
+6 -4
View File
@@ -3,8 +3,10 @@
[input]
entrypoint = 0x80000400
# Paths are relative to the location of this config file.
elf_path = "dukenukemzerohour.elf"
output_func_path = "RecompiledFuncs"
# elf_path = "dukenukemzerohour.elf"
symbols_file_path = "DNZHRecompSyms/dump.toml"
rom_file_path = "baserom.us.z64"
[patches]
stubs = [
@@ -190,12 +192,12 @@ size = 200
# Hooks
[[patches.hook]]
func = "mainLoop_00003148"
func = "mainLoop"
text = "load_overlays(0xEB300, 0x801C0D80, 0xBA70);"
#before_vram = 0x80002548
[[patches.hook]]
func = "mainLoop_00003148"
func = "mainLoop"
text = "yield_self_1ms(rdram);"
before_vram = 0x80002E9C
@@ -207,6 +209,6 @@ vram = 0x80003970
value = 0x00000000 # jal func_80000000 -> nop
[[patches.instruction]]
func = "func_801C30EC_000ED66C"
func = "func_801C30EC"
vram = 0x801C313C
value = 0x00000000 # nop