Skip to content

Commit

Permalink
Fix $gp calculation when addiu value is negative (#393)
Browse files Browse the repository at this point in the history
* Fix $gp calculation when addiu value is negative

* black

* Use getProcessedImmediate

* Bump version to 0.25.3
  • Loading branch information
mkst authored Aug 10, 2024
1 parent f37e767 commit e2a638e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# splat Release Notes

### 0.25.3

* Fix incorrect calculation for `$gp` value in create_config.py for PSX when immediate value is negative.

### 0.25.2

* Two new yaml options: `use_gp_rel_macro_nonmatching` and `use_gp_rel_macro`
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.25.2,<1.0.0
splat64[mips]>=0.25.3,<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.25.2"
version = "0.25.3"
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.25.2"
__version__ = "0.25.3"
__author__ = "ethteck"

from . import util as util
Expand Down
4 changes: 2 additions & 2 deletions src/splat/util/psx/psxexeinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def try_get_gp(rom_bytes, start_offset, max_instructions=50) -> int:
break
insn = rabbitizer.Instruction(word)
if insn.getOpcodeName() == "lui" and insn.rt.name == "gp":
gp = insn.getImmediate() << 16
gp = insn.getProcessedImmediate() << 16
elif insn.getOpcodeName() == "addiu" and insn.rt.name == "gp":
gp += insn.getImmediate()
gp += insn.getProcessedImmediate()
break
return gp

Expand Down

0 comments on commit e2a638e

Please sign in to comment.