Atrius: I'm trying to fix the site, but it might take a while.

It seems the SQL database had grown larger than our hosting company allows.
I've cleaned out all of the unnecessary log data to get it down to an
acceptable size, but haven't received a response as to why normal
functionality hasn't been restored yet.


 Palette info
Golden Sun Hacking Community
July 19, 2018, 09:49:12 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
  Home   Forum   DC Wiki Help Search Calendar Downloads Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Palette info  (Read 4552 times)
0 Members and 1 Guest are viewing this topic.
Salanewt
His Sexiness
Mercury Clan

Oh yeah, baby!

Prodigy
*

Coins: 32
Offline Offline

I am: A part of the organization of Cool Cats, but more of a dog person in reality.
Emblems: Have a nice day.
Posts: 4566

« on: December 01, 2009, 07:29:57 PM »

Hello. Lately, I have been wondering how game handle palettes. For example, how does Golden Sun get its colours, and how many bytes are used?

I am only wondering this because Mario and Luigi uses four bytes per colour. I am still working it out for those who are interested (myself included), but a single colour is built like this (still not sure for tilesets, but I am very sure that this is the case). Sprites are also composed of 16 colours, no more.

BR BG

I can only guarantee the second two. Basically, we have Brown, Burgundy (this can be made into red with the first bit), Green, and Blue. I find this a bit confusing, so I was hoping that someone could give me some palette information if other games use similar colour systems, or hopefully even a place to enter byte combinations for colours (since finding the palette that I want is going to be hard just by trial and error). I have noticed that the very first colour might actually be shade? I doubt this, since F0 F0 is purple, not blue (although F0 0F seems to be a light green).

Have a nice day.


By the way, any palette information for hacking games should be acceptable here.
Logged

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?
View Profile WWW
Atrius
Programmer Extraordinaire
Web Host

Fear my blades

Veteran Member
*

Coins: 1
Offline Offline

Gender: Male
Emblems: Website Founder
Clan Position: Creation God of Sol
Posts: 1758

« Reply #1 on: December 01, 2009, 07:48:43 PM »

2 bytes, all GBA games use the same palette format which is only 2 bytes for each color in a palette.

1 hex value = 4 bits
1 byte = 8 bits
1 byte =  2 hex values

The actual data is formatted as such:

bits 0-4 : Red
bits 5-9 : Green
bits 10-14 : Blue
bit 15: Unused.  (This is why white is represented as 7FFF)

For example:

001F = Red
03E0 = Green
7C00 = Blue

(GBA is little endian, so when you combine two bytes into a single 16-bit value they get reversed)

It can be rather confusing if you don't understand how each bit falls into a hex value.
« Last Edit: December 01, 2009, 07:50:30 PM by Atrius » Logged

I'm shaking my head in general disapproval of everything
View Profile WWW
Salanewt
His Sexiness
Mercury Clan

Oh yeah, baby!

Prodigy
*

Coins: 32
Offline Offline

I am: A part of the organization of Cool Cats, but more of a dog person in reality.
Emblems: Have a nice day.
Posts: 4566

« Reply #2 on: December 01, 2009, 08:07:39 PM »

Thanks again Atrius! I always assumed that half of a byte was a bit, but... Lol. Anyway, thanks for clearing so much up for me! Now, with the knowledge of Palettes at my side, I can slowly work on customizing any character how I want. All GBA games work like this for how their palettes are constructed? Very nice to know.

Have a nice day.

Now to find my spriting scalpel.
Logged

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?
View Profile WWW
Atrius
Programmer Extraordinaire
Web Host

Fear my blades

Veteran Member
*

Coins: 1
Offline Offline

Gender: Male
Emblems: Website Founder
Clan Position: Creation God of Sol
Posts: 1758

« Reply #3 on: December 01, 2009, 08:25:13 PM »

Computers store data as 1's and 0's.  These are known as bits.

A single hex digit uses 4 bits, or 1's and 0's to store it's value.

bit 0 represents 1
bit 1 represents 2
bit 2 represents 4
bit 3 represents 8

By adding these values in different combinations you can get any number 0 to 15 in decimal, or 0 to F in hexadecimal

Basically, with the bits ordered from right to left as all digits are:

