diff --git a/CHANGELOG.md b/CHANGELOG.md index c651c2be..64204704 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # splat Release Notes +### 0.21.7 + +* New attribute for symbols: `allow_duplicated` + * Allows to lift the duplicated symbol restriction for the specified symbols, allowing to have specific symbols that are not checked for shared vrams or names but keeping the check for everything else. + ### 0.21.6 * Fix `bss_contains_common` option not being passed to "auto all" inserted sections. diff --git a/docs/Adding-Symbols.md b/docs/Adding-Symbols.md index 8bb0debe..f4d875df 100644 --- a/docs/Adding-Symbols.md +++ b/docs/Adding-Symbols.md @@ -134,3 +134,16 @@ This attribute overrides the global `allow_data_addends` option. ```ini aspMainTextStart = 0x80084760; // dont_allow_addend:True ``` + +### `allow_duplicated` + +Tells splat that a symbol is allowed to have its vram/name duplicated with another symbol. + +This attribute has to be specified on all symbols that share the same vram or name. + +**Example** +```ini +obj_fallCA1_tex_rgb_ia8 = 0x06013118; // allow_duplicated:True +// ... +obj_fallCA1_tex_rgb_ia8 = 0x060140A8; // allow_duplicated:True +``` diff --git a/pyproject.toml b/pyproject.toml index 4195eebc..b060fe5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "splat64" # Should be synced with src/splat/__init__.py -version = "0.21.6" +version = "0.21.7" description = "A binary splitting tool to assist with decompilation and modding projects" readme = "README.md" license = {file = "LICENSE"} diff --git a/src/splat/util/symbols.py b/src/splat/util/symbols.py index b78bede0..433b964f 100644 --- a/src/splat/util/symbols.py +++ b/src/splat/util/symbols.py @@ -252,7 +252,7 @@ def get_seg_for_rom(rom: int) -> Optional["Segment"]: if not sym.allow_duplicated or not seen_symbols[sym.name].allow_duplicated: log.parsing_error_preamble(path, line_num, line) log.error( - f"Duplicate symbol detected! {sym.name} has already been defined at vram 0x{seen_symbols[sym.name].vram_start:X}" + f"Duplicate symbol detected! {sym.name} has already been defined at vram 0x{seen_symbols[sym.name].vram_start:08X}" ) if addr in all_symbols_dict: @@ -265,7 +265,7 @@ def get_seg_for_rom(rom: int) -> Optional["Segment"]: if not sym.allow_duplicated or not item.allow_duplicated: log.parsing_error_preamble(path, line_num, line) log.error( - f"Duplicate symbol detected! {sym.name} clashes with {item.name} defined at vram 0x{addr:X}.\n If this is intended, specify either a segment or a rom address for this symbol" + f"Duplicate symbol detected! {sym.name} clashes with {item.name} defined at vram 0x{addr:08X}.\n If this is intended, specify either a segment or a rom address for this symbol" ) seen_symbols[sym.name] = sym @@ -370,13 +370,13 @@ def initialize_spim_context(all_segments: "List[Segment]") -> None: for ovl_segment in overlay_segments: assert ( ovl_segment.vramStart <= ovl_segment.vramEnd - ), f"{ovl_segment.vramStart:X} {ovl_segment.vramEnd:X}" + ), f"{ovl_segment.vramStart:08X} {ovl_segment.vramEnd:08X}" if ( ovl_segment.vramEnd > global_vram_start and global_vram_end > ovl_segment.vramStart ): log.write( - f"Warning: the vram range ([0x{ovl_segment.vramStart:X}, 0x{ovl_segment.vramEnd:X}]) of the non-global segment at rom address 0x{ovl_segment.vromStart:X} overlaps with the global vram range ([0x{global_vram_start:X}, 0x{global_vram_end:X}])", + f"Warning: the vram range ([0x{ovl_segment.vramStart:08X}, 0x{ovl_segment.vramEnd:08X}]) of the non-global segment at rom address 0x{ovl_segment.vromStart:X} overlaps with the global vram range ([0x{global_vram_start:08X}, 0x{global_vram_end:08X}])", status="warn", ) @@ -600,7 +600,7 @@ def format_name(self, format: str) -> str: if "$ROM" in ret: if not isinstance(self.rom, int): log.error( - f"Attempting to rom-name a symbol with no ROM address: {self.vram_start:X} typed {self.type}" + f"Attempting to rom-name a symbol with no ROM address: {self.vram_start:08X} typed {self.type}" ) ret = ret.replace("$ROM", f"{self.rom:X}")