TIP: A lead on how to decompress SNES graphics


Recommended Posts

http://www.romhacking.net/forum/index.php/...9.html#msg87919

reply #3 by Ryusui.

So you opened it up in Tile Molester and couldn't find any graphics on any codec setting?

...If you haven't done that, you can't be wholly sure it's compressed (though if "4bpp planar, composite" and "2bpp planar" turned up nothing, odds are it is).

As DaMarsMan said, SNES compression is entirely hand-rolled, as it were: there is no magic bullet that can handle SNES compression because there are a myriad of different implementations. Mind you, they tend to rely on similar mechanisms. LZ compression is a favorite: the GBA and DS BIOSes actually have LZ decompression functions built-in, though I doubt you'll find any SNES games that use the exact same mechanism.

AFAIK, you're pretty much screwed unless Boot Camp can run Geiger's Snes9x Tracer and VSNES. First you make a save state in Snes9x, then you load it in VSNES and look for the uncompressed graphics in RAM (not VRAM). Once you find out where they're decompressed to, set a write breakpoint on that place in RAM and you'll find the tail end of the decompression routine. Trace through it and with some patience you can figure out just how the decompression routine works.

Mind you, writing a decompressor is easy. Just figure out how the original decompression routine does its magic and copy its functionality verbatim: in other words, port it. The hard part - probably harder than figuring out how to get the aforementioned tools to work on a Mac and digging up the game's decompression routine - is writing a recompressor. The game itself gives you the blueprint for the decompressor, but all you know about the recompressor is the format it produces. It's rather like having to figure out the workings of a sausage maker by analyzing the sausage it produces. Not only that, but your recompressor has to have comparable efficiency to the original recompressor: what it produces has to fit in the original space.

It's still possible if you're a half-decent programmer. I've tackled compression several times, and all of my apps were written in Visual Basic Express, which is 100% free to download from Microsoft. (You can also get Visual C++ Express for free as well, if you're so inclined.)

So he has given some couple hints here..

Use these programs in the way he said:

Geiger's Snes9x Debugger

VSNES.

EDIT: update snes9x debugger link

Edited by smozoma
Link to post
Share on other sites

There is a usage note for Snes9x Debugger:

Due to the way some things work, and to save myself a ton of support headaches, this application requires that your ROM be both headerless and non-interleaved. The application will prompt to save if it detects either.

This means you need to make a copy of your ROM, open it in a hex editor, and delete the first 0200 bytes (512 in decimal).

Link to post
Share on other sites
take it one step at a time and i think you'll be surprised at how far you can get : )

I had a look before at SNES 93 and the sprites and face-off screen are editable but looks like banners and rink are compressed. Downloaded the Snes9x Debugger but haven't had time to look at this yet.

Related to this I have expanded the 93 rom. I am trying to see if I can use the free bytes. I want to help statto create an editor for 93 but want to see if this is possible first. I can do this in the Gens version of 93 no problem (e.g. to add another team from the original not wboys 30 team rom) but with the SNES no luck. Not totally sure about how the SNES memory banks work at the moment. I assume its possible and assume the problem is me being stupid about something. Guess if works for 93 will work for 94 as well.

Any chance of some help Smoz? Not sure if you know about this but you may understand more what the problem is than me.

Link to post
Share on other sites
I had a look before at SNES 93 and the sprites and face-off screen are editable but looks like banners and rink are compressed. Downloaded the Snes9x Debugger but haven't had time to look at this yet.

Related to this I have expanded the 93 rom. I am trying to see if I can use the free bytes. I want to help statto create an editor for 93 but want to see if this is possible first. I can do this in the Gens version of 93 no problem (e.g. to add another team from the original not wboys 30 team rom) but with the SNES no luck. Not totally sure about how the SNES memory banks work at the moment. I assume its possible and assume the problem is me being stupid about something. Guess if works for 93 will work for 94 as well.

Any chance of some help Smoz? Not sure if you know about this but you may understand more what the problem is than me.

I don't really know about SNES hacking, but the issue will be getting around the memory segmentation.

http://en.wikipedia.org/wiki/X86_memory_segmentation

http://en.wikipedia.org/wiki/X86_assembly_...nted_addressing

If you move a segment, you need to figure out where the base pointer for that segment is, and update it to the new base location..

