Sector

General Information[edit]

Chrono Cross[edit]

1. In General

The data on an actual, physical CD is divided up into chunks called sectors, each of which is about 2K in size. Only part of the information in a sector consists of data; there's also a header and (usually) some error detection and correction codes intended to compensate for damage to the physical CD medium.

Playstation ~CDs are composed of what the Yellow Book/High Sierra/ISO 9660 CD standard describes as Mode 2 data sectors. Chrono Cross, specifically, uses only Mode 2 Form 1 sectors (other PSX games sometimes also use Mode 2 Form 2, typically for some type of sampled audio such as voice clips).

Why should you care? Because the file table of the Chrono Cross ~CDs uses a sector-based index, so if you're looking through the entire CD for a file, you're looking for a sector boundary, and its exact offset from the beginning of the file in bytes is going to depend on the type of CD image you're working with.

2. ISO CD Images

An ISO image consists //only// of the data part of each sector, so each ISO sector is exactly 2048 bytes in size and contains no stuff-which-is-not-game-data. To find a sector in an ISO, just multiply the sector number by 0x800. This format's simplicity makes it easy to work with for hacking purposes, but many emulators don't recognize it (pSX, AKA psxfin, does, but ePSXe and PCSX do not).

3. BIN and IMG Images

The biggest difference between these two formats is that .bins typically come with a .cue, and .img is typically found flying in formation with a .ccd and a .sub. They use exactly the same sector format, which is a literal dump of the sector bytes as they exist on the physical CD (.img also has a bit of junk data attached to the end).

BIN images contain 2354-byte sectors, each of which can be divided into 3 parts:

1. Header. This is 24 bytes long, and can be subdivided into a 12-byte sync code, 3 bytes indicating the sector's location on the disc, a 1 byte mode marker (0x02), and an 8-byte subheader (usually 00 00 08 00 00 00 08 00, unless the sector is the last in a file, in which case it's 00 00 89 00 00 00 89 00).

2. Data block. This is 2048 bytes of actual game data.

3. Error detection and correction. 282 bytes, which can be subdivided into 4 bytes of overall EDC/ECC, a 172-byte P-block, and a 106-byte Q-block. The details of how these are calculated are amazingly tedious (if you really want to learn about them, search the 'Net for "Ecma-130.pdf").

What does this mean in terms of locating a file inside a BIN image? Multiplying the sector number by 2354 will give you the sector start, but you have to skip an additional 24 bytes to find the start of the file data, and if the file is more than 2048 bytes long, you will have to skip another 306 bytes after every 2K (this is why we have file dumpers). The only good part of all this is that most emulators don't seem to care what's actually in the header and error detection/correction parts of the file—they just have to be there.

From: Chrono Cross File Structure