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

Author Topic: GBC graphics  (Read 3459 times)

SunnyGuy

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
GBC graphics
« on: December 19, 2011, 10:58:44 pm »
I have found out that GBC roms contain mixed pieces of graphics - some of them are clear ones (like font), which you can locate and edit easily... And some of them are messy.
Example - .
I don't think that they are compressed... So how can I actually edit them? Is there a way to make them less messy? :)

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: GBC graphics
« Reply #1 on: December 19, 2011, 11:49:33 pm »
Nnnnno...those are compressed. Sorry.

Extraction's a cinch, though. Most games use some flavor of LZ, which is easy to work with. Use BGB to reverse-engineer the decompression routine and write a program in the language of your choice to rip the graphics to binary files which you can edit as you see fit. Reinsertion can be problematic, mind: you'll either need to write a compressor, which the game does not provide a helpful blueprint for, or hack the game so that it loads uncompressed graphics (which means you'll need enough space in the ROM to fit the uncompressed graphics).
In the event of a firestorm, the salad bar will remain open.

SunnyGuy

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: GBC graphics
« Reply #2 on: December 20, 2011, 12:22:44 am »
Quote
Nnnnno...those are compressed. Sorry.
Dammit  :(

Quote
Extraction's a cinch, though. Most games use some flavor of LZ, which is easy to work with. Use BGB to reverse-engineer the decompression routine and write a program in the language of your choice to rip the graphics to binary files which you can edit as you see fit. Reinsertion can be problematic, mind: you'll either need to write a compressor, which the game does not provide a helpful blueprint for, or hack the game so that it loads uncompressed graphics (which means you'll need enough space in the ROM to fit the uncompressed graphics).
It may be not hard for you, but I'll never be able to do something like this ;D

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: GBC graphics
« Reply #3 on: December 20, 2011, 12:34:47 am »
Heh. Don't give up so quickly. Programming isn't hard at all; pick a language you like (it might take several tries!) and work with that. You could even write utilities in Flash ActionScript, if you wanted.
In the event of a firestorm, the salad bar will remain open.

SunnyGuy

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: GBC graphics
« Reply #4 on: December 20, 2011, 12:45:48 am »
Well, I guess I can try... What should I do first?

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: GBC graphics
« Reply #5 on: December 20, 2011, 12:58:41 am »
Assuming you have some programming skill already, the first step would be to trace the compression routine. Play the game in BGB until the uncompressed graphics appear on screen and make a note of their location in VRAM. Then reset to right before the graphics appear in VRAM, set a write breakpoint to that location in VRAM, and play until it trips. This will point you to the tail end of the compression routine, which you can then trace to until you understand exactly how it works.

As mentioned before, odds are it's some kind of LZ compression scheme. There will be some kind of mechanism in play to determine whether each code is a "plaintext" byte or a compression code. Each compression code consists of a "length-width" pair that indicates to the decompressor how far back to look for the next sequence in the output buffer, as well as how many bytes to transfer from that position.
In the event of a firestorm, the salad bar will remain open.

Plint Michigan

  • Sr. Member
  • ****
  • Posts: 328
    • View Profile
Re: GBC graphics
« Reply #6 on: December 20, 2011, 09:01:05 pm »
If there is one thing I DO know about hacking, it's that what you are seeing is normal for any system.