I only know a bit about this CPU type (and nothing about how it is actually used in the SNES.. you mentioned there being memory banks, which I don't know about).

EDIT: aaaand it's not an x86 CPU, so no wonder the memory banks thing wasn't familiar...

Edited by smozoma
Link to post
Share on other sites
EDIT: removed info about wrong cpu type.. !

It looks like the logos are sprites and the player pictures are written to the WRAM.

EDIT: I'm not really sure how to go about doing all of this, but I got the programs to work.

Edited by statto
Link to post
Share on other sites
I don't really know about SNES hacking, but the issue will be getting around the memory segmentation.

If you move a segment, you need to figure out where the base pointer for that segment is, and update it to the new base location..

Have found a link that explains how to use the free space in an expanded rom in NES not SNES but I guess it works in a similar way. Have not found much else helpful information. Not had a chance to read it properly but looks well beyond my level but may make more sense to someone else.

http://kingmike.emuxhaven.net/romhelp/NESromexp.txt

Link to post
Share on other sites

Can you guys tell me what you want to do with the expanded ROM, in case I'm totally missing the point? :)

I've been going on the assumption that you want to have more room for adding players.

But maybe you also want to be able to decompress graphics and move them to expanded data banks...

Link to post
Share on other sites
Can you guys tell me what you want to do with the expanded ROM, in case I'm totally missing the point? :)

I've been going on the assumption that you want to have more room for adding players.

But maybe you also want to be able to decompress graphics and move them to expanded data banks...

How much of a headache is it going to be to move the graphics?

Link to post
Share on other sites

I'm afraid I don't know much graphics stuff...

If someone can find where the graphics are decompressed to, using the method described in the first post, I might be able to get some ideas...

However, the one time I tried his method, I couldn't figure much out. I saw the graphics in VRAM, but he said not to use the VRAM, so I'm not sure what to look for in the RAM.

Link to post
Share on other sites

Method for making a 30+team ROM..

  • Move team data to a new bank to get more room (as explained in the SNES 93 topic).
  • Add additional team pointers and team data.
  • Locate the places in code where the main menu has the number of teams hard-coded (this is what tells it to wrap around back to ANH(94) or BOS(93) in the main menu).
  • Fixing this and trying to go to the new teams will probably cause a crash due to team banners not existing.
  • Figure out and fix how the team banners work. add more banners. probably need to move the banners around within a bank or into an expanded data bank.
  • Starting the game at this point might crash because it won't know where the palettes for the new teams are.
  • Figure out how the team palettes, make it work for extra teams
  • Add teams to the playoff matchups.
  • ... not sure what else.

Link to post
Share on other sites
I'm afraid I don't know much graphics stuff...

If someone can find where the graphics are decompressed to, using the method described in the first post, I might be able to get some ideas...

However, the one time I tried his method, I couldn't figure much out. I saw the graphics in VRAM, but he said not to use the VRAM, so I'm not sure what to look for in the RAM.

Made a bit of a discovery when searching for the goalie pause menu name.

Changed @78FD2 from bank $83 to $90 and all the rink data disappeared. So I'm guessing this points to the data in RAM/VRAM as the rink is not editable in TM. If we can find the rink data copy it to the free space and change the pointer it may mean we can edit the rink. If this is correct it may be easier to find out how to decompress the banners (maybe).

Link to post
Share on other sites
I had a look before at SNES 93 and the sprites and face-off screen are editable but looks like banners and rink are compressed. Downloaded the Snes9x Debugger but haven't had time to look at this yet.

Related to this I have expanded the 93 rom. I am trying to see if I can use the free bytes. I want to help statto create an editor for 93 but want to see if this is possible first. I can do this in the Gens version of 93 no problem (e.g. to add another team from the original not wboys 30 team rom) but with the SNES no luck. Not totally sure about how the SNES memory banks work at the moment. I assume its possible and assume the problem is me being stupid about something. Guess if works for 93 will work for 94 as well.

Any chance of some help Smoz? Not sure if you know about this but you may understand more what the problem is than me.

Above you write you helped expand the the 93 rom. Was it for genesis. If so maybe you can help me. I can't find how the rom points to/assigns palletes and logo to each team on Coahc K basketball. I have a 85% edit done fo rthis year. Team info is done. I rewrote all the pointers and regrouped everything for a fellow Tecmo Hacker to create an editor for. He is almost done. I can edit unies through HivePaellte, and editing logos trough tile molestor, but the greats teams share a bunch of info with the normal counterpart, and would like to redirect those teams to an empty part of the ROM. I have been hacking for over a year(Working on a TSB3 Ncaa edit for SNES with my brother. Already have a 80percent hack, now just redisigning plays for a more college feel). Any help in the Coahc K issue would be aprreciated. It was done by EA, so i am hoping they use the same prgramming techniques.

Link to post
Share on other sites
Above you write you helped expand the the 93 rom. Was it for genesis. If so maybe you can help me. I can't find how the rom points to/assigns palletes and logo to each team on Coahc K basketball. I have a 85% edit done fo rthis year. Team info is done. I rewrote all the pointers and regrouped everything for a fellow Tecmo Hacker to create an editor for. He is almost done. I can edit unies through HivePaellte, and editing logos trough tile molestor, but the greats teams share a bunch of info with the normal counterpart, and would like to redirect those teams to an empty part of the ROM. I have been hacking for over a year(Working on a TSB3 Ncaa edit for SNES with my brother. Already have a 80percent hack, now just redisigning plays for a more college feel). Any help in the Coahc K issue would be aprreciated. It was done by EA, so i am hoping they use the same prgramming techniques.

I didn't help with the 30 team NHL 93 on Genesis - this was all wboy's work. Before he released it I was having a go at adding teams and managed so far (with some help from him) but never managed to link any of the graphics etc. I don't know the game you are talking about but I used the free space by the same way we are doing it on the SNES, finding the pointer table for the teams then just changing the pointer to point to the free space, which sounds like you have done already. Sorry I can't be more helpful but I think you need to speak to wboy if you can catch him.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.