Skip to content

Commit

Permalink
Merge branch 'main' into sym_filename
Browse files Browse the repository at this point in the history
  • Loading branch information
ethteck authored Mar 19, 2024
2 parents 8ca21b7 + 1ae07f7 commit 3ffe563
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# splat Release Notes

### 0.22.4
* splat now checks if symbol names can be valid filepaths and produce an error if not.
* This is checked because functions are written to their own files and the symbol name is used as the filepath.
* There are two checks in place:
* The resulting filename should not exceed 255 bytes, since most OSes impose that restriction.
* It should not contain any of the following characters: `"<", ">", ":", '"', "/", "\\", "|", "?", "*"`
* It is possible to specify a different filename and retain the symbol name by using the `filename` attribute for each symbol on the `symbol_addrs` file.
* Make sure that the new specified `filename` does fit the listed requirements.
* Change `sbss` to properly work as a noload section.
* To make it not behave as noload then turn off `ld_bss_is_noload`.
* `ld_bss_is_noload` is now `False` by default for `psx` projects.

### 0.22.3

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The brackets corresponds to the optional dependencies to install while installin
If you use a `requirements.txt` file in your repository, then you can add this library with the following line:

```txt
splat64[mips]>=0.22.3,<1.0.0
splat64[mips]>=0.22.4,<1.0.0
```

### Optional dependencies
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.22.3"
version = "0.22.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__ = "0.22.3"
__version__ = "0.22.4"
__author__ = "ethteck"

from . import util as util
Expand Down
10 changes: 10 additions & 0 deletions src/splat/segtypes/common/bss.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

from ...disassembler.disassembler_section import make_bss_section

# If `options.opts.ld_bss_is_noload` is False, then this segment behaves like a `CommonSegData`


class CommonSegBss(CommonSegData):
def get_linker_section(self) -> str:
return ".bss"

@staticmethod
def is_data() -> bool:
if not options.opts.ld_bss_is_noload:
return True
return False

@staticmethod
Expand All @@ -20,6 +24,10 @@ def is_noload() -> bool:
return True

def disassemble_data(self, rom_bytes: bytes):
if not options.opts.ld_bss_is_noload:
super().disassemble_data(rom_bytes)
return

if not isinstance(self.rom_start, int):
log.error(
f"Segment '{self.name}' (type '{self.type}') requires a rom_start. Got '{self.rom_start}'"
Expand Down Expand Up @@ -65,4 +73,6 @@ def disassemble_data(self, rom_bytes: bytes):
)

def should_scan(self) -> bool:
if not options.opts.ld_bss_is_noload:
return super().should_scan()
return options.opts.is_mode_active("code") and self.vram_start is not None
4 changes: 2 additions & 2 deletions src/splat/segtypes/common/sbss.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .data import CommonSegData
from .bss import CommonSegBss


class CommonSegSbss(CommonSegData):
class CommonSegSbss(CommonSegBss):
def get_linker_section(self) -> str:
return ".sbss"
8 changes: 7 additions & 1 deletion src/splat/util/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ def parse_endianness() -> Literal["big", "little"]:
else:
raise ValueError(f"Invalid endianness: {endianness}")

default_ld_bss_is_noload = True
if platform == "psx":
default_ld_bss_is_noload = False

ret = SplatOpts(
verbose=verbose,
dump_symbols=p.parse_opt("dump_symbols", bool, False),
Expand Down Expand Up @@ -448,7 +452,9 @@ def parse_endianness() -> Literal["big", "little"]:
),
ld_rom_start=p.parse_opt("ld_rom_start", int, 0),
ld_fill_value=p.parse_optional_opt_with_default("ld_fill_value", int, 0),
ld_bss_is_noload=p.parse_opt("ld_bss_is_noload", bool, True),
ld_bss_is_noload=p.parse_opt(
"ld_bss_is_noload", bool, default_ld_bss_is_noload
),
ld_align_segment_vram_end=p.parse_opt("ld_align_segment_vram_end", bool, True),
ld_align_section_vram_end=p.parse_opt("ld_align_section_vram_end", bool, True),
ld_generate_symbol_per_data_segment=p.parse_opt(
Expand Down

0 comments on commit 3ffe563

Please sign in to comment.