Let's replace Sega Saturn graphics.

Malenko

Established Member
Preamble: This is *A* technique, and not the only one. This assumes a lot of things about the game you're working on specifically that the graphics are uncompressed and on VPD1. There is a chance this will work for the project you want to start but there is also a chance it will not. Consider this a solid starting block. This is not Malenko's tutorial. This is just an amalgamation of knowledge shared on the discords for Shiro! and SegaXtreme I just happen to be the one writing it up.

This will be showing you how to replace graphics, and while I will be demonstrating on converting tiles from Japanese to English, that is not the only use for this. I did something very similar with NBA Jam to replace Hugo Hornet with Sonic the Hedgehog. This does not mean I will be translating Bomberman Fight!! but I wanted to put up some kind of starter guide because of questions being asked on Discord and there not being any good resource showing how this is done other than my barebones Google Drive document.

software used:
Yaba Sanshiro 2 (I used v1.9.3 ) uoYabause
Crystal Tile 2 Crystal Tile 2
ByteSearch 1.2 ByteSearch
a graphics editing program ( I use Adobe CS2, but this is up to you GIMP is free)
CRAM2PAL https://url.is.pending.dont.click.here
Sega Saturn Patcher Sega Saturn Patcher
wxMEdit Hexeditor wxMEdit - A Cross-platform Text/Hex Editor

Things you need to know:
Basic computer use
basic hex math
basic graphics editing
this isn't as hard to do as you think

Ok, with all of that out of the way let's edit some tiles/sprites/graphics!

I will be demonstrating this on "Bomberman Fight!!"
1667578484559.png


Step one is to open the ISO in Sega Saturn Patcher and extract the files to a folder.
1667579471548.png


This the folder structure I currently use when working on games:
1667579519927.png

So I loaded the ISO and extracted it to "Vanilla Files" and left the freshly ripped game in the "Vanilla ISO" folder. I will be saving the changed files in the "Edited Files" folder, and when we patch the vanilla ISO with Sega Saturn Patcher, we'll save the edited ISO in "Edited ISO" for testing. Dumps are where I put memory dumps from the debugger and palette files.

To keep this as straightforward as possible, I'll focus on tiles that are easy to get to and easy to test. If you read my other guide, I have an affinity for getting the menus done first, and this won't be an exception to that. Fortunately, Bomberman Fight!! has menus that are mostly in English, so navigation won't be a problem.

From the start menu pick "OPTION" and you will land on this screen:
1667579981159.png

Lets start with one of the 2 tiles at the bottom, the "Dpad" icon. The text for is says "select" (えらぶ) and the text for the B button says go back (もどる)

So lets find the tile and redraw the Japanese into English.
We will use Yaba's debug to find the tile's location in memory. So choose Debug->VPD1 from the menu
1667580455601.png


Then scroll through the VPD1 command list until you see the tile we are looking for. Since this one was at the bottom I started from the bottom and scrolled up but this isn't always the case and you may have to look at every single one of them. Here we can see the tile in the texture window.
1667580532779.png


