diff --git a/CHANGELOG.md b/CHANGELOG.md index cea39363..7df75e32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,16 @@ # splat Release Notes +### 0.21.4 + +* New yaml option: `hasm_in_src_path` + * Tells splat to consider `hasm` files to be relative to `src_path` instead of `asm_path`. + ### 0.21.3 + * Updated version graphically ### 0.21.2 + * Fix bugs involving segments not having proper end rom positions if followed by segments with "auto" rom addresses; splat will now skip over these properly ### 0.21.1 diff --git a/docs/Configuration.md b/docs/Configuration.md index 3d3ef07c..4b82f0d3 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -228,6 +228,19 @@ cache_path: path/to/splat/cache #### Default `.splat_cache` +### hasm_in_src_path + +Tells splat to consider `hasm` files to be relative to `src_path` instead of `asm_path`. + +#### Usage + +```yaml +hasm_in_src_path: True +``` + +#### Default + +`False` ### create_undefined_funcs_auto If `True`, splat will generate an `undefined_funcs_auto.txt` file. diff --git a/pyproject.toml b/pyproject.toml index 15ea501c..6d7fbc58 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.3" +version = "0.21.4" description = "A binary splitting tool to assist with decompilation and modding projects" readme = "README.md" license = {file = "LICENSE"} diff --git a/src/splat/__init__.py b/src/splat/__init__.py index 33f0f769..926fc9ec 100644 --- a/src/splat/__init__.py +++ b/src/splat/__init__.py @@ -3,7 +3,7 @@ __package_name__ = __name__ # Should be synced with pyproject.toml -__version_info__: Tuple[int, int, int] = (0, 21, 3) +__version_info__: Tuple[int, int, int] = (0, 21, 4) __version__ = ".".join(map(str, __version_info__)) __author__ = "ethteck" diff --git a/src/splat/segtypes/common/hasm.py b/src/splat/segtypes/common/hasm.py index d0f18761..e8704039 100644 --- a/src/splat/segtypes/common/hasm.py +++ b/src/splat/segtypes/common/hasm.py @@ -1,7 +1,18 @@ +from pathlib import Path +from typing import Optional + from .asm import CommonSegAsm +from ...util import options + class CommonSegHasm(CommonSegAsm): + def out_path(self) -> Optional[Path]: + if options.opts.hasm_in_src_path: + return options.opts.src_path / self.dir / f"{self.name}.s" + + return super().out_path() + def scan(self, rom_bytes: bytes): if ( self.rom_start is not None diff --git a/src/splat/util/options.py b/src/splat/util/options.py index 04acff6a..e1edebed 100644 --- a/src/splat/util/options.py +++ b/src/splat/util/options.py @@ -63,6 +63,8 @@ class SplatOpts: nonmatchings_path: Path # Determines the path to the cache file (used when supplied --use-cache via the CLI) cache_path: Path + # Tells splat to consider `hasm` files to be relative to `src_path` instead of `asm_path`. + hasm_in_src_path: bool # Determines whether to create an automatically-generated undefined functions file # this file stores all functions that are referenced in the code but are not defined as seen by splat @@ -399,6 +401,7 @@ def parse_endianness() -> Literal["big", "little"]: data_path=p.parse_path(asm_path, "data_path", "data"), nonmatchings_path=p.parse_path(asm_path, "nonmatchings_path", "nonmatchings"), cache_path=p.parse_path(base_path, "cache_path", ".splache"), + hasm_in_src_path=p.parse_opt("hasm_in_src_path", bool, False), create_undefined_funcs_auto=p.parse_opt( "create_undefined_funcs_auto", bool, True ),