]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix CDTV and CD32 statefile restore with paused CD audio and CD32 CD audio mute.
authorToni Wilen <twilen@winuae.net>
Wed, 10 Feb 2021 17:04:36 +0000 (19:04 +0200)
committerToni Wilen <twilen@winuae.net>
Wed, 10 Feb 2021 17:04:36 +0000 (19:04 +0200)
akiko.cpp
cdtv.cpp
cia.cpp

index a146ccff66351b66d0feac469e1fc4b3c33dd7b7..f9f8cf373c4217ffdf36eaf26faccf430e8bdabc 100644 (file)
--- a/akiko.cpp
+++ b/akiko.cpp
@@ -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);
+               }
+       }
 }
 
index 43541a359e295ab4ac3d7e9847e1076320fce4a8..07fa45cd43f05c2886c78a62c29594e790b37bb8 100644 (file)
--- a/cdtv.cpp
+++ b/cdtv.cpp
@@ -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);
+               }
        }
 }
 
diff --git a/cia.cpp b/cia.cpp
index a4f5ea01012081549fd733bda3c59c637522c180..19d64180ed9d553e22a915bb0dfc3ebb4345d4c9 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -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;