TheGag96 / individual-color-variation

Pokémon Platinum hack to make individual Pokémon have a unique color variation (+ some shiny color changes).
16 stars 3 forks source link

Combining custom_overlay.narc with another modded narc? (SoulSilver) #13

Open RottingCrow opened 1 month ago

RottingCrow commented 1 month ago

Hello again! I'm trying to patch this mod over soothing silver. After a crap ton of trial and error, I've found the build script does work on the vanilla soul silver rom I'm using and most files can be manually patched without any conflict. The only issue is the 0.bin in the custom_overlay (a/0/2/8) narc. Both mods use the space in that narc for some form of code. I assume the exact offsets of the code is important for everything to work, so my question is which files in the build folder would I need to change the offsets in to attempt to get this to work?

Edit for clarity: I'm going to combine both 0.bin files from the extracted narc, just moving the code from this mod to be after the other one. I want to change any offsets that point to the code in the narc to match the new offsets so everything has the possibility of functioning

TheGag96 commented 1 month ago

I've found the build script does work on the vanilla soul silver rom I'm using and most files can be manually patched without any conflict

Is that so?? Note that my build script isn't checking the source bytes for being what's expected - it just writes bytes, so finishing without error isn't necessarily a sign of success. I don't know myself whether the code in HG and SS is identical. Let me know how it goes.

However, for inserting this mod into an already-made synthetic overlay, the way I set up my code and build script in this repo is not doing you any favors... You'd have to carefully add an offset to all of the insertion locations and hardcoded addresses in the source files yourself. But, some time ago, I was actually trying to make a tool that would actually help you accomplish exactly what you're wanting called nitromods. It's able to unpack a ROM, assemble code organized into "mods", and insert it all for you dynamically. In theory, you'd be able to have it handle an already-existing synthetic overlay by searching for free space, though I haven't done that in a generic way yet. Maybe I should try to beef this thing up...

As a test, I had ported the code portion of the Platinum version of this mod to work with nitromods. Give me some time and I'll see if I can make all this easier for you (and others). (Or, you can try the manual way in the meantime.)

RottingCrow commented 1 month ago

Is that so?? Note that my build script isn't checking the source bytes for being what's expected - it just writes bytes, so finishing without error isn't necessarily a sign of success. I don't know myself whether the code in HG and SS is identical. Let me know how it goes.

I did run the patched SS rom and up to the starter choice it ran well and produced color variations. I didn't move past that starter choice so there could be errors/glitches later, but I'll burn that bridge when I get to it.

As a test, I had ported the code portion of the Platinum version of this mod to work with nitromods. Give me some time and I'll see if I can make all this easier for you (and others). (Or, you can try the manual way in the meantime.)

Awesome! I'll probably mess around with nitromods in the mean time too to see if I can get anything to work. Thank you so much for all of your help!

RottingCrow commented 1 month ago

Managed to patch it by changing the offsets in the build scripts and using the custom overlay from soothing silver as the temp overlay file. Adding extra bytes to the file and putting the code for this mod at the end got it to work for me. Everything was offset by x16000 so the new offsets just had 23C8xxx changed to 23DExxx. Managed to get to starter selection without crashing + starters produced color variation!! Again, might have errors or glitches later on, but for now this is a win! Should I close the issue since I managed to create a patch, or do you want to keep it open for creating a nitromods port that others may use?

TheGag96 commented 1 month ago

Nicely done! I'll keep this open - I'll try to get a nitromods port uploaded somehow soon.