Skip to content

Commit

Permalink
hasm_in_src_path (#328)
Browse files Browse the repository at this point in the history
* impl

* changelog

* hasm_in_src_path
  • Loading branch information
AngheloAlf authored Jan 16, 2024
1 parent 2135b10 commit 9d37168
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 13 additions & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion src/splat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
11 changes: 11 additions & 0 deletions src/splat/segtypes/common/hasm.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/splat/util/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
),
Expand Down

0 comments on commit 9d37168

Please sign in to comment.