In Development
Devlog Archives 2008-2010
Devlog Archives 2002-2007


Quest For Glory V and Mac OS 9: Rite of Passage

10th August 2017 | Programming

Each year I play through at least one of the five Quest For Glory computer games, and this year it was time for Quest For Glory V. Whereas the first four games in the series can be played under DOSBox, QFG5 was released in 1998, which put it in the era of Windows 9X and the "Classic" era of Mac OS. Due to the hardware and software changes made in the past 19 years, QFG5 cannot be played natively on modern Macs. I've finally setup Sheepshaver on my main Mac, however I haven't experimented with it much, but it might be worth testing further in the future to determine if it can be a reliable replacement for aging hardware. Instead of using an emulator, I pulled out my Gigabit PowerMac G4, which can run every version of Mac OS from 9.0.4 through 10.4.11. This amazing machine was my main workhorse for seven years before I moved over to a new iMac. Sadly, time is starting to catch up with the G4, and I encountered a bevy of crashes, related both to dying hardware and the unreliability of a 90s-era operating system.

Using a computing system of yesteryear invokes sweet nostalgia, but that quickly wears off when one is rudely reminded of the shortcomings which have long been remedied with modern systems. Mac OS 9 lacked protected memory and preemptive multitasking, so one errant program could take down the entire system. Between the game freezing, the computer locking up, an entire boot volume gone AWOL and other hardware issues, completing QFG5 became much more difficult than normal by trying to fix and maintain the PowerMac.

After the first of several frustrating crashes, the main Macintosh HD volume refused to mount. After performing a scan with Disk Utility, it reported the following error:

invalid key length 4, 1579

The issue refused to be repaired by Disk Utility. Fortunately, I had a copy of DiskWarrior 3 on a Mac OS X partition, and it was able to rebuild the Macintosh HD. For good measure, I blessed the Mac OS 9 system folder so it was bootable. Running the following command from the Mac OS X Terminal will bless the specified Mac OS 9 system folder so it will be bootable:

sudo bless -folder9 "/Volumes/Macintosh HD/System Folder" --bootBlockFile "/usr/share/misc/bootblockdata"

Note: The -folder9 option has been removed from more modern versions of the bless utility, since Mac OS 9 has not been available on Macs since 2003.

This appeared to resolve the issues for a short while, until the computer crashed again, but this time, trying to fix the unmountable partition wasn't working. After digging further into old tricks on restoring Mac OS 9, I finally came across why the system was not booting properly any longer. When DiskWarrior tried rebuilding the Macintosh HD the second time, not all of the files were found. Another approach to bless the drive was to remove the System and Finder files from the System Folder, and then replace them. If everything goes well, the System Folder will get badged with a little Mac or Finder icon. What I encountered was that Finder file was missing! That would explain a lot why the system was not booting if a very critical part to the OS was missing.

The solution to fix this issue was to carefully reinstall Mac OS 9, and hopefully not have to wipe everything first. Since the Mac OS installer detected that a newer version of the OS already existed, it refused to install. By removing the existing System Folder, this helped convince the installer to begin installing. I started by installing Mac OS 9.1, which came along with my copy of Mac OS X 10.0. I then used the 9.2.1 upgrade disc that came with Mac OS X Jaguar for the next step. Trying to find the 9.2.2 installer proved to be a little more difficult and required a little digging across the internet to find a working version (albeit, on a very sluggish FTP server). A copy of the Mac OS 9.2.2 upgrade installer is available here.

Fortunately, even after telling the Mac OS installer to perform a clean install, it left most of the original files intact, so I did not have to reinstall much except for the driver for the ATI Radeon 9000 video card.

Things looked good again! Well, for a few minutes, at least. I started getting odd glitches and errors again, such as when I tried to launch QFG5, the OS claimed it could not find the DrawSprocketLib, but when I tried again, the game launched fine. Then the game started to get extremely sluggish, and eventually froze. When I restarted the computer, the Macintosh HD could not be found as a bootable drive again. (sigh)

