I had a look at AC3’s disassembly again. It’s pretty hard because opposed to TAW, it includes little to no debug strings. (Remember that we reversed TAW’s flight model because we found a debug string that printed speed, altitude, etc)
There is hardly any string handling in general, as almost all in-game text is laid out in texture atlases like these:
- image.png (12.26 KiB) Viewed 1699 times
But a few strings I
did find:
EASY, NORMAL, HARD, VERY HARD,
POINT, and
PRESS START BUTTON TO EXIT.
The latter can be found on the HUD during replay. So I got a rough idea where HUD rendering code is.
POINT is harder: It is only referenced once, in the mission where you must follow Dision:
- image.png (143.99 KiB) Viewed 1699 times
Now
EASY, NORMAL, HARD, VERY HARD were trivial to identify: It’s what you see when a mission starts!
- image.png (28.7 KiB) Viewed 1699 times
Note that the font matches. So the text written in this font is the only text that is printed from strings, instead of being pre-baked into textures.
I tried understanding more HUD code, but without any initial clues or strings it’s too large and too complex to identify anything of value.
If we look at the mission start animation for another second, it also displays the level name:
- image.png (240.44 KiB) Viewed 1699 times
This code was just a few lines down! Tracing back the registers involved, I was able to identify the memory location where the mission index is stored as well as the difficulty level.
- image.png (69.38 KiB) Viewed 1699 times
The blinking cursor during level name display unveiled the location of the animation timer, and so on.
But really the mission index was the most important discovery. Asking Ghidra for references lists more than 100 locations with hard-coded game logic. This shattered my hopes that mission-specific scripting was done in the data files … no, it’s in the code.
- image.png (54.06 KiB) Viewed 1699 times
These locations already say a lot. E.g. one function checks specifically for five missions … and it’s the exact missions with the battle airship
Sphyrna. Patterns emerge.
Still, this doesn’t help us with AI or flight model. But one expression caught my eye – testing for
Ghosts of the Past and an integer that we have seen quite often in data files!
- image.png (8.29 KiB) Viewed 1699 times
Ghosts of the Past is the infamous ravine mission where you are not allowed to climb above a certain altitude. How high? I fired up TFXplorer to measure the top of the cliffs (where you fail the mission) and it’s about 800 meters. The number in the code is 10,485,760, leading to a factor of ~13,100.
That’s close enough to the scale factor of 16,384
I calculated earlier (
plus the confusion about altitude) that it leads me to believe I found the XYZ coordinates of the player!
Now the flight model shouldn’t be so hard to find any more …