CPC Disk Protection

From Sierra WikiNew
Revision as of 10:23, 24 February 2022 by sierraw>Andrew Branscom (→‎Also See)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

CPC Disk Protection

 

Condensed from a thread on Sierra Gamers [1]
(credit to NewRisingSun)



Introduction

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.

How CPC Protection Works

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. When not encrypted 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.)

CPC Protection Workarounds

  1. 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.
     
  2. 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.

    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!
     
  3. 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 run on modern x64 Windows, it does not require access to the original floppy, eliminating the need for low level access to the disk drive.
     
  4. Create an image of the disk with an adapter such as the KryoFlux that can capture to hidden "bad" track and then play it in an emulator that is compatible with the image with the CPC Protection. To Do!!!!!!!!!!

References


Also See