0 = 0000 = 0 = 0
1 = 0001 = 1 = 1
2 = 0010 = 2 = 2
3 = 0011 = 2+1 = 3
4 = 0100 = 4 = 4
5 = 0101 = 4+1 = 5
6 = 0110 = 4+2 = 6
7 = 0111 = 4+2+1 = 7
8 = 1000 = 8 = 8
9 = 1001 = 8+1 = 9
A = 1010 = 8+2 = 10
B = 1011 = 8+2+1 = 11
C = 1100 = 8+4 = 12
D = 1101 = 8+4+1 = 13
E = 1110 = 8+4+2 = 14
F = 1111 = 8+4+2+1 = 15
« Last Edit: December 01, 2009, 08:26:55 PM by Atrius » Logged

I'm shaking my head in general disapproval of everything
View Profile WWW
Salanewt
His Sexiness
Mercury Clan

Oh yeah, baby!

Prodigy
*

Coins: 32
Offline Offline

I am: A part of the organization of Cool Cats, but more of a dog person in reality.
Emblems: Have a nice day.
Posts: 4566

« Reply #4 on: December 01, 2009, 09:59:05 PM »

Yep, must love Binary, right? Well, thanks again! So that is the relationship between HEX and Binary... I wonder if there is a formula to convert Hexadecimal to Decimal without having to use a calculator/spend time thinking of it?

Thank you for all of your help.

Have a nice day.

Oh yes, is there any way that I can test colour values without trial and error, or not? I pretty much have the colours that I want, but I am not sure how to get them with the GBA's method of creating colours.
Logged

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?
View Profile WWW
Atrius
Programmer Extraordinaire
Web Host

Fear my blades

Veteran Member
*

Coins: 1
Offline Offline

Gender: Male
Emblems: Website Founder
Clan Position: Creation God of Sol
Posts: 1758

« Reply #5 on: December 02, 2009, 03:28:43 AM »

Your RGB values should all be 248 at the the highest.  Take each of them divide them by 8, and round it to the nearest number which should be between 0 and 31, if you use 32 it won't work.

Using windows calculator in scientific, or programmer mode (whichever your version actually has, and allows you to view values in hex) In decimal mode first put in the blue value, multiply by 32, add the green value, multiply by 32 again, and finally add the red value, then switch to hex mode to get your color value.
Logged

I'm shaking my head in general disapproval of everything
View Profile WWW
Salanewt
His Sexiness
Mercury Clan

Oh yeah, baby!

Prodigy
*

Coins: 32
Offline Offline

I am: A part of the organization of Cool Cats, but more of a dog person in reality.
Emblems: Have a nice day.
Posts: 4566

« Reply #6 on: December 02, 2009, 12:43:44 PM »

Wow, thanks again! Wait though, wouldn't I just be able to select the same colours from Golden Sun'a palette? Hm... Hard to say. It does seem that the other colours might work (and people tend to favour the brighter colours in Superstar Saga), but they do not display correctly? Well, it is time to see if the palette that I am using for a "surprise" will work, since the original came from a DS game. One last question for now. Do you know how I can find out the values for the colours that I am using?

Have a nice day.

Edit: If it were for the html based colour system, then I would know, but for the GBA system... I would rather not do trial and error, but I will if I must.
« Last Edit: December 03, 2009, 12:49:36 AM by Salanewt » Logged

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?
View Profile WWW

Regular Member
**

Coins: 0
Offline Offline

Posts: 195

« Reply #7 on: December 10, 2014, 10:05:49 AM »

Bumping because relevant topic.

How does one convert RGB to a 2-byte hex?

For example, what is the formula that goes into converting 26,9,16 to 413A?
Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411

« Reply #8 on: December 10, 2014, 10:10:33 AM »

Formula?

Valid numbers for each color of RGB go from 0 to 31.
(blue * 0x400) + (green * 0x20) + (red)


In programming, it'd probably be better to do:
(blue << 10) Or (green << 5) Or (red)
« Last Edit: December 10, 2014, 10:15:28 AM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile

Regular Member
**

Coins: 0
Offline Offline

Posts: 195

« Reply #9 on: December 10, 2014, 10:19:01 AM »

Formula?

Valid numbers for each color of RGB go from 0 to 31.
(blue * 0x400) + (green * 0x20) + (red)


In programming, it'd probably be better to do:
(blue << 10) Or (green << 5) Or (red)

I'm not sure how to apply the double "<<" symbol. It's never something I learned in math.


Using windows calculator in scientific, or programmer mode (whichever your version actually has, and allows you to view values in hex) In decimal mode first put in the blue value, multiply by 32, add the green value, multiply by 32 again, and finally add the red value, then switch to hex mode to get your color value.

