Alcaro / Flips

Floating IPS is a patcher for IPS and BPS files.
Other
334 stars 46 forks source link

Combine/Merge BPS patches #15

Closed ShadowOne333 closed 6 years ago

ShadowOne333 commented 6 years ago

Good day. Recently I stumbled upon two hacks for Ocarina of Time (v1.2), one of which is in XDelta form (widescreen), and the other in BPS (uncensored). What I've been trying to do these past days is to possibly merge them both into a single ROM. I could easily convert the XDelta patch into a BPS one, to keep both of them as BSP patches.

However, given how XDelta and BPS patches work once patched into a ROM, it is very hard to keep track on what specific changes have been made to the ROM, since once applied the changes go way above 10MB in the patched ROM compared to the original base, even when the original XDelta/BPS patches do not go above 500kB each.

I tried separating the ROMs into 4 parts, and then make IPS patches from each part, then patching the IPS for each one into 4 final parts, then merging them together, but the IPS patches for each part were between 4-5MB each.

So, with that said, I wanted to know if there is perhaps a known way to possibly merge or combine 2 BPS patches into a single one, or perhaps make it so that one can be applied over the other, since neither XDelta nor BPS give this option (to avoid issues of incompatibility with the patched ROM).

The patches I am using are the following:

OoT 64 Widescreen patch:
https://www.dropbox.com/s/o4ad8fvqf02gji8/oot12ws.xdelta?dl=0

OoT64 Uncensoring patch:
http://www.mediafire.com/download/pgnk7x3kcmc3tlc/oot_v12_firetemple.zip

Both should be applied to a clean Ocarina of Time v1.2 ROM (N64). If there is something I can do for testing, please let me know.

Thanks in advance!

Alcaro commented 6 years ago

Merging patches is always risky. Simple patches in simple formats (like IPS) can be applied on top of each other, but more complex patches are likely to be incompatible with each other. They could edit the same routine in the clean ROM, they could use the same freespace in the clean ROM, they could call a routine that the other edits and not expect its modifications, they could use the same originally-free RAM, or they could do something even worse; any one of those would make it impossible for a computer to apply both and get a usable result.

In this case, the fire temple patch is deep into 'something worse' territory - from what I can see, it inserts 17 bytes in the middle of the ROM, and shifts around everything else. This is the absolute worst case possible for merging binary patches; not only is it impossible for a computer to figure out where to put the changes, but it's also super annoying even for a human to figure out which changes are just moving things around and adjusting pointers, and which are significant. BPS and Xdelta don't mind moving things around, but as you saw, IPS can't do that - it has to reproduce nearly the entire ROM.

I don't have an Xdelta patcher nearby, but judging by its filesize, it most likely does something similar.

I'm afraid it's completely unrealistic, even for a human, to merge these patches. You'll have to find the textual source code of at least one, preferably both, if you want a combined ROM.

ShadowOne333 commented 6 years ago

Understandable. Thanks for the details. I'll try to see if I can find the source for any of the two patches and then go onwards from there.

Thanks again!

Alcaro commented 6 years ago

Once (if) you've found them, someone (either you or someone else) needs to know enough N64 coding to merge them. It's a lot easier if you find both source codes, but a sufficiently skilled coder could do it with only one of them without too much trouble (if they want to - skilled coders tend to be busy, lazy, or both).

I could do that if it was a SNES game (unless one or both patches do something creepy other than shifting the entire ROM), but I don't know N64. There should be some OOT hacking communities somewhere, look or ask around there.

Either way, I believe this one is resolved, so I'll just reclaim the zero open issues label. If not, feel free to ask.