Skip to content

Commit 45ab97b

Browse files
authored
Merge pull request #119 from Decompollaborate/develop
1.13.3
2 parents 7c67bb9 + ff9ec80 commit 45ab97b

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[project]
55
name = "spimdisasm"
66
# Version should be synced with spimdisasm/__init__.py
7-
version = "1.13.2"
7+
version = "1.13.3"
88
description = "MIPS disassembler"
99
# license = "MIT"
1010
readme = "README.md"

spimdisasm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77

8-
__version_info__ = (1, 13, 2)
8+
__version_info__ = (1, 13, 3)
99
__version__ = ".".join(map(str, __version_info__))
1010
__author__ = "Decompollaborate"
1111

spimdisasm/frontendCommon/FrontendUtilities.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def getSplittedSections(context: common.Context, splits: common.FileSplitFormat,
5858
outputFilePath = outputPath / fileName
5959

6060
common.Utils.printVerbose(f"Reading '{row.fileName}'")
61-
f = mips.FilesHandlers.createSectionFromSplitEntry(row, array_of_bytes, outputFilePath, context)
61+
f = mips.FilesHandlers.createSectionFromSplitEntry(row, array_of_bytes, context)
6262
f.setCommentOffset(row.offset)
6363
processedFiles[row.section].append(f)
6464
processedFilesOutputPaths[row.section].append(outputFilePath)
@@ -145,6 +145,7 @@ def writeProcessedFiles(processedFiles: dict[common.FileSectionType, list[mips.s
145145
if progressCallback is not None:
146146
progressCallback(i, str(filePath), processedFilesCount)
147147

148+
common.Utils.printVerbose(f"Writing {filePath}")
148149
mips.FilesHandlers.writeSection(filePath, f)
149150
i += 1
150151
return
@@ -167,7 +168,7 @@ def migrateFunctions(processedFiles: dict[common.FileSectionType, list[mips.sect
167168
rodataFileList = processedFiles.get(common.FileSectionType.Rodata, [])
168169
i = 0
169170
for textFile in processedFiles.get(common.FileSectionType.Text, []):
170-
filePath = functionMigrationPath / textFile.name
171+
filePath = functionMigrationPath / textFile.getName()
171172
filePath.mkdir(parents=True, exist_ok=True)
172173
for func in textFile.symbolList:
173174
if progressCallback is not None:
@@ -177,6 +178,7 @@ def migrateFunctions(processedFiles: dict[common.FileSectionType, list[mips.sect
177178
entry = mips.FunctionRodataEntry.getEntryForFuncFromPossibleRodataSections(func, rodataFileList)
178179

179180
funcPath = filePath / (func.getName()+ ".s")
181+
common.Utils.printVerbose(f"Writing function {funcPath}")
180182
with funcPath.open("w") as f:
181183
entry.writeToFile(f, writeFunction=True)
182184

spimdisasm/mips/FilesHandlers.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from . import FunctionRodataEntry
1818

1919

20-
def createSectionFromSplitEntry(splitEntry: common.FileSplitEntry, array_of_bytes: bytearray, outputPath: Path, context: common.Context) -> sections.SectionBase:
20+
def createSectionFromSplitEntry(splitEntry: common.FileSplitEntry, array_of_bytes: bytearray, context: common.Context) -> sections.SectionBase:
2121
offsetStart = splitEntry.offset
2222
offsetEnd = splitEntry.nextOffset
2323

@@ -36,15 +36,16 @@ def createSectionFromSplitEntry(splitEntry: common.FileSplitEntry, array_of_byte
3636

3737
f: sections.SectionBase
3838
if splitEntry.section == common.FileSectionType.Text:
39-
f = sections.SectionText(context, offsetStart, offsetEnd, vram, outputPath.stem, array_of_bytes, 0, None)
39+
f = sections.SectionText(context, offsetStart, offsetEnd, vram, splitEntry.fileName, array_of_bytes, 0, None)
4040
if splitEntry.isRsp:
4141
f.instrCat = rabbitizer.InstrCategory.RSP
4242
elif splitEntry.section == common.FileSectionType.Data:
43-
f = sections.SectionData(context, offsetStart, offsetEnd, vram, outputPath.stem, array_of_bytes, 0, None)
43+
f = sections.SectionData(context, offsetStart, offsetEnd, vram, splitEntry.fileName, array_of_bytes, 0, None)
4444
elif splitEntry.section == common.FileSectionType.Rodata:
45-
f = sections.SectionRodata(context, offsetStart, offsetEnd, vram, outputPath.stem, array_of_bytes, 0, None)
45+
f = sections.SectionRodata(context, offsetStart, offsetEnd, vram, splitEntry.fileName, array_of_bytes, 0, None)
4646
elif splitEntry.section == common.FileSectionType.Bss:
47-
f = sections.SectionBss(context, offsetStart, offsetEnd, splitEntry.vram, splitEntry.vram + offsetEnd - offsetStart, outputPath.stem, 0, None)
47+
bssVramEnd = splitEntry.vram + offsetEnd - offsetStart
48+
f = sections.SectionBss(context, offsetStart, offsetEnd, splitEntry.vram, bssVramEnd, splitEntry.fileName, 0, None)
4849
else:
4950
common.Utils.eprint("Error! Section not set!")
5051
exit(-1)
@@ -105,6 +106,8 @@ def writeOtherRodata(path: Path, rodataFileList: list[sections.SectionBase]):
105106
continue
106107

107108
rodataSymbolPath = rodataPath / (rodataSym.getName() + ".s")
109+
common.Utils.printVerbose(f"Writing unmigrated rodata {rodataSymbolPath}")
110+
108111
with rodataSymbolPath.open("w") as f:
109112
f.write(".section .rodata" + common.GlobalConfig.LINE_ENDS)
110113
f.write(rodataSym.disassemble(migrate=True))

spimdisasm/mips/MipsFileSplits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(self, context: common.Context, vromStart: int, vromEnd: int, vram:
7474
# if self.vram is None:
7575
# self.vram = splitEntry.vram
7676

77-
f = FilesHandlers.createSectionFromSplitEntry(splitEntry, array_of_bytes, Path(splitEntry.fileName), context)
77+
f = FilesHandlers.createSectionFromSplitEntry(splitEntry, array_of_bytes, context)
7878
f.parent = self
7979
f.setCommentOffset(splitEntry.offset)
8080

0 commit comments

Comments
 (0)