This is a system extension, which should fix the graphic corruption in Color VETTE! on System 7.1 and later.
Place it in the Extensions folder, and restart your Mac to activate it.
The download link for both the extension, and source code, are available at the end of this page.
I originally got idea for this “hack” this spring, while I was working on the QDExtensions trap handler in MACE. Even though the QD offscreen routines were working nicely in Wolfenstein 3D, I noticed that Color VETTE! was producing same kind of graphic glitching as it did on real System 7.5.5 I was using as reference, and thought it might be interesting to see if I could figure out a fix for it, as certain people on the Macintosh Garden were suffering from the graphics glitches too, and I did not find references to any known solution for the issue (except, of course, running older System version).
WHAT CAUSES THE BUG
After investigating the issue, I found out that the graphic corruption in Color VETTE! is caused by the combination of how Apple changed the calculation of rowBytes value of GWorlds in NewGWorld around System version 7.1, and the way Color VETTE! seems to assume the rowBytes to have certain fixed value in them.
In older System version, the NewGWorld would calculate rowBytes by taking the number of bytes required for the width of GWorld rectangle, rounding it up to nearest multiple of 4 (32 bits), and adding extra 4 bytes of slop into it.
In newer Systems, Apple changed the calculation to use rounding up to nearest multiple of 16 (128 bits), and adding extra 16 bytes slop.
HOW THE FIX (=HACK) WORKS
This extension intercepts specifically the calls made by Color VETTE! to NewGWorld, and tweaks the GWorld’s rowBytes value to match the old formula. As the rowBytes should always shrink in size, there should not be risk for buffer overflows, as the pixmap buffer will just have unused space at the end of it.
This extension works in two stages; First, it will patch LoadSeg, and use that patch to notice when Color VETTE! is launched. At this point, the actual QuickDraw patch is installed (_QDExtensions trap handler, as NewGWorld is dispatched through it, among other QDOffscreen routines). From this point on, any calls to NewGWorld in Color VETTE! will go through a piece of code, which will analyze and hack the GWorld rowBytes value.
The motivation for two-stage patching with LoadSeg is to avoid causing ALL QuickDraw Offscreen routines (_QDExtensions dispatched) to go through the patch, which is both unnecessary and might cause trouble for other applications expecting the new behaviour. Also, using LoadSeg as entry point ensures that only 68K applications are exposed to the analysis (PowerPC applications don’t use LoadSeg at all, as they are loaded through CFM).
After two weekends of prototyping and hours of debugging and fixing silly mistakes, this extension was created.
This extension and the source code are free to use & tinker with, but if you make any modifications and/or fixes, please let me know and I’ll try to incorporate any critical fixes in the original source. If you distribute the original (or modified source), please retain the original copyrights & this readme. For any changes made in the source, please remember to include the list of changes to keep track of any possible modifications from the original. Project and source files are in Codewarrior Pro 2.1 format, and resource file was created using ResEdit 2.1.3. It also contains ShowInitIcon 1.0.1 by Peter N Lewis to display the extension’s icon a startup screen.
WHAT IT DOES NOT DO
This hack only fixes the corruption issue, but Color VETTE! still requires 16 colors, so most of PowerMacs are out of luck running the game (would be curious though, if 68k Macs with PowerPC upgrade work with this – they are quite rare though…)
This is EXPERIMENTAL CODE, which may cause still problems, so USE AT YOUR OWN RISK! This code has been tested on a limited number of systems, and may cause yet uncovered issues on certain software/hardware combinations. If you experience problems, let me know and I’ll see if there’s something that can be done.
At the time of writing this, the code has been tested to work on Basilisk II (where graphics bug was fixed), and verified to not crash on PowerBook G3 and Minivmac (which cannot run Color VETTE! due to color depth limitations).
If you like this little piece of software, please support the MACE project (by either sharing & telling to your friends about it, or helping me contact authors of old Mac software/games for permissions to create MACE bundles of their legacy products). More information about MACE is available at https://mace.software
Here are a couple of screenshots of BASILISK II emulator running MacOS 8.1, with “before” and “after” screenshots of the bug, to show how the effect of this hack:
(And as mentioned, this is a side project, and above screenshots are NOT of MACE, but of BASILISK II running the hack. MACE will not need this hack, as it will include support for selecting desired data alignment through configuration settings, when we get the generic runtime environment in future completed).
Below is download link to a ZIP file containing two SIT files (vettehack-100-release.sit, which contains the extension file, and vettehack-100-source.sit, which contains source code for the hack). Sorry for wrapping the SIT files in another compressed archive, but the hosting platform (wordpress) does not allow uploading directly the SIT files… 😦
And as mentioned, USE AT YOUR OWN RISK! This has only been tested on a couple systems, so it may crash or cause loss of data!