]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2210b2
authorToni Wilen <twilen@winuae.net>
Thu, 8 Jul 2010 14:35:06 +0000 (17:35 +0300)
committerToni Wilen <twilen@winuae.net>
Thu, 8 Jul 2010 14:35:06 +0000 (17:35 +0300)
19 files changed:
akiko.cpp
audio.cpp
blkdev.cpp
blkdev_cdimage.cpp
catweasel.cpp
cdtv.cpp
cia.cpp
custom.cpp
debug.cpp
include/blkdev.h
include/debug.h
include/savestate.h
od-win32/blkdev_win32_aspi.cpp
od-win32/blkdev_win32_ioctl.cpp
od-win32/blkdev_win32_spti.cpp
od-win32/direct3d.cpp
od-win32/win32.h
od-win32/winuaechangelog.txt
savestate.cpp

index d2897267f9beb9fde9acf8c3d5bb0e55259cd008..c4229fb77b76eeea2349cda6d7334ff827001198 100644 (file)
--- a/akiko.cpp
+++ b/akiko.cpp
@@ -422,6 +422,7 @@ static uae_u8 *sector_buffer_info_1, *sector_buffer_info_2;
 static int unitnum = -1;
 static int cdromok = 0;
 static int cd_hunt;
+static bool akiko_inited;
 static volatile int mediachanged, mediacheckcounter;
 static volatile int frame2counter;
 
@@ -511,22 +512,46 @@ static void cdaudioplay_do (void)
        sys_command_cd_play (DF_IOCTL, unitnum, startmsf, endmsf, scan);
 }
 