This seems more up my alley, and now I understand it.

I'll put it into layman's terms for myself:

Atrius saying that each RGB color supported by the GBA can go up to 248.

To convert it to a value usable by the GBA, you must first convert each RGB color by dividing them each by 8. So 248/8 = 31

Then in Windows calculator, in Decimal Mode, you plug in the blue value, multiply by 32, add the green value, multiply by 32 again, then add red value. After, convert to hex. I should get the answer 7FFF.

For me, the formula would look like:
((31*32+31)*32)+31

Or otherwise

((blue*32+green)*32)+red

Okay, seems simple now.
« Last Edit: December 10, 2014, 10:33:13 AM by Lishy » Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411

« Reply #10 on: December 10, 2014, 10:25:51 AM »

7FFF is white.

Quote
I would multiply in hex 31x400, 31x20, and 31x1?
Close, but not quite.  I used hex numbers, you just made them dec. The dec equivalent would be: 31x1024, 31x32, 31x1.

<< just shifts the bits left by the number of given bits.

"<< 10" shifts the number over to the left 10 bits... (Think in binary.)


@Lishy's edit: Yeah, Atrius's way is obviously easiest to remember. Good thing I linked this topic!
« Last Edit: December 10, 2014, 10:37:05 AM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Pages: [1]   Go Up
  Print  
 
Jump to:  

Cbox
Yesterday at 10:49:52 PM
roger: I can post but it goes to an error page when I submit.
Yesterday at 05:24:12 PM
zman9000: Site is back WOO!
May 09, 2018, 12:35:37 AM
KyleRunner: The "Start In" field is not editable... I'll try making new shortcuts
May 08, 2018, 09:51:08 PM
Fox: If all else fails, you canmake new Shortcuts to do the same thing.
May 08, 2018, 09:49:53 PM
Fox: Export Properties > Shortcut (Tab) > Target / Start In ; Target (for Export) should be: (filename) 0 , and for Import: (filename) 1
May 08, 2018, 08:52:00 PM
KyleRunner: I can't change the path in properties menu...
May 08, 2018, 01:27:19 AM
Fox: You may need to edit something in properties, though... so it uses the exe file in the same directory.
May 08, 2018, 01:24:59 AM
Fox: It is suppose to be a shortcut, yes.
May 03, 2018, 11:48:05 PM
KyleRunner: Fox, the "export" function in your text editor is just a shortcut... Could you please fix it?
May 02, 2018, 09:53:45 PM
KyleRunner: I come here everyday. I'm working on a Portuguese translation, and the people here help me a lot.
May 02, 2018, 08:56:07 AM
Drake baku: My feel as well, I posted a little as well since my return, but silence was all that followed... At least the forum is a great source for data when hacking GS/ GS2, currently looking for something I have read a long time ago cause my PP recovery psy is not working
May 01, 2018, 09:58:04 AM
Fox: I am thinking a lot of this might be because of Discord?
May 01, 2018, 09:56:08 AM
Fox: Yeah, this forum is more dead than ever before.  February and April have 0 new topics. (All other months prior have more.) And March has lowest number of new posts. (It'd be dumb to count the very first month this site was created.)
April 25, 2018, 09:02:13 PM
Fox: Yes. The best tool is a hex editor. Well.... VBA, VBA-SDL-H, no$gba Debugger, GBATEK, and my documentation.... to use these to learn how the code/data works. Best method because it maximizes your editing ability... and then there is my program gsmagic that I was working on. Still in its early stages, though. (Even after year(s).)
April 25, 2018, 04:21:58 PM
Xendrox D: *exept tla editor.
April 25, 2018, 04:21:29 PM
Xendrox D: is there any other tool for hacking gs?
April 23, 2018, 09:26:27 PM
Atrius: Rarely, but not never.
April 23, 2018, 08:01:48 AM
Drake baku: Can it be, the god who created the editor, atrius. I heard you never came back online here anymore
April 20, 2018, 02:46:36 PM
KyleRunner: Atrius!!
April 19, 2018, 11:29:46 PM
Atrius: @Fox, I tried, but for some reason Mario Golf won't boot, and Mario Tennis crashes when you patch out the text compression, and I'm not sure why...  The normal text loading functions in them are basically the same as the ones in the Golden Sun games.

Affiliates
Temple of Kraden Golden Sunrise
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.073 seconds with 29 queries.