CDROM: Set m_current_lba to the sector being read

Fixes double-read commands returning incorrect sectors.

Fixes Vigilante 8 - 2nd Offense.
This commit is contained in:
Connor McLaughlin 2020-05-24 13:27:02 +10:00
parent cd4f551e8c
commit 1494f2bc75
1 changed files with 4 additions and 7 deletions

View File

@ -771,9 +771,7 @@ void CDROM::ExecuteCommand()
SendACKAndStat(); SendACKAndStat();
if ((!m_setloc_pending || m_setloc_position.ToLBA() == m_current_lba) && if ((!m_setloc_pending || m_setloc_position.ToLBA() == m_current_lba) &&
(m_drive_state == DriveState::Reading || (m_drive_state == DriveState::Reading || (IsSeeking() && m_read_after_seek)))
((m_drive_state == DriveState::SeekingPhysical || m_drive_state == DriveState::SeekingLogical) &&
m_read_after_seek)))
{ {
Log_DevPrintf("Ignoring read command with no/same setloc, already reading/reading after seek"); Log_DevPrintf("Ignoring read command with no/same setloc, already reading/reading after seek");
} }
@ -801,9 +799,7 @@ void CDROM::ExecuteCommand()
SendACKAndStat(); SendACKAndStat();
if (track == 0 && (!m_setloc_pending || m_setloc_position.ToLBA() == m_current_lba) && if (track == 0 && (!m_setloc_pending || m_setloc_position.ToLBA() == m_current_lba) &&
(m_drive_state == DriveState::Playing || (m_drive_state == DriveState::Playing || (IsSeeking() && m_play_after_seek)))
((m_drive_state == DriveState::SeekingPhysical || m_drive_state == DriveState::SeekingLogical) &&
m_play_after_seek)))
{ {
Log_DevPrintf("Ignoring play command with no/same setloc, already playing/playing after seek"); Log_DevPrintf("Ignoring play command with no/same setloc, already playing/playing after seek");
} }
@ -1613,7 +1609,8 @@ void CDROM::DoSectorRead()
is_data_sector ? "data" : "audio", is_data_sector ? "reading" : "playing"); is_data_sector ? "data" : "audio", is_data_sector ? "reading" : "playing");
} }
m_reader.QueueReadSector(m_current_lba + 1u); m_current_lba++;
m_reader.QueueReadSector(m_current_lba);
} }
void CDROM::ProcessDataSectorHeader(const u8* raw_sector) void CDROM::ProcessDataSectorHeader(const u8* raw_sector)