Fixed a bug in the DOSBox track position return code to no longer incorrectly offset the relative position by 150 sectors (2 frames), fixes track time counters in Sony CD Player for DOS and DOS Navigator.
This commit is contained in:
@@ -143,18 +143,6 @@ static void sound_cd_thread(void *param)
|
||||
cd_out_buffer[c] = 0.0;
|
||||
cd_out_buffer[c+1] = 0.0;
|
||||
}
|
||||
has_audio = 0;
|
||||
for (i = 0; i < CDROM_NUM; i++)
|
||||
{
|
||||
if (cdrom_drives[i].bus_type && cdrom_drives[i].sound_on)
|
||||
{
|
||||
has_audio++;
|
||||
}
|
||||
}
|
||||
if (!has_audio)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < CDROM_NUM; i++)
|
||||
{
|
||||
has_audio = 0;
|
||||
|
||||
@@ -2920,7 +2920,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
|
||||
max_len |= cdb[8];
|
||||
msf = (cdb[1] >> 1) & 1;
|
||||
|
||||
cdrom_log("CD-ROM %i: Getting page %i\n", id, cdb[3]);
|
||||
cdrom_log("CD-ROM %i: Getting page %i (%s)\n", id, cdb[3], msf ? "MSF" : "LBA");
|
||||
if ((cdrom_drives[id].handler->pass_through) && (cdb[3] != 1))
|
||||
{
|
||||
ret = cdrom_pass_through(id, &len, cdrom[id].current_cdb, cdbufferb);
|
||||
|
||||
@@ -125,7 +125,9 @@ bool CDROM_Interface_Image::GetAudioSub(int sector, unsigned char& attr, unsigne
|
||||
attr = tracks[track - 1].attr;
|
||||
index = 1;
|
||||
FRAMES_TO_MSF(sector + 150, &absPos.min, &absPos.sec, &absPos.fr);
|
||||
FRAMES_TO_MSF(sector - tracks[track - 1].start + 150, &relPos.min, &relPos.sec, &relPos.fr);
|
||||
/* FRAMES_TO_MSF(sector - tracks[track - 1].start + 150, &relPos.min, &relPos.sec, &relPos.fr); */
|
||||
/* Note by Kotori: Yes, the absolute position should be adjusted by 150, but not the relative position. */
|
||||
FRAMES_TO_MSF(sector - tracks[track - 1].start, &relPos.min, &relPos.sec, &relPos.fr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,8 +59,12 @@ void image_close(uint8_t id);
|
||||
|
||||
void image_audio_callback(uint8_t id, int16_t *output, int len)
|
||||
{
|
||||
if ((cdrom_image[id].cd_state != CD_PLAYING) || (cdrom_image[id].image_is_iso))
|
||||
if (!cdrom_drives[id].sound_on || (cdrom_image[id].cd_state != CD_PLAYING) || cdrom_image[id].image_is_iso)
|
||||
{
|
||||
if (cdrom_ioctl[id].cd_state == CD_PLAYING)
|
||||
{
|
||||
cdrom[id].seek_pos += (len >> 11);
|
||||
}
|
||||
memset(output, 0, len * 2);
|
||||
return;
|
||||
}
|
||||
@@ -292,22 +296,20 @@ static uint8_t image_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf)
|
||||
|
||||
if (msf)
|
||||
{
|
||||
uint32_t dat = MSFtoLBA(absPos.min, absPos.sec, absPos.fr);
|
||||
b[pos + 3] = (uint8_t)(dat % 75); dat /= 75;
|
||||
b[pos + 2] = (uint8_t)(dat % 60); dat /= 60;
|
||||
b[pos + 1] = (uint8_t)dat;
|
||||
b[pos + 3] = (uint8_t) absPos.fr;
|
||||
b[pos + 2] = (uint8_t) absPos.sec;
|
||||
b[pos + 1] = (uint8_t) absPos.min;
|
||||
b[pos] = 0;
|
||||
pos += 4;
|
||||
dat = MSFtoLBA(relPos.min, relPos.sec, relPos.fr);
|
||||
b[pos + 3] = (uint8_t)(dat % 75); dat /= 75;
|
||||
b[pos + 2] = (uint8_t)(dat % 60); dat /= 60;
|
||||
b[pos + 1] = (uint8_t)dat;
|
||||
b[pos + 3] = (uint8_t) relPos.fr;
|
||||
b[pos + 2] = (uint8_t) relPos.sec;
|
||||
b[pos + 1] = (uint8_t) relPos.min;
|
||||
b[pos] = 0;
|
||||
pos += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t dat = MSFtoLBA(absPos.min, absPos.sec, absPos.fr);
|
||||
uint32_t dat = MSFtoLBA(absPos.min, absPos.sec, absPos.fr) - 150;
|
||||
b[pos++] = (dat >> 24) & 0xff;
|
||||
b[pos++] = (dat >> 16) & 0xff;
|
||||
b[pos++] = (dat >> 8) & 0xff;
|
||||
|
||||
@@ -53,8 +53,12 @@ void ioctl_audio_callback(uint8_t id, int16_t *output, int len)
|
||||
RAW_READ_INFO in;
|
||||
DWORD count;
|
||||
|
||||
if (cdrom_ioctl[id].cd_state != CD_PLAYING)
|
||||
if (!cdrom_drives[id].sound_on || (cdrom_ioctl[id].cd_state != CD_PLAYING))
|
||||
{
|
||||
if (cdrom_ioctl[id].cd_state == CD_PLAYING)
|
||||
{
|
||||
cdrom[id].seek_pos += (len >> 11);
|
||||
}
|
||||
memset(output, 0, len * 2);
|
||||
return;
|
||||
}
|
||||
@@ -395,7 +399,7 @@ static uint8_t ioctl_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf)
|
||||
|
||||
if (msf)
|
||||
{
|
||||
dat = cdpos;
|
||||
dat = cdpos + 150;
|
||||
b[pos + 3] = (uint8_t)(dat % 75); dat /= 75;
|
||||
b[pos + 2] = (uint8_t)(dat % 60); dat /= 60;
|
||||
b[pos + 1] = (uint8_t)dat;
|
||||
|
||||
Reference in New Issue
Block a user