AetiasHax / ds-rom

Library/CLI for extracting and building DS ROMs
6 stars 0 forks source link

Panic on `rom dump --show-fnt` (Fire Emblem: Shadow Dragon, USA) #1

Closed Eebit closed 2 weeks ago

Eebit commented 2 weeks ago

Hey there! Thanks for working on this project -- it looks very promising so far!

I've been doing some early experimenting with Fire Emblem: Shadow Dragon (USA), and this project (and dsd) came along at just the right time. Unfortunately, I get an issue when trying to load the FNT of the ROM:

$ ./dsrom-windows-x86_64.exe dump --rom fe11.nds  --show-fnt
thread 'main' panicked at lib\src\rom\raw\fnt.rs:172:52:
file name could not be parsed: Utf8Error { valid_up_to: 0, error_len: Some(1) }

Version: 0.2.0 OS: Windows

Output of --show-header ``` $ ./dsrom-windows-x86_64.exe dump --rom fe11.nds --show-header ROM header: Header version .......... : DS after DSi release Title ................... : FIREEMBLEM11 Gamecode ................ : YFEE Makercode ............... : 01 Unitcode ................ : 0 DS flags ................ : Normal DSi flags ............... : Normal Capacity ................ : 64MB ROM size (DS) ........... : 57.5MB (0x39824c0) ROM version ............. : 0 ARM9 program Offset ........ : 0x4000 Entrypoint .... : 0x2000800 Base address .. : 0x2000000 Size .......... : 0xe8a78 ARM9 autoload callback .. : 0x2000a74 ARM9 build info offset .. : 0x4b68 ARM7 program Offset ........ : 0x208200 Entrypoint .... : 0x2380000 Base address .. : 0x2380000 Size .......... : 0x26f28 ARM7 autoload callback .. : 0x2380188 ARM7 build info offset .. : 0x0 File name table Offset .. : 0x22f200 Size .... : 0x98ce File allocation table Offset .. : 0x238c00 Size .... : 0x7e40 Banner Offset: 0x240c00 Normal cmd setting ...... : 0x416657 KEY1 cmd setting ........ : 0x81808f8 Seed select ............. : 0x0 Autostart ............... : 0x0 Secure area disable ..... : 0x0 Secure area delay ....... : 26.4ms (0xd7e) Secure area CRC ......... : 0x2369 Logo CRC ................ : 0xcf56 Header CRC .............. : 0xaf57 Logo .................... : ⣿⠛⠛⢿⣿⣿⠛⠛⣿⠛⠛⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⠛⣿⣿⣿⣿⣿⣿⡿⡫⠭⣝⢿ ⣿⠀⠀⡈⢻⣿⠀⠀⣿⠒⠒⣿⠛⠛⠟⠛⠻⢿⣉⠀⠀⣉⣿⠟⢛⡛⠻⣿⡟⠛⠻⠛⠛⠿⣿⣿⠟⠛⠻⠀⠀⣿⡿⠛⣛⠛⢿⣇⢇⣭⡺⣸ ⣿⠀⠀⣷⡄⠹⠀⠀⣿⠀⠀⣿⠀⠀⣾⣿⠀⠀⣿⠀⠀⣿⠁⠀⣛⣛⣀⣈⡇⠀⢰⣿⡇⠀⢸⠁⠀⣾⣿⠀⠀⡏⠀⢸⣿⡇⠀⢹⣷⣶⣾⣿ ⣿⠀⠀⣿⣿⣆⠀⠀⣿⠀⠀⣿⠀⠀⣿⣿⠀⠀⣿⠀⠀⣿⣦⡀⠻⠟⢀⣠⡇⠀⢸⣿⡇⠀⢸⣦⡀⠻⠟⠀⠀⣷⣄⠘⠿⠃⣠⣾⣿⣿⣿⣿ DS ROM region end ....... : 0x0 DSi ROM region end ...... : 0x0 ROM NAND end ............ : 0x0 RW NAND end ............. : 0x0 Debug ROM offset ........ : 0x0 Debug size .............. : 0x0 Debug RAM address ....... : 0x0 Header size ............. : 0x4000 ```

It seems like it's possible to load the FNT of other ROMs (e.g. I tried with Pokemon Black and it was able to print it without issue).

I'm happy to provide any other contextual information to help troubleshoot, just let me know!

Eebit commented 2 weeks ago

I dug into it a bit more, and it looks like the files that cause issues are named with SHIFT-JIS encoding -- they reside in a file folder called "nameinput" in the original ROM.

ひらがな.txt
カタカナ.txt
英数字.txt
漢字.txt
半角英数字.txt
AetiasHax commented 2 weeks ago

Thanks for reporting! I didn't know that the FNT is SHIFT-JIS encoded, but it makes sense that it is. Will fix soon!

AetiasHax commented 2 weeks ago

Resolved by #2, see the new release v0.2.1. Thanks for the detailed issue!

Eebit commented 2 weeks ago

Thanks a lot for the quick fix!