don't click here

Pallete Editing with hex

Discussion in 'Engineering & Reverse Engineering' started by 3588897, Aug 9, 2005.

  1. 3588897


    Pending Member
    Sonic 2 Redone
    Editing Palletes with Hex

    Below I am going to explain how to edit palletes using hex without the use of any utilies at all. I got the below information while restoring my palletes due to the hack crashing. Now lets get started, shall we?

    OK now to edit palletes you'll need to know the locations of them in the ROM. (I obtained the below using Hivepal). If you need to know the left is pallete name and the right is the offset of the pallete.
    Sega Sonic 2902
    Title Screen (Sonic) 133EC
    Title Screen (Tails) 2942
    Title Screen (Main) 1340C
    Title Screen Water 1E5A
    Sonic and Tails 29E2
    Sonic to Super Sonic 2246
    Super Sonic 2276
    Title Cards 2A02
    Emerald Hill 2A22
    Emerald Hill/Aquatic Ruin Rotating Water 1E7A
    Wood 2A82
    Wood Conveyor Belts 1F1A
    Metropolis 2AE2
    Metropolis Cycle #1 1F2A
    Metropolis Cycle #2 1F36
    Metropolis Cycle #3 1F42
    Wing Fortress 2B42
    Wing Fortress Fire Cycle 20A2
    Hill Top 2BA2
    Hill Top Lava 1E9A
    Hidden Palace 2C02
    Hidden Palace (Sonic & Tails Under Water) 2C62
    Hidden Palace Underwater Tiles Pallete 2C82
    Hidden Palace Water Cycle 1F56
    Hidden Palace Underwater Cycle 1F66
    Oil Ocean (Do not edit or you'll get a huge mess unless you know how to fix it!) 2CE2
    Oil Ocean Oil 1F76
    Mystic Cave 2D42
    Mystic Cave Lanterns 1F86
    Casino Night 2DA2
    Casino Night Cycle 1 1F8E
    Casino Night Cycle 2 1FA0
    Casino Night Cycle 3 1FB2
    Casino Night Cycle 4 1FC4
    Chemical Plant 2E02
    Chemical Plant Sonic & Tails Underwater 2E62
    Chemical Plant Underwater 2E82
    Chemical Plant Underwater Sonic to Super Sonic 22C6
    Chemical Plant Underwater Super Sonic 22F6
    Chemical Plant Cycle 1 2022
    Chemical Plant Cycle 2 2058
    Chemical Plant Cycle 3 2082
    Chemical Plant Cycle 4 20E2
    Death Egg 2EE2
    Aquatic Ruin 2F42
    Sonic & Tails Underwater (Aquatic Ruin) 2FA2
    Aquatic Ruin Underwater 2FC2
    Sonic to Super Sonic Underwater (Aquatic Ruin) 2346
    Aquatic Ruin Underwater Super Sonic 2376
    Sky Chase 3022
    Menus 30E2
    Special Stage Main 3162
    Special Stage Sonic 3182
    Special Stage Tails 31A2
    Special Stage 1 31C2
    Special Stage 2 31E2
    Special Stage 3 3202
    Special Stage 4 3222
    Special Stage 5 3242
    Special Stage 6 3262
    Special Stage 7 3282
    Special Stag 1 2p 32A2
    Special Stage 2 2p 32C2
    Special Stage 3 2p 32E2
    Special Stage Chaos Emerald 35F92
    Special Stage Results Screen 3302
    Emerald Hill Icon 9880
    Metropolis Icon 98A0
    Hill Top Icon 98C0
    Hidden Palace Icon 98E0
    Oil Ocean Icon 9900
    Mystic Cave Icon 9920
    Casino Night Icon 9940
    Chemical Plant Icon 9960
    Aquatic Ruin Icon 9980
    Sky Chase Icon 99A0
    Wing Fortress Icon 99C0
    Death Egg Icon 99E0
    Special Stage Icon 9A00
    X 2 Player Versus Icon 9A20
    Sound Test Icon 9A40
    Ending Grey Cutscenes AD1E
    Ending Main ACBE
    Ending Sonic AC7E
    Ending Tails AC9E
    Ending Super Sonic AD3E
    Unknown 1 3082
    Unknown 2 30A2
    Unknown 3 30C2

    Now you'll need just a sonic 2 ROM and a hex editor. Now to exlplain how to edit:
    First off leave that 0 there as the very first nibble on EVERYTHING! the last three nibbles are used as the RGB values. Now the higher you go the brighter the color. Like 0EEE would make a grey color 0000 would make black. 1EEE would most likely crash the ROM. Now if you use 0333 or 0111 it also won't work. You can only use even values. Even values are 0, 2, 4, 6, 8, A, C, and E. 1, 3, 5, 7, 9, B, D, and F don't work.Now when you reach the end of a pallete the bytes should be 0000 0000. Edit no further! If you edit any further than that you will be editing another level entirely. Now I'll say one more thing before you go away with new knowledge and start editing palletes. Now I'll explain what every nibble is. The first (should be 0) is I've no clue, the second is red, the third is green, and the last is blue.
  2. Aurochs


    Единый, могучий Советский Союз! Tech Member
    Whatever catches my fancy
    This has been explained better in Saxman's hacking guides, IIRC.
  3. Radio F Software

    Radio F Software

    How about a game of Gyromite? Oldbie
    Texas, USA
    Robot Combat
    Hey, that's cool though that he figured out how to find all of that. :) It would make a handy "pocket reference" or something right? I don't know what all of the numbers and letters mean exactly, but it looks important. :P
  4. Heran Bago

    Heran Bago

    Ah! It's Puyo battle then. Tech Member
    ICEknight explained it REALLY good this one time. Wish I had saved that.

    edit; Oh yeah! It was when Rika made the pallete hack of MJ's moonwalker.
  5. Radio F Software

    Radio F Software

    How about a game of Gyromite? Oldbie
    Texas, USA
    Robot Combat
    Moonwalker, of all games. :P
  6. ICEknight


    Researcher Researcher
    Link here.
    Copy/paste here:
    First of all, make sure your emulator can make screenshots using the correct colors. The RGB color values shouldn't be different than those the Genesis accepts (0,32,64,96,128,160,192,224).
    If you're using the latest versions of Gens, you should have the following lines in the GENS.CFG file:
    Code (Text):
    1. Contrast=90
    2. Brightness=100
    Then, take a look at the palette you want to find (in Gens, go to CPU->Debug->Genesis VDP) and make a screenshot of it. Now you'll have to find those colors in the ROM.

    The MegaDrive palettes have the format 0BGR (Zero, Blue, Green, Red), etc, so you must look at the color values, convert each of them to the byte the MD uses for it and go to the next color you want to find. The bytes used for each color value are as follows:
    Code (Text):
    1. E:224
    2. C:192
    3. A:160
    4. 8:128
    5. 6:96
    6. 4:64
    7. 2:32
    8. 0:0
    So if you had a palette with the two consecutive colors "R:224 G:160 B:0" and "R:192 G:128 B:0" you should look for the hex values "00AE008C".

    I also had to explain it a couple of times at the SEGA Emulation Forums, if I remember correctly. =|
  7. Eclipse


    Pending Member
    Or do the easier way...Lightning's way that is short and easy...
    Let's see If I can explain...

    Code (Text):
    1. Needed stuff:
    2. ---------------
    3. -DebuGens
    4. -Hivepal
    5. -Hex Editor (In this I use Hex Workshop)
    7. -Open DebuGens and open your rom
    8. -Make it so the thing you want to change is on the screen
    9. -Dump the pallete with "GDump Palletes (CRAM)"   => This dumps the colors onto an oh-so-easy to read, .bin file
    10. -Open your Hex Editor and HivePal
    11. -Open your .bin file that you dumped the palletes on your Hex Editor and HivePal
    12. -On HivePal count how many colors comes before the colors you want to change.
    13. -Then on your Hex Editor skip 4 numbers for every color that comes before your colors
    14. -Then with HivePal count how many colors there are you want to change
    15. -Then with your Hex Editor HIGHLIGHT 4 numbers for every 1 color you want to change (REMEMBER: You skipped some digits)
    16. -With the digits highlighted copy them
    17. -Then open the rom you want to change
    18. -Then find the digits you had highlighted and copied (ctrl+F opens find)
    19. -It may or may not find it and it may find more than one result
    20. -Open your rom you want to change in HivePal
    21. -Put the offset in and you should see the pallete which you wanted to change!
    Wow that was a lot of typing...
    This should work...I'm pretty sure I didn't miss a step...

    Lightning was my teacher on this...hope he doesn't mind me saying this or I'm screwed out of his kick ass teachings...
  8. ICEknight


    Researcher Researcher
    Ehh... I'm sure the other way is easier to understand.