Leo Tries Modding Ghost Trick (And May In Fact Succeed): Episode 3

The end of this post gets into spoilers for the game Ghost Trick, but I will post a big obvious line and warning before that happens.

It's been a while since my last update, because for a while I was stuck. This game hasn't really been documented so far and the only documentation I found implied that "cpac_2d.bin" was where I should find what I was looking for.

This was, it turns out, a wild goose chase, but it did bear some fruit.

After my last post I sought to "unscramble" other images I found in the ROM. I'll post another here just because I think it looks cool with the incorrect palettes:

However, after spending a couple days on these, I started to suspect that they were all background images rather than sprites or other visual assets. Nothing looked remotely like what I was looking for. To confirm my suspicions, I started messing around with copying and pasting tiles around in this portion of the ROM to see what assets got messed up. I was not surprised when the only things that got messed up were the backgrounds.

(To do this more rigorously I then completely blocked out all of the tiles with solid colors, and this absolutely confirmed my suspicions.)

...So, what now? The only images in the ROM that I could actually see and feasibly make changes to seemed to be the backgrounds. If I wanted to change a background, I know how I would go about it: "unscramble" the associated tiles, then make the changes or replacements desired and re-"scramble" them before re-inserting them over the originals.

It would be more complicated than that, especially because one would need to also discern where the palette info is drawn from; but since that's not what I've set out to do, I'm not looking into it more at this time. If anyone reading this is interested in that the Episode 2 post is probably a more useful reference.

My next step was to figure out what part of the absolutely massive "cpac_2d.bin" - the overwhelmingly largest portion of the ROM - contained the sprite data I was looking for. I started blocking out bigger and bigger chunks of the .bin to see what assets did or did not load. It got to a point where the game would no longer start and had to be loaded from a save state, but even in those states where it would crash after a few actions and looked like a buggy mess with miscolored text, the talk sprites all still loaded perfectly. Even when the entire .bin was overwritten:

It was here that I realized a frustrating truth: the talk sprites are, with absolute and definitive certainty, not to be found in "cpac_2d.bin". Which had been my only lead from the only pre-existing threads I could find.

But hey... on the flip side, I knew where I would never again need to look for my answer. I moved on to "cpac_3d.bin," and resumed the process of blocking out a couple lines at a time then launching the ROM and seeing what changed.

IMMEDIATELY, I saw results, and bitterly wished for compensation for the time wasted on cpac_2d.bin.

This image might not look like much, because there isn't a talk sprite there. But that's just it... I know there should be one there, because I have re-played this scene about 5 gazillion times when testing out cpac_2d.bin. This was the first time the talk sprites had ever disappeared or changed in any way.

So I knew that somewhere in the tiles (and/or corresponding hex code) I had just blocked out, was some data that tells the game what talk sprite to display in what contexts. THIS is something I can work with. I had only blocked out the addresses from 04ED4200 - 04ED45C0; so I went back to my master copy of the ROM and blocked out each individual tile in there until AT LAST, I found the single tile that, if overwritten, would cause the talk sprite not to spawn.


This boy right here.

I had a hunch that all of these tiles with this format - ending in that black and salmon bar - corresponded to similar sprite data, so I started swapping around random tiles to see what happened. And I was right! Some combinations did weird things and/or crashed the game, but I also got some legitimate sprite swaps, including funny results like pulling up what appears to be the French Final Chapter screen reversed (result from swapping in tile at 04ED5F80):

Or the hippie NPC's entire mini spritesheet (result from swapping in tile at 04ED4600):

I can't tell you exactly how I figured this out, but after some messing around with the tile editor and hex code editor, I realized that those "salmon and black" bars are caused by the repeated instance of "00, 80" in the hex editor that signify the "end" of a particular sprite. To my understanding, each of these codes points to a particular sprite.