It is 64 pixels wide, 16 pixels tall, and is using a 4 BPP color mode and most importantly its texture address is 669A0.
You need to keep track of this data (spread sheet, notepad, pen and paper, doesn't matter)

Next we will go to Yaba's memory editor to get the data we need. Start by closing the VDP1 debugger and going into Yaba's memory Editor by selecting debug then memory editor:
1667580991569.png

First thing I do is dump the PAL (palette) data by highlighting VDP2CRAM and selecting save tab.
1667581079041.png

again, I save this in a folder called PAL under the Dumps folder as OptionsScreenCRAM.bin
Next step is just to drag the bin file on top of CRAM2PAL and it'll extract all the palettes from the memory dump. There are 1,024 typically but more often than not you'll find what you need in the first dozen.
1667581272965.png


Next we dump the actual tile data from memory so we can find it in the game data. Remember when I said you'd need all those file details from before? This is why.
The texture address in VDP1 debugger is an address relative to VDP1 VRAM start address which is 0x05C00000.
So the memory address of the texture is :
5C00000 + 669A0 = 5C669A0

We are going to stay in the memory editor and go to the address 05C669A0
1667581811292.png


Since the texture's size is 64x16 we will multiply 64*16 (which equals 1,024) then divide by 2 (which equals 512). Now I know you are wondering why you divide by 2, I know this because I wondered the same thing when I started. You divide by 2 because the image's format is 4 bits per pixel, and 1 byte equals 8 bits, so 2 pixels are described by just 1 byte. If the image were 15BPP you'd have to do the opposite and multiply by 2 because in that format it takes 2 bytes to describe a single pixel.

So we need to copy 512 bytes of data starting at 5C669A0 . Since we are copying in hex we need to add 200 (which is 512 in hex) to the starting value. This means we will need to highlight from 5C669A0 to 5C66BA0 and save the selected data. Start at 5C669A0 hold shift and arrow down till 5C66BA0 then hit save selected
1667583024234.png

save it as something obvious like "DpadSelect.bin" in the Dumps folder.

We are going to actually close Yaba and open up Crystal tile now. Once you have CrystalTIle open , open the "dpadselect.bin" file then hit F6 to put CrystalTile into graphics editing mode. Next on the properties tab set the width to 64, the height to 16 and the Tile format to N64/MD 4bpp and it should look something like this:
1667583248908.png

You can tell that's the right tile, albeit with the wrong colors. The colors don't matter much for identifying but will matter for editing. Now click the "Palette" tab (next to the "Properties" tab below the save icon) and then click the "Import" button. Use the Explorer window that pops up to navigate to the folder where you dumped all your palette files generated by the CRAM2PAL utility.

I don't know of a strictly scientific method of finding the correct file, but I hope to update this when one is found. Lucky for us, the second palette (OptionsScreenCRAM_1.pal) is the correct one, so double-click on that. Now we just have to choose the correct line of palette colors in the grid on the left. Keep in mind the first color in a palette is more often than not the transparent one.

1667583921904.png

As you can see, that's the correct tile with the correct colors. So we know the memory we dumped contains the correct data to edit and all we have to do is find it.
 
Last edited:
The next step is to open the "DpadSelect.bin" in a hexeditor. I use wxMEdit as my editor of choice, but you can use whatever you prefer. I start by closing CrystalTile as I don't like having the same file open in multiple applications at the same time. Here we can see all the raw data from the dump of the "dpadselect.bin" file. This is the data we will be looking for using bytesearch.
1667584211639.png


So we'll want to grab a big enough chunk to not get too many false positives, but not too big or too small. I typically start with 1 row of hex and go from there. For this example I will start with 0x0C0:

1667584322630.png

This is the ideal result, 1 result in 1 file. We got a hit on TITCHR.BIN at offset 0x56A60

We will now open that file up in Crystal Tile, set the tile to the same properties as the dump, with the same palette and see how that looks.
Doing that, we will get this as a result:
1667584593687.png


Since we did not search from the start of the dump we need to adjust the offset in Crystal Tile. Since we started at 0xC0 we just need to subtract that from 56A60 (56A60-C0 = 569A0) and we'll see our tile clear as day, as an added bonus we can also see the "B to go back tile". This only happened because the tiles are the same size and happen to be saved side by side in the game data.
1667584905163.png


The next small bit will be done with photoshop in mind, so you may need to make small adjustments based on your graphics editor of choice. We will start by exporting the PAL so we can import it into photoshop. I save as an ACT file because I know Photoshop can use it. Now if you don't export/use the PAL then copy & paste the data back into CrystalTile, CT will do its best to find the nearest color but your results may not be what you expect.

1667585959659.png

I also save the ACT file in the dumps folder so I can find it.

So we just copy the data from Crystal Tile (CTRL+C or edit->copy) then paste into photoshop and apply the ACT file.
1667586048967.png


Now you have to actually edit the file into what you want it to be; and no I wont be teaching you how to use Photoshop.
So after you create your new tile, just make sure you don't have any layers (flatten your image) , and then copy and paste it into Crystal Tile and be sure to hit enter then SAVE-AS and keep the file name the same but save it into the "Edited Files" folder. You will also want to keep the same folder structure as the default ISO because we will use this folder to create patches in Sega Saturn Patcher.

1667586702118.png


With that, all that's left to do is make the patch, apply the patch, then test the patch.

The next steps reference this image:
1667587442420.png


1) So open Sega Saturn Patcher and select your vanilla ISO , select "Create New Patch" from the bottom, then drag and drop the edited file , and pick "Create Patch"

