diff --git a/configure.py b/configure.py index 21f6f860ee..5febf47ffd 100755 --- a/configure.py +++ b/configure.py @@ -47,7 +47,8 @@ def read_splat(splat_config: str): for segment in all_segments: for subdir, path, obj_type, start in segment.get_ld_files(): - path = subdir + "/" + path + print(path) + path = (segment.name if segment.name.endswith("/") else "") + subdir + "/" + path objects.add(path) segments[path] = segment diff --git a/src/battle/area_kmr_part_1/battles.c b/src/battle/area_kmr_part_1/battles.c index 3b9c3ae854..c89528b310 100644 --- a/src/battle/area_kmr_part_1/battles.c +++ b/src/battle/area_kmr_part_1/battles.c @@ -1,9 +1,9 @@ #include "common.h" #include "battle/battle.h" -#include "battle/actor/goomba.h" -#include "battle/actor/paragoomba.h" -#include "battle/actor/spiked_goomba.h" +#include "goomba.h" +#include "paragoomba.h" +#include "spiked_goomba.h" #define NAMESPACE b_area_kmr_part_1 diff --git a/src/battle/actor/goomba.c b/src/battle/area_kmr_part_1/goomba.c similarity index 100% rename from src/battle/actor/goomba.c rename to src/battle/area_kmr_part_1/goomba.c diff --git a/src/battle/actor/goomba.h b/src/battle/area_kmr_part_1/goomba.h similarity index 100% rename from src/battle/actor/goomba.h rename to src/battle/area_kmr_part_1/goomba.h diff --git a/src/battle/actor/paragoomba.h b/src/battle/area_kmr_part_1/paragoomba.h similarity index 100% rename from src/battle/actor/paragoomba.h rename to src/battle/area_kmr_part_1/paragoomba.h diff --git a/src/battle/actor/spiked_goomba.h b/src/battle/area_kmr_part_1/spiked_goomba.h similarity index 100% rename from src/battle/actor/spiked_goomba.h rename to src/battle/area_kmr_part_1/spiked_goomba.h diff --git a/src/battle/item/coconut.c b/src/battle/item/coconut/aux.c similarity index 100% rename from src/battle/item/coconut.c rename to src/battle/item/coconut/aux.c diff --git a/tools/splat.yaml b/tools/splat.yaml index 7af8f092e9..3053bd65a1 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -1550,10 +1550,10 @@ segments: - [0x4313F0, c] - [0x431660, c] - [0x4318D0, c] - - [0x431B80, .data, battle/area_kmr_part_1/battles] - - [0x431FB0, .data, battle/actor/goomba] + - [0x431B80, .data, battles] + - [0x431FB0, .data, goomba] - [0x433970, bin] - - [0x4398A0, .rodata, battle/area_kmr_part_1/battles] + - [0x4398A0, .rodata, battles] - [0x439984, bin] - name: battle/area_kmr_part_2/ type: code @@ -2338,14 +2338,18 @@ segments: files: - [0x72E530, c] - [0x72EA20, data] - - name: battle/item/coconut + - name: battle/item/coconut/ type: code start: 0x72F720 vram: 0x802A1000 overlay: True files: - - [0x72F720, c, battle/item/coconut] - - [0x72F960, .data, battle/item/coconut] + - [0x72F720, c, aux] + - [0x72F960, .data, aux] + # - [0x72F960, .data, aux] + # - [0x72F960, ci8, coconut, w, h] + # - [0x72F960, palette, coconut] + # - [0x72F960, .data, coconut] - name: battle/item/electro_pop type: code start: 0x7305A0 @@ -2742,7 +2746,7 @@ segments: - [0x7E3700, c] - [0x7E4690, c] - [0x7E4D00, data] - - [0x7E7380, .rodata, world/script_api/7E2AA0] + - [0x7E7380, .rodata, 7E2AA0] - name: world/area_mac/machi/ type: code overlay: True @@ -3279,13 +3283,13 @@ segments: - [0x8C82B0, c] - [0x8C83A0, c] - [0x8C85E0, c] - - [0x8C85E0, .data, world/area_kmr/kmr_03/8C7F90] - - [0x8C8680, .data, world/area_kmr/kmr_03/8C8140] - - [0x8C88E0, .data, world/area_kmr/kmr_03/8C82B0] + - [0x8C85E0, .data, 8C7F90] + - [0x8C8680, .data, 8C8140] + - [0x8C88E0, .data, 8C82B0] # - [0x8C9400, bin] - - [0x8C9780, .data, world/area_kmr/kmr_03/8C83A0] - - [0x8CA2D0, .data, world/area_kmr/kmr_03/8C85E0] - - [0x8CA8F0, .rodata, world/area_kmr/kmr_03/8C8140] + - [0x8C9780, .data, 8C83A0] + - [0x8CA2D0, .data, 8C85E0] + - [0x8CA8F0, .rodata, 8C8140] - name: world/area_kmr/kmr_04/ type: code overlay: True @@ -3391,10 +3395,10 @@ segments: start: 0x8EB360 vram: 0x80240000 files: - - [0x8EB360, c, world/area_kmr/kmr_12/header] - - [0x8EB390, .data, world/area_kmr/kmr_12/header] - - [0x8EB420, .data, world/area_kmr/kmr_12/events] - - [0x8EBE10, .rodata, world/area_kmr/kmr_12/events] + - [0x8EB360, c, header] + - [0x8EB390, .data, header] + - [0x8EB420, .data, events] + - [0x8EBE10, .rodata, events] - name: world/area_kmr/kmr_20/ type: code overlay: True @@ -3589,9 +3593,9 @@ segments: files: - [0x929270, c] - [0x9292B0, c] - - [0x9292D0, .data, world/area_sbk/sbk_00/929270] - - [0x929A00, .data, world/area_sbk/sbk_00/9292B0] - - [0x929A80, .rodata, world/area_sbk/sbk_00/929270] + - [0x9292D0, .data, "929270"] + - [0x929A00, .data, 9292B0] + - [0x929A80, .rodata, "929270"] - name: world/area_sbk/sbk_01/ type: code overlay: True @@ -3600,9 +3604,9 @@ segments: files: - [0x929A90, c] - [0x929AD0, c] - - [0x929AF0, .data, world/area_sbk/sbk_01/929A90] - - [0x929E00, .data, world/area_sbk/sbk_01/929AD0] - - [0x92A290, .rodata, world/area_sbk/sbk_01/929A90] + - [0x929AF0, .data, 929A90] + - [0x929E00, .data, 929AD0] + - [0x92A290, .rodata, 929A90] - name: world/area_sbk/sbk_02/ type: code overlay: True diff --git a/tools/splat/requirements.txt b/tools/splat/requirements.txt index 1a273b575c..20331e4a2a 100644 --- a/tools/splat/requirements.txt +++ b/tools/splat/requirements.txt @@ -1,4 +1,5 @@ PyYAML>=5.3.1,<6 pypng==0.0.20 colorama>=0.4.4,<0.5 -capstone>=4.0.2,<5 +python-ranges>=0.1.3,<0.2 +capstone>=4.0.2,<5 \ No newline at end of file diff --git a/tools/splat/segtypes/n64/code.py b/tools/splat/segtypes/n64/code.py index f752f68a80..795db82337 100644 --- a/tools/splat/segtypes/n64/code.py +++ b/tools/splat/segtypes/n64/code.py @@ -46,7 +46,7 @@ def get_funcs_defined_in_c(c_file): class N64SegCode(N64Segment): def parse_segment_files(self, segment, seg_start, seg_end, seg_name, seg_vram): - prefix = seg_name if seg_name.endswith("/") else f"{seg_name}_" + prefix = "" if seg_name.endswith("/") else f"{seg_name}_" ret = [] prev_start = -1 @@ -733,7 +733,11 @@ class N64SegCode(N64Segment): if file_type == "c": c_path = os.path.join( - base_path, "src", split_file["name"] + "." + self.get_ext(split_file["subtype"])) + base_path, + "src", + self.name if self.name.endswith("/") else "", + split_file["name"] + "." + self.get_ext(split_file["subtype"]) + ) if os.path.exists(c_path): defined_funcs = get_funcs_defined_in_c(c_path) diff --git a/tools/splat/segtypes/segment.py b/tools/splat/segtypes/segment.py index 0695c4c8ea..a02f1ccc24 100644 --- a/tools/splat/segtypes/segment.py +++ b/tools/splat/segtypes/segment.py @@ -1,5 +1,6 @@ from pathlib import Path, PurePath from util import log +import os default_subalign = 16 @@ -129,7 +130,7 @@ class Segment: for subdir, path, obj_type, start in self.get_ld_files(): # Hack for non-0x10 alignment if start % 0x10 != 0 and i != 0: - tmp_sect_name = path.replace(".", "_") + tmp_sect_name = os.path.join(subdir, path).replace(".", "_") tmp_sect_name = tmp_sect_name.replace("/", "_") tmp_vram = start - self.rom_start + self.vram_start s += (