+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  New patching format, UPS, debuts today
Pages: 1 [2] 3 4 ... 9
Author Topic: New patching format, UPS, debuts today  (Read 4 times)
Ryusui
Guest
« Reply #15 on: March 31, 2008, 01:55:59 pm »

I meant that I had intended to back the NINJA format by making SF1 a NINJA-only patch, but that effort backfired. Still, the spec is public domain, so if UPS takes off on Windows and Linux, it won't be long before we see patchers on other platforms.
HyperHacker
Guest
« Reply #16 on: March 31, 2008, 02:09:43 pm »

The only two real useful changes I can think of are 1) multi-file patching and 2) support for checking the file's CRC32 before patching (to warn you if you're patching the wrong file). Fortunately, with clever filenames neither of these need require any changes to the patch format itself. For #1 you can just point the patcher to a directory, and for every file it will look for a corresponding patch (foo.bar -> foo.bar.ups). For #2, include the file CRC in the patch filename in a way that the patcher can automatically find it (foo.bar -> foo.bar[12345678].ups). Simple. Tongue

Even better if the patcher supports filenames on the command line, then we could just write a batch file/shell script to apply all the patches, except on Windows we'd have to either include the patcher or have the user copy it to \\WINDOWS or something to be able to call it. :-/

I wasn't clear exactly what "X File" and "Y File" are in the spec. Do you already have #2 in there? If so it should be possible to create a patch that doesn't specify the destination file CRC. For example, a patch that may be applied to a hack in progress or to more than one version of a game. (Hence why I suggested putting it in the filename - just leave it out and no CRC checking.)

Anyway sounds like a great format. XOR patching is a brilliant idea and I think you're right about RLE being unnecessary if all the patchers support zipped patches. I'll be using this in the future. Smiley Maybe a patcher for the DS?
BRPXQZME
Guest
« Reply #17 on: March 31, 2008, 02:45:10 pm »

Quote from: byuu on March 31, 2008, 01:26:37 pm
Mine at least doesn't require anything else to run. No .NET, no MFC DLLs ... none of that.
Yeah, and there isn’t any clause in the license saying YOU NOT COCOAING.

(Though I suppose this would be a pretty easy port to Cocoa for anyone who knows it).
creaothceann
Guest
« Reply #18 on: March 31, 2008, 02:50:49 pm »

Looks good! Wink I can only add that the patcher won't like pointer values > 2^64, but that shouldn't be a problem for the near future.

HyperHacker:
byuu's patcher already checks the CRC32s and reports a matching error message. Multi-file patching will be done by the container format; UPS is only for single files. The patcher does support filenames on the command line.
« Last Edit: March 31, 2008, 02:56:18 pm by creaothceann »
byuu
Guest
« Reply #19 on: March 31, 2008, 03:00:40 pm »

One more thing, UPS can convert between a file size of zero bytes and more than zero bytes (it can also patch two identical files, though why you'd want to ...), but creating and deleting files is a job for NINJA3.

Quote
The only two real useful changes I can think of are 1) multi-file patching

This is what NINJA3 is for.

Quote
and 2) support for checking the file's CRC32 before patching (to warn you if you're patching the wrong file)

It already does this. It has to read the input file first to calculate the CRC32, so it takes a few moments.

Quote
I wasn't clear exactly what "X File" and "Y File" are in the spec.

Because this format is bi-directional, "original" and "modified" don't make as much sense. But it's roughly the same thing. The UPS patch is a delta between two files, and is used to convert either file to the other one. So, pretend x = "original" and y = "modified file" or vice versa. Same thing.

Quote
If so it should be possible to create a patch that doesn't specify the destination file CRC.

As this is bi-directional, that's a really bad idea. The XOR data will likely not align between multiple different files. You would want to use a uni-directional patch if you want it to apply to multiple different files.
DarknessSavior
Guest
« Reply #20 on: March 31, 2008, 03:04:38 pm »

I know this is quite off topic, but what was worth changing for the DL update? You guys find more script inconsistencies you wanted to edit, or more bugs or something?

I'll read the readme later, but I wanted to see if there was anything significant. Also, it's not April Fools Day. So you're a liar.  Roll Eyes

~DS
byuu
Guest
« Reply #21 on: March 31, 2008, 03:14:32 pm »

The changelog is on the page:
http://projects.elsallia.com/

