News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Uncensoring Mortal Kombat 1 (SNES)?  (Read 6709 times)

darkmoon2321

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: Uncensoring Mortal Kombat 1 (SNES)?
« Reply #20 on: April 12, 2019, 02:37:43 pm »
Graphics compression for the sprites appears to be very simple.  All they are basically doing is compressing those bytes of tile data that are 00.  A good number of the sprite tiles in the ROM are not compressed at all.  For those that are, there is a 4 byte header with decompression control information.  Each nybble in that header controls a single segment of 4 bytes of tile data.  The control operations for each type of nybble are as follows:

0:0,0,0,0
1:0,0,0,copy
2:0,0,copy,0
3:0,0,copy,copy
4:0,copy,0,0
5:0,copy,0,copy
6:0,copy,copy,0
7:0,copy,copy,copy
8:copy,0,0,0
9:copy,0,0,copy
A:copy,0,copy,0
B:copy,0,copy,copy
C:copy,copy,0,0
D:copy,copy,0,copy
E:copy,copy,copy,0
F:copy,copy,copy,copy

A zero indicates that the next byte of tile data is zero, and "copy" copies a byte of ROM data into the tile instead.  Actual tile data starts immediately after the 4 byte header.  So making a decompression/compression algorithm for these tiles is pretty straightforward.  The other part is then locating all the actual pointers to compressed tile data, and then editing those pointers from within a character's animation frames themselves.

April 14, 2019, 11:13:38 am - (Auto Merged - Double Posts are not allowed before 7 days.)
I can see why this game hasn't had much hacking attention before.  It's not that the compression routine for sprites itself is difficult, but rather the structure of the data and the pointers.  This game basically REQUIRES you to use a tool to make edits, as doing it by hand is incredibly impractical.  For each character, all of their compressed tiles are stored together, and MUST be ordered by their compressed size.  Rather than having a list of pointers to each tile, pointers are automatically generated based on these compressed sizes and a table in ROM that lists how many tiles of each size there are.  So if you change the size of a single tile:
1. The compressed tile list needs to be re-ordered
2. The table holding the # of compressed tiles of each size needs to be updated
3. EVERY animation frame for that character needs to be rewritten.
« Last Edit: April 14, 2019, 11:13:38 am by darkmoon2321 »

Vanya

  • Hero Member
  • *****
  • Posts: 1437
    • View Profile
Re: Uncensoring Mortal Kombat 1 (SNES)?
« Reply #21 on: April 16, 2019, 02:08:21 am »
Can the rom be expanded to allow for the use of uncompressed graphics?

darkmoon2321

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: Uncensoring Mortal Kombat 1 (SNES)?
« Reply #22 on: April 17, 2019, 09:05:37 pm »
Can the rom be expanded to allow for the use of uncompressed graphics?

It can, but since doing so would still require updating every animation frame, I'd still rather just make a tool for it.  I'm working on it now, I've already made some progress loading in the tile data.  Hopefully I'll at least have it functioning as a sprite viewer in a couple days, then I can work on editing/saving.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1155
    • View Profile
Re: Uncensoring Mortal Kombat 1 (SNES)?
« Reply #23 on: April 18, 2019, 01:32:13 am »
Oh that sounds great!
Can't wait to see what you come up with :)
The frame thing does sound painful, but it's quite interesting that they did it that way.

RealGaea

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: Uncensoring Mortal Kombat 1 (SNES)?
« Reply #24 on: April 19, 2019, 01:14:03 pm »
Another thing has to be fixed. The music adresses.

Every stage has its correct music except two stages.

Goro's Lair, regular cycle (has Palace Gates instead of Warrior Shrine)
The Pit Bottom, Reptile Battle (has also Palace Gates instead of The Throne)
Tried to do it myself, almost went nuts in doing so.

I would add a layer of Blood/Recolored sweat in opponent's chest during Cage's censored Fatality.

Remove the "Finishing Bonus" and replace it with "Fatality".

Ah, if possible make the patch for all three Regions.

darkmoon2321

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: Uncensoring Mortal Kombat 1 (SNES)?
« Reply #25 on: April 27, 2019, 05:05:30 pm »
Ok, took longer than a few days, but finally got it viewing (at least some) sprites correctly:



Debugging is taking a lot longer than the code itself, and it's still really buggy.  Most of the buttons are just placeholders at the moment, so I'll work on filling those out too.  I uploaded the code for the project here:

https://github.com/darkmoon2321/mk-character-edit

Vanya

  • Hero Member
  • *****
  • Posts: 1437
    • View Profile
Re: Uncensoring Mortal Kombat 1 (SNES)?
« Reply #26 on: April 27, 2019, 08:29:39 pm »
Nice!
That is a great first step.