From: Toni Wilen Date: Sun, 8 Dec 2019 12:16:03 +0000 (+0200) Subject: Fix CD32 CD boot after reset. X-Git-Tag: 4300~18 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=22e887d69a54bdbd6912d53159f999a09bf7ffd3;p=francis%2Fwinuae.git Fix CD32 CD boot after reset. --- diff --git a/akiko.cpp b/akiko.cpp index 600a2c68..cbcd207c 100644 --- 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 4d4ed989..a7514a32 100644 --- 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) diff --git a/devices.cpp b/devices.cpp index a9e3a87c..f87624ff 100644 --- a/devices.cpp +++ b/devices.cpp @@ -335,6 +335,9 @@ void virtualdevice_init (void) { reset_device_items(); +#ifdef CD32 + akiko_init(); +#endif #ifdef AUTOCONFIG rtarea_setup (); #endif diff --git a/include/akiko.h b/include/akiko.h index 2649c953..502d6e36 100644 --- a/include/akiko.h +++ b/include/akiko.h @@ -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);