ioctl: replace SCSIDEFS.h with Windows headers
This commit is contained in:
parent
6d32ad2ac8
commit
fa217e4cd0
|
@ -181,7 +181,7 @@ if(NOT WITH_SYSTEM_ZLIB)
|
|||
target_link_libraries(${PROJECT_NAME} PRIVATE zlib)
|
||||
# help libzip find the package
|
||||
set(ZLIB_FOUND TRUE)
|
||||
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/core/deps/libchdr/deps/zlib-1.2.11")
|
||||
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/core/deps/libchdr/deps/zlib-1.2.11")
|
||||
cmake_policy(SET CMP0026 OLD)
|
||||
get_target_property(ZLIB_LIBRARY zlib LOCATION)
|
||||
endif()
|
||||
|
@ -571,8 +571,7 @@ target_sources(${PROJECT_NAME} PRIVATE
|
|||
core/imgread/cue.cpp
|
||||
core/imgread/gdi.cpp
|
||||
core/imgread/ImgReader.cpp
|
||||
core/imgread/ioctl.cpp
|
||||
core/imgread/SCSIDEFS.H)
|
||||
core/imgread/ioctl.cpp)
|
||||
|
||||
target_sources(${PROJECT_NAME} PRIVATE
|
||||
core/input/gamepad.h
|
||||
|
|
|
@ -1,304 +0,0 @@
|
|||
//***************************************************************************
|
||||
//
|
||||
// Name: SCSIDEFS.H
|
||||
//
|
||||
// Description: SCSI definitions ('C' Language)
|
||||
//
|
||||
//***************************************************************************
|
||||
|
||||
//***************************************************************************
|
||||
// %%% TARGET STATUS VALUES %%%
|
||||
//***************************************************************************
|
||||
#define STATUS_GOOD 0x00 // Status Good
|
||||
#define STATUS_CHKCOND 0x02 // Check Condition
|
||||
#define STATUS_CONDMET 0x04 // Condition Met
|
||||
#define STATUS_BUSY 0x08 // Busy
|
||||
#define STATUS_INTERM 0x10 // Intermediate
|
||||
#define STATUS_INTCDMET 0x14 // Intermediate-condition met
|
||||
#define STATUS_RESCONF 0x18 // Reservation conflict
|
||||
#define STATUS_COMTERM 0x22 // Command Terminated
|
||||
#define STATUS_QFULL 0x28 // Queue full
|
||||
|
||||
//***************************************************************************
|
||||
// %%% SCSI MISCELLANEOUS EQUATES %%%
|
||||
//***************************************************************************
|
||||
#define MAXLUN 7 // Maximum Logical Unit Id
|
||||
#define MAXTARG 7 // Maximum Target Id
|
||||
#define MAX_SCSI_LUNS 64 // Maximum Number of SCSI LUNs
|
||||
#define MAX_NUM_HA 8 // Maximum Number of SCSI HA's
|
||||
|
||||
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
|
||||
//
|
||||
// %%% SCSI COMMAND OPCODES %%%
|
||||
//
|
||||
///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands for all Device Types %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_CHANGE_DEF 0x40 // Change Definition (Optional)
|
||||
#define SCSI_COMPARE 0x39 // Compare (O)
|
||||
#define SCSI_COPY 0x18 // Copy (O)
|
||||
#define SCSI_COP_VERIFY 0x3A // Copy and Verify (O)
|
||||
#define SCSI_INQUIRY 0x12 // Inquiry (MANDATORY)
|
||||
#define SCSI_LOG_SELECT 0x4C // Log Select (O)
|
||||
#define SCSI_LOG_SENSE 0x4D // Log Sense (O)
|
||||
#define SCSI_MODE_SEL6 0x15 // Mode Select 6-byte (Device Specific)
|
||||
#define SCSI_MODE_SEL10 0x55 // Mode Select 10-byte (Device Specific)
|
||||
#define SCSI_MODE_SEN6 0x1A // Mode Sense 6-byte (Device Specific)
|
||||
#define SCSI_MODE_SEN10 0x5A // Mode Sense 10-byte (Device Specific)
|
||||
#define SCSI_READ_BUFF 0x3C // Read Buffer (O)
|
||||
#define SCSI_REQ_SENSE 0x03 // Request Sense (MANDATORY)
|
||||
#define SCSI_SEND_DIAG 0x1D // Send Diagnostic (O)
|
||||
#define SCSI_TST_U_RDY 0x00 // Test Unit Ready (MANDATORY)
|
||||
#define SCSI_WRITE_BUFF 0x3B // Write Buffer (O)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to Direct Access Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_COMPARE 0x39 // Compare (O)
|
||||
#define SCSI_FORMAT 0x04 // Format Unit (MANDATORY)
|
||||
#define SCSI_LCK_UN_CAC 0x36 // Lock Unlock Cache (O)
|
||||
#define SCSI_PREFETCH 0x34 // Prefetch (O)
|
||||
#define SCSI_MED_REMOVL 0x1E // Prevent/Allow medium Removal (O)
|
||||
#define SCSI_READ6 0x08 // Read 6-byte (MANDATORY)
|
||||
#define SCSI_READ10 0x28 // Read 10-byte (MANDATORY)
|
||||
#define SCSI_RD_CAPAC 0x25 // Read Capacity (MANDATORY)
|
||||
#define SCSI_RD_DEFECT 0x37 // Read Defect Data (O)
|
||||
#define SCSI_READ_LONG 0x3E // Read Long (O)
|
||||
#define SCSI_REASS_BLK 0x07 // Reassign Blocks (O)
|
||||
#define SCSI_RCV_DIAG 0x1C // Receive Diagnostic Results (O)
|
||||
#define SCSI_RELEASE 0x17 // Release Unit (MANDATORY)
|
||||
#define SCSI_REZERO 0x01 // Rezero Unit (O)
|
||||
#define SCSI_SRCH_DAT_E 0x31 // Search Data Equal (O)
|
||||
#define SCSI_SRCH_DAT_H 0x30 // Search Data High (O)
|
||||
#define SCSI_SRCH_DAT_L 0x32 // Search Data Low (O)
|
||||
#define SCSI_SEEK6 0x0B // Seek 6-Byte (O)
|
||||
#define SCSI_SEEK10 0x2B // Seek 10-Byte (O)
|
||||
#define SCSI_SEND_DIAG 0x1D // Send Diagnostics (MANDATORY)
|
||||
#define SCSI_SET_LIMIT 0x33 // Set Limits (O)
|
||||
#define SCSI_START_STP 0x1B // Start/Stop Unit (O)
|
||||
#define SCSI_SYNC_CACHE 0x35 // Synchronize Cache (O)
|
||||
#define SCSI_VERIFY 0x2F // Verify (O)
|
||||
#define SCSI_WRITE6 0x0A // Write 6-Byte (MANDATORY)
|
||||
#define SCSI_WRITE10 0x2A // Write 10-Byte (MANDATORY)
|
||||
#define SCSI_WRT_VERIFY 0x2E // Write and Verify (O)
|
||||
#define SCSI_WRITE_LONG 0x3F // Write Long (O)
|
||||
#define SCSI_WRITE_SAME 0x41 // Write Same (O)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to Sequential Access Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_ERASE 0x19 // Erase (MANDATORY)
|
||||
#define SCSI_LOAD_UN 0x1B // Load/Unload (O)
|
||||
#define SCSI_LOCATE 0x2B // Locate (O)
|
||||
#define SCSI_RD_BLK_LIM 0x05 // Read Block Limits (MANDATORY)
|
||||
#define SCSI_READ_POS 0x34 // Read Position (O)
|
||||
#define SCSI_READ_REV 0x0F // Read Reverse (O)
|
||||
#define SCSI_REC_BF_DAT 0x14 // Recover Buffer Data (O)
|
||||
#define SCSI_RESERVE 0x16 // Reserve Unit (MANDATORY)
|
||||
#define SCSI_REWIND 0x01 // Rewind (MANDATORY)
|
||||
#define SCSI_SPACE 0x11 // Space (MANDATORY)
|
||||
#define SCSI_VERIFY_T 0x13 // Verify (Tape) (O)
|
||||
#define SCSI_WRT_FILE 0x10 // Write Filemarks (MANDATORY)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to Printer Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_PRINT 0x0A // Print (MANDATORY)
|
||||
#define SCSI_SLEW_PNT 0x0B // Slew and Print (O)
|
||||
#define SCSI_STOP_PNT 0x1B // Stop Print (O)
|
||||
#define SCSI_SYNC_BUFF 0x10 // Synchronize Buffer (O)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to Processor Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_RECEIVE 0x08 // Receive (O)
|
||||
#define SCSI_SEND 0x0A // Send (O)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to Write-Once Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_MEDIUM_SCN 0x38 // Medium Scan (O)
|
||||
#define SCSI_SRCHDATE10 0x31 // Search Data Equal 10-Byte (O)
|
||||
#define SCSI_SRCHDATE12 0xB1 // Search Data Equal 12-Byte (O)
|
||||
#define SCSI_SRCHDATH10 0x30 // Search Data High 10-Byte (O)
|
||||
#define SCSI_SRCHDATH12 0xB0 // Search Data High 12-Byte (O)
|
||||
#define SCSI_SRCHDATL10 0x32 // Search Data Low 10-Byte (O)
|
||||
#define SCSI_SRCHDATL12 0xB2 // Search Data Low 12-Byte (O)
|
||||
#define SCSI_SET_LIM_10 0x33 // Set Limits 10-Byte (O)
|
||||
#define SCSI_SET_LIM_12 0xB3 // Set Limits 10-Byte (O)
|
||||
#define SCSI_VERIFY10 0x2F // Verify 10-Byte (O)
|
||||
#define SCSI_VERIFY12 0xAF // Verify 12-Byte (O)
|
||||
#define SCSI_WRITE12 0xAA // Write 12-Byte (O)
|
||||
#define SCSI_WRT_VER10 0x2E // Write and Verify 10-Byte (O)
|
||||
#define SCSI_WRT_VER12 0xAE // Write and Verify 12-Byte (O)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to CD-ROM Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_PLAYAUD_10 0x45 // Play Audio 10-Byte (O)
|
||||
#define SCSI_PLAYAUD_12 0xA5 // Play Audio 12-Byte 12-Byte (O)
|
||||
#define SCSI_PLAYAUDMSF 0x47 // Play Audio MSF (O)
|
||||
#define SCSI_PLAYA_TKIN 0x48 // Play Audio Track/Index (O)
|
||||
#define SCSI_PLYTKREL10 0x49 // Play Track Relative 10-Byte (O)
|
||||
#define SCSI_PLYTKREL12 0xA9 // Play Track Relative 12-Byte (O)
|
||||
#define SCSI_READCDCAP 0x25 // Read CD-ROM Capacity (MANDATORY)
|
||||
#define SCSI_READHEADER 0x44 // Read Header (O)
|
||||
#define SCSI_SUBCHANNEL 0x42 // Read Subchannel (O)
|
||||
#define SCSI_READ_TOC 0x43 // Read TOC (O)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to Scanner Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_GETDBSTAT 0x34 // Get Data Buffer Status (O)
|
||||
#define SCSI_GETWINDOW 0x25 // Get Window (O)
|
||||
#define SCSI_OBJECTPOS 0x31 // Object Postion (O)
|
||||
#define SCSI_SCAN 0x1B // Scan (O)
|
||||
#define SCSI_SETWINDOW 0x24 // Set Window (MANDATORY)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to Optical Memory Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_UpdateBlk 0x3D // Update Block (O)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to Medium Changer Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_EXCHMEDIUM 0xA6 // Exchange Medium (O)
|
||||
#define SCSI_INITELSTAT 0x07 // Initialize Element Status (O)
|
||||
#define SCSI_POSTOELEM 0x2B // Position to Element (O)
|
||||
#define SCSI_REQ_VE_ADD 0xB5 // Request Volume Element Address (O)
|
||||
#define SCSI_SENDVOLTAG 0xB6 // Send Volume Tag (O)
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Commands Unique to Communication Devices %%%
|
||||
//***************************************************************************
|
||||
#define SCSI_GET_MSG_6 0x08 // Get Message 6-Byte (MANDATORY)
|
||||
#define SCSI_GET_MSG_10 0x28 // Get Message 10-Byte (O)
|
||||
#define SCSI_GET_MSG_12 0xA8 // Get Message 12-Byte (O)
|
||||
#define SCSI_SND_MSG_6 0x0A // Send Message 6-Byte (MANDATORY)
|
||||
#define SCSI_SND_MSG_10 0x2A // Send Message 10-Byte (O)
|
||||
#define SCSI_SND_MSG_12 0xAA // Send Message 12-Byte (O)
|
||||
|
||||
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
|
||||
//
|
||||
// %%% END OF SCSI COMMAND OPCODES %%%
|
||||
//
|
||||
///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
|
||||
|
||||
//***************************************************************************
|
||||
// %%% Request Sense Data Format %%%
|
||||
//***************************************************************************
|
||||
typedef struct {
|
||||
|
||||
BYTE ErrorCode; // Error Code (70H or 71H)
|
||||
BYTE SegmentNum; // Number of current segment descriptor
|
||||
BYTE SenseKey; // Sense Key(See bit definitions too)
|
||||
BYTE InfoByte0; // Information MSB
|
||||
BYTE InfoByte1; // Information MID
|
||||
BYTE InfoByte2; // Information MID
|
||||
BYTE InfoByte3; // Information LSB
|
||||
BYTE AddSenLen; // Additional Sense Length
|
||||
BYTE ComSpecInf0; // Command Specific Information MSB
|
||||
BYTE ComSpecInf1; // Command Specific Information MID
|
||||
BYTE ComSpecInf2; // Command Specific Information MID
|
||||
BYTE ComSpecInf3; // Command Specific Information LSB
|
||||
BYTE AddSenseCode; // Additional Sense Code
|
||||
BYTE AddSenQual; // Additional Sense Code Qualifier
|
||||
BYTE FieldRepUCode; // Field Replaceable Unit Code
|
||||
BYTE SenKeySpec15; // Sense Key Specific 15th byte
|
||||
BYTE SenKeySpec16; // Sense Key Specific 16th byte
|
||||
BYTE SenKeySpec17; // Sense Key Specific 17th byte
|
||||
BYTE AddSenseBytes; // Additional Sense Bytes
|
||||
|
||||
} SENSE_DATA_FMT;
|
||||
|
||||
//***************************************************************************
|
||||
// %%% REQUEST SENSE ERROR CODE %%%
|
||||
//***************************************************************************
|
||||
#define SERROR_CURRENT 0x70 // Current Errors
|
||||
#define SERROR_DEFERED 0x71 // Deferred Errors
|
||||
|
||||
//***************************************************************************
|
||||
// %%% REQUEST SENSE BIT DEFINITIONS %%%
|
||||
//***************************************************************************
|
||||
#define SENSE_VALID 0x80 // Byte 0 Bit 7
|
||||
#define SENSE_FILEMRK 0x80 // Byte 2 Bit 7
|
||||
#define SENSE_EOM 0x40 // Byte 2 Bit 6
|
||||
#define SENSE_ILI 0x20 // Byte 2 Bit 5
|
||||
|
||||
//***************************************************************************
|
||||
// %%% REQUEST SENSE SENSE KEY DEFINITIONS %%%
|
||||
//***************************************************************************
|
||||
#define KEY_NOSENSE 0x00 // No Sense
|
||||
#define KEY_RECERROR 0x01 // Recovered Error
|
||||
#define KEY_NOTREADY 0x02 // Not Ready
|
||||
#define KEY_MEDIUMERR 0x03 // Medium Error
|
||||
#define KEY_HARDERROR 0x04 // Hardware Error
|
||||
#define KEY_ILLGLREQ 0x05 // Illegal Request
|
||||
#define KEY_UNITATT 0x06 // Unit Attention
|
||||
#define KEY_DATAPROT 0x07 // Data Protect
|
||||
#define KEY_BLANKCHK 0x08 // Blank Check
|
||||
#define KEY_VENDSPEC 0x09 // Vendor Specific
|
||||
#define KEY_COPYABORT 0x0A // Copy Abort
|
||||
#define KEY_EQUAL 0x0C // Equal (Search)
|
||||
#define KEY_VOLOVRFLW 0x0D // Volume Overflow
|
||||
#define KEY_MISCOMP 0x0E // Miscompare (Search)
|
||||
#define KEY_RESERVED 0x0F // Reserved
|
||||
|
||||
//***************************************************************************
|
||||
// %%% PERIPHERAL DEVICE TYPE DEFINITIONS %%%
|
||||
//***************************************************************************
|
||||
#define DTYPE_DASD 0x00 // Disk Device
|
||||
#define DTYPE_SEQD 0x01 // Tape Device
|
||||
#define DTYPE_PRNT 0x02 // Printer
|
||||
#define DTYPE_PROC 0x03 // Processor
|
||||
#define DTYPE_WORM 0x04 // Write-once read-multiple
|
||||
#define DTYPE_CROM 0x05 // CD-ROM device
|
||||
#define DTYPE_CDROM 0x05 // CD-ROM device
|
||||
#define DTYPE_SCAN 0x06 // Scanner device
|
||||
#define DTYPE_OPTI 0x07 // Optical memory device
|
||||
#define DTYPE_JUKE 0x08 // Medium Changer device
|
||||
#define DTYPE_COMM 0x09 // Communications device
|
||||
#define DTYPE_RESL 0x0A // Reserved (low)
|
||||
#define DTYPE_RESH 0x1E // Reserved (high)
|
||||
#define DTYPE_UNKNOWN 0x1F // Unknown or no device type
|
||||
|
||||
//***************************************************************************
|
||||
// %%% ANSI APPROVED VERSION DEFINITIONS %%%
|
||||
//***************************************************************************
|
||||
#define ANSI_MAYBE 0x0 // Device may or may not be ANSI approved stand
|
||||
#define ANSI_SCSI1 0x1 // Device complies to ANSI X3.131-1986 (SCSI-1)
|
||||
#define ANSI_SCSI2 0x2 // Device complies to SCSI-2
|
||||
#define ANSI_RESLO 0x3 // Reserved (low)
|
||||
#define ANSI_RESHI 0x7 // Reserved (high)
|
||||
|
||||
|
||||
#define MMC_READCD_OPCODE 0xBE
|
||||
struct MMC_READCD
|
||||
{
|
||||
//+0
|
||||
u8 opcode;
|
||||
//+1
|
||||
u8 RelADR:1;
|
||||
u8 res_1:1;
|
||||
u8 ExpectedSectorType:3;
|
||||
u8 res_2:3;
|
||||
//+2
|
||||
u8 LBA[4];
|
||||
//+6
|
||||
u8 len[3];
|
||||
//+9
|
||||
u8 res_3:1;
|
||||
u8 err:2;
|
||||
u8 EDC_ECC:1;
|
||||
u8 UserData:1;
|
||||
u8 HeaderCodes:2;
|
||||
u8 sync:1;
|
||||
//+10
|
||||
u8 subchannel:3;
|
||||
u8 res:5;
|
||||
//+11
|
||||
u8 control;
|
||||
};
|
|
@ -1,90 +1,60 @@
|
|||
#include "build.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "types.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <windows.h>
|
||||
|
||||
#include <ntddcdrm.h>
|
||||
#include <ntddscsi.h>
|
||||
#include "SCSIDEFS.H"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _NTSCSI_USER_MODE_
|
||||
#include <scsi.h>
|
||||
#undef _NTSCSI_USER_MODE_
|
||||
#else
|
||||
#define CD_RAW_READ_SUBCODE_SIZE ( 96)
|
||||
|
||||
#pragma pack(push, cdb, 1)
|
||||
typedef union _CDB {
|
||||
struct _READ_CD {
|
||||
UCHAR OperationCode; // 0xBE - SCSIOP_READ_CD
|
||||
UCHAR RelativeAddress : 1;
|
||||
UCHAR Reserved0 : 1;
|
||||
UCHAR ExpectedSectorType : 3;
|
||||
UCHAR Lun : 3;
|
||||
UCHAR StartingLBA[4];
|
||||
UCHAR TransferBlocks[3];
|
||||
UCHAR Reserved2 : 1;
|
||||
UCHAR ErrorFlags : 2;
|
||||
UCHAR IncludeEDC : 1;
|
||||
UCHAR IncludeUserData : 1;
|
||||
UCHAR HeaderCode : 2;
|
||||
UCHAR IncludeSyncData : 1;
|
||||
UCHAR SubChannelSelection : 3;
|
||||
UCHAR Reserved3 : 5;
|
||||
UCHAR Control;
|
||||
} READ_CD;
|
||||
} CDB, *PCDB;
|
||||
#pragma pack(pop, cdb)
|
||||
|
||||
#define READ_TOC_FORMAT_FULL_TOC 0x02
|
||||
|
||||
#define SCSIOP_READ 0x28
|
||||
#define SCSIOP_READ_CD 0xBE
|
||||
#endif
|
||||
|
||||
#ifndef noheaders
|
||||
#define RAW_SECTOR_SIZE 2352
|
||||
#define CD_SECTOR_SIZE 2048
|
||||
#define MAXIMUM_NUMBER_TRACKS 100
|
||||
#define SECTORS_AT_READ 20
|
||||
#define CD_BLOCKS_PER_SECOND 75
|
||||
#define IOCTL_CDROM_RAW_READ 0x2403E
|
||||
#define IOCTL_CDROM_READ_TOC 0x24000
|
||||
#define IOCTL_CDROM_READ_TOC_EX 0x24054
|
||||
|
||||
// These structures are defined somewhere in the windows-api, but I did
|
||||
// not have the include-file.
|
||||
typedef struct _TRACK_DATA
|
||||
{
|
||||
UCHAR Reserved;
|
||||
UCHAR Control : 4;
|
||||
UCHAR Adr : 4;
|
||||
UCHAR TrackNumber;
|
||||
UCHAR Reserved1;
|
||||
UCHAR Address[4];
|
||||
} TRACK_DATA;
|
||||
|
||||
typedef struct _CDROM_TOC
|
||||
{
|
||||
UCHAR Length[2];
|
||||
UCHAR FirstTrack;
|
||||
UCHAR LastTrack;
|
||||
TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
|
||||
} CDROM_TOC;
|
||||
|
||||
typedef enum _TRACK_MODE_TYPE
|
||||
{
|
||||
YellowMode2,
|
||||
XAForm2,
|
||||
CDDA
|
||||
} TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
|
||||
|
||||
typedef struct __RAW_READ_INFO
|
||||
{
|
||||
LARGE_INTEGER DiskOffset;
|
||||
ULONG SectorCount;
|
||||
TRACK_MODE_TYPE TrackMode;
|
||||
} RAW_READ_INFO, *PRAW_READ_INFO;
|
||||
typedef struct _CDROM_TOC_FULL_TOC_DATA_BLOCK { UCHAR SessionNumber; UCHAR Control:4; UCHAR Adr:4; UCHAR Reserved1; UCHAR Point; UCHAR MsfExtra[3]; UCHAR Zero; UCHAR Msf[3];} CDROM_TOC_FULL_TOC_DATA_BLOCK, *PCDROM_TOC_FULL_TOC_DATA_BLOCK;
|
||||
typedef struct _CDROM_TOC_FULL_TOC_DATA
|
||||
{
|
||||
UCHAR Length[2];
|
||||
UCHAR FirstCompleteSession;
|
||||
UCHAR LastCompleteSession;
|
||||
CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
|
||||
} CDROM_TOC_FULL_TOC_DATA, *PCDROM_TOC_FULL_TOC_DATA;
|
||||
/* CDROM_READ_TOC_EX.Format constants */
|
||||
#define CDROM_READ_TOC_EX_FORMAT_TOC 0x00
|
||||
#define CDROM_READ_TOC_EX_FORMAT_SESSION 0x01
|
||||
#define CDROM_READ_TOC_EX_FORMAT_FULL_TOC 0x02
|
||||
#define CDROM_READ_TOC_EX_FORMAT_PMA 0x03
|
||||
#define CDROM_READ_TOC_EX_FORMAT_ATIP 0x04
|
||||
#define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
|
||||
|
||||
typedef struct _CDROM_READ_TOC_EX
|
||||
{
|
||||
UCHAR Format : 4;
|
||||
UCHAR Reserved1 : 3;
|
||||
UCHAR Msf : 1;
|
||||
UCHAR SessionTrack;
|
||||
UCHAR Reserved2;
|
||||
UCHAR Reserved3;
|
||||
} CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
|
||||
#endif
|
||||
struct spti_s
|
||||
{
|
||||
SCSI_PASS_THROUGH_DIRECT sptd;
|
||||
DWORD alignmentDummy;
|
||||
BYTE senseBuf[0x12];
|
||||
} ;
|
||||
};
|
||||
|
||||
ULONG msf2fad(const UCHAR Addr[4])
|
||||
{
|
||||
|
@ -107,7 +77,7 @@ bool spti_SendCommand(HANDLE hand,spti_s& s,SCSI_ADDRESS& ioctl_addr)
|
|||
//s.sptd.CdbLength = 0x0A;
|
||||
s.sptd.SenseInfoLength = 0x12;
|
||||
s.sptd.SenseInfoOffset = offsetof(spti_s, senseBuf);
|
||||
// s.sptd.DataIn = 0x01;//DATA_IN
|
||||
// s.sptd.DataIn = SCSI_IOCTL_DATA_IN;
|
||||
// s.sptd.DataTransferLength = 0x800;
|
||||
// s.sptd.DataBuffer = pdata;
|
||||
|
||||
|
@ -125,7 +95,7 @@ bool spti_Read10(HANDLE hand,void * pdata,u32 sector,SCSI_ADDRESS& ioctl_addr)
|
|||
spti_s s;
|
||||
memset(&s,0,sizeof(spti_s));
|
||||
|
||||
s.sptd.Cdb[0] = SCSI_READ10;
|
||||
s.sptd.Cdb[0] = SCSIOP_READ;
|
||||
s.sptd.Cdb[1] = (ioctl_addr.Lun&7) << 5;// | DPO ; DPO = 8
|
||||
|
||||
s.sptd.Cdb[2] = (BYTE)(sector >> 0x18 & 0xFF); // MSB
|
||||
|
@ -137,7 +107,7 @@ bool spti_Read10(HANDLE hand,void * pdata,u32 sector,SCSI_ADDRESS& ioctl_addr)
|
|||
s.sptd.Cdb[8] = 1;
|
||||
|
||||
s.sptd.CdbLength = 0x0A;
|
||||
s.sptd.DataIn = 0x01;//DATA_IN
|
||||
s.sptd.DataIn = SCSI_IOCTL_DATA_IN;
|
||||
s.sptd.DataTransferLength = 0x800;
|
||||
s.sptd.DataBuffer = pdata;
|
||||
|
||||
|
@ -147,33 +117,30 @@ bool spti_ReadCD(HANDLE hand,void * pdata,u32 sector,SCSI_ADDRESS& ioctl_addr)
|
|||
{
|
||||
spti_s s;
|
||||
memset(&s,0,sizeof(spti_s));
|
||||
MMC_READCD& r=*(MMC_READCD*)s.sptd.Cdb;
|
||||
CDB& r = *(PCDB)s.sptd.Cdb;
|
||||
|
||||
r.opcode = MMC_READCD_OPCODE;
|
||||
|
||||
r.READ_CD.OperationCode = SCSIOP_READ_CD;
|
||||
|
||||
//lba
|
||||
r.LBA[0] = (BYTE)(sector >> 0x18 & 0xFF);
|
||||
r.LBA[1] = (BYTE)(sector >> 0x10 & 0xFF);
|
||||
r.LBA[2] = (BYTE)(sector >> 0x08 & 0xFF);
|
||||
r.LBA[3] = (BYTE)(sector >> 0x00 & 0xFF);
|
||||
r.READ_CD.StartingLBA[0] = (BYTE)(sector >> 0x18 & 0xFF);
|
||||
r.READ_CD.StartingLBA[1] = (BYTE)(sector >> 0x10 & 0xFF);
|
||||
r.READ_CD.StartingLBA[2] = (BYTE)(sector >> 0x08 & 0xFF);
|
||||
r.READ_CD.StartingLBA[3] = (BYTE)(sector >> 0x00 & 0xFF);
|
||||
|
||||
//1 sector
|
||||
r.len[0]=0;
|
||||
r.len[1]=0;
|
||||
r.len[2]=1;
|
||||
|
||||
//0xF8
|
||||
r.sync=1;
|
||||
r.HeaderCodes=3;
|
||||
r.UserData=1;
|
||||
r.EDC_ECC=1;
|
||||
|
||||
// 1 sector
|
||||
r.READ_CD.TransferBlocks[0] = 0;
|
||||
r.READ_CD.TransferBlocks[1] = 0;
|
||||
r.READ_CD.TransferBlocks[2] = 1;
|
||||
|
||||
// 0xF8
|
||||
r.READ_CD.IncludeSyncData = 1;
|
||||
r.READ_CD.HeaderCode = 3;
|
||||
r.READ_CD.IncludeUserData = 1;
|
||||
r.READ_CD.IncludeEDC = 1;
|
||||
|
||||
r.READ_CD.SubChannelSelection = 1;
|
||||
|
||||
r.subchannel=1;
|
||||
|
||||
s.sptd.CdbLength = 12;
|
||||
s.sptd.DataIn = 0x01;//DATA_IN
|
||||
s.sptd.DataIn = SCSI_IOCTL_DATA_IN;
|
||||
s.sptd.DataTransferLength = 2448;
|
||||
s.sptd.DataBuffer = pdata;
|
||||
return spti_SendCommand(hand,s,ioctl_addr);
|
||||
|
@ -212,7 +179,7 @@ struct PhysicalDrive:Disc
|
|||
// Get track-table and parse it
|
||||
CDROM_READ_TOC_EX tocrq={0};
|
||||
|
||||
tocrq.Format = CDROM_READ_TOC_EX_FORMAT_FULL_TOC;
|
||||
tocrq.Format = READ_TOC_FORMAT_FULL_TOC;
|
||||
tocrq.Msf=1;
|
||||
tocrq.SessionTrack=1;
|
||||
u8 buff[2048];
|
||||
|
@ -311,8 +278,8 @@ void PhysicalTrack::Read(u32 FAD,u8* dst,SectorFormat* sector_type,u8* subcode,S
|
|||
else
|
||||
{
|
||||
//sector read success, with subcode
|
||||
memcpy(dst,temp,2352);
|
||||
memcpy(subcode,temp+2352,96);
|
||||
memcpy(dst, temp, 2352);
|
||||
memcpy(subcode, temp + 2352, CD_RAW_READ_SUBCODE_SIZE);
|
||||
|
||||
*sector_type=SECFMT_2352;
|
||||
*subcode_type=SUBFMT_96;
|
||||
|
|
|
@ -131,7 +131,6 @@
|
|||
<ClInclude Include="..\core\deps\zlib\zutil.h" />
|
||||
<ClInclude Include="..\core\imgread\common.h" />
|
||||
<ClInclude Include="..\core\imgread\ImgReader.h" />
|
||||
<ClInclude Include="..\core\imgread\SCSIDEFS.H" />
|
||||
<ClInclude Include="src\cdromfs.h" />
|
||||
<ClInclude Include="src\cdromfs_imp.h" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -120,9 +120,6 @@
|
|||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\core\imgread\SCSIDEFS.H">
|
||||
<Filter>imgread</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\core\imgread\common.h">
|
||||
<Filter>imgread</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -519,7 +519,6 @@
|
|||
9C7A3A6018C806E00070BB5F /* gdi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gdi.cpp; sourceTree = "<group>"; };
|
||||
9C7A3A6118C806E00070BB5F /* ImgReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImgReader.cpp; sourceTree = "<group>"; };
|
||||
9C7A3A6318C806E00070BB5F /* ioctl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ioctl.cpp; sourceTree = "<group>"; };
|
||||
9C7A3A6418C806E00070BB5F /* SCSIDEFS.H */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SCSIDEFS.H; sourceTree = "<group>"; };
|
||||
9C7A3A6718C806E00070BB5F /* egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = egl.h; sourceTree = "<group>"; };
|
||||
9C7A3A6818C806E00070BB5F /* eglext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eglext.h; sourceTree = "<group>"; };
|
||||
9C7A3A6918C806E00070BB5F /* eglplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eglplatform.h; sourceTree = "<group>"; };
|
||||
|
@ -1197,7 +1196,6 @@
|
|||
9C7A3A6018C806E00070BB5F /* gdi.cpp */,
|
||||
9C7A3A6118C806E00070BB5F /* ImgReader.cpp */,
|
||||
9C7A3A6318C806E00070BB5F /* ioctl.cpp */,
|
||||
9C7A3A6418C806E00070BB5F /* SCSIDEFS.H */,
|
||||
);
|
||||
path = imgread;
|
||||
sourceTree = "<group>";
|
||||
|
|
|
@ -582,7 +582,6 @@
|
|||
84B7BE481B72720100F9733F /* gdi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gdi.cpp; sourceTree = "<group>"; };
|
||||
84B7BE491B72720100F9733F /* ImgReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImgReader.cpp; sourceTree = "<group>"; };
|
||||
84B7BE4B1B72720100F9733F /* ioctl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ioctl.cpp; sourceTree = "<group>"; };
|
||||
84B7BE4C1B72720100F9733F /* SCSIDEFS.H */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SCSIDEFS.H; sourceTree = "<group>"; };
|
||||
84B7BE4F1B72720100F9733F /* egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = egl.h; sourceTree = "<group>"; };
|
||||
84B7BE501B72720100F9733F /* eglplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eglplatform.h; sourceTree = "<group>"; };
|
||||
84B7BE511B72720100F9733F /* khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = khrplatform.h; sourceTree = "<group>"; };
|
||||
|
@ -1747,7 +1746,6 @@
|
|||
84B7BE481B72720100F9733F /* gdi.cpp */,
|
||||
84B7BE491B72720100F9733F /* ImgReader.cpp */,
|
||||
84B7BE4B1B72720100F9733F /* ioctl.cpp */,
|
||||
84B7BE4C1B72720100F9733F /* SCSIDEFS.H */,
|
||||
);
|
||||
path = imgread;
|
||||
sourceTree = "<group>";
|
||||
|
|
Loading…
Reference in New Issue