The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Other Expanding # of palettes in JPAN's engine (https://www.pokecommunity.com/showthread.php?t=357525)

Sensual October 24th, 2015 7:39 AM

Expanding # of palettes in JPAN's engine
 
Can somebody explain the process of creating several new palettes at once using JPAN's hacked engine? I was able to follow this tutorial and add a single palette, but I don't understand the actual process enough to figure out how to insert multiple palettes at once (if that makes sense). I would like to be able to actually make sense of what's going on with the data rather than just follow the tutorial to the tee.

1. Find out how many palettes are needed (20). Multiply number of needed palettes by 32 and type result (640) into FSF. This will find an offset that's large enough to hold 640 bytes.

2. Insert palette into NSE for unmodified game. Write down the palette offset.

3. Navigate to 0x1A2400 in JPAN rom. Insert pointer before end of table (string that designates palette numbers and offset).

4. Open unmodified rom in a hex editor. Navigate to the palette offset and copy 32 bytes. Go back to your hex editor with the JPAN rom and navigate to FSF offset and paste the data. (for additional palettes, add 32 to offset)

5. MUST CHANGE PALETTE NUMBER MANUALLY IN HEX EDITOR. (Say you wanted to edit the male hero from Ruby’s sprite. See what he sprite offset is in NSE and write it down. 0x3A3C64. Go to that address in the JPAN rom. The palette number is the third byte over. So change that to a 20.

6. Now open your Overworld Editor Rebirth sprites.ini file. Go down to the English Fire red and change the SpritePaletteHeader pointer to 1A2400.

Sensual October 25th, 2015 5:27 PM

Sorry for the bump, but is there anybody that can explain this? I'd really like to understand the process.

Blah October 25th, 2015 6:52 PM

Yeah, so you're not going to understand what's going on here from this guide. The writer is just showing how a process is done, and there's no documentation in this guide. I don't think that this is open source or the research is explained. If it is, feel free to link that that instead, maybe I can help you from there.

But basically it's just a table of pointers, where each pointer is a pointer to some palette data. What the guy here is doing is using FSF to find free space for X palettes then using that as a pointer. He states that each pal takes 64 bytes (I think that's a typo of some sort, cause OW pals are 16 colors and that's just 32 bytes). What you can do is
Needed space = (32 * number of pals you want). Then you use the resulting number as the amount of bytes to search for. Each pointer would be the pointer to free space FSF gave you + 32 for each successive palette.

Hopefully that makes sense. I can't explain the actual process of the routine, or how it works though without seeing the source/further documentation.

Sensual October 29th, 2015 5:31 PM

Quote:

Originally Posted by FBI (Post 8976482)

But basically it's just a table of pointers, where each pointer is a pointer to some palette data. What the guy here is doing is using FSF to find free space for X palettes then using that as a pointer.

Ok, this is where I'm confused.

Say I want to insert 10 palettes. I would need 320 bytes, so I type that into FSF and the first usable offset it finds is x800000. Do I have to repeat that step for each individual palette, or can I do all 10 at once?

Blah October 29th, 2015 6:04 PM

Quote:

Originally Posted by Sensual (Post 8980342)
Ok, this is where I'm confused.

Say I want to insert 10 palettes. I would need 320 bytes, so I type that into FSF and the first usable offset it finds is x800000. Do I have to repeat that step for each individual palette, or can I do all 10 at once?

Yeah, so it's 320 bytes for 10 new pals. FSF will give you the offset, then the first pal pointer should be the value FSF gave you, for the next pal, you add 32 to that offset.

Basically,

Pal offset = FSF_offset + ( 32 * (pal_number - 1))
pal_number is supposed to be which pal you're trying to get the pointer of. The second one pal_number is 0x1, third it's 0x2 and so on. Don't forget to convert 32 to hex when adding and subtracting from FSF's hex pointer.

Sensual November 2nd, 2015 8:16 AM

I got the chance to test this out again. I think I have it understood for the most part, but I have a couple final questions for you if you don't mind answering them.

Spoiler:
As JPAN states in his guide, a palette pointer consists of PPPPPPPP nn110000, with P = palette pointer and n = palette number. For example, if I wanted to write a pointer to a palette located at 0x800000 with a palette number of 32, I would use this.

00008008 20110000

When typing pointers, you need to break the original address into three blocks of two and rearrange them like so. 80 00 00 -> 00 00 80 80. You had the 80 because it is located within the rom.

20 is actually 32 in hex, so make sure you convert. I would use the calculator that came with your computer.


This part is a little confusing. The fact that he decided to insert palette with the number 32 is completely coincidental, yes? If I'm understanding this correctly, he could have used 31, 17, 92, etc. if he wanted to.

Also, let's say I found free space at x16159C. Would I insert it like so?: 9C 15 16 80

Spoiler:
Remember that offset we found for free space, well were going to use it! Open you modified rom into a hex editor and navigate to 0x1A2400.

Go to the end of the table and insert your pointer before the 00000000 FF110000 as shown. I just rewrote the ending afterwards. Make sure your table ends with that or else in will NOT work at all.

He's basically inserting a new palette number into the rom at this step, right? For example, If I wanted to insert palette numbers 11 and 12, it would look something like this:

00 00 80 08 0B 11 00 00 (inserting palette number 11 to 800000) / 02 00 80 08 0C 11 00 00 (inserting palette 12 to 800020) / 00 00 00 00 / FF 11 00 00

The offsets 800000 and 800020 are where the data for the individual palettes are actually stored, yes?

Blah November 2nd, 2015 9:01 AM

Quote:

Originally Posted by Sensual (Post 8983612)
I got the chance to test this out again. I think I have it understood for the most part, but I have a couple final questions for you if you don't mind answering them.

Spoiler:
As JPAN states in his guide, a palette pointer consists of PPPPPPPP nn110000, with P = palette pointer and n = palette number. For example, if I wanted to write a pointer to a palette located at 0x800000 with a palette number of 32, I would use this.

00008008 20110000

When typing pointers, you need to break the original address into three blocks of two and rearrange them like so. 80 00 00 -> 00 00 80 80. You had the 80 because it is located within the rom.

20 is actually 32 in hex, so make sure you convert. I would use the calculator that came with your computer.


This part is a little confusing. The fact that he decided to insert palette with the number 32 is completely coincidental, yes? If I'm understanding this correctly, he could have used 31, 17, 92, etc. if he wanted to.

Yeah, it's arbitrary that he choose 32.


Quote:

Also, let's say I found free space at x16159C. Would I insert it like so?: 9C 15 16 80
This is the reverse hex version which is the format a pointer like 0816159C would be in, yeah.

Quote:

Spoiler:
Remember that offset we found for free space, well were going to use it! Open you modified rom into a hex editor and navigate to 0x1A2400.

Go to the end of the table and insert your pointer before the 00000000 FF110000 as shown. I just rewrote the ending afterwards. Make sure your table ends with that or else in will NOT work at all.

He's basically inserting a new palette number into the rom at this step, right? For example, If I wanted to insert palette numbers 11 and 12, it would look something like this:

00 00 80 08 0B 11 00 00 (inserting palette number 11 to 800000) / 20 00 80 08 0C 11 00 00 (inserting palette 12 to 800020) / 00 00 00 00 / FF 11 00 00

The offsets 800000 and 800020 are where the data for the individual palettes are actually stored, yes?
Yeah, one small error I've fixed with bold. I haven't actually read the tutorial, so I can't be certain, but based on the instructions you've posted here, this is probably the way it's done.

Sensual November 2nd, 2015 12:14 PM

Great, it all makes sense now. I really appreciate all the help, FBI.

The tutorial was good, but it didn't really explain much. It's kinda like that saying; catch somebody a fish and you feed them for a day, but teach them how to catch a fish and you feed them for life.

BluRose November 2nd, 2015 12:45 PM

Quote:

Originally Posted by Sensual (Post 8983789)
Great, it all makes sense now. I really appreciate all the help, FBI.

The tutorial was good, but it didn't really explain much. It's kinda like that saying; catch somebody a fish and you feed them for a day, but teach them how to catch a fish and you feed them for life.

Quote:

Originally Posted by FBI (Post 8983668)
Yeah, it's arbitrary that he choose 32.

This is the reverse hex version which is the format a pointer like 0816159C would be in, yeah.

Yeah, one small error I've fixed with bold. I haven't actually read the tutorial, so I can't be certain, but based on the instructions you've posted here, this is probably the way it's done.

Sorry, FBI, was reading this and had to correct something because it might actually cause a problem:

9C 15 16 80, the format Sensual posted, would actually lead to address 8016159C. Before it causes a problem for him/her, it would actually be 9C 15 16 08, no? I know that you know this and that the person that apparently wrote the guide that Sensual quoted got it wrong, too, but...

Blah November 2nd, 2015 1:44 PM

Quote:

Originally Posted by BluRose (Post 8983811)
Sorry, FBI, was reading this and had to correct something because it might actually cause a problem:

9C 15 16 80, the format Sensual posted, would actually lead to address 8016159C. Before it causes a problem for him/her, it would actually be 9C 15 16 08, no? I know that you know this and that the person that apparently wrote the guide that Sensual quoted got it wrong, too, but...

Ah, thanks for the correction, I missed it :)


All times are GMT -8. The time now is 2:30 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 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 - 2016 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.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.