The last two are the biggest fixes, and the cheat codes are absolutely awesome. You can make Erwin attack Hein :D

Quote
Also, it's not April Fools Day. So you're a liar.

I didn't release the patch, and not everyone lives in the US.

http://www.google.com/search?hl=en&q=time+in+beijing&btnG=Google+Search

Quote
4:27am Tuesday (CST) - Time in Beijing, China
DarknessSavior
Guest
« Reply #22 on: March 31, 2008, 03:18:55 pm »

Blah blah. D's in China. =P

Are we (the beta testers) supposed to still be testing DL? If so, I apologize, I didn't know. >.>

Interesting, a debug system. Me likes.

~DS
GenoBlast
Guest
« Reply #23 on: March 31, 2008, 03:56:11 pm »

I think I found a bug. When trying to apply a patch I created, the patcher failed and deleted the input file.

Here's specific information:
1.) I created a patch from a hack I made a while ago
2.) I tried to apply the patch to a copy of the original file
3.) For the output I selected the same file
4.) I clicked 'Apply'

After #4, the patcher failed with the error:
Quote from: 'UPS v0.03 ~byuu'
Patch apply failed!
Input file size and/or CRC32 invalid.
Also, the rom was gone. Deleted, even!  Shocked

On a side note, I think the first line of the error message should have been "Patch application failed!"
byuu
Guest
« Reply #24 on: March 31, 2008, 04:30:28 pm »

Yeah, it does do that. I should add a safeguard not to select the same input+output file name.

I always create the dest file and start patching it. I have to, before I can verify CRCs. The delete thing happens outside of the UPS lib, it just knows patch apply fails and deletes the dest file name. Don't want to leave the file there for people to try and use.

I can refine this for future releases.
FuSoYa
Guest
« Reply #25 on: March 31, 2008, 07:46:38 pm »

Quote from: byuu on March 31, 2008, 11:40:10 am
Eg Lunar IPS patches add a clip command that SNESTool won't parse.

Er, no... SNESTool does parse that.  In fact, SNESTool is where I copied that clip command from.  Wink  You probably used an older version of it or something.
daemoncollector
Guest
« Reply #26 on: March 31, 2008, 07:57:59 pm »

Well, I went ahead and put together a Cocoa version of the UPS patcher because I'm a mac user...and this is what the Mother3 project will be using and I really don't like using weird windowing frameworks on OSX (Qt, Gtk and whatnot....). Sadly I have no way to test this patcher, even on the windows version when I tried to create some dummy files is choked on itself. If someone has dummy files that work in the windows one I will get my OSX version posted up, only 44k zipped, should run on OSX 10.3+.

 - Josh Weinberg

Edit 1:--

Seems that the patching fails in really small files, I tested it on a large file and it worked like a charm...putting it up on my site now...

Edit 2:

Bin:
http://opennestopia.staulkor.com/UPS.zip

Src (Including XCode project):
http://opennestopia.staulkor.com/UPS_Src.zip

n'joy
« Last Edit: March 31, 2008, 09:54:32 pm by daemoncollector »
Vystrix Nexoth
Guest
« Reply #27 on: March 31, 2008, 09:29:25 pm »

Take IPS, make it use XOR instead of plain old overwriting, and add checksums for everything but the patcher itself, and you basically have this format.

What's the point in keeping the checksum of the patch file itself? If it's incorrect, it's like saying "this statement is false" = "this patch doesn't meet its own checksum". How nice. And it discourages hand-hacking of the patch (with a hex editor) since you basically have to run it through a program afterwards in order to make it correct because you, the one hand-hacking it, cannot be trusted. :thumbsup:

For the target file itself, UPS records one checksum. Suppose there are multiple supported versions of the target data (for example, a patch that can work with both FF6 v1.0 and v1.1)? What then?

Even if you change parts that differ between the two versions, with IPS, you could make a patch that supports both: add data that can change both to a known state. You couldn't do that at all with this format, since XOR-style patching is dependent on the exact values of the bytes it modifies.

So, to be honest, I don't see how this is significantly better than IPS, aside from declaring file size changes up-front (which makes it much better-behaved for in-memory patching, such as by an emulator on-the-fly).

Though, being informed of its existence has prodded me into working on XRIF again, so I suppose some good has come from it. Cheesy
byuu
Guest
« Reply #28 on: March 31, 2008, 10:38:49 pm »

