ROM Hack Decompressing Trauma Center: Under the Knife (romfile.bin) (help needed)

Lucinamarth

Active Member
OP
Newcomer
Joined
Jan 7, 2017
Messages
33
Trophies
0
Age
21
XP
65
Country
I wanted to start working on a graphical mod for the game Trauma Center: Under the Knife (aiming to replace some of its character assets with those from its sequel, as well as its Wii remake Trauma Center: Second Opinion) so I dumped the game's rom (.nds) file and opened it up with a few programs (I've tried Crystaltile2 and Tinke.)

The game's directory looks like this in Crystaltile2:
1650567917706.png

As you can see, the largest file by far is romfile.bin which appears to be a compressed archive containing most of the actual game content.

The main point of my problem is that I don't know what kind of compression has been used on romfile.bin, and my efforts so far to decompress it in order to begin locating the game's assets have been unsuccessful. If you have experience with DS ROM hacking, I would really appreciate any advice.

That's the core of the thread, but I'd also like to share some of what I've found while looking into the issue, in case it helps to narrow things down.

Firstly: this thread from 2020 in which someone asks about the same file:
https://gbatemp.net/threads/how-to-extract-from-trauma-centers-romfile-bin.562966/
(Apologies if my thread seems unnecessary when this one exists, but I didn't think necroposting just to ask "figured it out yet?" would be appropriate forum behaviour)

Secondly: also in 2020, a team developed and released a complete Brazilian Portuguese translation of the game, implying that they were able to successfully decompress and edit the ROM:
https://www.romhacking.net/translations/5774/
The translation is impressively polished, and includes text, graphical and even audio edits which show that the game has been reverse-engineered before.

Thirdly: the game also has a mod (ALSO released in 2020) which adds button controls, further showing that it has been decompressed before:
https://www.romhacking.net/hacks/5565/
I don't have much more to say, but this ROM hack also shows that the game has been modded before.
(It seems like interest in this game peaked in 2020? Probably something to do with the game's plot about an epidemic :huh: )

Finally: some evidence of other games (Ace Attorney Investigations, mostly) using a romfile.bin which needs to be decompressed. This one is tenuous but they might use the same compression; by this point I was desperate:
http://www.romhacking.net/forum/index.php?topic=31882.0
In this thread, a Ukrainian user (needless to say, I hope they're alright) complains of a very similar issue, and having used Tinke unsuccessfully to inspect another game's romfile.bin.

All of this extra information might be unnecessary, but I'll share it anyway because I want to show that I've spent plenty of time researching my issue independently before choosing to bother the forum with it; I wouldn't want to waste all your time before trying on my own first.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
35,099
Trophies
2
Website
trastindustries.com
XP
24,620
Country
United Kingdom
I have not got it in front of me right now to pull apart but most of these archives are not so bad.

I don't see any other files in the same directory worth considering (sometimes archives will have separate listings for various reasons) so it is probably all in the thing.

To that end most of the the first however much of the file will be at least the sizes/locations of the files, hopefully also some file names.
Assuming it does not jump out at you (runs of numbers increasing in size by various amounts is a good sign of something to investigate) what most do in these scenarios is try to find a bunch of sub files -- I imagine a bunch of https://www.romhacking.net/documents/[469]nds_formats.htm are in there somewhere. From there you know the start of the archived files, and ends to go for the next files if you use any internal size values to figure it out, which also means start of next file. Get a little list going of sizes and locations and compare that to any potential candidates for pointers at the start or end (footers are rare but have been seen).
Alternatively if anything has been compressed within it (you won't compress a whole however many megs file that is as you have to then decompress the lot -- the DS having 4 megs of RAM which it needs to do everything but some aspects of graphics, including house the ARM9) then a compression search within it (don't know what I am suggesting right now -- cue's stuff is more for when you get it out, dsdecmp might do something, crystaltile2 is unstable as you like as well as lying lots but can get it done. Most compression searching efforts are more for the GBA, though this should be early enough that it should be mostly BIOS compatible type 10 so who knows) might yield some locations to look at, do also be aware of compression if you are searching for magic stamps (in this case it will start with 10 hex or maybe 11 and have a file size afterwards, and flags for the compression will mess up locations if you are comparing to the link above or similar documents).

Beyond that you can watch the game decode something and fetch it as it will have to go through pointer lists and formulating a read command. Jumping into assembly, much less tracing on the DS, is possibly a bit much but the idea is sound enough -- I would probably find something in RAM, find it in the romfile.bin/ROM as a whole. Set a bread on read for that address and work backwards from there as it generates the B7 command ( http://problemkaputt.de/gbatek.htm#dscartridgeprotocol ) and thus you have your pointer list and how it works.
I have seen games do extra maths to generate pointers -- as I noted in one of your earlier links then these sorts of games are seen from time to time on the DS, another one of those being Touch Detective which did a shift (effectively multiplies a binary number) to get the final result, I discovering that by finding a known format first and figuring out what it corresponded to in the header.

I don't know if Ace Attorney Investigations will be this -- that was a fairly late game compared to this and also from a different company (Atlus vs Capcom). While possible it is some middleware I would bet more heavily on it being the "just need a name" picked the same as calling it .bin for the extension.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    NeoGaming @ NeoGaming: but able for to sell it i had to unhomebrew it which was a pain