2) After you save the patch you will have to click "+Game Patch (SSP)" and load it , this buttons name will change to your SSP file name

3) Build your image, and save it to "Edited ISO" folder. This allows you to keep the ISO's integrity and have a separate image to test. This does take up more room on your hard drive, but a CD image isn't very big by today's standards. I prefer to keep tracks separate.

After Sega Saturn Patcher is done, load up the Edited ISO and test. Hopefully your end results are similar to this:
1667587799336.png


Feel free to join the discords and ask questions! Big thanks to @Knight0fDragon for teaching me all this stuff almost 3 years ago and another big thanks to @Danthrax for proof-reading.

SegaXtreme Discord: Join the SegaXtreme Discord Server!
Shiro! Discord: Join the SEGA SATURN, SHIRO! Discord Server!
 
Last edited:
Great post,

Are there features that can be added to yaba-sanshiro to make your job easier? Similar to the "Save Bitmap" button, button to dump the CRAM and image data?
 
Great post,

Are there features that can be added to yaba-sanshiro to make your job easier? Similar to the "Save Bitmap" button, button to dump the CRAM and image data?
It would be very helpful if Yaba Sanshiro displayed the hex location in the ISO of graphics being shown on VDP2 and had a function for dumping specific graphics being shown on VDP2 (rather than an entire layer, as Yaba can do now).
 
Where can I get cram2pal? The link is broken and google is not finding it.

Nevermind, I found a copy on the shiro discord
 
Last edited:
I've attached CRAM2PAL to this post.

[edit] And while Malenko pretty much described this above, here's an easy checklist of what you need to do to extract and apply a palette:

1) Play the game in Yaba Sanshiro until you see the graphic in question on screen.
2) With the graphic on screen, click "Debug" up top and then "Memory Editor."
3) Click the "VDP2 CRAM" tab at the far right, then click the "Save Tab" button below.
4) Save the BIN file wherever you want. I recommend a specific folder just for this palette. (You can close out of Yaba now.)
5) Save the CRAM2PAL EXE file I've attached here to your hard drive somewhere, then drag the BIN file you just saved onto the EXE file. It'll run a DOS window for a couple seconds before closing itself, placing about a thousand tiny PAL files in the folder where the BIN file is.
6) Open CrystalTile, open the extracted graphic in question, click "View" up top and then "Tile Viewer," and set your BPP and your tile height and width correctly.
7) Click the "Palette" tab at the upper-left, then the "Import" button. Navigate to where all those PAL files you just created are and try the first one. If the graphic still looks weird, import the next PAL file. (Even though there are 1,000+ PAL files, it's really just eight unique ones being repeated over and over, so your graphic should appear more correct with one of the palettes in files 0 through 7).

And that's it! If it still doesn't look right, there may be compression or other weirdness going on.



Oh, and while I'm posting in this thread, this doesn't have anything to do with CRAM2PAL but here are the instructions I typed out for myself on how to find which file some data is in:

- Run the game in Yaba Sanshiro
- When the graphic you want to find is on screen, go into Debug, look at VDP1 RAM or VDP2 RAM (whichever applies) and copy a string of bytes that look unique and might be from your graphic
- Open the full game as a big .BIN file in a hex editor
- Search for the string of hex you copied (presumably, you find it somewhere in the full .BIN)
- Look at the hex address where it starts
- Open Windows calculator and set it to Programming, then select Hex
- Type into the calculator the hex address from your hex editor where you found your copied string of hex, then divide it by 930, then look at the Decimal number that corresponds to whatever Hex it calculated — that number is your LBA of the file containing your graphic on the disc
- Now open the game's first track in CDMage and sort the files by LBA
- Find the file with an LBA closest to — but still lower than — the one you found in Calculator ... right click on it and extract it, that's the file your graphic is in

Hopefully this helps someone.
 

Attachments

  • CRAM2PAL.rar
    64.9 KB · Views: 178
Last edited:
Back
Top