diff --git a/CHANGELOG.md b/CHANGELOG.md index 88746cf0..fafb79ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.31.2] - 2024-12-02 + +### Fixed + +- Fix jumptable labels sometimes missing their rom suffix. + ## [1.31.1] - 2024-12-01 ### Fixed @@ -1707,6 +1713,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Version 1.0.0 [unreleased]: https://github.com/Decompollaborate/spimdisasm/compare/master...develop +[1.31.2]: https://github.com/Decompollaborate/spimdisasm/compare/1.31.1...1.31.2 [1.31.1]: https://github.com/Decompollaborate/spimdisasm/compare/1.31.0...1.31.1 [1.31.0]: https://github.com/Decompollaborate/spimdisasm/compare/1.30.2...1.31.0 [1.30.2]: https://github.com/Decompollaborate/spimdisasm/compare/1.30.1...1.30.2 diff --git a/README.md b/README.md index 191c203b..7aab1005 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ If you use a `requirements.txt` file in your repository, then you can add this library with the following line: ```txt -spimdisasm>=1.31.1,<2.0.0 +spimdisasm>=1.31.2,<2.0.0 ``` ### Development version diff --git a/pyproject.toml b/pyproject.toml index e1164a72..34076f8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [project] name = "spimdisasm" # Version should be synced with spimdisasm/__init__.py -version = "1.31.1" +version = "1.31.2" description = "MIPS disassembler" readme = "README.md" license = {file = "LICENSE"} diff --git a/spimdisasm/__init__.py b/spimdisasm/__init__.py index 866fca37..8a4a126a 100644 --- a/spimdisasm/__init__.py +++ b/spimdisasm/__init__.py @@ -5,7 +5,7 @@ from __future__ import annotations -__version_info__: tuple[int, int, int] = (1, 31, 1) +__version_info__: tuple[int, int, int] = (1, 31, 2) __version__ = ".".join(map(str, __version_info__))# + "-dev0" __author__ = "Decompollaborate" diff --git a/spimdisasm/mips/FuncRodataEntry.py b/spimdisasm/mips/FuncRodataEntry.py index 545bb635..03dfc3c3 100644 --- a/spimdisasm/mips/FuncRodataEntry.py +++ b/spimdisasm/mips/FuncRodataEntry.py @@ -53,6 +53,16 @@ def iterRodataSyms(self) -> Generator[symbols.SymbolBase, None, None]: yield sym def writeToFile(self, f: TextIO, writeFunction: bool=True) -> None: + # Sadly, we have some logic that may affect disassembling other symbols + # on the "function"'s disassembly function, like setting the rom address + # of jumptable labels. Having this info may affect the name they get + # disassembled as. + # To avoid this issue, we disassemble the function first without writing + # it to the file. + disassembledFunction: str|None = None + if self.function is not None: + disassembledFunction = self.function.disassemble(migrate=self.hasRodataSyms(), isSplittedSymbol=True) + if len(self.rodataSyms) > 0: # Write the rdata f.write(f".section {self.sectionRodata}{common.GlobalConfig.LINE_ENDS}") @@ -79,13 +89,13 @@ def writeToFile(self, f: TextIO, writeFunction: bool=True) -> None: f.write(sym.disassemble(migrate=True, useGlobalLabel=True, isSplittedSymbol=True)) f.write(common.GlobalConfig.LINE_ENDS) - if self.function is not None: + if disassembledFunction is not None: if len(self.rodataSyms) > 0 or len(self.lateRodataSyms) > 0: f.write(f"{common.GlobalConfig.LINE_ENDS}.section {self.sectionText}{common.GlobalConfig.LINE_ENDS}") if writeFunction: # Write the function itself - f.write(self.function.disassemble(migrate=self.hasRodataSyms(), isSplittedSymbol=True)) + f.write(disassembledFunction) def getName(self) -> str: assert self.function is not None or self.hasRodataSyms()