From 03213e0ea3e88903ad721684afcc5ee0eeb7b3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20S=C3=A1nchez?= <55501523+andresj-sanchez@users.noreply.github.com> Date: Mon, 1 Jun 2026 17:36:23 -0400 Subject: [PATCH 1/2] Expose spimdisasm pad creation options Co-authored-by: dreamingmoths <252494949+dreamingmoths@users.noreply.github.com> Co-authored-by: Mc-muffin <8714476+Mc-muffin@users.noreply.github.com> --- docs/Configuration.md | 12 ++++++++++++ src/splat/disassembler/spimdisasm_disassembler.py | 15 +++++++++++++++ src/splat/util/options.py | 9 +++++++++ 3 files changed, 36 insertions(+) diff --git a/docs/Configuration.md b/docs/Configuration.md index 556d391a..88f42874 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -851,6 +851,18 @@ Global option for the rodata string guesser. 0 disables the guesser completely. Global option for the data string guesser. 0 disables the guesser completely. +### create_data_pads + +Tells the disassembler whether to create dummy and unreferenced data symbols after symbols with a non-zero user-declared size. + +### create_rodata_pads + +Tells the disassembler whether to create dummy and unreferenced rodata symbols after symbols with a non-zero user-declared size. + +### create_bss_pads + +Tells the disassembler whether to create dummy and unreferenced bss/sbss symbols after symbols with a non-zero user-declared size. + ### allow_data_addends Global option for allowing data symbols using addends on symbol references. It can be overriden per symbol diff --git a/src/splat/disassembler/spimdisasm_disassembler.py b/src/splat/disassembler/spimdisasm_disassembler.py index cf2406a3..6d856cee 100644 --- a/src/splat/disassembler/spimdisasm_disassembler.py +++ b/src/splat/disassembler/spimdisasm_disassembler.py @@ -37,6 +37,21 @@ def configure(self): options.opts.data_string_guesser_level ) + if options.opts.create_data_pads is not None: + spimdisasm.common.GlobalConfig.CREATE_DATA_PADS = ( + options.opts.create_data_pads + ) + + if options.opts.create_rodata_pads is not None: + spimdisasm.common.GlobalConfig.CREATE_RODATA_PADS = ( + options.opts.create_rodata_pads + ) + + if options.opts.create_bss_pads is not None: + spimdisasm.common.GlobalConfig.CREATE_BSS_PADS = ( + options.opts.create_bss_pads + ) + rabbitizer.config.regNames_userFpcCsr = False rabbitizer.config.regNames_vr4300Cop0NamedRegisters = False diff --git a/src/splat/util/options.py b/src/splat/util/options.py index 27089d51..f3c5689c 100644 --- a/src/splat/util/options.py +++ b/src/splat/util/options.py @@ -238,6 +238,12 @@ class SplatOpts: rodata_string_guesser_level: Optional[int] # Global option for the data string guesser. 0 disables the guesser completely. data_string_guesser_level: Optional[int] + # Tells the disassembler whether to create dummy and unreferenced data symbols after another symbol with non-zero user-declared size. + create_data_pads: Optional[bool] + # Tells the disassembler whether to create dummy and unreferenced rodata symbols after another symbol with non-zero user-declared size. + create_rodata_pads: Optional[bool] + # Tells the disassembler whether to create dummy and unreferenced bss/sbss symbols after another symbol with non-zero user-declared size. + create_bss_pads: Optional[bool] # Global option for allowing data symbols using addends on symbol references. It can be overriden per symbol allow_data_addends: bool # Tells the disassembler to try disassembling functions with unknown instructions instead of falling back to disassembling as raw data @@ -618,6 +624,9 @@ def parse_include_asm_macro_style() -> Literal["default", "maspsx_hack"]: data_string_guesser_level=p.parse_optional_opt( "data_string_guesser_level", int ), + create_data_pads=p.parse_optional_opt("create_data_pads", bool), + create_rodata_pads=p.parse_optional_opt("create_rodata_pads", bool), + create_bss_pads=p.parse_optional_opt("create_bss_pads", bool), allow_data_addends=p.parse_opt("allow_data_addends", bool, True), header_encoding=p.parse_opt("header_encoding", str, "ASCII"), gfx_ucode=p.parse_opt_within( From e3e4189137adb3097a85da7b6a808e289692f434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20S=C3=A1nchez?= <55501523+andresj-sanchez@users.noreply.github.com> Date: Tue, 2 Jun 2026 02:28:32 -0400 Subject: [PATCH 2/2] Require spimdisasm 1.41.0 Co-authored-by: dreamingmoths <252494949+dreamingmoths@users.noreply.github.com> Co-authored-by: Mc-muffin <8714476+Mc-muffin@users.noreply.github.com> --- CHANGELOG.md | 2 ++ pyproject.toml | 2 +- requirements.txt | 2 +- src/splat/disassembler/spimdisasm_disassembler.py | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5d3b653..a3db2da3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ * Now internally every segment has a `bss_size` attribute, which is considered in most calculations now. * This fixes some usages where bss segments would report the wrong `vram_end`. * Consider zero-sized bss segments as valid if they are the last subsegment of a code segment. +* Add options `create_data_pads`, `create_rodata_pads` and `create_bss_pads` for controlling spimdisasm autogenerated data, rodata, and BSS/SBSS pad symbols. +* `spimdisasm` 1.41.0 or above is now required. ### 0.40.0 diff --git a/pyproject.toml b/pyproject.toml index e04cdd70..837ab8f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ dependencies = [ [project.optional-dependencies] mips = [ - "spimdisasm>=1.40.0,<2.0.0", # This value should be keep in sync with the version listed on disassembler/spimdisasm_disassembler.py + "spimdisasm>=1.41.0,<2.0.0", # This value should be keep in sync with the version listed on disassembler/spimdisasm_disassembler.py "rabbitizer>=1.12.0,<2.0.0", "pygfxd>=1.0.5", "n64img>=0.3.3", diff --git a/requirements.txt b/requirements.txt index 2d471d6f..ccee9aba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ tqdm==4.67.1 intervaltree==3.1.0 colorama==0.4.6 # This value should be keep in sync with the version listed on disassembler/spimdisasm_disassembler.py and pyproject.toml -spimdisasm>=1.40.0 +spimdisasm>=1.41.0 rabbitizer>=1.10.0 pygfxd>=1.0.5 n64img>=0.1.4 diff --git a/src/splat/disassembler/spimdisasm_disassembler.py b/src/splat/disassembler/spimdisasm_disassembler.py index 6d856cee..c7e1b177 100644 --- a/src/splat/disassembler/spimdisasm_disassembler.py +++ b/src/splat/disassembler/spimdisasm_disassembler.py @@ -7,7 +7,7 @@ class SpimdisasmDisassembler(disassembler.Disassembler): # This value should be kept in sync with the version listed on requirements.txt and pyproject.toml - SPIMDISASM_MIN = (1, 40, 0) + SPIMDISASM_MIN = (1, 41, 0) def configure(self): # Configure spimdisasm