HELP TO CHANGE SAVE STATE GRAPHICS AND PLACE IT IN THE ROM

Started by Gilberto9, January 30, 2023, 09:13:31 PM

Previous topic - Next topic

Gilberto9

 :( help to modify the image with the word USA, the graphics are compressed in the rom, could someone help me with that? I made a save state by zsnes, but I don't know how to put it back in the rom when editing by save state, help me with a tutorial if you can ROM:https://drive.google.com/file/d/1Ao_noO
GILBERTO9

Jorpho

Please do not post subject lines in all caps. Ever.

Quote from: Gilberto9 on January 30, 2023, 09:13:31 PMI made a save state by zsnes
Don't you think you should say what game you are working with?

Quotebut I don't know how to put it back in the rom when editing by save state
If the graphics are compressed in the ROM, then you will have to find out how to compress the graphics to put them back into the ROM. This is not trivial and there is no tutorial for this.

(The alternative is to rewrite the program so that it uses uncompressed data, and then probably expand the ROM so there's room for uncompressed data. There is no tutorial for that either.)
This signature is an illusion and is a trap devisut by Satan. Go ahead dauntlessly! Make rapid progres!

Gilberto9

I found out that the graphics I want to change are compressed by RLE algorithms and I don't know how to view to edit,the game is international super star soccer deluxe (snes)
GILBERTO9

FAST6191

RLE is a fairly simplistic compression type but very fast and low memory requirements so if you are going to encounter compression on a 16 bit or older device it is probably going to be that (after that LZ became far more common, which is still fairly similar to RLE).

The longer form of the name (Run Length Encoding) gives you a clue as to what is done. In it the decoder will take a run of data from the game and scan through it, when it encounters a flag it will repeat the byte a certain number of times. Quite useful for graphics that might well have long runs of a given colour, and also represent a fair chunk of data within the game.
The trouble for this comes in that while there might be one or two known approaches then back in times where it was done then everybody pretty much rolled their own. You get to sort this and either make a new encoder or encode it in such a way that compression is not used (if the compression is so much IF [compression flag] is TRUE write compression flag+1+few more because you want it to mean something* number of bytes to output, else read next section and check for [compression flag] then it is not so bad to make compared to big boy compression algorithms. The compression algorithm then runs something like read data stream, if repetition of bytes more than so much happens then ), the trouble with the latter as was noted above is compression tends to be used when space is tight so you in turn have to find extra space or make it (see expanding a ROM, easier said than done for some SNES stuff and that is not counting any bankswitching you may have to deal with on it as well).

*if the flag and the amount to write is say 2 bytes long you are only going to ever do it when you can savea minimum of 3 bytes** from the total (you hope anyway, the original coders could have been bad at their job) so the number of bytes to be copied is going to be a minimum of 3, to allow a potentially higher maximum then 0 in the number of repetitions might well mean 3 bytes worth, 1 means 4 and so on and so on. This will also return in LZ if you ever encounter that when the maximum distance and copy value really makes much more difference in real world scenarios compared to RLE where runs are not usually high enough to really justify it.

**bytes might also be my LZ mind shining through, could be a number of bits or nybbles it counts instead but that makes the maths and memory operations a lot more tedious on processors of any age really so who knows.

You don't necessarily need to know any assembly for this either (though it will certainly help if you do) as you can compare before (in the ROM) and after (in your savestate/memory dump) and for RLE it should be fairly obvious what was done.

Those looking for an intro to compression I usually link https://ece.uwaterloo.ca/~ece611/LempelZiv.pdf and despite the name it does cover all the families you are likely to encounter when playing ROM hacker this side of some silly PC game doing something quite exotic.

Jorpho

Quote from: Gilberto9 on February 05, 2023, 09:15:32 PMI found out that the graphics I want to change are compressed by RLE algorithms
And how did you find this out?
This signature is an illusion and is a trap devisut by Satan. Go ahead dauntlessly! Make rapid progres!