Romhacking => Newcomer's Board => Topic started by: FaustWolf on July 03, 2011, 08:17:45 pm

Title: Advice for patching CD images?
Post by: FaustWolf on July 03, 2011, 08:17:45 pm
To make a long story short, I've been rebuilding the translated copy of Dragon Force II manually, ordering the files alphabetically like so:

Sega's original press, however, has a more complex custom ordering:

Ergo, LBAs are completely misaligned between the two, and it will probably come as no surprise when I report that an XDelta patch made with these as the modified and original images is as large as the disc image itself.  :D

If worse comes to worst, I suppose I can bite the bullet and have the end user rebuild their images manually before patching, in which case the end user's file ordering will match mine before the patch is applied. However, that process is complex enough that it's going to turn lots of folks off. My other option as I see it right now is to meticulously re-order my file build one by one so it matches the original. So I wanted to ask if there's some magic bullet I'm missing here -- have translation authors found a quick way of rebuilding their images so it matches the file ordering of the original CD?

Also, I should note that a few of the translated files are larger than the Japanese source files. This will become especially frequent when we move on to inserting storyline translation. When the file ordering matches, an XDelta patch ends up being 20MB with compression turned way up (I'm using SadNESCity's Delta patcher). This is still much, much larger than justified by the changes alone, and I suspect the patcher's trying to correct for the misalignment caused by differently sized files. So I'll toss that fact in and see what comments y'all would make on that.
Title: Re: Advice for patching CD images?
Post by: Klarth on July 03, 2011, 09:15:30 pm
It's ok to have different file sizes and whatnot.  It's not ok (for patch size) to shift files way outside of the original order.  xdelta uses a 64MB default window (32mb shift maximum), so that's why your custom order performs poorly.  The command line utility supports increasing the window size (not sure about the frontends)...but it may require the end user to have similarly large memory requirements to patch.  I'm not sure about the patch application algorithm.  I'd definitely increase the window size for large files (NDS, cd images, etc) though.  Patch size could also be due to recompressed files as data will not match up.
Title: Re: Advice for patching CD images?
Post by: FaustWolf on July 03, 2011, 11:14:22 pm
Thanks Klarth, I wasn't aware of the 64MB window. Presuming I'm smart enough to get the command line utility working (checking into the documentation on right now), I have two concerns:

1. It looks like my life might become easier if I kick up that default window to, say, half a gigabyte (Dragon Force II is 570MB all told). Anyone know if a value that high has ever been used, or does this sound absurd? There's a single file in the game that's 300MB in and of itself, so it really throws the whole image out of whack if it's misaligned between comparison copies.

2. If I use the command line utility to create an XDelta patch, does the end user have to use the command line utility to patch too, or will front-ends still be compatible with a patch made with a wider default window?

I'll check around for other XDelta front-ends too, but I have a feeling SadNESCity's and KaioShin's are the best available currently.

Barring these considerations, I suppose what I'm looking for is some way of building a CD where I can copy the file order from Sega's original print and use that as a template for ordering files in the translated build. I've been using UltraISO to build my disc images from the file set, and try as I might I'm not seeing that sort of option.
Title: Re: Advice for patching CD images?
Post by: Auryn on July 04, 2011, 12:17:16 am
For many psx games, the order of the files is not important.
Anyway, why not use CDmage to reinsert the files in the right order??
If there is a problem with the big file, put it at the end by hacking the TOC.
Title: Re: Advice for patching CD images?
Post by: FaustWolf on July 04, 2011, 12:23:40 am
A-ha, I've got it now! Turns out I was just being silly; UltraISO allows injection of new files directly into the original image, and it...somehow magically adjusts for different file sizes and stuff while keeping the order roughly the same. The patch works, and everything's A-OK.  :thumbsup:

Thanks for the feedback guys. Case closed. Looks like the patch file size decreased by half when I do it this way; about 13MB now. Very happy about that!
Title: Re: Advice for patching CD images?
Post by: PhOeNiX on July 04, 2011, 06:06:14 am
If you guys think a window size option might be useful, It'll be simple adding it to Delta Patcher. Just let me know ;).

P.S. Regarding the new files size growing. Maybe, UltraISO or whatever program you are using, amutomatically moves these filese, changing their LBA. I suggest you changing, wherever possible, the file size only. Often, the last sector of your file stored in the ISO has many free bytes. Try using TOC Changer to calculate the amount of space available, if it suits your needs, just change the file size and reinsert your modified file (the less you move your files, the more your patch becomes small ;)).
Title: Re: Advice for patching CD images?
Post by: FaustWolf on July 04, 2011, 06:39:46 am
Thanks PhOeNiX! The default window size looks sufficient for my needs right now, actually. Looks like we'll be going with your own DeltaPatcher as the front end for distributing the Dragon Force II translation. Now that I'm aligning the files correctly, why, I think I'll even be able to fit two patch versions within RHDN's upload limit. The compression options sure came in handy! :beer:
Title: Re: Advice for patching CD images?
Post by: PhOeNiX on July 04, 2011, 06:51:36 am
Just a hint. Try use 0 compression and compress your patch with 7z at maximum level. You archve should be' much much smaller ;).