I’m on an adventure learning the basics of Nintendo DS ROM hacking/modding because there is a very stupid, very self-indulgent, very spoilery ROM hack/mod I want to implement for Ghost Trick. It has been a journey and I’m going to document my adventures on here as a series titled "Leo Tries Modding Ghost Trick." Anything pertaining to the actual in-game spoilers down the line will be posted under a big obvious line with a warning, but for now, I'll just be doing a general look at How Does Viddygame Work.
Now…. for “progress” I’ve made so far, if you can call it that. The first thing I need to figure out is whether I can implement a swap of talk sprites. So I set out to try and isolate the talk sprites.
I started by checking out the Ultimate Nintendo DS ROM Hacking Guide, which seemed as good a starting place as any. I also downloaded the big zipped file with all the referenced programs, but as I found out later, some of the programs didn’t zip properly so I had to procure them elsewhere.
At any rate, I tried to open up the Ghost Trick .nds file in CrystalTile2, and that much was a success…. and just about that much only. Ghost Trick doesn’t use the file types referenced in the guide. There are .xml.lz files and .bin files. I didn’t know what to do with these yet, so I decided to just mess around in the tile viewer and see if I could find anything. After some aimless scrolling, I did find something that gave me hope that I was in fact looking at meaningful data:
(don’t mind the windows 7 and pesterchum and malwarebytes this is my old 2011 laptop from undergrad, it just so happens that a lot of tools for NDS hacking work great on windows 7 because shit’s old)
That right there is very unambiguously the Ghost Trick logo. It gave me a glimmer of hope. And CrystalTile lets you highlight a selection of tiles and export them as an image:
My rudimentary knowledge of How This Works tells me that it needs to reference the right palette for the colors to be right, but whatever, this is CLEARLY IMAGE DATA so ALL IS NOT LOST.
…but, for a while, that was about as far as I got. Some googling brought me to this thread, where OP states that allegedly the “cpac_2d.bin” contains all of the sprite data in the game [this is Capcom standard, it seems?], but they were having trouble actually accessing said data. Viewed as-is it’s a jumbled mess, I haven’t been able to make heads or tails of it in CrystalTile although this could certainly be because they’re out of order in a way that’s not obvious. It is really, really difficult to parse like this…. it’s a massive portion of the ROM, too, so even figuring out what general area I should poke around in is quite an undertaking.
I've been viewing with tile form GBA 4bpp as that is the only tile form that gave me a visible image for the logo above. I found some things which look like visual patterns, and might help me figure out how to re-order these tiles so i can maybe see something approaching an image. I uh… haven’t figured out how to customize the tile ordering in CrystalTile (like column widths) very well, that’s next on my to-do list. This section in particular I may come back to later:
(^Viewed at offset 4AD9E0)
There are plenty of others but this is among the more promising as far as likely actually being uncompressed visual data. There’s so much besides just this one though that I would be here all day posting screenshots, but I will post findings if they turn up anything. At any rate, there are patterns that may be worth looking into, but the sheer volume of data corresponding to this “.bin” file is going to make that REALLY tedious to try and comb through with any sort of reasonable efficiency. This could also be a fool’s errand, as it could be the data is compressed or out of order somehow and it is necessary to extract the true files hidden within that “.bin” to actually make proper sense of them. I don’t know. If I haven’t made it clear, I’m a newbie at this and don’t really understand what I’m working with yet.
So I briefly tried another approach. I thought, heck, I have the dev version of DeSmuME on here, let’s boot that baby up.
(oh boy did it chug.)
I learned some neat stuff.
First, I learned that for most of the game, the “main screen” is the bottom screen as opposed to the top screen, which makes complete sense if you’ve played it. Just goes against convention which is interesting. Except for during the title screen, where it is the expected order, for… reasons?
Anyway, I first tried isolating what layer the talk sprites were on on the “main” screen, which was unsuccessful but I'll post the results anyway. This is with every other layer turned off on the bottom screen (tools -> view layers, toggled off all except for “Main BG 0″)…:
It looks like a lot of things are on that same layer. Now we know.
(Worth noting that if you isolate just the “Main BG 3″ layer you get a nice view of the backgrounds!)
My next task was fiddling around in the tile viewer in the emulator to see if that got me anywhere. And, well, it did… I think! I don’t know what it means just yet but launching the tile viewer (tools -> view tiles) and selecting “LCD - 0x6850000″, at the 0x140 tile there is a very clear image of the current talk sprite. And this image DOES update when the sprite changes, so whatever this tile is pulling from is where I want to be.
…Unfortunately, I’ve more or less hit a roadblock here and am calling it a night. I have absolutely no idea how to figure out where that tile is getting its information from (or more accurately, what is telling that tile where to pull information from), and I don’t understand enough about NDS files to know how to parse the information in CrystalTile any better at the moment. I tried using this tool by Luigi Auriemma to dive into the cpac_2d.bin file after exporting it, but it spewed out a billion .dat files that are no easier to make heads or tails of than the original.
That’s all I've got for the time being. If anyone reading this happens to know any directions they can point me toward I am all ears, otherwise I will continue to just poke at this from various angles until it decides to succumb.