Decompollaborate / spimdisasm

MIPS disassembler
https://pypi.org/project/spimdisasm/
MIT License
42 stars 13 forks source link

Add --output-undecoded-strings to allow reassembling decoded strings #150

Closed cadmic closed 8 months ago

cadmic commented 8 months ago

Currently, spimdisasm will decode EUC-JP strings and output the decoded strings in an .asciz directive instead of the original string. This is very useful for humans, but it means that the disassembly does not actually reassemble to the original object. The new --output-undecoded-strings will output the original bytes instead, although with a comment containing the decoded string if the original was not ASCII.

Example output:

.align 2
dlabel RO_STR_801074E4_unknown
/* 0F65E4 801074E4 */ .asciz "Largest Free Block Size %08x\n"
.align 2
.size RO_STR_801074E4_unknown, . - RO_STR_801074E4_unknown

.align 2
dlabel RO_STR_80107504_unknown
/* 0F6604 80107504 */ .asciz /* "アリーナの内容をチェックしています... (%08x)\n" */ "\xA5\xA2\xA5\xEA\xA1\xBC\xA5\xCA\xA4\xCE\xC6\xE2\xCD\xC6\xA4\xF2\xA5\xC1\xA5\xA7\xA5\xC3\xA5\xAF\xA4\xB7\xA4\xC6\xA4\xA4\xA4\xDE\xA4\xB9\xA1\xA5\xA1\xA5\xA1\xA5 (%08x)\n"
.align 2
.size RO_STR_80107504_unknown, . - RO_STR_80107504_unknown

.align 2
dlabel RO_STR_80107538_unknown
/* 0F6638 80107538 */ .asciz /* "おおっと!! (%08x %08x)\n" */ "\xA4\xAA\xA4\xAA\xA4\xC3\xA4\xC8\xA1\xAA\xA1\xAA (%08x %08x)\n"
.align 2
.size RO_STR_80107538_unknown, . - RO_STR_80107538_unknown