In the last U2 Upgrade release (v1.2) I included a new patching tool called “u2up”. It’s based on the same patching system that the U3 Upgrade has been using since v3.0. The system works at build-time by storing only the differences between the original and new versions of game files in a PAT file. At install time, the patching tool then applies those differences to the game files. This is in contrast to earlier releases which included a clone of ULTIMAII.EXE called U2EGA.EXE that was a fully runnable binary with all the upgrade’s modifications.
I started moving to this patching tool for several reasons…
- The first and most important reason was that whole game data files and executables were being packaged together. Although it was still a somewhat incomplete set, the upgrade had the potential to become a source of pirating the game.
- I needed a way to validate that the original data files match what’s expected. This is so the patching tool doesn’t inadvertently break someone’s game.
- I needed a way to progressively apply changes to the game files between different upgrade releases. Say, upgrading from v1.2 to v2.0.
- I wanted to give people the choice to unapply the upgrade without reinstalling the game.
- Lastly, I wanted to be able to run a common set of installation actions against DOS and Windows environments. (and Linux, but more on that later)
Ultima II Releases
As a consequence, if I wanted to patch with validation, I needed a frame of reference from which to apply the patch. In v1.2, this was the Ultima Collection release. However, locking the patch to a single starting point had an obvious side-effect. It would fail if applied to other releases of the game, of which there are several:
- Original, Sierra On-Line (3 Floppies, 1983)
- Ultima Trilogy 1-2-3 (2 Floppies, 1989)
- Ultima 1-6 Series (CD, 1991)
- Ultima Collection (CD, 1998)
- Includes Micro Dragon’s Speed Fix (Unofficial, 1997)
- Moonstone Dragon’s Map Patch (Unofficial, 1997)
- GOG.com (Internet, 2007)
There are likely others that I’ve missed as well. (e.g. I’ve no idea what the version from EA’s Origin downloader looks like.)
Upgrade’s Patching Approach
To handle this, in v2.0 I’ve added a bunch of enhancements to the patching tool to process incremental upgrades from several official or unofficial releases. This includes anything from the Ultima 1-6 Series CD release on up. I can’t think of a great way to support floppy releases unfortunately as there are are multiple disks with overlapping filenames. And given the prevalence of the CD and GOG versions it is likely an extreme edge case. But for CD and later releases, the upgrade package now includes the following files:
- u2-uc.pat – upgrades from Ultima 1-6 Series release to Ultima Collection release
- u2-map.pat – upgrades from Ultima Collection release to the Map Patch
- u2-gog.pat – upgrades from the Map Patch to GOG.com’s release
- u2up-20.pat – upgrades from Map Patch to U2 Upgrade v2.0
Now, the frame of reference for this and all future U2 Upgrade patches will be Moonstone Dragon’s Map Patch. I chose that since that was the first non-floppy “release” that became fully functional. This means that uninstalling the upgrade will roll back to this release.
Determining the current patch level isn’t an exact science, but seems to work with the versions I tested against. It’s mostly done by using the validation logic to figure out what patches are not applied. So if u2up incorrectly identifies your release, or you have a version that’s not listed above then please let me know! I’ll be happy to look at adding support.
Patch Actions
Beyond taking simple diffs of files and applying them, the patching tool also supports a bunch of additional actions.
- change – the traditional action for patching a file in-place
- add – adds a new file
- move – moves a file to a new destination and applies a diff
- move-only – moves a file to a new destination, no diff applied
- copy – copies a file to a new destination and applies a diff
- copy-only – copies a file to a new destination, no diff applied
- replace – replaces a file, backing up the original version to a new destination
The replace action is noteworthy because I needed something to migrate saved games to the PLAYER.U2 folder when upgrading to v2.0. After a file has been backed up, it is replaced with the “master” version. It’s admittedly a bit custom rather than general-purpose, but fills an essential use-case for the saved game changes.
GOG Release
If you were paying attention, you may have noticed that I chose not to make the patches relative to the GOG version. The reason for this is because GOG actually uses some of the game files from the U2 Upgrade, particularly the TLK files that contain lower-case text. While I’m not at all opposed to GOG using them, I see the U2 Upgrade’s code base as the source-of-truth for that data. By contrast, the Map Patch is the last version that includes all the original game data files.
Linux
Unfortunately, while testing the patching tool I ran into problems with Linux. It turns out there are some filename case differences between the GOG version and earlier releases. The patcher doesn’t pay attention much to case-sensitivity, so while it works just fine on Windows and DOS, on Linux it fails to locate some files. To get it working properly on Linux would require a bunch more dev work that I didn’t really see as a priority.
I originally added Linux based patching and config tools as a convenience, but I really don’t have much data to indicate that the tools have a high level of usage on that O/S. The Windows builds are essential because it’s a common platform for gaming, I want to support GOG versions, and I cannot expect all users to be tech savvy. Linux users tend to be a bit more comfortable with a command-line, so I don’t think it’s that much of an inconvenience to run the upgrade commands manually in Dosbox on that O/S.
So going forward, I’ve removed Linux support from the patching and config tools. If needs change in the future I can always revisit this again.
What’s Next?
At this point, I’ve wrapped up all the patching work and pushed it to bitbucket. I have one more feature write-up to complete then hope to have v2.0 out shortly thereafter. Thanks for the interest and stay tuned!
I’m having trouble installing the U2/U3/U4 upgrades for floppy releases. I don’t know if it’s the copy-protection on the floppies that is messing them up or whether the upgrade patches are designed only for CD/digital releases.
For example, in the U4 upgrade install script, I noticed there were some modifications made to RUNE_* files (which I assume is the CD release, because of the underscore). In the floppy versions, those files are all hyphenated, i.e. RUNE-0*, RUNE-1*, RUNE-2*, etc, causing the install script to choke.
Would be nice if the floppy versions are also given the same amount of care as the CD/digital versions.
Thanks for your hard work.
Hey there Maurin! Yes, the upgrade patches are all currently written to work with the CD versions and later. As called out in the above post, there are some obstacles with trying to patch from the U2 floppies. However, I don’t think U3 and U4 have problems with overlapping filenames, so I imagine support for floppy versions of those games could be added.
Do you know which version of each game you are using (e.g. standalone, or part of Ultima Trilogy)? Are you trying to patch directly to the floppy disks or copy to a hard drive first? Are you using emulation or 80’s hardware?
If you’re looking to just get U4 to work, the digital version is free on GOG.com.
Hi,
I’m sorry I didn’t notice your reply all this time. I thought I subscribed to this topic with my email for notification but it seems I messed up somehow and later got distracted by tangible reality.
For Ultima II, the version I’m using is the one from Ultima I-III trilogy (OSI-1 copy protection, 5.25″ 360K, two disks, 1989). Because this version didn’t have an installer (no setup.exe or install.exe), I simply copied the contents of both disks to a folder on the hard drive (i.e. C:\ULTIMA2). I understand both disks have files that have identical names but the content of the files themselves are different. So I used an earlier version of your patch (u2upgrade-1.1.zip) which contained complete binary executables and which I assume was meant for the Ultima I-VI Series CD collection, extracted all its contents to my custom game directory. I had to download and install the DPMI service utility – CWSDPMI (csdpmi7b.zip) – as well because DOSBox was throwing up some error. I then applied the Galaxy Map patch (RENGAL.BAT), applied Pangea Dungeon fix (DNGPATCH.EXE), configured and saved game settings (U2CFG.EXE). Then started the game using the launcher (ULTIMA2.COM). Everything seems to work on both DOSBox and VirtualPC (with MS-DOS 6.22 installed), although I don’t know whether some problem would manifest while I’m well into the game.
I don’t know what would happen if the patch is applied to other, older versions of floppy releases with different copy protections (Copylock, Softguard, etc).
For Ultima III, the version I’m using is again the one from Ultima I-III trilogy (OSI-1 copy protection, 5.25″ 360K, one disk, 1989). Basically had to use the same method as in Ultima II by using an older version of your patch (u3upgrade25.zip), install CWSDPMI, configure music (SETM.EXE), configure and save game settings (U3CFG.EXE), start the game using the launcher (ULTIMA3.COM).
For Ultima IV, I’m using the standalone version (OSI-1 copy protection, 5.25″ 360K, two disks). This time, instead of manually copying the contents from the floppies to a directory on the hard drive, I installed in a more “formal” way – by using CopyIIPC (NOGUARD.EXE) in a DOS environment (VirtualPC). It’s a tool that copies over the game contents from the floppies to the hard drive while disabling the copy protection safely. The game is now installed but the upgrade patch (u4upgrade-1.3.zip) cannot work because, as mentioned earlier, it’s looking for underscored filenames, needs a dos version of avpatch.exe, and probably other things relevant to the CD version. I could get the patch working if I first manually rename the hyphenated filenames to underscored ones, and run avpatch.exe in a DOS shell outside in Windows. The game starts up fine and the changes are noticeable, but again I don’t know if something went wrong under the hood.
Thanks for your trouble, and apologies again for the late response.
No problem! And this is awesome detail. I’ll take some time to review this, and I can very likely make this easier for you.
Muarin,
I’ve released another version of the U2 Upgrade today that will upgrade you from the 1-2-3 Trilogy version. You’ll just need to copy the Program Master to the hard drive and apply the patch to that. No need to worry about copy protection – the patcher will strip it out.
Let me know how it goes and if you run into any problems.
Hi,
I’m getting an “Upgrade aborted! — Game version could not be identified” message when I run the patch (u2up.exe and u2upw.exe).
You mentioned copying the contents of only the Program Master disk to the hard drive. Are you referring to an earlier, three-disk floppy release?
Mine is called the Program-Galactic (disk 1) and Player Master (disk 2).
http://www.mobygames.com/game/ultima-trilogy-i-ii-iii/cover-art/gameCoverId,225305/
http://www.mobygames.com/game/ultima-trilogy-i-ii-iii/cover-art/gameCoverId,225308/
The game executable (ULTIMAII.EXE) is dated 1989-02-08 (size: 37344 bytes, CRC32 checksum: 48874810)
For reference, here’s a file listing of the contents of both floppies: https://pastebin.com/jp8w3vd3
Ok interesting. Same size, same date, different checksum (6599076c). I don’t have a physical copy of the 1-2-3 trilogy, so I’m using downloaded disk images. Would you mind emailing me the ULTIMAII.EXE you’re using? I’d like to understand the differences and at least produce a patch for you.
Just a quick follow-up to my earlier comment. I thought perhaps the patch was aimed at some other U2 trilogy floppy version, so I searched a few abandonware sites for an Ultima II floppy release. Then found what appeared to be the game in a two-disk floppy image (.IMA) format. All files were identical to mine, except for ULTIMAII.EXE (which had a CRC32 checksum of 6599076C, though the timestamp was identical mysteriously).
Tried applying the patch on *that* version – this time the patch identified the game correctly and applied all the changes.
Here’s the non-working ULTIMAII.EXE if curious (all other files are identical) – https://ufile.io/6949m
Looks like our replies crossed around the same time. Thanks! I’ll check this out.
Ok, so my diff tools report a delta of 479 bytes at offset 0x8cd2, and 1 byte at offset 0x8eed. This part of the code appears to deal with the copy protection. My theories at the moment are:
1) My assumption on how OSI-1 copy protection worked was incorrect,
2) Origin produced multiple disk images with the same date/time stamp, or
3) One of the disk images has corrupted data (some schemes of copy protection allegedly leveraged bad sectors)
I’m looking around for more details about how OSI-1 works so I can verify. But one of the things I noticed looking at diffs is that the ULTIMAII.EXE I was using is closer to the CD release. There are only 20 bytes difference in the copy protection code between Trilogy 1-2-3 and the Ultima 1-6 Series CD release. These 20 bytes basically just skip over the copy protection and start the game. However for the binary you sent me, there is a 485 byte difference, which includes a bunch of seemingly random data after that code that I thought was used for copy protection validation. I’m not sure why it would be so different.
Anyway, I’m still looking into this, just thought I’d give you an update.
Thank you, really. Not just for providing such a wonderful patch, but I truly admire your enthusiasm in pursuing the matter to get to the root of the problem.
In one of your other posts where you linked to the Ultima Collectors Guide site that had just about every Ultima version is listed, I noticed there were two different floppy releases of Ultima Trilogy 1-2-3 — Standard Edition IBM PC and Second Edition IBM PC. Both two-disk floppies of Ultima II. Is it possible that one of those versions happen to be your copy of Ultima and the other version mine? Maybe that might explain the subtle difference in the game executables. I have to admit my copy of Ultima II is also a floppy image that I got several years ago from someone who used to make raw Kryoflux-like dumps of old floppies, so I would suspect their image of Ultima II would be an authentic version that keeps all copy-protected info intact.
Other than that I’m not sure what to say or how else I can assist you in resolving this mystery. I guess I’ll just have to wait.
Thanks again for the patch. The options to install some of the features from other ports are really nice. 🙂