+static bool isaudiotrack (uae_u32 startmsf)
+{
+       uae_u8 *buf = cdrom_toc_cd_buffer;
+       uae_u8 *s = NULL;
+       uae_u32 addr;
+       int i;
+
+       if (!cdrom_toc_entries)
+               return false;
+       for (i = 0; i < cdrom_toc_entries; i++) {
+               s = buf + 4 + i * 11;
+               addr = (s[8] << 16) | (s[9] << 8) | (s[10] << 0);
+               if (s[3] > 0 && s[3] < 100 && addr >= startmsf)
+                       break;
+       }
+       if (s && (s[1] & 0x0c) == 0x04) {
+               write_log (L"tried to play data track %d!\n", s[3]);
+               return false;
+       }
+       return true;
+}
+
+
 static uae_u32 last_play_end;
 static int cd_play_audio (uae_u32 startmsf, uae_u32 endmsf, int scan)
 {
-#if 1
        uae_u8 *buf = cdrom_toc_cd_buffer;
-       uae_u8 *s;
+       uae_u8 *s = NULL;
        uae_u32 addr;
        int i;
 
+       if (!cdrom_toc_entries)
+               return 0;
        for (i = 0; i < cdrom_toc_entries; i++) {
                s = buf + 4 + i * 11;
                addr = (s[8] << 16) | (s[9] << 8) | (s[10] << 0);
                if (s[3] > 0 && s[3] < 100 && addr >= startmsf)
                        break;
        }
-       if ((s[1] & 0x0c) == 0x04) {
+       if (s && (s[1] & 0x0c) == 0x04) {
                write_log (L"tried to play data track %d!\n", s[3]);
                s += 11;
                startmsf = (s[8] << 16) | (s[9] << 8) | (s[10] << 0);
@@ -535,10 +560,9 @@ static int cd_play_audio (uae_u32 startmsf, uae_u32 endmsf, int scan)
                //cdrom_audiotimeout = 312;
                return 0;
        }
-#endif
        last_play_end = endmsf;
        cdrom_audiotimeout = 0;
-       write_comm_pipe_u32 (&requests, 0x110, 0);
+       write_comm_pipe_u32 (&requests, 0x0110, 0);
        write_comm_pipe_u32 (&requests, startmsf, 0);
        write_comm_pipe_u32 (&requests, endmsf, 0);
        write_comm_pipe_u32 (&requests, scan, 1);
@@ -773,13 +797,13 @@ static int cdrom_command_led (void)
 {
        int v = cdrom_command_buffer[1];
        int old = cdrom_led;
-       cdrom_led &= ~1;
-       cdrom_led |= v & 1;
+       cdrom_led &= ~LED_CD_ACTIVE;
+       cdrom_led |= (v & 1) ? LED_CD_ACTIVE : 0;
        if (cdrom_led != old)
                gui_flicker_led (LED_CD, 0, cdrom_led);
        if (v & 0x80) { // result wanted?
                cdrom_result_buffer[0] = cdrom_command;
-               cdrom_result_buffer[1] = cdrom_led & 1;
+               cdrom_result_buffer[1] = (cdrom_led & LED_CD_ACTIVE) ? 1 : 0;
                return 2;
        }
        return 0;
@@ -1178,7 +1202,7 @@ void AKIKO_hsync_handler (void)
 {
        static int framecounter;
 
-       if (!currprefs.cs_cd32cd)
+       if (!currprefs.cs_cd32cd || !akiko_inited)
                return;
 
        if (cd_hunt) {
@@ -1699,6 +1723,7 @@ void akiko_reset (void)
        }
        akiko_cdrom_free ();
        mediacheckcounter = 0;
+       akiko_inited = false;
 }
 
 
@@ -1736,12 +1761,13 @@ int akiko_init (void)
                init_comm_pipe (&requests, 100, 1);
                uae_start_thread (L"akiko", akiko_thread, 0, NULL);
        }
+       akiko_inited = true;
        return 1;
 }
 
 #ifdef SAVESTATE
 
-uae_u8 *save_akiko(int *len)
+uae_u8 *save_akiko (int *len)
 {
        uae_u8 *dstbak, *dst;
        int i;
@@ -1802,6 +1828,7 @@ uae_u8 *restore_akiko (uae_u8 *src)
        uae_u32 v;
        int i;
 
+       akiko_free ();
        if (!currprefs.cs_cd32cd || !cdromok) {
                changed_prefs.cs_cd32c2p = changed_prefs.cs_cd32cd = changed_prefs.cs_cd32nvram = true;
                currprefs.cs_cd32c2p = currprefs.cs_cd32cd = currprefs.cs_cd32nvram = true;
@@ -1866,11 +1893,13 @@ void restore_akiko_finish (void)
 {
        if (!currprefs.cs_cd32cd)
                return;
+       akiko_init ();
        akiko_c2p_do ();
+       cdrom_toc ();
        write_comm_pipe_u32 (&requests, 0x0102, 1); // pause
        write_comm_pipe_u32 (&requests, 0x0104, 1); // stop
        write_comm_pipe_u32 (&requests, 0x0103, 1); // unpause
-       if (cdrom_playing) {
+       if (cdrom_playing && isaudiotrack (last_play_pos)) {
                write_comm_pipe_u32 (&requests, 0x0103, 1); // unpause
                write_comm_pipe_u32 (&requests, 0x0110, 0); // play
                write_comm_pipe_u32 (&requests, last_play_pos, 0);
index 38e38edaf8e1874e5b206e4fc7972a0af40584dd..d5ed42bc6df0169232dab28a0c24791e8f057a8d 100644 (file)
--- a/audio.cpp
+++ b/audio.cpp
@@ -45,7 +45,7 @@
 
 #define MAX_EV ~0ul
 //#define DEBUG_AUDIO
-#define DEBUG_CHANNEL_MASK 2
+#define DEBUG_CHANNEL_MASK 15
 //#define TEST_AUDIO
 
 #define PERIOD_MIN 4
@@ -1034,13 +1034,18 @@ static int audio_work_to_do;
 static void zerostate (int nr)
 {
        struct audio_channel_data *cdp = audio_channel + nr;
+#ifdef DEBUG_AUDIO
+       write_log (L"%d: ZEROSTATE\n", nr);
+#endif
        cdp->state = 0;
        cdp->evtime = MAX_EV;
        cdp->intreq2 = 0;
        cdp->dsr = cdp->dr = false;
+       cdp->dmaenstore = false;
 #ifdef TEST_AUDIO
        cdp->have_dat = false;
 #endif
+
 }
 
 static void schedule_audio (void)
@@ -1218,23 +1223,35 @@ static void audio_state_channel2 (int nr, bool perfin)
 {
        struct audio_channel_data *cdp = audio_channel + nr;
        bool chan_ena = (dmacon & DMA_MASTER) && (dmacon & (1 << nr));
+       bool old_dma = cdp->dmaenstore;
        int audav = adkcon & (0x01 << nr);
        int audap = adkcon & (0x10 << nr);
        int napnav = (!audav && !audap) || audav;
        int hpos = current_hpos ();
 
-#ifdef DEBUG_AUDIO
-       if (debugchannel (nr)) {
-               if (cdp->dmaenstore != chan_ena) {
-                       cdp->dmaenstore = chan_ena;
-                       write_log (L"%d:DMA=%d IRQ=%d PC=%08x\n", nr, chan_ena, isirq (nr) ? 1 : 0, M68K_GETPC);
-               }
+       cdp->dmaenstore = chan_ena;
+
+       if (currprefs.produce_sound == 0) {
+               zerostate (nr);
+               return;
        }
+       audio_activate ();
+
+       if ((cdp->state == 2 || cdp->state == 3) && (currprefs.cpu_model >= 68020 || currprefs.m68k_speed != 0) && !chan_ena && old_dma) {
+               // DMA switched off, state=2/3 and "too fast CPU": kill DMA instantly
+               // or CPU timed DMA wait routines in common tracker players will lose notes
+#ifdef DEBUG_AUDIO
+               write_log (L"%d: INSTADMAOFF\n", nr, M68K_GETPC);
 #endif
-       if (currprefs.produce_sound == 0) {
                zerostate (nr);
                return;
        }
+
+#ifdef DEBUG_AUDIO
+       if (debugchannel (nr) && old_dma != chan_ena) {
+               write_log (L"%d:DMA=%d IRQ=%d PC=%08x\n", nr, chan_ena, isirq (nr) ? 1 : 0, M68K_GETPC);
+       }
+#endif
        switch (cdp->state)
        {
        case 0:
@@ -1270,6 +1287,7 @@ static void audio_state_channel2 (int nr, bool perfin)
                }
                break;
        case 1:
+               cdp->evtime = MAX_EV;
                if (!cdp->dat_written)
                        return;
 #ifdef TEST_AUDIO
@@ -1285,6 +1303,7 @@ static void audio_state_channel2 (int nr, bool perfin)
                cdp->state = 5;
                break;
        case 5:
+               cdp->evtime = MAX_EV;
                if (!cdp->dat_written)
                        return;
 #ifdef DEBUG_AUDIO
@@ -1691,8 +1710,13 @@ void update_audio (void)
                }
 
                for (i = 0; i < 4; i++) {
-                       if (audio_channel[i].evtime == 0)
+                       if (audio_channel[i].evtime == 0) {
                                audio_state_channel (i, true);
+                               if (audio_channel[i].evtime == 0) {
+                                       write_log (L"evtime==0 sound bug channel %d\n");
+                                       audio_channel[i].evtime = MAX_EV;
+                               }
+                       }
                }
        }
 end:
@@ -1923,7 +1947,7 @@ uae_u8 *save_audio (int i, int *len, uae_u8 *dstptr)
        if (dstptr)
                dstbak = dst = dstptr;
        else
-               dstbak = dst = (uae_u8*)malloc (100);
+               dstbak = dst = xmalloc (uae_u8, 100);
        acd = audio_channel + i;
        save_u8 ((uae_u8)acd->state);
        save_u8 (acd->vol);
index f1638fed9dd92efb39b26981ecf9f9674d78bb7e..a4bd8b6d1eb65731eb57f71aa48c4f63009233cb 100644 (file)
@@ -34,7 +34,7 @@ static void install_driver (int flags)
 
        device_func[DF_IOCTL] = NULL;
        device_func[DF_SCSI] = &devicefunc_win32_aspi;
-       if (devicefunc_cdimage.openbus (flags)) {
+       if (devicefunc_cdimage.checkbus (flags | DEVICE_TYPE_CHECKAVAIL)) {
                device_func[DF_IOCTL] = &devicefunc_cdimage;
                device_func[DF_SCSI] = NULL;
                return;
@@ -52,6 +52,10 @@ static void install_driver (int flags)
                        device_func[DF_IOCTL] = 0;
        }
 #endif
+       if (device_func[DF_SCSI])
+               device_func[DF_SCSI]->checkbus (DEVICE_TYPE_CHECKAVAIL);
+       if (device_func[DF_IOCTL])
+               device_func[DF_IOCTL]->checkbus (DEVICE_TYPE_CHECKAVAIL);
 }
 #endif
 
@@ -499,8 +503,10 @@ uae_u8 *restore_cd (int unit, uae_u8 *src)
 
        flags = restore_u32 ();
        s = restore_string ();
-       if ((flags & 4) && unit == 0)
+       if ((flags & 4) && unit == 0) {
                _tcscpy (changed_prefs.cdimagefile, s);
+               _tcscpy (currprefs.cdimagefile, s);
+       }
        return src;
 }
 
index 5e2e052d2f66eaf162ec7e354fce72a1d3a16346..afe857a954a131d0b901e2e007691468a7e3214a 100644 (file)
@@ -59,7 +59,7 @@ static uae_u32 cd_last_pos;
 static int cdda_start, cdda_end;
 
 static int imagechange;
-static bool donotmountme;
+static int donotmountme;
 static TCHAR newfile[MAX_DPATH];
 
 /* convert minutes, seconds and frames -> logical sector number */
@@ -583,8 +583,6 @@ static uae_u8 *command_qcode (int unitnum)
 
        p = buf + 4;
 
-       if (pos >= 150)
-               trk = 0;
        start = end = 0;
        for (trk = 0; trk <= tracks; trk++) {
                struct cdtoc *td = &toc[trk];
@@ -605,10 +603,10 @@ static uae_u8 *command_qcode (int unitnum)
        pos -= start;
        if (pos < 0)
                pos = 0;
-       msf = lsn2msf (pos);
-       p[9] = (pos >> 16) & 0xff;
-       p[10] = (pos >> 8) & 0xff;
-       p[11] = (pos >> 0) & 0xff;
+       msf = lsn2msf (pos - 150);
+       p[9] = (msf >> 16) & 0xff;
+       p[10] = (msf >> 8) & 0xff;
+       p[11] = (msf >> 0) & 0xff;
 
        return buf;
 }
@@ -1032,7 +1030,8 @@ static int open_device (int unitnum)
 {
        if (unitnum)
                return 0;
-       parse_image ();
+       if (!tracks)
+               parse_image ();
        return 1;
 }
 
@@ -1041,11 +1040,12 @@ static void close_device (int unitnum)
        unload_image ();
 }
 
-static bool mountme (void)
+static int mountme (bool checkparse)
 {
        sys_command_setunit (-1);
+
        bool sel = false;
-       donotmountme = true;
+       donotmountme = 1;
        device_func_init (DEVICE_TYPE_ANY);
        for (int i = 0; i < MAX_TOTAL_DEVICES && !sel; i++) {
                int opened = sys_command_isopen (i);
@@ -1057,21 +1057,23 @@ static bool mountme (void)
                                if (!_tcsicmp (currprefs.cdimagefile, discsi->label)) {
                                        sys_command_setunit (i);
                                        write_log (L"Drive '%s' (unit=%d) selected (media=%d)\n", discsi->label, i, discsi->media_inserted);
-                                       sel = true;
+                                       donotmountme = false;
+                                       return -1;
                                }
                        }
                }
        }
-       donotmountme = false;
-       if (!sel) {
+       donotmountme = -1;
+       device_func_init (DEVICE_TYPE_ANY); // activate us again
+       donotmountme = 0;
+       if (checkparse) {
                sys_command_setunit (0);
-               device_func_init (DEVICE_TYPE_ANY); // activate us again
                parse_image ();
                int media = tracks > 0;
                write_log (L"IMG_EMU (%s) selected (media=%d)\n", currprefs.cdimagefile, media);
-               return true;
+               return 1;
        }
-       return false;
+       return 0;
 }
 
 void cdimage_vsync (void)
@@ -1097,16 +1099,18 @@ void cdimage_vsync (void)
        newfile[0] = 0;
        write_log (L"CD: delayed insert '%s'\n", currprefs.cdimagefile[0] ? currprefs.cdimagefile : L"<EMPTY>");
        if (currprefs.scsi) {
-               donotmountme = true;
+               donotmountme = 1;
                int un = scsi_do_disk_device_change ();
-               donotmountme = false;
+               donotmountme = 0;
                if (un < 0) {
+                       donotmountme = -1;
                        device_func_init (DEVICE_TYPE_ANY); // activate us again
+                       donotmountme = 0;
                        parse_image ();
                        scsi_do_disk_change (255, 1);
                }
        } else {
-               mountme ();
+               mountme (true);
        }
 #ifdef RETROPLATFORM
        rp_cd_image_change (0, currprefs.cdimagefile);
@@ -1121,27 +1125,42 @@ static int ismedia (int unitnum, int quick)
        return tracks > 0 ? 1 : 0;
 }
 
-static int open_bus (int flags)
+static int check_bus (int flags)
 {
-       int v;
-
-       if (donotmountme && !(flags & DEVICE_TYPE_ALLOWEMU))
+       if (!(flags & DEVICE_TYPE_CHECKAVAIL))
+               return 1;
+       if (donotmountme > 0)
                return 0;
+       if (donotmountme < 0)
+               return 1;
        if (imagechange)
                return 1;
-       v = currprefs.cdimagefile[0] ? 1 : 0;
+       int v = currprefs.cdimagefile[0] ? 1 : 0;
        if (v) {
-               if (!mountme ())
+               if (mountme (false) < 0) // is it supported <drive letter:>\?
                        return 0;
        }
        if (currprefs.cdimagefileuse) {
                v = 1;
        }
+       return v;
+}
+
+static int open_bus (int flags)
+{
+       if (!(flags & DEVICE_TYPE_CHECKAVAIL))
+               return 1;
+       if (donotmountme > 0)
+               return 0;
+       if (donotmountme < 0)
+               return 1;
+
+       mountme (true);
 #ifdef RETROPLATFORM
        rp_cd_change (0, 0);
        rp_cd_image_change (0, currprefs.cdimagefile);
 #endif
-       return v;
+       return 1;
 }
 
 static void close_bus (void)
@@ -1178,7 +1197,7 @@ static struct device_info *info_device (int unitnum, struct device_info *di)
 }
 
 struct device_functions devicefunc_cdimage = {
-       open_bus, close_bus, open_device, close_device, info_device,
+       check_bus, open_bus, close_bus, open_device, close_device, info_device,
        0, 0, 0,
        command_pause, command_stop, command_play, command_volume, command_qcode,
        command_toc, command_read, command_rawread, 0,
index a05f7e7c3302e7fa6f9d230da01047cdd8148534..a4433e486d4946a7f818bb5698beeb916b9d66f3 100644 (file)
@@ -13,6 +13,7 @@
 #include "uae.h"
 #include "zfile.h"
 
+#define DRIVER
 #include <catweasl_usr.h>
 
 struct catweasel_contr cwc;
index 7949b865bcb5dc9f4431cbed9872a12b60adc838..0f09c16277f48d81e5e8fb137db18612b1b91678 100644 (file)
--- a/cdtv.cpp
+++ b/cdtv.cpp
@@ -30,6 +30,7 @@
 #include "threaddep/thread.h"
 #include "a2091.h"
 #include "uae.h"
+#include "savestate.h"
 
 /* DMAC CNTR bits. */
 #define CNTR_TCEN               (1<<7)
@@ -81,6 +82,7 @@ static volatile int dmac_dma;
 static volatile int activate_stch, cdrom_command_done, play_state, play_state_cmd, play_statewait;
 static volatile int cdrom_sector, cdrom_sectors, cdrom_length, cdrom_offset;
 static volatile int cd_playing, cd_paused, cd_motor, cd_media, cd_error, cd_finished, cd_isready, cd_hunt;
+static uae_u32 last_play_pos, last_play_end;
 
 static volatile int cdtv_hsync, dma_finished, cdtv_sectorsize;
 static volatile uae_u64 dma_wait;
@@ -171,7 +173,7 @@ static int get_qcode (void)
        memcpy (cdrom_qcode, s, 16);
        if (cd_playing) {
                if (s[1] == AUDIO_STATUS_IN_PROGRESS) {
-                       int end = msf2lsn((s[5 + 4] << 16) | (s[6 + 4] << 8) | (s[7 + 4]));
+                       int end = msf2lsn ((s[5 + 4] << 16) | (s[6 + 4] << 8) | (s[7 + 4]));
                        if (end >= play_end - 75)
                                finished_cdplay ();
                } else if (s[1] == AUDIO_STATUS_PLAY_COMPLETE) {
@@ -281,6 +283,8 @@ static int play_cdtrack (uae_u8 *p)
        }
        play_end = msf2lsn (end);
        play_start = msf2lsn (start);
+       last_play_end = start;
+       last_play_end = end;
 #ifdef CDTV_DEBUG
        write_log (L"PLAY CD AUDIO from %d-%d, %06X (%d) to %06X (%d)\n",
                track_start, track_end,
@@ -357,7 +361,6 @@ static int cdrom_subq (uae_u8 *out, int msflsn)
        out[10] = (msflsn ? trackposmsf : trackposlsn) >> 8;
        out[11] = (msflsn ? trackposmsf : trackposlsn) >> 0;
        out[12] = 0;
-
        return 13;
 }
 
@@ -678,6 +681,10 @@ static void *dev_thread (void *p)
        for (;;) {
 
                uae_u32 b = read_comm_pipe_u32_blocking (&requests);
+               if (b == 0xffff) {
+                       thread_alive = -1;
+                       return NULL;
+               }
                if (unitnum < 0)
                        continue;
 
@@ -719,9 +726,6 @@ static void *dev_thread (void *p)
                case 0x0110: // do_play!
                        do_play ();
                        break;
-               case 0xffff:
-                       thread_alive = -1;
-                       return NULL;
                default:
                        cdrom_command_thread (b);
                        break;
@@ -1006,7 +1010,7 @@ void CDTV_hsync_handler (void)
                cd_led |= LED_CD_AUDIO;
        else
                cd_led &= ~LED_CD_AUDIO;
-       if (dmac_dma)
+       if (dmac_dma || dma_finished)
                cd_led |= LED_CD_ACTIVE;
        else
                cd_led &= ~LED_CD_ACTIVE;
@@ -1452,24 +1456,12 @@ addrbank dmac_bank = {
 };
 
 
-void cdtv_entergui (void)
-{
-       if (cd_playing && !cd_paused)
-               write_comm_pipe_u32 (&requests, 0x102, 1);
-}
-void cdtv_exitgui (void)
-{
-       if (cd_playing && !cd_paused)
-               write_comm_pipe_u32 (&requests, 0x103, 1);
-}
-
-
 /* CDTV batterybacked RAM emulation */
 #define CDTV_NVRAM_MASK 16383
 #define CDTV_NVRAM_SIZE 32768
 static uae_u8 cdtv_battram[CDTV_NVRAM_SIZE];
 
-void cdtv_loadcardmem(uae_u8 *p, int size)
+void cdtv_loadcardmem (uae_u8 *p, int size)
 {
        struct zfile *f;
 
@@ -1482,7 +1474,7 @@ void cdtv_loadcardmem(uae_u8 *p, int size)
        zfile_fclose (f);
 }
 
-void cdtv_savecardmem(uae_u8 *p, int size)
+void cdtv_savecardmem (uae_u8 *p, int size)
 {
        struct zfile *f;
 
@@ -1652,3 +1644,63 @@ void cdtv_init (void)
        cdtv_battram_reset ();
        open_unit ();
 }
+
+#ifdef SAVESTATE
+
+uae_u8 *save_cdtv (int *len)
+{
+       uae_u8 *dstbak, *dst;
+       int i;
+
+       if (!currprefs.cs_cd32cd)
+               return NULL;
+       return NULL;
+       dstbak = dst = xmalloc (uae_u8, 1000);
+       *len = dst - dstbak;
+       return dstbak;
+}
+
+uae_u8 *restore_cdtv (uae_u8 *src)
+{
+       uae_u32 v;
+       int i;
+
+       cdtv_free ();
+       if (!currprefs.cs_cdtvcd) {
+               changed_prefs.cs_cdtvcd = changed_prefs.cs_cdtvram = true;
+               currprefs.cs_cdtvcd = currprefs.cs_cdtvram = true;
+               cdtv_init ();
+       }
+       return src;
+}
+
+void restore_cdtv_finish (void)
+{
+       if (!currprefs.cs_cdtvcd)
+               return;
+       cdtv_init ();
+       get_toc ();
+       write_comm_pipe_u32 (&requests, 0x0102, 1); // pause
+       write_comm_pipe_u32 (&requests, 0x0104, 1); // stop
+       write_comm_pipe_u32 (&requests, 0x0103, 1); // unpause
+       if (cd_playing) {
+               write_comm_pipe_u32 (&requests, 0x0103, 1); // unpause
+               write_comm_pipe_u32 (&requests, 0x0110, 0); // play
+               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);
+       }
+}
+
+#endif
+
+void cdtv_entergui (void)
+{
+       if (cd_playing && !cd_paused)
+               write_comm_pipe_u32 (&requests, 0x102, 1);
+}
+void cdtv_exitgui (void)
+{
+       if (cd_playing && !cd_paused)
+               write_comm_pipe_u32 (&requests, 0x103, 1);
+}
diff --git a/cia.cpp b/cia.cpp
index 03626be96dd1c73529d4f278047b9b858ca5d28b..f7e205a6a20192456f30fafc6efc61693d61c99b 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -1207,7 +1207,7 @@ void CIA_reset (void)
                DISK_select (ciabprb);
        }
 #ifdef CD32
-       if (savestate_state != STATE_RESTORE) {
+       if (savestate_state != STATE_RESTORE && savestate_state != STATE_DORESTORE) {
                akiko_reset ();
                if (!akiko_init ())
                        currprefs.cs_cd32cd = changed_prefs.cs_cd32cd = 0;
index 20910d0f07490ab264393e307b986e67089c838d..cc742de4e50d9b031503c75e05c346d054bfa681 100644 (file)
@@ -4232,7 +4232,7 @@ static int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value, int noget)
 {
        int v;
 
-       debug_wputpeekdma (0xdff000 + addr, value);
+       value = debug_wputpeekdma (0xdff000 + addr, value);
        copper_access = 1;
        v = custom_wput_1 (hpos, addr, value, noget);
        copper_access = 0;
index 606e71179b66f30d5fc07954cd3c6bfebf510b41..ea1b487da2298ef84ee28a3bd9701f663194a277 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -1856,18 +1856,20 @@ static uae_u8 *REGPARAM2 debug_xlate (uaecptr addr)
        return debug_mem_banks[munge24 (addr) >> 16]->xlateaddr (addr);
 }
 
-void debug_wputpeekdma (uaecptr addr, uae_u32 v)
+uae_u16 debug_wputpeekdma (uaecptr addr, uae_u32 v)
 {
        if (!memwatch_enabled)
-               return;
+               return v;
        memwatch_func (addr, 2, 2, &v);
+       return v;
 }
-void debug_wgetpeekdma (uaecptr addr, uae_u32 v)
+uae_u16 debug_wgetpeekdma (uaecptr addr, uae_u32 v)
 {
        uae_u32 vv = v;
        if (!memwatch_enabled)
-               return;
+               return v;
        memwatch_func (addr, 1, 2, &vv);
+       return vv;
 }
 
 void debug_putlpeek (uaecptr addr, uae_u32 v)
index 6c67714e17262852c17d7e232b1b934177625093..7cd2f7643efb2a12149883055ee58c951095d293 100644 (file)
@@ -25,7 +25,8 @@
 
 #define DEVICE_TYPE_ANY 1
 #define DEVICE_TYPE_SCSI 2
-#define DEVICE_TYPE_ALLOWEMU 0x100
+#define DEVICE_TYPE_ALLOWEMU   0x10000000
+#define DEVICE_TYPE_CHECKAVAIL 0x20000000
 
 #define DF_SCSI 0
 #define DF_IOCTL 1
@@ -65,6 +66,7 @@ struct amigascsi
     uae_u16 sactual;
 };
 
+typedef int (*check_bus_func)(int flags);
 typedef int (*open_bus_func)(int flags);
 typedef void (*close_bus_func)(void);
 typedef int (*open_device_func)(int);
@@ -88,6 +90,7 @@ typedef int (*isatapi_func)(int);
 typedef int (*ismedia_func)(int, int);
 
 struct device_functions {
+       check_bus_func checkbus;
     open_bus_func openbus;
     close_bus_func closebus;
     open_device_func opendev;
index 038322e873bb919289ae3f97fd262ea417bb267f..c9dd6d5947f4d0e0c28ed8500ebb089147694eba 100644 (file)
@@ -64,8 +64,8 @@ extern struct memwatch_node mwnodes[MEMWATCH_TOTAL];
 
 extern void memwatch_dump2 (TCHAR *buf, int bufsize, int num);
 
-void debug_wgetpeekdma (uaecptr addr, uae_u32 v);
-void debug_wputpeekdma (uaecptr addr, uae_u32 v);
+uae_u16 debug_wgetpeekdma (uaecptr addr, uae_u32 v);
+uae_u16 debug_wputpeekdma (uaecptr addr, uae_u32 v);
 void debug_lgetpeek (uaecptr addr, uae_u32 v);
 void debug_wgetpeek (uaecptr addr, uae_u32 v);
 void debug_bgetpeek (uaecptr addr, uae_u32 v);
index b3d6d309e7cba098295b9eb26ef4aedc655f8c1d..4433446ee3f7c5c6a6e7e80ed4afc29c3ee7dbce 100644 (file)
@@ -89,9 +89,13 @@ extern void restore_p96_finish (void);
 extern uae_u8 *restore_keyboard (uae_u8 *);
 extern uae_u8 *save_keyboard (int *);
 
-extern uae_u8 *restore_akiko(uae_u8 *src);
-extern uae_u8 *save_akiko(int *len);
-extern void restore_akiko_finish(void);
+extern uae_u8 *restore_akiko (uae_u8 *src);
+extern uae_u8 *save_akiko (int *len);
+extern void restore_akiko_finish (void);
+
+extern uae_u8 *restore_cdtv (uae_u8 *src);
+extern uae_u8 *save_cdtv (int *len);
+extern void restore_cdtv_finish (void);
 
 extern uae_u8 *restore_filesys (uae_u8 *src);
 extern uae_u8 *save_filesys (int num, int *len);
index 74a83bf65114734eb7670b850473ba8f8083d705..7d67b3afa7f6496a01e4cd1adc7334ede402a51a 100644 (file)
@@ -187,13 +187,13 @@ static int open_driver (SCSI *scgp)
        nero = frog = 0;
        _tcscpy (path, L"WNASPI32");
        if (currprefs.win32_uaescsimode == UAESCSI_NEROASPI) {
-               const TCHAR *p = get_aspi_path(1);
+               const TCHAR *p = get_aspi_path (1);
                if (p) {
                        _tcscpy (path, p);
                        nero = 1;
                }
        } else if (currprefs.win32_uaescsimode == UAESCSI_FROGASPI) {
-               const TCHAR *p = get_aspi_path(2);
+               const TCHAR *p = get_aspi_path (2);
                if (p) {
                        _tcscpy (path, p);
                        frog = 1;
@@ -252,6 +252,9 @@ static int open_driver (SCSI *scgp)
 
        write_log (L"ASPI: open_driver HostASPIStatus=0x%x HACount=0x%x\n", ASPIStatus, HACount);
 
+       if (!scgp)
+               return TRUE;
+
        for (i=0; i < busses; i++) {
                SRB_HAInquiry s;
                ha_inquiry(scgp, i, &s);
@@ -817,18 +820,33 @@ static uae_u8 *execscsicmd_in (int unitnum, uae_u8 *data, int len, int *outlen)
 
 static SCSI *scsi_handle;
 
+static int check_scsi_bus (int flags)
+{
+       if (open_driver (NULL)) {
+               close_driver ();
+               return 1;
+       }
+       return 0;
+}
+
 static int open_scsi_bus (int flags)
 {
        SCSI *scgp = openscsi (-1, -1, -1);
-       unitcnt = 0;
        if (scgp) {
+               unitcnt = 0;
                scan_scsi_bus (scgp, flags);
                uae_sem_init (&scgp_sem, 0, 1);
+               scsi_handle = scgp;
        }
-       scsi_handle = scgp;
        return scgp ? 1 : 0;
 }
 
+static void close_scsi_bus (void)
+{
+       closescsi (scsi_handle);
+       scsi_handle = 0;
+}
+
 static int mediacheck (int unitnum)
 {
        uae_u8 cmd [6] = { 0,0,0,0,0,0 }; /* TEST UNIT READY */
@@ -891,12 +909,6 @@ static void close_scsi_device (int unitnum)
        si[unitnum].handle = 0;
 }
 
-static void close_scsi_bus (void)
-{
-       closescsi (scsi_handle);
-       scsi_handle = 0;
-}
-
 static int execscsicmd_direct (int unitnum, struct amigascsi *as)
 {
        int sactual = 0, i, parm;
@@ -1015,7 +1027,7 @@ static struct device_scsi_info *scsi_info (int unitnum, struct device_scsi_info
 }
 
 struct device_functions devicefunc_win32_aspi = {
-       open_scsi_bus, close_scsi_bus, open_scsi_device, close_scsi_device, info_device,
+       check_scsi_bus, open_scsi_bus, close_scsi_bus, open_scsi_device, close_scsi_device, info_device,
        execscsicmd_out, execscsicmd_in, execscsicmd_direct,
        0, 0, 0, 0, 0, 0, 0, 0, 0, check_isatapi, scsi_info, 0
 };
index c6102081c47c88a4dbddd39f1e6a4b936ef0121b..bb24711175106ff3a18f8423d9e48f9696c0429f 100644 (file)
@@ -577,7 +577,7 @@ static int ioctl_command_play (int unitnum, uae_u32 start, uae_u32 end, int scan
 
        } else if (ciw->cdda) {
 
-               if (!open_createfile (unitnum, 1))
+               if (!open_createfile (unitnum, 0))
                        return 0;
                ciw->cdda_paused = 0;
                ciw->cdda_play_finished = 0;
@@ -758,9 +758,9 @@ static uae_u8 *ioctl_command_qcode (int unitnum)
                if (pos < 0)
                        pos = 0;
                msf = lsn2msf (pos);
-               p[9] = (pos >> 16) & 0xff;
-               p[10] = (pos >> 8) & 0xff;
-               p[11] = (pos >> 0) & 0xff;
+               p[9] = (msf >> 16) & 0xff;
+               p[10] = (msf >> 8) & 0xff;
+               p[11] = (msf >> 0) & 0xff;
 
                return buf;
 
@@ -1179,6 +1179,11 @@ static void close_bus (void)
 
 static int total_devices;
 
+static int check_bus (int flags)
+{
+       return 1;
+}
+
 static int open_bus (int flags)
 {
        int dwDriveMask;
@@ -1278,7 +1283,7 @@ static struct device_scsi_info *ioctl_scsi_info (int unitnum, struct device_scsi
 }
 
 struct device_functions devicefunc_win32_ioctl = {
-       open_bus, close_bus, open_device, close_device, info_device,
+       check_bus, open_bus, close_bus, open_device, close_device, info_device,
        0, 0, 0,
        ioctl_command_pause, ioctl_command_stop, ioctl_command_play, ioctl_command_volume, ioctl_command_qcode,
        ioctl_command_toc, ioctl_command_read, ioctl_command_rawread, ioctl_command_write,
index 3eff98ac83cd3ac08c8a806c6264641065424d8c..be6832d62d247b0e6376f3962d61c737d2578289 100644 (file)
@@ -258,6 +258,12 @@ static void free_scsi_device(int dev)
 }
 
 static int rescan (void);
+
+static int check_scsi_bus (int flags)
+{
+       return 1;
+}
+
 static int open_scsi_bus (int flags)
 {
        int i;
@@ -563,7 +569,7 @@ static struct device_scsi_info *scsi_info (int unitnum, struct device_scsi_info
 }
 
 struct device_functions devicefunc_win32_spti = {
-       open_scsi_bus, close_scsi_bus, open_scsi_device, close_scsi_device, info_device,
+       check_scsi_bus, open_scsi_bus, close_scsi_bus, open_scsi_device, close_scsi_device, info_device,
        execscsicmd_out, execscsicmd_in, execscsicmd_direct,
        0, 0, 0, 0, 0, 0, 0, 0, 0, check_isatapi, scsi_info, 0
 };
index 43a3e7539d25d20bbd068672ebccd7d22a606954..02f486bf061f85e9df19f532247b711a3075bbf2 100644 (file)
@@ -687,7 +687,7 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full)
        int canusefile = 0, existsfile = 0;
 
        get_plugin_path (tmp, sizeof tmp / sizeof (TCHAR), L"filtershaders\\direct3d");
-       _tcscpy (tmp, shaderfile);
+       _tcscat (tmp, shaderfile);
        if (!full) {
                struct zfile *z = zfile_fopen (tmp, L"r", 0);
                if (z) {
@@ -1180,7 +1180,7 @@ static int createmask2texture (const TCHAR *filename)
        for (int i = 0; i < 2; i++) {
                if (i == 0) {
                        get_plugin_path (tmp, sizeof tmp / sizeof (TCHAR), L"overlays");
-                       _tcscpy (tmp, filename);
+                       _tcscat (tmp, filename);
                } else {
                        _tcscpy (tmp, filename);
                }
@@ -1241,7 +1241,7 @@ static int createmasktexture (const TCHAR *filename)
                return 0;
        tx = NULL;
        get_plugin_path (tmp, sizeof tmp / sizeof (TCHAR), L"masks");
-       _tcscpy (tmp, filename);
+       _tcscat (tmp, filename);
        zf = zfile_fopen (tmp, L"rb", ZFD_NORMAL);
        if (!zf) {
                zf = zfile_fopen (filename, L"rb", ZFD_NORMAL);
index 40c877b2c0f6f64a725ead3c070c834df2a6a86e..620bebd64ce1e9e77c67b1b430067a1846adc8fe 100644 (file)
@@ -18,8 +18,8 @@
 #define WINUAEPUBLICBETA 1
 #define LANG_DLL 1
 
-#define WINUAEBETA L"1"
-#define WINUAEDATE MAKEBD(2010, 7, 6)
+#define WINUAEBETA L"2"
+#define WINUAEDATE MAKEBD(2010, 7, 8)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index 472c5aae2210646d684e07b508f46c98d79e7982..a3e256bba93fb426b2fcd9b0c2db7e12d10570fb 100644 (file)
@@ -1,4 +1,20 @@
 
+
+- CD32/CDTV image mounting broke in b1 (can still be broken in some situations)
+- new audio state machine emulation froze in some situations
+- re-added "too fast CPU" hack that fixes missing sounds with sound routines that use CPU loops
+  in DMA waits (also needed in 68020 "CE" mode because short loops are currently too fast)
+- automatic audio switching detected idle audio when playing long samples
+- CD32 statefile restore ignored possible CD image file path in statefile
+- CDTV CD led flicker was practically non-existing when reading data
+- (I also noticed CDTV statefile support is still missing..)
+- old CD audio timecode relative track position bug fixed (CDTV audio CD player slow time display)
+- built-in image mounter cd audio timecode relative track position had 2 second offset
+- real cd audio cd playback asked for exclusive CD access when shared also works fine
+- do not parse mounted images (cue files) twice when booting in CD32 or CDTV mode
+- path update in b1 broke D3D related paths
+- CDTV processing thread stalled if no drive was detected when exiting
+
 Beta 1:
 
 - fixed Z3/RTG RAM leaking when restarting
index 0c049c0104a3fedc3d0fc077d2188efbdec36249..04b9e66c3e857eef804eda1e8f6c3dd596de36b7 100644 (file)
@@ -569,6 +569,10 @@ void restore_state (const TCHAR *filename)
 #ifdef CD32
                else if (!_tcscmp (name, L"CD32"))
                        end = restore_akiko (chunk);
+#endif
+#ifdef CDTV
+               else if (!_tcscmp (name, L"CDTV"))
+                       end = restore_cdtv (chunk);
 #endif
                else if (!_tcscmp (name, L"GAYL"))
                        end = restore_gayle (chunk);
@@ -595,6 +599,7 @@ void restore_state (const TCHAR *filename)
        restore_disk_finish ();
        restore_blitter_finish ();
        restore_akiko_finish ();
+       restore_cdtv_finish ();
        restore_p96_finish ();
        target_addtorecent (filename, 0);
        return;
@@ -826,6 +831,12 @@ int save_state (const TCHAR *filename, const TCHAR *description)
        save_chunk (f, dst, len, L"CD32", 0);
        xfree (dst);
 #endif
+#ifdef CDTV
+       dst = save_cdtv (&len);
+       save_chunk (f, dst, len, L"CDTV", 0);
+       xfree (dst);
+#endif
+
 #ifdef ACTION_REPLAY
        dst = save_action_replay (&len, 0);
        save_chunk (f, dst, len, L"ACTR", comp);