Sierra's AGI CPC Disk Protection
Posted: Thu Feb 26, 2015 12:46 am
Sierra AGI CPC Disk Protection
Condensed from a thread on Sierra Gamers
Credit goes mostly to NewRisingSun
Many of the early Sierra AGI games floppy disks cannot be backed up or copied. If you play the game copied to hard drive, it will ask you to insert the original disk. If you insert a disk with all the same files on it, including the hidden CPC.com file, and with the same label ("SQ DISK 1",) it will not accept it, so there is no way to make a backup disk that will work. This copy protection consisted of three files:Condensed from a thread on Sierra Gamers
Credit goes mostly to NewRisingSun
- AGI -- The actual program file. This file is encrypted to prevent you from renaming it to AGI.EXE or something like that and from evading the copy-protection. After it is decrypted, it is a normal .exe format file.
SIERRA.COM -- The "Loader". It loads AGI into memory, asks for the original disk, reads and executes CPC.COM to obtain the decryption key, then decrypts and runs AGI.
CPC.COM -- A hidden file on the original disk. Called by SIERRA.COM, checks for the presence of the copy-protected track (side 0, track 6), reads the decryption key and passes it on to SIERRA.COM.
- Sectors 2 through 8 must have a nonstandard sector size of 1024 bytes per sector (a normal DOS sector has 512 bytes).
- Sector 1 must have a nonstandard sector size of 8192 bytes per sector. This sector contains the decryption key.
- Sector 1 *must* have a CRC error. (BTW: This is what prevents the copy-protection from working under Windows 98, because Win98's Int13 handler returns incorrect error codes (0Ah instead of 10h for CRC error))
- All sectors on track 6 must overlap, i.e. the data for sector 2 also contains the beginning of sector 3, and so on. The data from sector 1 contains *all* the following sectors.
- The checksum of the first 128 bytes from sector 1 must match a certain value (1Ch or something like that).
To replace the interpreter with that from another game, you would need to replace the file "AGI" and all *.OVL files. However, AGI also has the gameId (i.e. "SQ2") hard-coded into the executable to prevent you from doing this (since you're not supposed to bypass the copy-protection).
There are unprotected versions of the AGI interpreter, some from Sierra's own AGI demos or from the compilation CDs. And then there are newer freeware/open source replacement interpreters such as NAGI and the defunct Sarien (which is what the ScummVM project used to add AGI support.
The most recommended solution used to be Anders M Olsson's old SUP (Sierra Unprotection Program v2.01. SUP patched SIERRA.COM so that the keydisk prompt no longer appears, CPC.COM is no longer loaded and the buffer which would be filled by CPC.COM with the decryption key at run-time will be already filled at program start. Or in short: It just "cracks" SIERRA.COM. Another older solution was Brian Provinciano's AGI Decryptor. It decrypted the "AGI" file into "AGI.EXE" The limitation of both of these old tools was that they are 16-bit DOS utilities which require low level access that modern Operating Systems do not allow.
The best modern solution is to use Cold Turkey's (siastbill1) AGI DiskFree Decryptor. AGI DiskFree Decryptor is a modern (Win32) implementation of SUP and the AGI Decryptor. Not only does it rum on modern x64 Windows, it does not require access to the original floppy, eliminating the need for low level access to the disk drive.
This is exactly what SIERRA did for the collection versions --- rather than properly recompiling the games to remove the copy-protection, they just used a "crack" on their own games!