EarthBound Compressed Graphics Editor

Tomato: "EarthBound has most of its graphics hidden behind an evil compression scheme, making most of the graphics uneditable for EB hackers. This is a very early version of a program that will let users change enemy battle graphics around.  This is not a graphical editor. Because of the compression used, it's not really possible to make it so easy-to-use like the uncompressed gfx editor I wrote long ago. This program is not for beginners either, it requires the user understands the concepts behind pointers, as well as other things."

For most information, you should look to the CGPED readme file itself.  This contains some of the information, along with some data on how to implement it best.  It assumes you've already downloaded the CGPED.  Now, let's make us a battle sprite!

Select the size of your image.  It can be - in pixels - 32 X 32, 64 X 32, 32 X 64, 64 X 64, 128 X 64, or 128 X 128.  No bigger, no smaller.  But, for purposes of this demo, let's make it 64 X 64, okay?  Make a new file in Microsoft Paint (or any other art program, for that matter) that size and save it as a 16 - bit bitmap file.  Don't have it compressed, either!
 
Now, draw something!  Now, what you have to understand is, EarthBound doesn't use the color pallet that your art progam does.  That's why I generated a full list of the color pallets used in the original ROM.  So, just use your imagination and pretend that the pallet in your program is the same as one of these color pallets.  See, right here I've used Pallet 1.  The upper left color is always the one that's transparent.  Now, don't try changing the colors in the Paint Pallet to match the ones in the EB Pallet.  It won't work correctly.  For reference, all color pallets are available at this page.

Now that we have that done and saved, let's do a little compression.

Okay, here's the CGPED interface.  You have three very important windows for it.  Sprite, Pointer, and Size.

Sprite contains all of the entries for the Compressed Sprites.  It's your selector screen.  Click here for a list of the images that it references.
Pointer details where exactly in the ROM the thing goes.  I'll discuss placing the image more later.  Remember how to convert from Hex into SNES?

 snes_address = (hex_address + 0xC00000) - 0x200

 And to go from the SNES address back to hex, you do this:

 hex_address = (snes_address - 0xC00000) + 0x200

Size is also a highly important bit of data.  If you don't have it correct, the image won't compress correctly!  So let's do this thing.
 
Size
Image Dimensions (pixels)
1
32 wide by 32 high
2
64 wide by 32 high
3
32 wide by 64 high
4
64 wide by 64 high
5
128 wide by 64 high
6
128 wide by 128 high
Okay, so our little image is a 64-by-64 pixel, so we find a spot that's size 4.  You can change the size variable for any image, but doing so in the main image block can overwrite data.

See, if you change that size 1 image in the middle to a size 5, you'd overwrite the size three and the beginning of the size 4 there.

BEFORE - 1 22 1333 4444
AFTER  - 1 22 5 555 5444

That may not be exact, but I think I've made my point.  If you just go changing the size, you'll destroy stuff.  Now, you can use the expanded space made by the ROM Expander and the Text Editor for the compressed data by changing the pointer variable to somewhere in there, but chances are it will make the Text Editor barf when it tries to load that data.  So it would be best to wait for another release of the Text Editor that allows partitioning of the data.

Let's just put the new image into a pre-existing hole.  We'll replace Sprite 11, which as the list shows is a Booka.  So, for the .bmp space, pick your image.  (Duh.)  For the address to insert into, pick $CDB802, which is the address of Sprite 11.  Remember, this only works because your sprite and the Booka sprite are both size 4.  Now, click Convert and Insert, and there we go!  It's inserted.  But we're not done yet...
Okay, so we open PK Hack and put in the battle sprite, "12."  You may find that a little confusing, so let me explain.  In the CGPED list, 0 is an Antoid.  But in PK Hack, 0 is NO sprite and 1 is the Antoid.  Because the no sprite sprite isn't listed in the CGPED menu, just add 1 to the sprite number you chose to insert to.

Also, remember to pick the correct pallet.  Pallet 1 is the correct one for this image, so that setting is fine.  And in the game, we find...

Woo hoo!  You did it!  You made a compressed image!

If you followed these directions to the letter and still couldn't get it to work, I don't know what to tell you.  Maybe you made an error in the address input, or something.  If you can't get it to work under these conditions come and whine at the PK Hack Forum and we'll try to help you out.