StrikerX3 / StrikeBox

StrikeBox - Original Xbox emulator
BSD 2-Clause "Simplified" License
52 stars 9 forks source link

Emulate IDE devices #10

Closed StrikerX3 closed 5 years ago

StrikerX3 commented 6 years ago

This includes the hard drive and the DVD-ROM. Ideally, we want to be able to emulate the DVD-ROM in such a way that allows us to read from XISO files or extracted folders. If possible, do the same for the hard drive.

Links to IDE emulation code: XQEMU, QEMU, VirtualBox. Matt Borgerson made an userspace FATX driver here which can be useful for understanding the hard drive file system.

The game discs use the XDVDFS file system and there are tools that can read them. However, they only deal with the data partition; the disc actually contains hidden partitions that hold authentication information and describe the media's contents. We need to keep this in mind if we're to emulate a DVD drive at a low level. (Or use a modified kernel that skips media checks.)

The Xbox uses an ATA/ATAPI-4 controller. The official specifications can be found here. There's also a PCI Bus Master IDE controller that uses DMA for high speed transfers. Some references for this device: here and here.

Additionally, for accessing the DVD drive, the SCSI command protocol is used under the PACKET ATA command. The specification for SCSI commands can be found here and an overview of operation under the ATAPI protocol is described here.

StrikerX3 commented 5 years ago

ATA emulation is at a point where the kernel can successfully identify and attempt to unlock the hard drive. The actual unlock operation is not yet implemented but should be trivial. Additionally, specifying that the hard drive has support for security features and has security enabled but not locked seems to circumvent the need to execute the unlock operation.

The next step is to implement the Bus Master IDE controller and any ATA commands that happen to be used during the process.

StrikerX3 commented 5 years ago

With the Bus Master IDE controller and DMA operations implemented, we're going further into the kernel. Very close to booting the dashboard at this point. Right now viXen is emulating a blank 10 GB hard disk that lies about writing data.

image

StrikerX3 commented 5 years ago

Slowly inching forward towards the Dashboard now. Looks like it initialized the network interface card and loaded xbdm.dll, but doesn't seem like the dashboard loaded successfully.

image

StrikerX3 commented 5 years ago

The dashboard now loads successfully!

image

StrikerX3 commented 5 years ago

viXen is now emulating just enough of the DVD drive commands to allow a retail BIOS to boot into the dashboard. Loading actual games, however, will require a bit more work and a BIOS without authentication checks, since we need to respond to those checks.

StrikerX3 commented 5 years ago

viXen can now load games!

image

Of course, there's no graphics or sound to speak of... you just have to use your imagination. ;)

StrikerX3 commented 5 years ago

The overarching goal for this issue has been accomplished, which was to implement enough of the IDE emulation to be able to load the Dashboard from a virtual hard disk and a game from an XISO. I'll close this issue.