Sega Saturn hacking docs (part 4)
Graphics Formats
(Last Updated December 25, 2002)
List of updates
-December 25, 2002 - First release
Introduction
First of all, as with all my hacking docs this is a WIP (Work-in-progress). I'm sure there will be info that will be inaccurate. But that's what you people reading this are for (so you can help me fix my mistakes ;), right?
Please, if you want to copy portions (whole or in part) of this document, please, at least email me and ask. Linking is fine, just mention where the original doc was found.
Getting Started
This list will likely get longer as I discover more formats. To view any of these formats, you'll either have to get one tilemod2 modules from the TranslationNext website: http:/www.emuxhaven.net/~translationnext
OR
You'll have to write your own editor/viewer.
You may also find Klarth's "Console Graphics Document" quite useful (as most of the discussed formats are also listed there). You can get it from romhacking.org
Tile Formats
1BPP:
Seems to be the most common for font, etc. It's stored as a linear, little endian (though Langrisser DE would be the exception) bitmap.
If the tiles are 8xh or 16xh, you treat each row as 1 byte or 2 bytes respectively. However, if you come across something like 12x12 (All 3 psx Langrisser's use this, as well as 4 & 5 for Saturn), just multiply the width and height, divide by 8, and use that value as your new height with 8 being the width.
Ex:
12*12 = 144
144 / 8 = 18
New width and height: 8x18.
Since it's stored linearly, tilemod2 doesn't really care about the dimensions so long as the total amount of pixels is the same.
One last note about 12x12. The way it’s drawn (in Langrisser IV/V) is by copying two characters at a time into a 24x16 area (which is made of 8x8 tiles).
Games known to use 1BPP:
-Black/Matrix
-Digital Devil Story: Devil Summoner
-Langrisser Dramatic Edition (Big-endian format though. 16x16 font)
-Langrisser III (16x16 font)
-Langrisser IV (12x12 font)
-Langrisser V (12x12 font)
-Lunar Magic School (16x16 font)
-Dracula X (16x16 font)
-Wachenroder (16x16 compressed font)
2BPP:
Not terribly common, but is an important format. Lunar: Silver Star Story uses this format for its 8x8, 16x16, and VW fonts. Lunar: SSSC MPEG also uses it, but a compressed version of it.
Pixel # 0 1 2 3
Bit # 0 1 2 3 4 5 6 7
4BPP:
Used only in Cotton 2, Grandia, Lunar: SSSC MPEG (16x16 compressed), Sakura Taisen, Sakura Taisen 2 and a few others that I know of.
Pixel # 0 1
Bit # 7 6 5 4 3 2 1 0
8BPP aka Mode7:
Used by most games for tiled backgrounds, images, etc. Normally is accompanied by a 15-bit Palette and mapping data.
Misc:
There are a number of variations as well. For instance Macross uses a type of 4BPP 16x16 font. There are at least 4 or 5 games that use some form of compression for certain things. For instance Grandia has compressed 8x16 and 16x16 4BPP fonts.
Games confirmed to use compression include:
-Cotton 2
-Grandia
-Langrisser: Dramatic Edition
-Wachenroder
I would also include the Shining Force III series of games, but it hasn’t been totally confirmed yet. So anyways, try to avoid these games unless want a challenge, or don’t mind one.
Linear Formats
15-bit:
Found this one in Macross: DYRL. I’ve also seen it used in Langrisser: DE. It's basically a linear image with each pixel having 5-bit color components. Essentially the equivalent of the RGB 555 palette format except Blue and Red are reversed. I think the highest bit is supposed to be for transparency, but don’t quote me on that.
Palette Formats
There are 3 palette modes. They are:
Mode 0:
RGB 555 format. Uses 2 bytes to store each color. Each component uses 5 bits. Allows up to 1024 colors. If read in little-endian, it would look as follows:
Usage Color Calc. Blue Green Red
Bit # 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Normally you don’t use the CC bit unless you need to do some weird color calculation. See the VDP2 manual for more information.
Mode 1:
Basically the same as Mode 0. Except it allows for up to 2048 colors.
Mode 2:
Your standard RGB 888 palette. 1 byte for each color component.
I've seen a number of Saturn games using the RGB 555 format for storing palette values for all sorts of things (including font), so I figured it would be best to explain it, and how to convert it into something more standard.
According to what I’ve found, in order to get a standard RGB888 out of RGB555, first split each color component into their own byte, and shift each to the left by 3. Then take the top 3 bits and copy them to the first 3 bits. For example:
RGB 555 Color
0101011010110101
Red component (before shifting)
00010101
Red component (after shifting)
10101000
Red component (after shifting and copying over top 3 bits)
10101101
Questions
If there's an important topic I may have missed feel free to email and ask.
Special Thanks
-The Saturn fans that keep the system alive
-Artemio Urbina for his hacking help
-SkankinMonkey for being ereet
-Sega for making one of my all-time favourite systems.
Cyber Warrior X
cwx@softhome.net
Source: http://www.cyberwarriorx.com