Palette Data?
Page 1 of 1
#1
19 May 2016 - 08:54 AM
Do you know where the actual palette colors are stored? Not the values that decide which palettes to use. They're hiding in some kind of Little Indian-type code that I can't find. I'm about to start paletting everyone, but I count 2 to 5 sub-palettes from sub-palettes 1 and 2 that I would like to replace before I decide which palettes to use. And probably half from sub-palette 3, but those are likely to be close by. I know you transcended the method, but I figure you found it first?
#2
19 May 2016 - 11:07 AM
Sub-palettes start at $25FAD (unheadered). They are initially 5 colors (10 bytes) each, and later 3 colors (6 bytes) each. They use R5G5B5A1 format.
#3
19 May 2016 - 05:13 PM
I see. I was in the right place, but I guess the format is what I can't understand. I can't find any documentation that really explains how A1R5G5B5 is broken down, other than 'multiply da color by 255/31.' I do have a little experience with this just from using the Color Edit option in fighting games, but here, I don't exactly know what color they're talking about.
This is what I believe to be the first sub-palette for 1 and 2:
Can you possibly explain how even one of these colors is achieved in the rom? (And no, my Imps won't look like that.)
This is what I believe to be the first sub-palette for 1 and 2:
Can you possibly explain how even one of these colors is achieved in the rom? (And no, my Imps won't look like that.)
#4
20 May 2016 - 01:45 PM
The numbers are how many bits each value takes up, so there's 5 bits for Red/Green/Blue. You don't really have to worry about the A1. Standard RGB is 256 settings (1 byte) while 5 bits only gets you 32 settings. These settings are equivalent to x*8 in RGB format, so there's the same range but fewer possibilities. I don't remember if the 1 bit is at the beginning or the end, so you'll have to test to figure that out. For added fun, it's in little endian format, which makes dealing with the 5 bit values even more annoying.
To reverse engineer one of those colors, get the RGB values, divide them by 8, then arrange them in the format above.
To reverse engineer one of those colors, get the RGB values, divide them by 8, then arrange them in the format above.
#5
21 May 2016 - 04:34 AM
A lot of those colors are only divisible by 4. Does that mean you just round up or down? Also, dividing by 8, wouldn't this mean that all the values would be #00-1F?
At $25FAD, I'm looking at
00 00 A6 53 A6 53 A6 53 48 15
and I can't see a corellation to anything there.
Anyway, it was just a thought to repair or replace a few of those sub-palettes with better colors or shades, to give something like this:
some needed contrast, but I'm gonna call it on this one. The regular sub-palettes are easy enough to manipulate, even if I don't know where they come from. Thanks for trying to make some sense out of it.
At $25FAD, I'm looking at
00 00 A6 53 A6 53 A6 53 48 15
and I can't see a corellation to anything there.
Anyway, it was just a thought to repair or replace a few of those sub-palettes with better colors or shades, to give something like this:
some needed contrast, but I'm gonna call it on this one. The regular sub-palettes are easy enough to manipulate, even if I don't know where they come from. Thanks for trying to make some sense out of it.
#6
21 May 2016 - 05:11 AM
Fidelity, on 21 May 2016 - 04:34 AM, said:
A lot of those colors are only divisible by 4. Does that mean you just round up or down? Also, dividing by 8, wouldn't this mean that all the values would be #00-1F?
Yes, all the 5-bit values are between $00-$1F, and then multiplied by 8 to get the RGB number. Are you saying you're looking at the RGB values in photoshop or something and not all of them are divisible by 8?
#7
21 May 2016 - 09:50 PM
Yeah, I was saying that, but nvm (ever notice that's usually how this ends?). I made a sheet with all the palette colors all the units could possibly have a while back, and it looks like I did something with the masking while I was checking. The colors are all fine (now).
But how do the rgb values, once divided by 8, thus becoming values ranging from $00-1F, fit into the rom? It seems that the 5-bit values of the 5 colors of a sub-palette do fit into 10 bytes if they're smashed into a string without number padding or placed with an alpha value, but even if that's how it was done, I still can't recognize any corellation in the rom.
These are the RGB values of the yellowish sub-palette I posted first (Color1 R G B, Color2 R G B, etc.)
24 24 16, 64 56 24, 128 112 40, 176 168 64, 248 240 96
which would reduce to
$3 3 2, 8 7 3, 10 D 8, 16 15 8, 1F 1E C
I'm not even looking to match a full string here, since I don't know the exact order, or where the 1-bit alpha values are. With 32 5-color sub-palettes and 32 3-color palettes, I'm assuming the sub-palettes are a total of 512 bytes? But even that wouldn't include any alpha values. Otherwise, I wouldn't even know where they end.
But how do the rgb values, once divided by 8, thus becoming values ranging from $00-1F, fit into the rom? It seems that the 5-bit values of the 5 colors of a sub-palette do fit into 10 bytes if they're smashed into a string without number padding or placed with an alpha value, but even if that's how it was done, I still can't recognize any corellation in the rom.
These are the RGB values of the yellowish sub-palette I posted first (Color1 R G B, Color2 R G B, etc.)
24 24 16, 64 56 24, 128 112 40, 176 168 64, 248 240 96
which would reduce to
$3 3 2, 8 7 3, 10 D 8, 16 15 8, 1F 1E C
I'm not even looking to match a full string here, since I don't know the exact order, or where the 1-bit alpha values are. With 32 5-color sub-palettes and 32 3-color palettes, I'm assuming the sub-palettes are a total of 512 bytes? But even that wouldn't include any alpha values. Otherwise, I wouldn't even know where they end.
#8
22 May 2016 - 03:26 AM
You gotta reduce each hex value to bits (3 would be 00011) and concatenate the bits together (in little endian order) two make a single 2-byte (16-bit) color. I'm 80% sure the alpha bit is at the end, because RGBA is a much more common color standard than ARGB. The colors are in order of brightness, darkest to lightest I think.
#9
22 May 2016 - 07:23 AM
Ohh. That's what 5-bit is. Easily the best thing I've learned all month. I have to leave for work, but I think I can actually do this now. I think you're right about it being RGBA since it's Little Endian, making it ABGR. Putting the alpha value on the right would literally increase the values exponentially, and I don't think they'd inflate them like that. I'll find out tonight.
I didn't think this was of interest to anyone, but with the attention Zombero's hack gets, there's about 100 views just for this thread (about 4 of them are from me), so assuming I figure this out, I'll layperson it by this time tomorrow. I'm sure it'd help someone out there like myself.
I didn't think this was of interest to anyone, but with the attention Zombero's hack gets, there's about 100 views just for this thread (about 4 of them are from me), so assuming I figure this out, I'll layperson it by this time tomorrow. I'm sure it'd help someone out there like myself.
#10
22 May 2016 - 08:38 AM
Quote
I think you're right about it being RGBA since it's Little Endian, making it ABGR.
Not quite that simple... little endian just reverses the order of *bytes*. So if you had 8 Red, 16 Green, 12 Blue, and 0 Alpha, it'd be:
01000 10000 01100 0
To regroup that by bytes would be:
01000100 00011000
And then to convert to little endian it would be:
00011000 01000100
And then you convert to hex. A casual reading of the final value basically won't make any sense.
#11
23 May 2016 - 03:08 AM
So that’s how little endian works for RGBA. I am damn happy that I tried the wrong thing before I checked back here, ‘cause it’s not little endian, then. It’s just ABGR. My brain might’ve melted out of my ears trying to make that work any longer. Also, the sub-palettes are at $25DAD unheadered. $25FAD was the headered location. The sub-palette values are still little endian.
Back to the first color up there, (divided by 8) 3 3 2, in 5-bit, 00011 00011 00010, and 0 for the 1-bit alpha. Reversing the values to change to ABGR leads to
0 00010 00011 00011
This (easily calculated in a Binary to Hexadecimal converter, like the one right here) gives the hex value $863, matching the first pair of bytes at $25DAD ($6308 in little endian). The next four match after that, and the next five match the Blue sub-palette, and so on. The 1-bit for the alpha is nice and insignificant.
There are still palettes at $25FAD, just not the sub-palettes. I think the first set is the healing palette, then all black, then all white, etc. The enemy's red colors and the player's blue colors are in there somewhere. I think I might change the player to green.
Back to the first color up there, (divided by 8) 3 3 2, in 5-bit, 00011 00011 00010, and 0 for the 1-bit alpha. Reversing the values to change to ABGR leads to
0 00010 00011 00011
This (easily calculated in a Binary to Hexadecimal converter, like the one right here) gives the hex value $863, matching the first pair of bytes at $25DAD ($6308 in little endian). The next four match after that, and the next five match the Blue sub-palette, and so on. The 1-bit for the alpha is nice and insignificant.
There are still palettes at $25FAD, just not the sub-palettes. I think the first set is the healing palette, then all black, then all white, etc. The enemy's red colors and the player's blue colors are in there somewhere. I think I might change the player to green.
#12
23 May 2016 - 03:32 AM
This is the sub-palette order for Sub-Palette 1 and 2 from left to right
White and black doesn't change. The four palettes in the middle with the drastically different first two colors are only intended for the Princess or Dandies, and only when used for Sub-Palette 2. Personally, those are gonna be the first palettes to go, unless I find that they're used somewhere other than the units. Sub-Palette 3 is also a set of 32 palettes, but with 3 colors instead of 5.
White and black doesn't change. The four palettes in the middle with the drastically different first two colors are only intended for the Princess or Dandies, and only when used for Sub-Palette 2. Personally, those are gonna be the first palettes to go, unless I find that they're used somewhere other than the units. Sub-Palette 3 is also a set of 32 palettes, but with 3 colors instead of 5.
#13
27 June 2016 - 04:16 AM
I decided to mention here how to determine a unit's palette. It probably could've used its own thread, but I don't wanna flood the forum. It's relevent enough here.
These are the ranges for Sub Palette 1 from color 00 to 31. These values only involve the second byte.
Sub-Palette 1 (use the pic from the last post)
As far as I know, any value past $7F is just a duplicate, so $80 is the same as $00, $C7 is the same as $47, etc.
Let's look at the ranges of Sub-Palette 2
Sub-Palette 2
Sub-Palette 3 also has 32 colors (counting from left to right),
but I think it's best to label them in Hexadecimal starting with 00, giving us $00 - $1F. These values are directly added to the first byte, whatever is first determined by Sub-Palette 2.
So if you're anything like me, it's not easy to learn anything this way; you need a few examples. We'll take a look at these random unit palettes and ID the sub-palettes first.
Example 1: Amazon palette, located at $E535 (unheadered)
Example 2: Generals
The last example is easily proven, since it's already in the rom.
Example 3: Albeleo, at $E60F
That's it. The hardest part now is to imagine the colors you want. I do have a .psd resource made that would show how any palette looks on any unit (besides Diablo...CBA'd), but it's 160 MB, and about 100 layers. Pretty cumbersome. I might put it up if someone specifically needs it, but otherwise, it doesn't seem necessary.
[EDIT] I had the Amazon palette backwards. Fixed now.
These are the ranges for Sub Palette 1 from color 00 to 31. These values only involve the second byte.
Sub-Palette 1 (use the pic from the last post)
Spoiler
As far as I know, any value past $7F is just a duplicate, so $80 is the same as $00, $C7 is the same as $47, etc.
Let's look at the ranges of Sub-Palette 2
Sub-Palette 2
Spoiler
Sub-Palette 3 also has 32 colors (counting from left to right),
but I think it's best to label them in Hexadecimal starting with 00, giving us $00 - $1F. These values are directly added to the first byte, whatever is first determined by Sub-Palette 2.
So if you're anything like me, it's not easy to learn anything this way; you need a few examples. We'll take a look at these random unit palettes and ID the sub-palettes first.
Example 1: Amazon palette, located at $E535 (unheadered)
Spoiler
Example 2: Generals
Spoiler
The last example is easily proven, since it's already in the rom.
Example 3: Albeleo, at $E60F
Spoiler
That's it. The hardest part now is to imagine the colors you want. I do have a .psd resource made that would show how any palette looks on any unit (besides Diablo...CBA'd), but it's 160 MB, and about 100 layers. Pretty cumbersome. I might put it up if someone specifically needs it, but otherwise, it doesn't seem necessary.
[EDIT] I had the Amazon palette backwards. Fixed now.
Share this topic:
Page 1 of 1