Fix CD32 CD boot after reset.

This commit is contained in:
Toni Wilen 2019-12-08 14:16:03 +02:00
parent 30d68b222e
commit 22e887d69a
4 changed files with 33 additions and 27 deletions

View File

@ -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;

View File

@ -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)

View File

@ -335,6 +335,9 @@ void virtualdevice_init (void)
{
reset_device_items();
#ifdef CD32
akiko_init();
#endif
#ifdef AUTOCONFIG
rtarea_setup ();
#endif

View 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);