diff --git a/.gitignore b/.gitignore index f397079b..4d59f171 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ baseroms/* #compiled or ripped asm asm/nonmatchings +asm/data asm/*.s asm/*/*.s asm/core1/os diff --git a/Makefile b/Makefile index cb486817..203774e3 100644 --- a/Makefile +++ b/Makefile @@ -373,6 +373,7 @@ clean: @$(RM) -rf $(NONMATCHING_DIR) @$(RM) -rf $(ASM_ROOT)/*.s @$(RM) -rf $(addprefix $(ASM_ROOT)/,$(filter-out core1,$(OVERLAYS))) + @$(RM) -rf $(ASM_ROOT)/data @$(RM) -rf $(ASM_ROOT)/core1/*.s @$(RM) -rf $(ASM_ROOT)/core1/os @$(RM) -f *.ld diff --git a/decompressed.pal.yaml b/decompressed.pal.yaml index 7f7fd9f9..66ded672 100644 --- a/decompressed.pal.yaml +++ b/decompressed.pal.yaml @@ -5,15 +5,10 @@ options: compiler: "IDO" platform: n64 asm_end_label: "endlabel" - cpp_args: - - "-Iinclude" - - "-Iinclude/2.0L" - - "-D_LANGUAGE_C" generated_c_preamble: | #include #include "functions.h" #include "variables.h" - undefined_syms_path: undefined_syms.pal.txt symbol_addrs_path: symbol_addrs.pal.txt create_undefined_funcs_auto: yes create_undefined_syms_auto: yes @@ -23,6 +18,10 @@ options: build_path: build/pal libultra_symbols: True hardware_regs: True + ld_sections_allowlist: + - .shstrtab + - .mdebug + - .mdebug.abi32 segments: - name: header type: header @@ -357,9 +356,9 @@ segments: - [0xF71660, c, io/epirawread] - [0xF716B0, c, os/setglobalintmask] - [0xF71700, c, os/yieldthread] - - [0xF71750, bin, n_aspMain_text] - - [0xF723B0, bin, gSPF3DEX_fifo_text] - - [0xF737E0, bin, gSPL3DEX_fifo_text] + - [0xF71750, textbin, pal/n_aspMain] + - [0xF723B0, textbin, pal/gSPF3DEX_fifo] + - [0xF737E0, textbin, pal/gSPL3DEX_fifo] - [0xF747D0, linker_offset, DATA_START] #data Section - [0xF747D0, .data, code_0] - [0xF74830, .data, code_660] @@ -449,9 +448,9 @@ segments: - [0xF77E70, .rodata, io/devmgr] - [0xF77E90, .rodata, audio/env] - [0xF77EE0, .rodata, audio/resample] - - [0xF77F20, bin, n_aspMain_data] - - [0xF781D0, bin, gSPF3DEX_fifo_data] - - [0xF789D0, bin, gSPL3DEX_fifo_data] + - [0xF77F20, rodatabin, pal/n_aspMain] + - [0xF781D0, rodatabin, pal/gSPF3DEX_fifo] + - [0xF789D0, rodatabin, pal/gSPL3DEX_fifo] - [0xF791D0, .bss, code_0] - [0xF791D0, .bss, code_660] - [0xF791D0, .bss, inflate] @@ -574,7 +573,7 @@ segments: - [0xF943D0, c, bs/bEggAss] - [0xF94640, c, bs/bEggHead] - [0xF948F0, c, bs/bFlap] - - [0xF94FC0, bin, core2_untouched_text] + - [0xF94FC0, textbin, core2_untouched] # - [0xF71730, c, bs/bFlip] #DONE # - [0xF71D20, c, bs/bFly] #DONE # - [0xF73BA0, c, bs/bLongLeg] #DONE @@ -1166,7 +1165,7 @@ segments: - [0x1067D90, .rodata, bs/bEggAss] - [0x1067DB0, .rodata, bs/bEggHead] - [0x1067DD0, .rodata, bs/bFlap] - - [0x1067E40, bin, core2_untouched_rodata] + - [0x1067E40, rodatabin, core2_untouched] # - [0x1043E70, .rodata, bs/bFlip] # - [0x1043EC0, .rodata, bs/bFly] # - [0x1043F20, .rodata, bs/bLongLeg] diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index 7cab4c82..facdfaa8 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -5,15 +5,10 @@ options: compiler: "IDO" platform: n64 asm_end_label: "endlabel" - cpp_args: - - "-Iinclude" - - "-Iinclude/2.0L" - - "-D_LANGUAGE_C" generated_c_preamble: | #include #include "functions.h" #include "variables.h" - undefined_syms_path: undefined_syms.us.v10.txt symbol_addrs_path: symbol_addrs.us.v10.txt create_undefined_funcs_auto: no create_undefined_syms_auto: no @@ -23,6 +18,10 @@ options: build_path: build/us.v10 libultra_symbols: True hardware_regs: True + ld_sections_allowlist: + - .shstrtab + - .mdebug + - .mdebug.abi32 segments: - name: header type: header @@ -357,9 +356,9 @@ segments: - [0xF4DCD0, c, io/epirawread] - [0xF4DD20, c, os/setglobalintmask] - [0xF4DD70, c, os/yieldthread] - - [0xF4DDC0, bin, n_aspMain_text] - - [0xF4EA20, bin, gSPF3DEX_fifo_text] - - [0xF4FE50, bin, gSPL3DEX_fifo_text] + - [0xF4DDC0, textbin, us.v10/n_aspMain] + - [0xF4EA20, textbin, us.v10/gSPF3DEX_fifo] + - [0xF4FE50, textbin, us.v10/gSPL3DEX_fifo] - [0xF50E40, linker_offset, DATA_START] #data Section - [0xF50E40, .data, code_0] - [0xF50EA0, .data, code_660] @@ -450,9 +449,9 @@ segments: - [0xF54600, .rodata, io/devmgr] - [0xF54620, .rodata, audio/env] - [0xF54670, .rodata, audio/resample] - - [0xF546B0, bin, n_aspMain_data] - - [0xF54960, bin, gSPF3DEX_fifo_data] - - [0xF55160, bin, gSPL3DEX_fifo_data] + - [0xF546B0, rodatabin, us.v10/n_aspMain] + - [0xF54960, rodatabin, us.v10/gSPF3DEX_fifo] + - [0xF55160, rodatabin, us.v10/gSPL3DEX_fifo] - [0xF55960, .bss, code_0] - [0xF55960, .bss, code_660] - [0xF55960, .bss, inflate] diff --git a/manual_syms.pal.txt b/manual_syms.pal.txt index c1585ab5..9b6a6b4c 100644 --- a/manual_syms.pal.txt +++ b/manual_syms.pal.txt @@ -1,16 +1,16 @@ -/* Microcode renames to match ucode.h names */ -n_aspMainTextStart = _binary_bin_core1_n_aspMain_text_bin_start; -n_aspMainTextEnd = _binary_bin_core1_n_aspMain_text_bin_end; -gSPF3DEX_fifoTextStart = _binary_bin_core1_gSPF3DEX_fifo_text_bin_start; -gSPF3DEX_fifoTextEnd = _binary_bin_core1_gSPF3DEX_fifo_text_bin_end; -gSPL3DEX_fifoTextStart = _binary_bin_core1_gSPL3DEX_fifo_text_bin_start; -gSPL3DEX_fifoTextEnd = _binary_bin_core1_gSPL3DEX_fifo_text_bin_end; -n_aspMainDataStart = _binary_bin_core1_n_aspMain_data_bin_start; -n_aspMainDataEnd = _binary_bin_core1_n_aspMain_data_bin_end; -gSPF3DEX_fifoDataStart = _binary_bin_core1_gSPF3DEX_fifo_data_bin_start; -gSPF3DEX_fifoDataEnd = _binary_bin_core1_gSPF3DEX_fifo_data_bin_end; -gSPL3DEX_fifoDataStart = _binary_bin_core1_gSPL3DEX_fifo_data_bin_start; -gSPL3DEX_fifoDataEnd = _binary_bin_core1_gSPL3DEX_fifo_data_bin_end; +/* Microcode renames to remove boot_ prefix */ +n_aspMainTextStart = boot_n_aspMainTextStart; +n_aspMainTextEnd = boot_n_aspMainTextEnd; +gSPF3DEX_fifoTextStart = boot_gSPF3DEX_fifoTextStart; +gSPF3DEX_fifoTextEnd = boot_gSPF3DEX_fifoTextEnd; +gSPL3DEX_fifoTextStart = boot_gSPL3DEX_fifoTextStart; +gSPL3DEX_fifoTextEnd = boot_gSPL3DEX_fifoTextEnd; +n_aspMainDataStart = boot_n_aspMainDataStart; +n_aspMainDataEnd = boot_n_aspMainDataEnd; +gSPF3DEX_fifoDataStart = boot_gSPF3DEX_fifoDataStart; +gSPF3DEX_fifoDataEnd = boot_gSPF3DEX_fifoDataEnd; +gSPL3DEX_fifoDataStart = boot_gSPL3DEX_fifoDataStart; +gSPL3DEX_fifoDataEnd = boot_gSPL3DEX_fifoDataEnd; /* Fixed-address buffers */ D_8000E800 = 0x8000E800; diff --git a/manual_syms.us.v10.txt b/manual_syms.us.v10.txt index ba725a80..dceb33b6 100644 --- a/manual_syms.us.v10.txt +++ b/manual_syms.us.v10.txt @@ -1,16 +1,16 @@ -/* Microcode renames to match ucode.h names */ -n_aspMainTextStart = _binary_bin_core1_n_aspMain_text_bin_start; -n_aspMainTextEnd = _binary_bin_core1_n_aspMain_text_bin_end; -gSPF3DEX_fifoTextStart = _binary_bin_core1_gSPF3DEX_fifo_text_bin_start; -gSPF3DEX_fifoTextEnd = _binary_bin_core1_gSPF3DEX_fifo_text_bin_end; -gSPL3DEX_fifoTextStart = _binary_bin_core1_gSPL3DEX_fifo_text_bin_start; -gSPL3DEX_fifoTextEnd = _binary_bin_core1_gSPL3DEX_fifo_text_bin_end; -n_aspMainDataStart = _binary_bin_core1_n_aspMain_data_bin_start; -n_aspMainDataEnd = _binary_bin_core1_n_aspMain_data_bin_end; -gSPF3DEX_fifoDataStart = _binary_bin_core1_gSPF3DEX_fifo_data_bin_start; -gSPF3DEX_fifoDataEnd = _binary_bin_core1_gSPF3DEX_fifo_data_bin_end; -gSPL3DEX_fifoDataStart = _binary_bin_core1_gSPL3DEX_fifo_data_bin_start; -gSPL3DEX_fifoDataEnd = _binary_bin_core1_gSPL3DEX_fifo_data_bin_end; +/* Microcode renames to remove boot_ prefix */ +n_aspMainTextStart = boot_n_aspMainTextStart; +n_aspMainTextEnd = boot_n_aspMainTextEnd; +gSPF3DEX_fifoTextStart = boot_gSPF3DEX_fifoTextStart; +gSPF3DEX_fifoTextEnd = boot_gSPF3DEX_fifoTextEnd; +gSPL3DEX_fifoTextStart = boot_gSPL3DEX_fifoTextStart; +gSPL3DEX_fifoTextEnd = boot_gSPL3DEX_fifoTextEnd; +n_aspMainDataStart = boot_n_aspMainDataStart; +n_aspMainDataEnd = boot_n_aspMainDataEnd; +gSPF3DEX_fifoDataStart = boot_gSPF3DEX_fifoDataStart; +gSPF3DEX_fifoDataEnd = boot_gSPF3DEX_fifoDataEnd; +gSPL3DEX_fifoDataStart = boot_gSPL3DEX_fifoDataStart; +gSPL3DEX_fifoDataEnd = boot_gSPL3DEX_fifoDataEnd; /* Fixed-address buffers */ D_8000E800 = 0x8000E800; diff --git a/requirements.txt b/requirements.txt index 04c3671f..d7b7d64b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ python-Levenshtein python-ranges pyyaml watchdog +spimdisasm==1.35.0 diff --git a/src/SM/code_46C0.c b/src/SM/code_46C0.c index 061a6c9a..03fb6455 100644 --- a/src/SM/code_46C0.c +++ b/src/SM/code_46C0.c @@ -5,13 +5,12 @@ #define US_1_0 0 #define PAL 1 -u8 D_8038BFC2; - #if VERSION == US_1_0 int func_8038AAB0(void){return 0;} #elif VERSION == PAL +// u8 D_8038BFC2; // void func_8038AAB0(s32 arg0, s32 arg1){ // if(arg1 < 0){ // func_8031A844(); diff --git a/symbol_addrs.pal.txt b/symbol_addrs.pal.txt index 78b23897..3a18fbc1 100644 --- a/symbol_addrs.pal.txt +++ b/symbol_addrs.pal.txt @@ -4,40 +4,40 @@ D_D954B0 = 0xD954B0; D_EA3EB0 = 0xEA3EB0; D_EADE60 = 0xEADE60; osRomBase = 0x80000308; -bzero = 0x800020F0; -__osSetSR = 0x80002190; -__osGetSR = 0x800021A0; -__osSetFpcCsr = 0x800021B0; -osWritebackDCache = 0x80002B70; -osInvalICache = 0x80002BF0; -osMapTLBRdb = 0x80002C70; -__osProbeTLB = 0x80003BD0; -__osDisableInt = 0x80003FC0; -__osRestoreInt = 0x80003FE0; +bzero = 0x800020F0; // allow_duplicated:true +__osSetSR = 0x80002190; // allow_duplicated:true +__osGetSR = 0x800021A0; // allow_duplicated:true +__osSetFpcCsr = 0x800021B0; // allow_duplicated:true +osWritebackDCache = 0x80002B70; // allow_duplicated:true +osInvalICache = 0x80002BF0; // allow_duplicated:true +osMapTLBRdb = 0x80002C70; // allow_duplicated:true +__osProbeTLB = 0x80003BD0; // allow_duplicated:true +__osDisableInt = 0x80003FC0; // allow_duplicated:true +__osRestoreInt = 0x80003FE0; // allow_duplicated:true bk_boot_BSS_START = 0x80005270; func_80253010 = 0x80252c60; func_80253034 = 0x80252c84; ___osGetSR = 0x8025AC30; func_8025C29C = 0x8025beec; -bzero = 0x80263790; +bzero = 0x80263790; // allow_duplicated:true osWriteBackDCacheAll = 0x80263830; -osWritebackDCache = 0x80264740; +osWritebackDCache = 0x80264740; // allow_duplicated:true osInvalDCache = 0x802647C0; osSetIntMask = 0x80265120; -osInvalICache = 0x80268060; -__osSetSR = 0x80269db0; -__osGetSR = 0x80269dc0; -__osSetFpcCsr = 0x80269dd0; +osInvalICache = 0x80268060; // allow_duplicated:true +__osSetSR = 0x80269db0; // allow_duplicated:true +__osGetSR = 0x80269dc0; // allow_duplicated:true +__osSetFpcCsr = 0x80269dd0; // allow_duplicated:true func_8026A2E0 = 0x80269e80; __osEnqueueAndYield = 0x8026a4ac; __osEnqueueThread = 0x8026a5ac; __osPopThread = 0x8026a5f4; __osDispatchThread = 0x8026a604; __osCleanupThread = 0x8026A780; -osMapTLBRdb = 0x8026a790; -__osDisableInt = 0x8026ab10; -__osRestoreInt = 0x8026ab30; -__osProbeTLB = 0x8026b280; +osMapTLBRdb = 0x8026a790; // allow_duplicated:true +__osDisableInt = 0x8026ab10; // allow_duplicated:true +__osRestoreInt = 0x8026ab30; // allow_duplicated:true +__osProbeTLB = 0x8026b280; // allow_duplicated:true bcopy = 0x8026bf70; __osSetCompare = 0x8026c8d0; osGetCount = 0x8026cc60; @@ -54,3 +54,9 @@ D_8027D5B0 = 0x8027D408; D_8027DCC8 = 0x8027DB20; D_8027DCCC = 0x8027DB24; D_8027D100 = 0x8027CE68; +n_aspMainTextStart = 0x802723f0; // name_end:n_aspMainTextEnd +n_aspMainDataStart = 0x80278bc0; // name_end:n_aspMainDataEnd +gSPF3DEX_fifoTextStart = 0x80273050; // name_end:gSPF3DEX_fifoTextEnd +gSPF3DEX_fifoDataStart = 0x80278e70; // name_end:gSPF3DEX_fifoDataEnd +gSPL3DEX_fifoTextStart = 0x80274480; // name_end:gSPL3DEX_fifoTextEnd +gSPL3DEX_fifoDataStart = 0x80279670; // name_end:gSPL3DEX_fifoDataEnd diff --git a/symbol_addrs.us.v10.txt b/symbol_addrs.us.v10.txt index 36c1ac3f..0bbf3f6f 100644 --- a/symbol_addrs.us.v10.txt +++ b/symbol_addrs.us.v10.txt @@ -4,41 +4,41 @@ D_D954B0 = 0xD954B0; D_EA3EB0 = 0xEA3EB0; D_EADE60 = 0xEADE60; osRomBase = 0x80000308; -bzero = 0x800020F0; -__osSetSR = 0x80002190; -__osGetSR = 0x800021A0; -__osSetFpcCsr = 0x800021B0; -osWritebackDCache = 0x80002B70; -osInvalICache = 0x80002BF0; -osMapTLBRdb = 0x80002C70; -__osProbeTLB = 0x80003BD0; -__osDisableInt = 0x80003FC0; -__osRestoreInt = 0x80003FE0; +bzero = 0x800020F0; // allow_duplicated:true +__osSetSR = 0x80002190; // allow_duplicated:true +__osGetSR = 0x800021A0; // allow_duplicated:true +__osSetFpcCsr = 0x800021B0; // allow_duplicated:true +osWritebackDCache = 0x80002B70; // allow_duplicated:true +osInvalICache = 0x80002BF0; // allow_duplicated:true +osMapTLBRdb = 0x80002C70; // allow_duplicated:true +__osProbeTLB = 0x80003BD0; // allow_duplicated:true +__osDisableInt = 0x80003FC0; // allow_duplicated:true +__osRestoreInt = 0x80003FE0; // allow_duplicated:true bk_boot_BSS_START = 0x80005270; ___osGetSR = 0x8025AFE0; -bzero = 0x80263B40; +bzero = 0x80263B40; // allow_duplicated:true osWriteBackDCacheAll = 0x80263BE0; osVirtualToPhysical = 0x802646A0; osRecvMesg = 0x80264550; osPiStartDma = 0x802647D0; -osWritebackDCache = 0x80264AF0; +osWritebackDCache = 0x80264AF0; // allow_duplicated:true osInvalDCache = 0x80264B70; osDestroyThread = 0x80264DB0; osSetThreadPri = 0x80265000; osSetIntMask = 0x802654D0; -osInvalICache = 0x802684C0; -__osSetSR = 0x8026A210; -__osGetSR = 0x8026A220; -__osSetFpcCsr = 0x8026A230; +osInvalICache = 0x802684C0; // allow_duplicated:true +__osSetSR = 0x8026A210; // allow_duplicated:true +__osGetSR = 0x8026A220; // allow_duplicated:true +__osSetFpcCsr = 0x8026A230; // allow_duplicated:true __osEnqueueAndYield = 0x8026A90C; __osEnqueueThread = 0x8026AA0C; __osPopThread = 0x8026AA54; __osDispatchThread = 0x8026AA64; __osCleanupThread = 0x8026ABE0; -osMapTLBRdb = 0x8026ABF0; -__osDisableInt = 0x8026ACB0; -__osRestoreInt = 0x8026ACD0; -__osProbeTLB = 0x8026B420; +osMapTLBRdb = 0x8026ABF0; // allow_duplicated:true +__osDisableInt = 0x8026ACB0; // allow_duplicated:true +__osRestoreInt = 0x8026ACD0; // allow_duplicated:true +__osProbeTLB = 0x8026B420; // allow_duplicated:true bcopy = 0x8026C110; __osSetCompare = 0x8026CA70; osGetCount = 0x8026CE00; @@ -49,3 +49,9 @@ __osRunningThread = 0x80277380; __osFaultedThread = 0x80277384; __osRcpImTable = 0x80278C60; __libm_qnan_f = 0x80278DB0; +n_aspMainTextStart = 0x80272590; // name_end:n_aspMainTextEnd +n_aspMainDataStart = 0x80278e80; // name_end:n_aspMainDataEnd +gSPF3DEX_fifoTextStart = 0x802731f0; // name_end:gSPF3DEX_fifoTextEnd +gSPF3DEX_fifoDataStart = 0x80279130; // name_end:gSPF3DEX_fifoDataEnd +gSPL3DEX_fifoTextStart = 0x80274620; // name_end:gSPL3DEX_fifoTextEnd +gSPL3DEX_fifoDataStart = 0x80279930; // name_end:gSPL3DEX_fifoDataEnd diff --git a/tools/n64splat b/tools/n64splat index ec7bd486..785e97b6 160000 --- a/tools/n64splat +++ b/tools/n64splat @@ -1 +1 @@ -Subproject commit ec7bd4868e6880a36bfd7ea3fb77573e3298e910 +Subproject commit 785e97b60418f9d56aca2dfd3374433f7bf92228 diff --git a/tools/splat_inputs.py b/tools/splat_inputs.py index 85a3cef8..e2e88e07 100755 --- a/tools/splat_inputs.py +++ b/tools/splat_inputs.py @@ -2,20 +2,24 @@ # Script to get a list of input files that are referenced by a splat file import argparse import sys +import yaml +import pathlib sys.path.append("./tools/n64splat") from split import * +from src.splat.util import options +from src.splat.scripts import split def main(config_path): # Load config with open(config_path) as f: config = yaml.load(f.read(), Loader=yaml.SafeLoader) - options.initialize(config, config_path, None, None) + options.initialize(config, [pathlib.Path(config_path)], [], False) options.opts.modes = [] options.opts.verbose = False - all_segments = initialize_segments(config["segments"]) + all_segments = split.initialize_segments(config["segments"]) objs = ""