Reimplemented the READ SUBCHANNEL command for both ATAPI and SCSI.

This commit is contained in:
OBattler
2017-01-04 22:33:49 +01:00
parent a8bc5133ec
commit d2be2fcc81
6 changed files with 137 additions and 27 deletions

View File

@@ -18,6 +18,8 @@ void iso_close(void);
static FILE* iso_image;
static int iso_changed = 0;
static uint32_t lba = 0;
static uint32_t iso_cd_pos = 0, iso_cd_end = 0;
void iso_audio_callback(int16_t *output, int len)
@@ -64,6 +66,7 @@ static void iso_stop(void)
static void iso_seek(uint32_t pos)
{
// pclog("iso_seek stub\n");
lba = pos;
return;
}
@@ -113,8 +116,39 @@ static int iso_medium_changed(void)
static uint8_t iso_getcurrentsubchannel(uint8_t *b, int msf)
{
// pclog("iso_getcurrentsubchannel stub\n");
return 0;
long size;
int pos=0;
if (strlen(iso_path) == 0)
{
return 0;
}
b[pos++]=0;
b[pos++]=0;
b[pos++]=0;
int32_t temp = lba;
if (msf)
{
memset(&(b[pos]), 0, 8);
lba_to_msf(&(b[pos]), temp);
pos += 4;
lba_to_msf(&(b[pos]), temp);
pos += 4;
}
else
{
b[pos++] = temp >> 24;
b[pos++] = temp >> 16;
b[pos++] = temp >> 8;
b[pos++] = temp;
b[pos++] = temp >> 24;
b[pos++] = temp >> 16;
b[pos++] = temp >> 8;
b[pos++] = temp;
}
return 0x13;
}
static void iso_eject(void)
@@ -418,6 +452,7 @@ static CDROM iso_cdrom =
iso_getcurrentsubchannel,
NULL,
NULL,
NULL,
NULL,
NULL,
iso_sector_data_type,