News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Advice for patching CD images?  (Read 4284 times)

FaustWolf

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Advice for patching CD images?
« 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:
http://i.imgur.com/XBEix.jpg

Sega's original press, however, has a more complex custom ordering:
http://i.imgur.com/DiTja.jpg


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.
« Last Edit: July 03, 2011, 08:26:53 pm by FaustWolf »
Verve Fanworks: We shall shew thee here the force of our arms!

Klarth

  • Sr. Member
  • ****
  • Posts: 495
    • View Profile
Re: Advice for patching CD images?
« Reply #1 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.

FaustWolf

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Advice for patching CD images?
« Reply #2 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 xdelta.org 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.
Verve Fanworks: We shall shew thee here the force of our arms!

Auryn

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Advice for patching CD images?
« Reply #3 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.

FaustWolf

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Advice for patching CD images?
« Reply #4 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!
« Last Edit: July 04, 2011, 01:17:42 am by FaustWolf »
Verve Fanworks: We shall shew thee here the force of our arms!

PhOeNiX

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Advice for patching CD images?
« Reply #5 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 ;)).
« Last Edit: July 04, 2011, 06:15:57 am by PhOeNiX »

FaustWolf

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Advice for patching CD images?
« Reply #6 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:
« Last Edit: July 04, 2011, 07:09:49 am by FaustWolf »
Verve Fanworks: We shall shew thee here the force of our arms!

PhOeNiX

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Advice for patching CD images?
« Reply #7 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 ;).