pce_cd.cpp: Fixed few bogus CD-ROM state bugs, fixes booting for Snatcher [Angelo Salese]

This commit is contained in:
angelosa 2017-09-18 10:01:44 +02:00
parent 1680634bcf
commit 5de8c6104b

View File

@ -6,10 +6,10 @@ PC Engine CD HW notes:
TODO: TODO:
- Dragon Ball Z: ADPCM dies after the first upload; - Dragon Ball Z: ADPCM dies after the first upload;
- Dragon Slayer - The Legend of Heroes: black screen; - Dragon Slayer - The Legend of Heroes: black screen; (actually timing/raster irq)
- Mirai Shonen Conan: dies at new game selection; - Mirai Shonen Conan: dies at new game selection; (actually timing/raster irq)
- Snatcher: black screen after Konami logo, tries set up CD-DA - Snatcher: black screen after Konami logo, tries set up CD-DA
while transferring data? while transferring data? (fixed)
- Steam Heart's: needs transfer ready irq to get past the - Steam Heart's: needs transfer ready irq to get past the
gameplay hang, don't know exactly when it should fire gameplay hang, don't know exactly when it should fire
- Steam Heart's: bad ADPCM irq, dialogue is cutted due of it; - Steam Heart's: bad ADPCM irq, dialogue is cutted due of it;
@ -439,18 +439,21 @@ void pce_cd_device::nec_set_audio_start_position()
m_current_frame = frame; m_current_frame = frame;
if (m_cdda_status == PCE_CD_CDDA_PAUSED) m_cdda_status = PCE_CD_CDDA_PAUSED;
{
m_cdda_status = PCE_CD_CDDA_OFF; // old code for reference, seems unlikely that this puts status in standby (and breaks Snatcher at the title screen)
m_cdda->stop_audio(); // if (m_cdda_status == PCE_CD_CDDA_PAUSED)
m_end_frame = m_last_frame; // {
m_end_mark = 0; // m_cdda_status = PCE_CD_CDDA_OFF;
} // m_cdda->stop_audio();
else // m_end_frame = m_last_frame;
// m_end_mark = 0;
// }
// else
{ {
if (m_command_buffer[1] & 0x03) if (m_command_buffer[1] & 0x03)
{ {
m_cdda_status = PCE_CD_CDDA_PLAYING; //m_cdda_status = PCE_CD_CDDA_PLAYING;
m_end_frame = m_last_frame; //get the end of the CD m_end_frame = m_last_frame; //get the end of the CD
m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame);
m_cdda_play_mode = (m_command_buffer[1] & 0x02) ? 2 : 3; // mode 2 sets IRQ at end m_cdda_play_mode = (m_command_buffer[1] & 0x02) ? 2 : 3; // mode 2 sets IRQ at end
@ -458,7 +461,7 @@ void pce_cd_device::nec_set_audio_start_position()
} }
else else
{ {
m_cdda_status = PCE_CD_CDDA_PLAYING; //m_cdda_status = PCE_CD_CDDA_PLAYING;
m_end_frame = m_toc->tracks[ cdrom_get_track(m_cd_file, m_current_frame) + 1 ].logframeofs; //get the end of THIS track m_end_frame = m_toc->tracks[ cdrom_get_track(m_cd_file, m_current_frame) + 1 ].logframeofs; //get the end of THIS track
m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame);
m_end_mark = 0; m_end_mark = 0;
@ -960,6 +963,8 @@ TIMER_CALLBACK_MEMBER(pce_cd_device::data_timer_callback)
/* We are done, disable the timer */ /* We are done, disable the timer */
logerror("Last frame read from CD\n"); logerror("Last frame read from CD\n");
m_data_transferred = 1; m_data_transferred = 1;
// data transfer is done, issue a pause
m_cdda_status = PCE_CD_CDDA_PAUSED;
m_data_timer->adjust(attotime::never); m_data_timer->adjust(attotime::never);
} }
else else