The number of errors I was encountering indicated something far past software-related issues, so I started performing more extensive hardware tests using DiskWarrior, Data Rescue II, and the Apple Hardware Test disc that came with the computer. The issues I kept experiencing seemed to indicate some bad sectors on the hard drive, but any of the tools did not report the disk being faulty. The extended Apple hardware test did reveal that one of the sticks of RAM was bad (error: mem_/2/4), which is a likely culprit to random errors, lock ups, and crashes. I removed the bad stick of RAM (and fortunately the RAM sticks didn't need to be paired on this particular Mac), which was somewhat sad, since that was 512MB of RAM on a system which had 1.5GB of RAM, a very impressive amount for a machine of that age. Still, 1GB of RAM is more than enough for Mac OS 9. I'm hoping that the bad RAM is the source of all of the issues and that the hard drive isn't also dying, since trying to find a small hard drive would become increasingly difficult during this time where most storage has moved over to SSD. I might need to look into other options in the future to equip the G4 with an SSD.

I ended up completing QFG5 by playing in Classic mode from one of my Mac OS X partitions, which was passable, but not as smooth as playing natively in Mac OS 9. I finished it this way since the Mac OS 9 drive was available in the Classic system preference pane so I could make use of the System Folder to launch the Classic mode, but I still wasn't able to boot back into Mac OS 9. Disk Utility was once again reporting an invalid key length and the disk could not be repaired. Time for DiskWarrior, again. I tried DiskWarrior once more, but when it tried to rebuild the disk, it kept locking up at a certain spot (sigh again). Classic mode it would be, before digging into this problem once again.

Next up I made use of the command line utility fsck_hfs to attempt to verify and repair the hard drive.

[Ixia:~] % sudo fsck_hfs -r -d /dev/disk0s10
** /dev/rdisk0s10
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Rebuilding Catalog B-tree.
hfs_UNswap_BTNode: invalid node height (1)
hfs_swap_HFSPlusBTInternalNode: catalog key #9 invalid length (8220)
   Invalid key length
(4, 1335)
hfs_swap_HFSPlusBTInternalNode: catalog key #32 invalid length (12338)
   Invalid key length
(4, 1614)
** Rechecking volume.
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
   Missing thread record (id = 805355401)
   Invalid extent entry
(4, 1504)
   Incorrect block count for file Finder Preferences
   (It should be 0 instead of 12288)
   Invalid extent entry
(4, 1504)
   Incorrect block count for file Finder Preferences
   (It should be 1 instead of 8193)
   Invalid extent entry
(4, 1504)
   Incorrect block count for file FonၴAnnexFiぬe
   (It should be 0 instead of 1)
   Invalid extent entry
(4, 1504)
   Incorrect size for file FonၴAnnexFiぬe
   (It should be 0 instead of 536870912)
   Invalid extent entry
(4, 1504)
   Incorrect block count for file Game Sばrockets〠Update ⁐refs
   (It should be 12289 instead of 8193)
   Invalid extent entry
(4, 1504)
   Incorrect block count for file Game Sばrockets〠Update ⁐refs
   (It should be 8193 instead of 12289)
   Invalid extent entry
(4, 1504)
   Invalid extent entry
(4, 1581)
   Invalid extent entry
(4, 1581)
   Incorrect block count for file Standard Additions
   (It should be 12299 instead of 11)
   Incorrect size for file 4/C Ctd. TRUMATCH/RIၔ/Profil⁥80
   (It should be 909312 instead of 52776559040052)
   Incorrect number of thread records
(4, 260)
        CheckCatalogBTree: dirCount = 6565, dirThread = 6583
   Incorrect number of thread records
(4, 260)
        CheckCatalogBTree: fileCount = 34766, fileThread = 34718
** Checking Catalog hierarchy.
   Missing thread record (id = 805355401)
   Invalid directory item count
   (It should be 7 instead of 45)
   Missing thread record (id = 805359315)
   Invalid directory item count
   (It should be 0 instead of 3)
   Invalid volume directory count
   (It should be 6355 instead of 6564)
   Invalid volume file count
   (It should be 32838 instead of 34766)
** Checking Extended Attributes file.
   Incorrect number of Extended Attributes
(8, 1)
        extentType=0x0, startBlock=0x277437, blockCount=0x1, attrName=(null)
   Overlapped extent allocation (file 805355895)
        extentType=0x0, startBlock=0x277439, blockCount=0x6, attrName=(null)
   Overlapped extent allocation (file 805355897)
        extentType=0xff, startBlock=0x277441, blockCount=0x1, attrName=(null)
   Overlapped extent allocation (file 805355898)   
        extentType=0x0, startBlock=0x277442, blockCount=0x1, attrName=(null)
    ... (several thousand more lines like this)
   Overlapped extent allocation (file 805362187)
** Checking volume bitmap.
   Volume Bit Map needs minor repair
** Checking volume information.
   Invalid volume free block count
   (It should be 2729961 instead of 2797618)
        invalid VHB nextCatalogID 
   Volume Header needs minor repair
(2, 0)
   Verify Status: VIStat = 0xa800, ABTStat = 0x0040 EBTStat = 0x0000
                  CBTStat = 0x0800 CatStat = 0x4230
** Repairing volume.
   Cannot create links to all corrupt files
** The volume Macintosh HD could not be repaired.
        volume type is embedded HFS+ 
        primary MDB is at block 2 0x02 
        alternate MDB is at block 41680894 0x27bfffe 
        primary VHB is at block 3226 0xc9a 
        alternate VHB is at block 41680662 0x27bff16 
        sector size = 512 0x200 
        VolumeObject flags = 0x1F 
        total sectors for volume = 41680896 0x27c0000 
        total sectors for embedded volume = 41677440 0x27bf280 
[Ixia:~] % 

I tried to force rebuild the catalog with the command sudo fsck_hfs -y -r -d /dev/disk0s10, but it was the same error as what Disk Utility displayed that the disk could not be repaired. That was enough fun and hair pulling for that night.

The next day...the computer booted up fine into Mac OS 9! Well, go figure. That's computers. Sometimes it does pay to step away from the problem and come back later. Perhaps the hardware is still having issues and giving it a rest fixed the problem for now (shrug). Either way, it probably is time to either resolve any additional hardware issues or finally retire this trusty workhorse of a Mac.

Working and playing with Mac OS 9 for a couple of weeks was an interesting experience. Some tools such as Transmit 1.7, BBEdit Lite 6.1.2 and Classilla proved to be quite useful, but other tools needed to be dug up or experimented with. I also tried out USBOverdrive 1.4, but it did not seem to work with the Razer DeathAdder mouse, and the mouse cursor locked up, so I had to restart the computer and hold down Shift to disable the Extensions and then permanently disable USBOverdrive. In addition to the software previously mentioned, I even downloaded ResEdit for fun.

Special thanks to those sites like Macintosh Repository and Mac OS 9 Lives for providing resources to keep the "classic" Mac OS alive, which proved useful in searching for old software.