The PokéCommunity Forums Tutorial DPPt Palette Colors

 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.

#1
April 20th, 2009 (7:59 AM). Edited April 15th, 2010 by Spherical Ice.
 Alpha de Splash DPPtHGSS Researcher Join Date: Apr 2009 Location: Resort Area Gender: Female Nature: Quiet Posts: 79
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]<8 && \$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.
__________________

 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 [icon] codes HTML code is Off Forum Rules
 Forum Jump Dashboard Private Messages Subscriptions Who's Online Search Forums Forums Home Community Square     Main Street: Meet & Greet!     Celebrations!     City Hall: Feedback & Support     PokéCommunity Daily         Published Piece Archive     The Bulletin Board Main Series Pokémon Gaming     Pokémon Sun & Pokémon Moon     Omega Ruby & Alpha Sapphire     Pokémon X & Pokémon Y     Fifth Generation     Fourth Generation     Third Generation     Second Generation     First Generation Pokémon Gaming     Pokémon Gaming Central     Pokémon GO         Pokémon Field Journals     Pokkén Tournament     Challenges     Trade Corner         Trade Shops         Quick Trades         Trader Reviews     Battling & Team Building         The PokéCommunity League         Events & Groups Approval The Wide World of Pokémon     Pokémon General     Pokémon World Championships     Pokémon Anime         Episode Discussion     Pokémon Trivia     Pokémon Trading Card Game         TCG Deck Reviewing         Custom Cards ROM Hacking     ROM Hacking Hub         Beginner’s Lounge     Hacks Studio         Progressing Hacks         Sideshow Showcase     Research & Development     Tools, Tutorials & Resources Create & Discover     Art & Design         A&D School of the Arts     Creative Media     Roleplay Theatre         Roleplay Casting         Roleplay Stage     Fan Fiction and Writing         Writer's Lounge         Fanfiction Archive     Game Development         Games Showcase         Progressing Games         Resources         Scripts & Tutorials         Pokémon Essentials Entertainment & Hobbies     General Entertainment     Anime & Manga     Video Games     Tabletop Gaming Off-Topic Discussions     The Mall     The Alola Exeggutorhouse     The Lab     The Round Table     The Playground     The Underground

All times are GMT -8. The time now is 1:11 AM.