]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix CD32 CD boot after reset.
authorToni Wilen <twilen@winuae.net>
Sun, 8 Dec 2019 12:16:03 +0000 (14:16 +0200)
committerToni Wilen <twilen@winuae.net>
Sun, 8 Dec 2019 12:16:03 +0000 (14:16 +0200)
akiko.cpp
cia.cpp
devices.cpp
include/akiko.h

index 600a2c68fc01b15a045a7f6164b5be4708333bb8..cbcd207ca7f07a239e8c1e8274a5f3c56c938527 100644 (file)
--- a/akiko.cpp
+++ b/akiko.cpp
@@ -2039,7 +2039,30 @@ static void akiko_cdrom_free (void)
        sector_buffer_info_2 = 0;
 }
 
-void akiko_reset(int hardreset)
+static int akiko_thread_do(int start)
+{
+       if (!start) {
+               if (akiko_thread_running > 0) {
+                       cdaudiostop();
+                       akiko_thread_running = 0;
+                       while (akiko_thread_running == 0)
+                               sleep_millis(10);
+                       akiko_thread_running = 0;
+                       destroy_comm_pipe(&requests);
+                       return 1;
+               }
+       } else {
+               if (!akiko_thread_running) {
+                       akiko_thread_running = 1;
+                       init_comm_pipe(&requests, 100, 1);
+                       uae_start_thread(_T("akiko"), akiko_thread, 0, NULL);
+                       return 1;
+               }
+       }
+       return 0;
+}
+
+static void akiko_reset(int hardreset)
 {
        cdaudiostop_do ();
        nvram_read ();
@@ -2056,28 +2079,21 @@ void akiko_reset(int hardreset)
                cdrom_intreq = CDINTERRUPT_SUBCODE;
                cdrom_subcodeoffset = 0xc2;
                cdrom_intena = 0;
+               cdrom_flags = 0;
        }
        cdrom_led = 0;
        cdrom_receive_length = 0;
        cdrom_receive_offset = 0;
        cd_initialized = 0;
-
-       if (akiko_thread_running > 0) {
-               cdaudiostop ();
-               akiko_thread_running = 0;
-               while(akiko_thread_running == 0)
-                       sleep_millis (10);
-               akiko_thread_running = 0;
-       }
-       akiko_cdrom_free ();
        mediacheckcounter = 0;
-       akiko_inited = false;
 }
 
 static void akiko_free(void)
 {
-       akiko_reset(1);
+       akiko_thread_do(0);
        akiko_cdrom_free();
+       mediacheckcounter = 0;
+       akiko_inited = false;
 }
 
 int akiko_init (void)
@@ -2103,11 +2119,7 @@ int akiko_init (void)
                cdrom_data_offset = -1;
        }
        patchrom ();
-       if (!akiko_thread_running) {
-               akiko_thread_running = 1;
-               init_comm_pipe (&requests, 100, 1);
-               uae_start_thread (_T("akiko"), akiko_thread, 0, NULL);
-       }
+       akiko_thread_do(1);
        gui_flicker_led (LED_HD, 0, -1);
        akiko_inited = true;
 
diff --git a/cia.cpp b/cia.cpp
index 4d4ed98945aafb84bea4f58e6d6afe29142f34f3..a7514a32ee420922ea3240b2a32838678b9548a4 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -1795,13 +1795,6 @@ void CIA_reset (void)
                        map_overlay (oldovl ? 0 : 1);
                }
        }
-#ifdef CD32
-       if (!isrestore()) {
-               akiko_reset(1);
-               if (!akiko_init())
-                       currprefs.cs_cd32cd = changed_prefs.cs_cd32cd = 0;
-       }
-#endif
 }
 
 void dumpcia (void)
index a9e3a87c1af0204c216e8565107284064fb68a7b..f87624ff0105ba38cc227ab0f2ca1aea148c3479 100644 (file)
@@ -335,6 +335,9 @@ void virtualdevice_init (void)
 {
        reset_device_items();
 
+#ifdef CD32
+       akiko_init();
+#endif
 #ifdef AUTOCONFIG
        rtarea_setup ();
 #endif
index 2649c953cdf5420ba86e5adad8d8c54861baa703..502d6e367f8cb57a9258f23cb1b9a9136b2b8038 100644 (file)
@@ -2,11 +2,9 @@
 #define UAE_AKIKO_H
 
 #define AKIKO_BASE 0xb80000
-#define AKIKO_BASE_END 0xb80100 /* ?? */
+#define AKIKO_BASE_END 0xb80040
 
 extern int akiko_init (void);
-extern void akiko_reset(int);
-
 extern void akiko_mute (int);
 extern bool akiko_ntscmode(void);