Quote
Er, no... SNESTool does parse that.  In fact, SNESTool is where I copied that clip command from.

Oh, oops x.x
For some reason, I thought you came up with that command. Thanks for the correction.

Quote
Well, I went ahead and put together a Cocoa version of the UPS patcher because I'm a mac user...

You rock!! Thank you very much :D

Quote
Take IPS, make it use XOR instead of plain old overwriting, and add checksums for everything but the patcher itself, and you basically have this format.

That was the idea. Fix what's wrong with IPS, and keep the new format as simple as possible. And as you can see, people can already write their own patchers in ~30 minutes time.

Quote
What's the point in keeping the checksum of the patch file itself?

To detect corruption errors in the patch itself. Sure it's rare, but we're only talking about four bytes. Call it peace of mind.

Quote
And it discourages hand-hacking of the patch (with a hex editor) since you basically have to run it through a program afterwards in order to make it correct because you, the one hand-hacking it, cannot be trusted.

Does anyone really sit there and hack IPS files directly? Modify the resultant ROM for that. I'm aiming for features more likely to be used. People hand-editing patches is less likely than people applying patches and wanting to make sure the patching process succeeded. Compare to something outside your niche: how many people burn ISOs and want to validate the burn, and now how many people manually hex edit the ISOs by hand first?

Seriously, again ... how many people modify IPS patches by hand? How many people will be seriously inconvenienced by not being able to do this? There are more appropriate tools for this, such as xkas (yes, it can even be used on systems other than SNES and GBA, albeit without opcode support.)

And if you can compute XOR diffs between two files in your head while modifying data -- wow. My hat is off.

Quote
For the target file itself, UPS records one checksum. Suppose there are multiple supported versions of the target data (for example, a patch that can work with both FF6 v1.0 and v1.1)? What then?

XOR data doesn't play well with multiple versions. Again, I had to weigh what was more practical. What happens more often? Someone makes a patch that can safely convert multiple versions of a game, or someone patches a game that has a header when the patch was made against an unheadered ROM, or a hacked / modified ROM, or a different version of the same game (v1.0 vs v1.1)?

The DQ6 IPS patch by NoProgress is the only case I think off off the top of my head that applies to multiple input files. Does anyone else want to compare a random sampling of ~50 IPS patches and determine how many contain this ability?

Quote
Even if you change parts that differ between the two versions, with IPS, you could make a patch that supports both: add data that can change both to a known state.

Right, that's the trade off. And with IPS, you can never revert a file to its original state, using only the modified file and the patch. Both are rarely used features, but I believe the latter is more valuable. The latter has novel uses outside of ROM translations (eg file backups), too. We can disagree if you like.

Quote
So, to be honest, I don't see how this is significantly better than IPS

Of course not, you've pointed out every possible disadvantage while ignoring every advantage but one. Not surprising since you're working on your own competing format.

Recap:

UPS is better than IPS because:
- it guarantees that you have converted file X to file Y; it can use this information to quickly determine whether a ROM header needs to be stripped or not
- it verifies the patch file integrity itself
- it's bi-directional, so you can un-apply hard patching if needed; easier to store / re-download a ~100kb UPS patch than a ~32MB Japanese ROM backup
- it supports infinitely sized files, no 16MB limit
- it's easier to implement
- no ambiguity in the file format, and no "extended features" -- all patchers make 1:1 identical UPS patches
- because of its simplicity and PD licensing, we will be adding it to multiple emulators for soft-patching -- ZSNES, Snes9X and bsnes for sure; VBA-M most likely; as it's supported by multiple emu devs, we'll be developing libraries to get this into even more emus

UPS is worse than IPS because:
- you can't apply the same patch to multiple input files to get the same output file
- you can't edit it directly in a hex editor ... yeah

UPS was a peer reviewed format. You're the first person I've seen who prefers uni-directional patching to bi-directional XOR patching. I wish you would have chimed in during the past two years myself, Nach, Derrick and others were discussing the format spec on this very forum.

I understand you want to promote your own format, but please don't attempt to do so by denigrating ours. I'll return the same respect to your XRIF format.
Spikeman
Guest
« Reply #29 on: March 31, 2008, 11:02:23 pm »

In my ROM hacking projects I like to make separate patches for each change I make and then patch them onto the ROM one at a time. Would this still be possible with UPS?
Pages: 1 [2] 3 4 ... 9  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC