Mortal Kombat Trilogy PC/PSX Graphics Decompression Routine

Started by Nightshades, June 14, 2018, 12:10:05 PM

Previous topic - Next topic

Nightshades

Hello i'm kinda new to PSX game hacking, i spent month to read sony docs and everything else related to the playstation 1 hardware which was a great help as well as some MIPS R3000 Assembly (i really sux with it right now).

My favorite game of the old time is Mortal Kombat series :) So recently i got the game for PC/PSX, what i find very interesting is that the PC game use the exact same file as the PSX Version.

I am searching a way to decompress every "Fighters" eg: "C:\MK_Tril\art\fighter\shaokahn\SHAOKAHN.DAT"
(Compressed heavly).

I am not new to game hacking as i reversed game such as Starcraft 2 and others so i know well how to use IDA Pro, i also got psyQ Flirt signature (thanks to the author of this release, it's useful).

So i'm wondering if i should debug ps1 game with GPU breakpoint (using Agemo Debugger) or lol maybe reverse the PC Version ?

I did find interesting stuff on the PC Version, I took cheat engine graphical memory viewer, scrolled a bit, and found the representation of the VRAM (exactly the same as the PS1). I placed a breakpoint on write on my character (in the vram) so once the next anim was here it did break.

So after a few days i found something but i have many doubt, it's related to the character's vram (if i change certain instruction Character A is totally messed up (doesn't appear to be rendered correctly, maybe it's not decompressing it before uploading to ram) instead of the character it's a chunk of weird lines pixels.

So in IDA i added a temporary name "graphics_Decompression?" You can see the entire function here: https://pastebin.com/wzv9T3Se

Have you ever seen a function like this for decompressing graphics ? (People that usually find those routine easy @expert PSX debugging guy =D).

I'm not really used to reverse file format tbh, and those game are so old it's a mess (Their way of doing just to render an image...).

So any help would be appreciated and i still wonder if it's not better to debug on the psx using agemo debugger (i still think it's easier using IDA on the pc with the ported pc version lol) Thanks !

Some goodies found and testing stuff: