Replies: 1 comment 2 replies
-
Yes, that is possible. The obvious one is if the first changed byte is at offset 0x454F46; the IPS format can't represent that, so Flips pretends 0x454F45 is changed as well and writes an unchanged byte. (I've seen other IPS creators do the same, throw errors, or simply emit corrupt patches; there's no real standard there.) It's also possible for the IPS creator to be poorly optimized; I've seen one that implements AAAAAAAAAAAAAAAA -> CABBBBBBBBBBBBBB as 'write CA, then switch to RLE for the Bs' (Flips only writes the C). Sure, that's not the first byte, but last byte being wasteful is just as fine heuristic as first, right? (And there's probably a patcher out there that'd be wasteful on the mirrored input.) And, as mentioned, unheadered source ROM and headered target will, of course, write huge numbers of unchanged bytes if applied to something headered. And I've seen several other kinds of IPS weirdness, like not having the records in ascending order; it wouldn't surprise me if wasteful bytes show up in one of the 999999 IPS creators in existence. Actually, it would surprise me if it does not. Sounds like a fine heuristic, though. If it writes pointless bytes on a headered ROM and everything looks sensible if unheadered, there's a 90% chance the unheadered is correct. (And if it's not wasteful on either, then the heuristic will just return 'no idea'.) No clue how that'd look to users, though. A --ips-guess-header command line flag would be reasonable, but I don't know how that'd look in the GUI. |
Beta Was this translation helpful? Give feedback.
-
For SNES, my usual method to verify whether or not a patch actually requires a Header or not (despite what the documentation may say because that information is often unreliable) would be to patch against BOTH versions: Headered & Unheadered ROMs.
Fortunately/Unfortunately (depending on perspective), I came across several Chrono Trigger patches that worked on BOTH Headered & Unheadered ROMs. So, it wasn't immediately apparent which one was the correct Parent/Baserom to use for patching.
Hence, I had to conduct binary fingerprint analysis of the patches against the ROMs:
One pattern that I noticed was that "shared bytes" often time signify the correct ROM: Altho, this is with the exception of cases where the patch has been created against an Unheadered Source ROM with a Headered Target ROM (or vice versa).
Something else that I noticed was IPS data being written regardless of the target area: Notably with respect to the FIRST BYTE.
Question: Does it make sense that the first byte of IPS data is the exact same as the first byte of the target ?
I don't see how that is a logically justifiable position: In other words, will an IPS implementation ever create a data record where the first byte of the source and the first byte of the target are the same ?
If not, then THIS is finally an excellent opportunity to introduce error detection to such a terrible format (as stated in #89 ): And at the same time, wouldn't break compatibility at all.
Also, I would like to re-iterate my support of #88 which would be a Header (or Footer) with the necessary hash information to perform error checking: Add it on patch creation, and remove it before applying. Easy peasy.
Beta Was this translation helpful? Give feedback.
All reactions