Sierra's AGI CPC Disk Protection

General technical information about Sierra & classic games. Please do not ask game support questions here unless it directly relates to an existing thread.
Post Reply
User avatar
Collector
Grand Poobah
Posts: 11993
Joined: Wed Oct 08, 2008 12:57 am
Location: Sierraland
Contact:

Sierra's AGI CPC Disk Protection

Post by Collector »

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:
  • 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.
So, whether the game starts up or not with your backup disk depends on whether CPC.COM recognizes the disk as an original disk or not. CPC.COM looks for the following things on side 0, track 6:
  1. Sectors 2 through 8 must have a nonstandard sector size of 1024 bytes per sector (a normal DOS sector has 512 bytes).
  2. Sector 1 must have a nonstandard sector size of 8192 bytes per sector. This sector contains the decryption key.
  3. 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))
  4. 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.
  5. The checksum of the first 128 bytes from sector 1 must match a certain value (1Ch or something like that).
1), 2) and 5) can be reproduced with an advanced diskcopy program, like CopyIIPC or Teledisk. 3) and 4) can NOT be reproduced, because the PC's floppy controller doesn't allow you to write "bad" sectors (with CRC errors) on purpose, and it doesn't allow you to write overlapping sectors (it wouldn't make any sense, except of course for copy-protection purposes,) so, you cannot make a backup copy from these disks because this copy-protection without special hardware, such as the old Copy2PC option board (if you could even find one nowadays, or let alone a PC which takes ISA cards.)

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!
01000010 01111001 01110100 01100101 00100000 01101101 01100101 00100001

Image
User avatar
Expack3
Sierra Obsessed
Posts: 169
Joined: Wed Apr 25, 2012 7:58 pm
Gender: Not Specified

Re: Sierra's AGI CPC Disk Protection

Post by Expack3 »

Do you know if anyone's tried backing up one of these copy-protected AGI games using something like the Kryoflux Floppy Disk Controller? Such devices are supposed to be purpose-built such that so long as a compatible floppy drive can read the disk, it can copy said disk to a variety of formats, including the raw data.
You like manuals. You like manuals. You love them. You cannot resist manuals.
Your gameplay experience is meaningless without manuals.
User avatar
Collector
Grand Poobah
Posts: 11993
Joined: Wed Oct 08, 2008 12:57 am
Location: Sierraland
Contact:

Re: Sierra's AGI CPC Disk Protection

Post by Collector »

While the KyroFlux can read all bytes it was primarily designed for Amiga disks. It has trouble with PC CPC tracks. My understanding is that it is more of a software problem than hardware and may be fixed in the next version of the main KyroFlux program. I'll be making a new thread about tools for archiving disks before too long.
01000010 01111001 01110100 01100101 00100000 01101101 01100101 00100001

Image
User avatar
Tawmis
Grand Poobah's Servant
Posts: 20261
Joined: Wed Oct 08, 2008 1:19 am
Gender: Not Specified
Contact:

Re: Sierra's AGI CPC Disk Protection

Post by Tawmis »

Pretty funny that they used a crack for their own games... I wonder if they didn't recompile because they don't have the software that they had to make the games?
User avatar
Collector
Grand Poobah
Posts: 11993
Joined: Wed Oct 08, 2008 12:57 am
Location: Sierraland
Contact:

Re: Sierra's AGI CPC Disk Protection

Post by Collector »

Probably just because it was quicker and easier (therefor cheaper labor wise). No need to track down the source code, make sure it was the latest and then seeing if it still compiles. Probably they also had other people doing the compilations rather than the programmers that still knew the AGI tools.
01000010 01111001 01110100 01100101 00100000 01101101 01100101 00100001

Image
User avatar
notbobsmith
Village Elder
Posts: 4922
Joined: Sun Mar 09, 2014 4:02 pm
Location: Massachusetts
Gender: Male

Re: Sierra's AGI CPC Disk Protection

Post by notbobsmith »

This is an interesting read. Do you know when Sierra stopped using on-disk copy protection? My copies of Police Quest I and Manhunter 1 & 2 never asked for an original disk.
Collector wrote:While the KyroFlux can read all bytes it was primarily designed for Amiga disks. It has trouble with PC CPC tracks. My understanding is that it is more of a software problem than hardware and may be fixed in the next version of the main KyroFlux program. I'll be making a new thread about tools for archiving disks before too long.
I thought that the Kryoflux is format independent and captures everything on the floppy. The problem lies with converting the raw streams into an image that PCs can use. At least that was my understanding.
User avatar
Collector
Grand Poobah
Posts: 11993
Joined: Wed Oct 08, 2008 12:57 am
Location: Sierraland
Contact:

Re: Sierra's AGI CPC Disk Protection

Post by Collector »

More or less what I said. The Kryoflux controller gets it all, but getting in some usable form is another matter. DTC should do raw for CPC protected disks, but it has trouble with other image formats. Not absolutely sure if the TeleDisk image can store the CPC track, so the failure may be the target format or Kryoflux's DTC program. Remember that PC diskette support is almost an afterthought.
01000010 01111001 01110100 01100101 00100000 01101101 01100101 00100001

Image
User avatar
audiodane
A Member Of Cap'n Tawmis' Scurvy Crew
Posts: 525
Joined: Sun Aug 29, 2010 12:14 am
Location: ..strange but true..
Gender: Confident

Re: Sierra's AGI CPC Disk Protection

Post by audiodane »

Collector wrote:
Sierra AGI CPC Disk Protection
Condensed from a thread on Sierra Gamers
Credit goes mostly to NewRisingSun
[..SNIP...]

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!
SWEEET, thank you for posting this. (sorry to resurrect such an old thread -- I've been gone a while). I recognize NewRisingSun from a SQ4 patch that used the disk images on the CD version. I can't remember if I was ever successful in applying that patch, however.

Now that has me curious -- is this approach what you use on your installers, too?

..dane
User avatar
Collector
Grand Poobah
Posts: 11993
Joined: Wed Oct 08, 2008 12:57 am
Location: Sierraland
Contact:

Re: Sierra's AGI CPC Disk Protection

Post by Collector »

Thread necro-ing is not exactly frowned upon here. The only time that I might make a deal of it is for an unrelated support request post.

In the case of the CPC protected games I have used it in some of my installers.

If you like the NRS patches see the "Ultimate KQ4 Installer". http://sierrahelp.com/forums/viewtopic. ... =60#p53395
01000010 01111001 01110100 01100101 00100000 01101101 01100101 00100001

Image
User avatar
audiodane
A Member Of Cap'n Tawmis' Scurvy Crew
Posts: 525
Joined: Sun Aug 29, 2010 12:14 am
Location: ..strange but true..
Gender: Confident

Re: Sierra's AGI CPC Disk Protection

Post by audiodane »

wow!! Okay, that changes things. This little game box I want to make ... I'm going to need multiple versions.. the version I grew up with, and other "interesting" versions... :)
Post Reply

Return to “Sierra Game Tech Info”