So, the game will search for a particular sprite for an asset by accessing a specific address (for example, the address 04ED4280) and the data at that address will "point" it to a specific sprite (in this case, the sprite called by "E8 23 03 00 F0 06 00 80", which is the 4 Minutes To Death hourglass).

If the wrong information is at the associated address the game will load the wrong sprite.

It is from here on out that I really can't explain the process further without massive Ghost Trick spoilers, so proceed at your peril. And I do mean peril, the game rules, so don't ruin it for yourself.




I'll start off with listing all of the hex codes for sprites that I worked out so far, again the vicinity to look in the hex code is 04ED4280:

E8 23 03 00 F0 06 00 80 - hourglass

D8 2A 03 00 FC 07 00 80 - fuller hourglass

D4 32 03 00 C8 0D 00 80 - this appeared to be a skinny version of the Sissel smirking sprite?

The following correspond to Sissel's "Yomiel" talk sprites, which specifically I am looking to replace:

9C 40 03 007C 19 00 80 - neutral smirk

18 5A 03 00 44 19 00 80 - neutral frown/serious

5C 73 03 00 E4 18 00 80 - hand on chin/thinking

40 8C 03 00 F8 18 00 80 - concerned/shocked/sweating

38 A5 03 00 50 1A 00 80 - the gag "D'OH" angular face

18 D9 03 00 BC 09 00 80 - ghosty boy with sunglasses (not a Yomiel sprite, but if my end goal is playing as a cat the whole time, which it is, this is another one to replace)

D4 E2 03 00 D8 1B 00 80 - mouth slightly open/slight surprise

78 18 04 00 98 18 00 80 - facing down, flat line lips, serious/melancholy

10 31 04 00 9C 18 00 80 - angry/emotional yelling

Sissel's true endgame sprite:

AC 49 04 00 54 10 00 80 (memory address 04ED42F0)

And the last couple I know:

88 BF 03 00 90 19 00 80 - Yomiel's evil smirk. I don't think Sissel ever uses this so I don't think anything needs to be done here.

00 5A 04 00 40 19 00 80 - Lynne! This was the first non-Yomiel-or-Sissel sprite so I assumed that for now it's safe to quit here.

So; where am I currently at?

For right now, what I have done is over-written all of the codes that point to Sissel's "Yomiel" sprites and instead pointed them to the endgame sprite. This is a messy way to go about it and it results in just the hex code AC49040054100080 repeated over and over, but for right now, I have confirmed it does exactly what I want it to do... it LETS ME PLAY AS A CAT!!!:

There are definitely things wrong with doing it this way. I am 99% certain Yomiel doesn't exclusively use his own sprites, so I am pretty sure in the final chapter this is going to turn Yomiel into a cat too. So that's not going to work out. But I'm still extremely stoked by this very tangible progress.

My immediate to-do list is as follows:

* Isolate the addresses pointing to any other assets used for Sissel that look like Yomiel to ultimately replace (the "Trick" icon, the "return to Sissel" icon when playing as Missile, etc...)

* Isolate the portion(s) of cpac_3d.bin that correspond to the actual sprite data. I've found the pointers, but not the sprite data itself. I might have to resort back to aimlessly blocking out portions until I get somewhere; but I need to know where the sprites are if I want to ultimately create new ones

And some future things to work on down the road:

* Look in the data for the specific chapters that tell it what asset(s) to pull. Maybe in the final chapter the band-aid fix is as simple as pointing it to a different sprite for Yomiel than for Sissel.

* Work on new assets to implement over the existing Yomiel assets - full new sprites for cat!Sissel, new icons replacing Sissel's face, etc.

My big ultimate dream is to somehow implement a switch you can toggle on-and-off to view Sissel as he sees himself vs. his true self; but that is infinitely beyond my capacity right now. For the moment, the most important fires to put out are changing all Sissels into cats, and then not turning Yomiel into a cat down the line.

I'm extremely excited now that this has once more entered the realm of possibility.




25 views0 comments

Recent Posts

See All