Fix CDTV and CD32 statefile restore with paused CD audio and CD32 CD audio mute.

This commit is contained in:
Toni Wilen 2021-02-10 19:04:36 +02:00
parent d0e5671142
commit f1d80bcabc
3 changed files with 23 additions and 15 deletions

View File

@ -1527,23 +1527,23 @@ static void akiko_thread (void *null)
switch (b)
{
case 0x0102: // pause
sys_command_cd_pause (unitnum, 1);
sys_command_cd_pause(unitnum, 1);
break;
case 0x0103: // unpause
sys_command_cd_pause (unitnum, 0);
sys_command_cd_pause(unitnum, 0);
break;
case 0x0104: // stop
cdaudiostop_do ();
break;
case 0x0105: // mute change
sys_command_cd_volume (unitnum, cdrom_muted ? 0 : 0x7fff, cdrom_muted ? 0 : 0x7fff);
sys_command_cd_volume(unitnum, cdrom_muted ? 0 : 0x7fff, cdrom_muted ? 0 : 0x7fff);
break;
case 0x0111: // instant play
sys_command_cd_volume(unitnum, cdrom_muted ? 0 : 0x7fff, cdrom_muted ? 0 : 0x7fff);
cdaudioplay_do(true);
break;
case 0x0110: // do_play!
sys_command_cd_volume (unitnum, cdrom_muted ? 0 : 0x7fff, cdrom_muted ? 0 : 0x7fff);
sys_command_cd_volume(unitnum, cdrom_muted ? 0 : 0x7fff, cdrom_muted ? 0 : 0x7fff);
cdaudioplay_do(false);
break;
}
@ -2304,6 +2304,7 @@ void restore_akiko_final(void)
if (!currprefs.cs_cd32cd)
return;
write_comm_pipe_u32(&requests, 0x0102, 1); // pause
write_comm_pipe_u32(&requests, 0x0105, 1); // set mute
write_comm_pipe_u32(&requests, 0x0104, 1); // stop
write_comm_pipe_u32(&requests, 0x0103, 1); // unpause
if (cdrom_playing && isaudiotrack(last_play_pos)) {
@ -2311,7 +2312,11 @@ void restore_akiko_final(void)
write_comm_pipe_u32(&requests, last_play_pos, 0);
write_comm_pipe_u32(&requests, last_play_end, 0);
write_comm_pipe_u32(&requests, 0, 1);
uae_sem_wait(&cda_sem);
if (!cdrom_paused) {
uae_sem_wait(&cda_sem);
} else {
write_comm_pipe_u32(&requests, 0x0102, 1); // pause
}
}
cd_initialized = 2;
}
@ -2320,8 +2325,11 @@ void restore_akiko_final(void)
void akiko_mute (int muted)
{
cdrom_muted = muted;
if (unitnum >= 0)
write_comm_pipe_u32 (&requests, 0x0105, 1);
if (muted != cdrom_muted) {
cdrom_muted = muted;
if (currprefs.cs_cd32cd && unitnum >= 0) {
write_comm_pipe_u32(&requests, 0x0105, 1);
}
}
}

View File

@ -1941,7 +1941,11 @@ void restore_cdtv_final(void)
write_comm_pipe_u32(&requests, last_play_pos, 0);
write_comm_pipe_u32(&requests, last_play_end, 0);
write_comm_pipe_u32(&requests, 0, 1);
uae_sem_wait(&cda_sem);
if (cd_paused) {
write_comm_pipe_u32(&requests, 0x0105, 1); // paused
} else {
uae_sem_wait(&cda_sem);
}
}
}

View File

@ -87,7 +87,7 @@ static unsigned long ciaata_passed, ciaatb_passed, ciabta_passed, ciabtb_passed;
static unsigned long ciaatod, ciabtod, ciaatol, ciabtol, ciaaalarm, ciabalarm;
static int ciaatlatch, ciabtlatch;
static bool oldovl, oldcd32mute;
static bool oldovl;
static bool led;
static int led_old_brightness;
static unsigned long led_cycles_on, led_cycles_off, led_cycle;
@ -1028,10 +1028,7 @@ static void bfe001_change(void)
map_overlay(0);
}
}
if (currprefs.cs_cd32cd && (v & 1) != oldcd32mute) {
oldcd32mute = v & 1;
akiko_mute(oldcd32mute ? 0 : 1);
}
akiko_mute((v & 1) == 0);
}
static uae_u32 getciatod(uae_u32 tod)
@ -1896,7 +1893,6 @@ void CIA_reset (void)
kblostsynccnt = 0;
serbits = 0;
oldcd32mute = 1;
resetwarning_phase = resetwarning_timer = 0;
heartbeat_cnt = 0;
ciab_tod_event_state = 0;