The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.


Advertise here

Reply
 
Thread Tools
  #1    
Old April 20th, 2009, 07:59 AM
Alpha de Splash's Avatar
Alpha de Splash
DPPtHGSS Researcher
 
Join Date: Apr 2009
Location: Resort Area
Gender: Female
Nature: Quiet
Send a message via AIM to Alpha de Splash Send a message via Windows Live Messenger to Alpha de Splash Send a message via Yahoo to Alpha de Splash

Advertise here
Here's my two cents on the Palette Colors:
Files extracted having the RLCN file type, or the RLCN magic stamp (hex: 524C 434E) are palette files. after that there are 18 words (36 bytes) of information about filesize which seem to be mostly the same. Then are the colors. Each color is 1 word (2 bytes) long. and i have created an algorithm for the hexadecimal equivalent of the color: (written in PHP by me)
PHP Code:
//This is a comment
$byte str_split($bytes);//$byte[0] is first digit of the word, $bytes[3] is 4th digit
//These are the variables for the Digits of the word
$byte[0] = hexdec($byte[0]);//first digit(decimal)
$byte[1] = hexdec($byte[1]);//2nd digit(decimal)
$byte[2] = hexdec($byte[2]);//3rd digit(decimal)
$byte[3] = hexdec($byte[3]);//4th digit(decimal)

if ($byte[0]%2==0){//if the first digit evenly divides by 2 (has a zero remainder)
$data 0;// just another variable
}
else {
//if it is odd
$data 8;
}

$hex[0] = dechex((($byte[1]-($byte[1]%2))/2)+$data);
//take the first digit and drop down to the nearest even number (1 to 0, 2 to 2, 9 to 8)and divide by two. then add the thing from above. This is the first hexadecimal number of the color

$data = (($byte[1]%2)*8);//sets a variable to either 0 if the second digit of the word is even or 8 if odd

$hex[1] = dechex($data);//turn that variable just above into the second digit of the color (it doesn't really need to be turned back into hex because it is same)

$data = (($byte[3]%4)*4);// take the remainder of the last digit of the word when divided by 4 (6 divided by 4 is 1 remainder 2, so use 2).

$hex[2] = dechex((($byte[0]-($byte[0]%4))/4)+$data);//drop the value of the first byte to the nearest 4 (10 goes to 8, 7 to 4, 4 to 4)and add the variable from above

if ($byte[1]%4==0||$byte[1]%4==1){//if the remainder when divided by 4 is 0 or is 1, set the variable to 0
$data 0;
}
else{
// if it is 2 or 3, set it to 8
$data 8;
}

$hex[3] = dechex($data);// that variable is the 4th number of the color

if ($byte[3] > 7){//if the last digit of the word is 8,9,10...14,15, or 16 then the variable is 1
$data 1;
}
else{
//if the digit is 7 or under, the variable is 0
$data 0;
}

$hex[4] = dechex((($byte[2]%8)*2)+$data);// the remainder of the 3rd digit of the word when divided by 8 is multiplied by 2 then added to the variable above to make the 5th number of the color

if (($byte[3]<&& $byte[3]>4) || ($byte[3]<16 && $byte[3]>11)){
$data 8;//if the last digit is 5,6,7,12,13,14,15 then the variable is 8
}
else{
//if the last digit is 0,1,2,3,4,8,9,10,11 then it is 0
$data 0;
}

$hex[5] = dechex($data);// that becomes the last variable

$fullhexstring '#' $hex[0] . $hex[1] . $hex[2] . $hex[3] . $hex[4] . $hex[5];// are combined now to get the final result 
I am well aware that there are tools that can do this, but we should know what is actually going on. Feel free to criticize.
__________________

Last edited by Spherical Ice; April 15th, 2010 at 07:39 AM.
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 02:49 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.