Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: halkun on 2004-12-05 03:06:25

Title: GZIP-type BIN files. (Little bitty Gears update)
Post by: halkun on 2004-12-05 03:06:25
Hi there, I'm updating Gears. (It's not a massive update, just tucking in some things that I think are important.)

I'm wrting on how the PSX Kernel bypasses the open() and read() BIOS calls for loading data, and how it reads the sector address directly.

Two questions.

1) can someone conferm that the 6 byte header in the GZIP-type BIN files (scene.bin) is the actual CD-ROM sector start location where that file is located?

I can't mount a type 2 CD-ROM with my Linux box. (Amusingly enough, I can image the file and can do a direct data copy, including the P and Q dubheader data.) So I can't confim this on my own.

2) I'm wondering what's up with the field script? Anyone still working on the commands?

-halkun
Title: GZIP-type BIN files. (Little bitty Gears update)
Post by: sfx1999 on 2004-12-05 03:49:44
What is a type 2 CD? I thought all CDs were ISO9660.
Title: GZIP-type BIN files. (Little bitty Gears update)
Post by: halkun on 2004-12-05 04:27:01
Well, Yes and no....

CD-ROMs, believe it or not, are actually propiatary. The only companies that are allowed to make CD-ROMs are Matsushita (aka Pioneer), Phillips, NEC, and Sony. Everyone else must sublicence the technology in order to be legal. For example, Microsoft has no ability to make thier own CD-ROM system and must use a 3rd party for thier CD-ROM. (Whis is why you don't see MS's name on the CD-ROM when you crack it open. It's also the reason why X-Boxs can get any smaller, but sony can go ahead and make/break any standard it wants to. (The gamecube Optical system is made my Matsushita)

Anyway, there are secret subchannels on a cd-rom  (Labeled A-Q) that hold metadata (Like track leangth) and other "reserved" uses. Sony uses some of the subchannels for copy protection and region locking.  CD-R's are never allowed to mess with these channels or risk a lawsuit. Mine can read some (But not all) of them.

Amusing note. On a CD-R there is a "wobble track" that sits right next to the data track and used to stableize the laser during a write session. Normal CD-ROMs can't read this track, and CD-Rs only use it as a "bumper" to push the laser back into it's "groove".

a PSX and PS2 can actually read this track. It's encoded with the region that the disk is from over and over throught the disk. ("SCEASCEASCEASCEASCEA"). If the track is blank, then it's a CDR and won't boot. If the track is absent, then it's a "silver" cd, and the audio program is loaded.

And that's how Sony's copy protection works.

Back to my point. Mode 2 CD-ROMs (Also known as CD-XA) is a Sony propitary format for PSX, PS2, VCD, and photo  CDs. The sectors are sized differently. (There is an extra 256 bytes per sector) which causes the CD-Rom to dip in and out of the subheaders.

I have a CDR as my primary cdrom, I need to patch my driver so it can read XA CDs correctly (With the extra 256 bytes). Microsoft is pretty on the ball when it comes to drivers, but any file that uses XA encoding will be "damaged" if copied off the disk with a drag and drop. The FF7 movies are XA encoded. Copy one and then compare the sizes and try and play them with a .str movie player you will see it's broken.
Title: GZIP-type BIN files. (Little bitty Gears update)
Post by: sfx1999 on 2004-12-05 17:52:16
Copy protection is evil. I've heard interesting things about floppy copy protection. The old drives could read extra sectors, but not write them. Then there were simple ones where it checks to see if someone didn't enable write-protect. One of the most evil ones, though, were when a laser burned a hole in the media and the disk checked for a read error. It required either very special equipment, or a way to circumvent this check.