I'm curious as to how optical drives detect the type of media inserted. e.g. if I inserted a blank unformatted disc, how does my drive know if it's a 650MB cd, 700MB cd, single layer DVD+R , single layer DVD-R, etc? Is there some unwritable part of the disc where this information is stored?
I'm guessing the physical medium if different, but could I write to the disk somehow and have my drive believe a DVD+R disc is really a DVD-R disc? (although it would cause the disc to be unreadable)
The last question is how do games detect if the original disc is inserted? I always assumed games accessed the disc as a stream of bytes and that is all that is available to them. If so, how would something like DPM work?
Detecting optical media type
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Detecting optical media type
My OS is Perception.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Re: Detecting optical media type
For CD's, ATIP.
Not sure about other types of optical media, but I assume it's a similar concept..
Additional Linkage:
http://www.cdr-forum.de/download/cdr.pdf
EDIT: According to the cdrecord(1) man page from the cdrtools project: "DVD media does not have ATIP information but there is equivalent prerecorded information that is read out and printed."
So it prints out both ATIP and.. the unnamed DVD counterpart.
Not sure about other types of optical media, but I assume it's a similar concept..
Additional Linkage:
http://www.cdr-forum.de/download/cdr.pdf
EDIT: According to the cdrecord(1) man page from the cdrtools project: "DVD media does not have ATIP information but there is equivalent prerecorded information that is read out and printed."
So it prints out both ATIP and.. the unnamed DVD counterpart.
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Detecting optical media type
On the question of determining if the original disc has been inserted for a game, I'm going to take Age of Empires II as an example. The game's .exe (EMPIRES2.EXE) is a stub to check to see if there is a CD in the drive with the file EMPIRES2.ICD (or something like that) on it. If it is, the copy of EMPIRES2.ICD on the hard drive is ran as an executable, running the game.
Not sure about new games though, but I assume it's much more complex (I can't just go and rename a few files to play SimCity 4 without a CD ).
Not sure about new games though, but I assume it's much more complex (I can't just go and rename a few files to play SimCity 4 without a CD ).
Re: Detecting optical media type
The tracks on optical discs are not multiples of 512bytes (or 2K or whatever nice power of 2 you want to contemplate).
The extra bytes on each track are called "subcodes". They can be accessed by special ATAPI read commands. A typical burning program has a default algorithm for calculating and burning the subcodes, and the burner hardware itself may also enforce the default algorithm.
Games use non-standard subcodes. They use the special read commands to make sure that the subcodes on the disk are "valid". So, to copy a game disk, you need a cloning program that reads and writes the non-standard subcodes, and you need a burner that does not try to "fix" your subcodes into the standard, generic subcode format.
The extra bytes on each track are called "subcodes". They can be accessed by special ATAPI read commands. A typical burning program has a default algorithm for calculating and burning the subcodes, and the burner hardware itself may also enforce the default algorithm.
Games use non-standard subcodes. They use the special read commands to make sure that the subcodes on the disk are "valid". So, to copy a game disk, you need a cloning program that reads and writes the non-standard subcodes, and you need a burner that does not try to "fix" your subcodes into the standard, generic subcode format.