]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2310b9
authorToni Wilen <twilen@winuae.net>
Tue, 4 Jan 2011 15:57:42 +0000 (17:57 +0200)
committerToni Wilen <twilen@winuae.net>
Tue, 4 Jan 2011 15:57:42 +0000 (17:57 +0200)
22 files changed:
blitter.cpp
blkdev.cpp
cfgfile.cpp
cia.cpp
custom.cpp
debug.cpp
disk.cpp
filesys.cpp
include/custom.h
include/options.h
include/savestate.h
inputdevice.cpp
newcpu.cpp
od-win32/resources/winuae.rc
od-win32/serial_win32.cpp
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32gui.cpp
od-win32/winuae_msvc10/winuae_msvc.vcxproj
od-win32/winuaechangelog.txt
rommgr.cpp
savestate.cpp

index 8e447814a24d25f1f07f2c5216ca4b9ca87f48d7..e659131e1b398813c924f1219d825a2e7a464b54 100644 (file)
@@ -1165,6 +1165,7 @@ static void blit_bltset (int con)
        if (!savestate_state && bltstate != BLT_done && blitline) {
                blitline = 0;
                bltstate = BLT_done;
+               blit_interrupt = 1;
                write_log (L"BLITTER: register modification during linedraw!\n");
        }
 
index 5ecdcef94b8ac4726d089223116af633c49a4ae7..8e7fe8374960e8d9f34422f96ec734fa2119582c 100644 (file)
@@ -1772,7 +1772,7 @@ uae_u8 *save_cd (int num, int *len)
                return NULL;
        dstbak = dst = xmalloc (uae_u8, 4 + 256 + 4 + 4);
        save_u32 (4);
-       save_string (currprefs.cdslots[num].name);
+       save_path (currprefs.cdslots[num].name, SAVESTATE_PATH_CD);
        save_u32 (currprefs.cdslots[num].type);
        save_u32 (0);
        *len = dst - dstbak;
@@ -1787,7 +1787,7 @@ uae_u8 *restore_cd (int num, uae_u8 *src)
        if (num >= MAX_TOTAL_SCSI_DEVICES)
                return NULL;
        flags = restore_u32 ();
-       s = restore_string ();
+       s = restore_path (SAVESTATE_PATH_CD);
        int type = restore_u32 ();
        restore_u32 ();
        if (flags & 4) {
index a8d8ae26eb0527baf12e30f0a24703f6643744b1..9297a0483b2f6ae22d9046200ef41c976e4c9190 100644 (file)
@@ -505,12 +505,30 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
                }
        }
 
-       _stprintf (tmp, L"%s.rom_path", TARGET_NAME);
-       cfgfile_write_str (f, tmp, p->path_rom);
-       _stprintf (tmp, L"%s.floppy_path", TARGET_NAME);
-       cfgfile_write_str (f, tmp, p->path_floppy);
-       _stprintf (tmp, L"%s.hardfile_path", TARGET_NAME);
-       cfgfile_write_str (f, tmp, p->path_hardfile);
+       for (i = 0; i < MAX_PATHS; i++) {
+               if (p->path_rom.path[i][0]) {
+                       _stprintf (tmp, L"%s.rom_path", TARGET_NAME);
+                       cfgfile_write_str (f, tmp, p->path_rom.path[i]);
+               }
+       }
+       for (i = 0; i < MAX_PATHS; i++) {
+               if (p->path_floppy.path[i][0]) {
+                       _stprintf (tmp, L"%s.floppy_path", TARGET_NAME);
+                       cfgfile_write_str (f, tmp, p->path_floppy.path[i]);
+               }
+       }
+       for (i = 0; i < MAX_PATHS; i++) {
+               if (p->path_hardfile.path[i][0]) {
+                       _stprintf (tmp, L"%s.hardfile_path", TARGET_NAME);
+                       cfgfile_write_str (f, tmp, p->path_hardfile.path[i]);
+               }
+       }
+       for (i = 0; i < MAX_PATHS; i++) {
+               if (p->path_cd.path[i][0]) {
+                       _stprintf (tmp, L"%s.cd_path", TARGET_NAME);
+                       cfgfile_write_str (f, tmp, p->path_cd.path[i]);
+               }
+       }
 
        cfg_write (L"; host-specific", f);
 
@@ -520,26 +538,26 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
 
        cfgfile_write_str (f, L"use_gui", guimode1[p->start_gui]);
        cfgfile_write_bool (f, L"use_debugger", p->start_debugger);
-       cfgfile_write_rom (f, p->path_rom, p->romfile, L"kickstart_rom_file");
-       cfgfile_write_rom (f, p->path_rom, p->romextfile, L"kickstart_ext_rom_file");
+       cfgfile_write_rom (f, p->path_rom.path[0], p->romfile, L"kickstart_rom_file");
+       cfgfile_write_rom (f, p->path_rom.path[0], p->romextfile, L"kickstart_ext_rom_file");
        if (p->romextfile2addr) {
                cfgfile_write (f, L"kickstart_ext_rom_file2_address", L"%x", p->romextfile2addr);
-               cfgfile_write_rom (f, p->path_rom, p->romextfile2, L"kickstart_ext_rom_file2");
+               cfgfile_write_rom (f, p->path_rom.path[0], p->romextfile2, L"kickstart_ext_rom_file2");
        }
        if (p->romident[0])
                cfgfile_dwrite_str (f, L"kickstart_rom", p->romident);
        if (p->romextident[0])
                cfgfile_write_str (f, L"kickstart_ext_rom=", p->romextident);
-       str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->flashfile);
+       str = cfgfile_subst_path (p->path_rom.path[0], UNEXPANDED, p->flashfile);
        cfgfile_write_str (f, L"flash_file", str);
        xfree (str);
-       str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->cartfile);
+       str = cfgfile_subst_path (p->path_rom.path[0], UNEXPANDED, p->cartfile);
        cfgfile_write_str (f, L"cart_file", str);
        xfree (str);
        if (p->cartident[0])
                cfgfile_write_str (f, L"cart", p->cartident);
        if (p->amaxromfile[0]) {
-               str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->amaxromfile);
+               str = cfgfile_subst_path (p->path_rom.path[0], UNEXPANDED, p->amaxromfile);
                cfgfile_write_str (f, L"amax_rom_file", str);
                xfree (str);
        }
@@ -548,7 +566,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
 
        p->nr_floppies = 4;
        for (i = 0; i < 4; i++) {
-               str = cfgfile_subst_path (p->path_floppy, UNEXPANDED, p->floppyslots[i].df);
+               str = cfgfile_subst_path (p->path_floppy.path[0], UNEXPANDED, p->floppyslots[i].df);
                _stprintf (tmp, L"floppy%d", i);
                cfgfile_write_str (f, tmp, str);
                xfree (str);
@@ -900,7 +918,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_dwrite_bool (f, L"warp", p->turbo_emulation);
 
 #ifdef FILESYS
-       write_filesys_config (p, UNEXPANDED, p->path_hardfile, f);
+       write_filesys_config (p, UNEXPANDED, p->path_hardfile.path[0], f);
        if (p->filesys_no_uaefsdb)
                cfgfile_write_bool (f, L"filesys_no_fsdb", p->filesys_no_uaefsdb);
 #endif
@@ -1019,6 +1037,23 @@ int cfgfile_path (const TCHAR *option, const TCHAR *value, const TCHAR *name, TC
        return 1;
 }
 
+int cfgfile_multipath (const TCHAR *option, const TCHAR *value, const TCHAR *name, struct multipath *mp)
+{
+       TCHAR tmploc[MAX_DPATH];
+       if (!cfgfile_string (option, value, name, tmploc, 256))
+               return 0;
+       for (int i = 0; i < MAX_PATHS; i++) {
+               if (mp->path[i][0] == 0 || (i == 0 && (!_tcscmp (mp->path[i], L".\\") || !_tcscmp (mp->path[i], L"./")))) {
+                       TCHAR *s = target_expand_environment (tmploc);
+                       _tcsncpy (mp->path[i], s, 256 - 1);
+                       mp->path[i][256 - 1] = 0;
+                       xfree (s);
+                       return 1;
+               }
+       }
+       return 1;
+}
+
 int cfgfile_rom (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz)
 {
        TCHAR id[MAX_DPATH];
@@ -1132,9 +1167,10 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                *tmpp = '\0';
                if (_tcscmp (section, TARGET_NAME) == 0) {
                        /* We special case the various path options here.  */
-                       if (cfgfile_path (option, value, L"rom_path", p->path_rom, sizeof p->path_rom / sizeof (TCHAR))
-                               || cfgfile_path (option, value, L"floppy_path", p->path_floppy, sizeof p->path_floppy / sizeof (TCHAR))
-                               || cfgfile_path (option, value, L"hardfile_path", p->path_hardfile, sizeof p->path_hardfile / sizeof (TCHAR)))
+                       if (cfgfile_multipath (option, value, L"rom_path", &p->path_rom)
+                               || cfgfile_multipath (option, value, L"floppy_path", &p->path_floppy)
+                               || cfgfile_multipath (option, value, L"cd_path", &p->path_floppy)
+                               || cfgfile_multipath (option, value, L"hardfile_path", &p->path_hardfile))
                                return 1;
                        return target_parse_option (p, option, value);
                }
@@ -2162,7 +2198,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
                        root = value;
                        aname = 0;
                }
-               str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, root);
+               str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile.path[0], root);
 #ifdef FILESYS
                add_filesys_config (p, -1, NULL, aname, str, ro, secs, heads, reserved, bs, 0, NULL, 0, 0);
 #endif
@@ -2257,7 +2293,7 @@ empty_fs:
                                root += 2;
                                *root = ':';
                        }
-                       str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, root);
+                       str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile.path[0], root);
                }
 #ifdef FILESYS
                add_filesys_config (p, -1, dname, aname, str, ro, secs, heads, reserved, bs, bp, fs, hdcv, 0);
@@ -2563,10 +2599,10 @@ static int cfgfile_load_2 (struct uae_prefs *p, const TCHAR *filename, bool real
        }
 
        for (i = 0; i < 4; i++)
-               subst (p->path_floppy, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof (TCHAR));
-       subst (p->path_rom, p->romfile, sizeof p->romfile / sizeof (TCHAR));
-       subst (p->path_rom, p->romextfile, sizeof p->romextfile / sizeof (TCHAR));
-       subst (p->path_rom, p->romextfile2, sizeof p->romextfile2 / sizeof (TCHAR));
+               subst (p->path_floppy.path[0], p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof (TCHAR));
+       subst (p->path_rom.path[0], p->romfile, sizeof p->romfile / sizeof (TCHAR));
+       subst (p->path_rom.path[0], p->romextfile, sizeof p->romextfile / sizeof (TCHAR));
+       subst (p->path_rom.path[0], p->romextfile2, sizeof p->romextfile2 / sizeof (TCHAR));
 
        return 1;
 }
@@ -3639,9 +3675,9 @@ void default_prefs (struct uae_prefs *p, int type)
        _tcscpy (p->flashfile, L"");
        _tcscpy (p->cartfile, L"");
 
-       _tcscpy (p->path_rom, L"./");
-       _tcscpy (p->path_floppy, L"./");
-       _tcscpy (p->path_hardfile, L"./");
+       _tcscpy (p->path_rom.path[0], L"./");
+       _tcscpy (p->path_floppy.path[0], L"./");
+       _tcscpy (p->path_hardfile.path[0], L"./");
 
        p->prtname[0] = 0;
        p->sername[0] = 0;
diff --git a/cia.cpp b/cia.cpp
index 4418f070a482040c550ab4f9feee619201f72ee2..1336b61b97926ab48c00cdd81ab6ecb32698102e 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -92,6 +92,7 @@ static void setclr (unsigned int *p, unsigned int val)
 static void RethinkICRA (void)
 {
        if (ciaaimask & ciaaicr) {
+               //write_log (L"A");
                ciaaicr |= 0x80;
                send_interrupt (3, 2 * CYCLE_UNIT + CYCLE_UNIT / 2);
        }
@@ -100,6 +101,7 @@ static void RethinkICRA (void)
 static void RethinkICRB (void)
 {
        if (ciabimask & ciabicr) {
+               //write_log (L"B");
                ciabicr |= 0x80;
                send_interrupt (13, 2 * CYCLE_UNIT + CYCLE_UNIT / 2);
        }
index 6ea56076ac12074e72e376411a904022178df252..910f97e07d2cef7a4b2eb8c0cde3b4208ab5e7c4 100644 (file)
@@ -5361,7 +5361,7 @@ static void dmal_func (uae_u32 v)
 
 static void dmal_func2 (uae_u32 v)
 {
-       for (int i = 0; i < 6 + 8; i += 2) {
+       while (dmal) {
                if (dmal & 3)
                        dmal_emu (dmal_hpos + ((dmal & 2) ? 1 : 0));
                dmal_hpos += 2;
@@ -5371,11 +5371,10 @@ static void dmal_func2 (uae_u32 v)
 
 static void events_dmal (int hp)
 {
-       int i;
        if (!dmal)
                return;
        if (currprefs.cpu_cycle_exact) {
-               for (i = 0; i < 6 + 8; i += 2) {
+               while (dmal) {
                        if (dmal & 3)
                                break;
                        hp += 2;
index 93bcf23ba5f50a58e4831414469cb902b8dc9d2d..1dfa596386df99156f67d76bbc86e0a199e7cbb3 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -2515,6 +2515,7 @@ static void show_exec_lists (TCHAR t)
                if (dosbase) {
                        uaecptr rootnode = get_long (dosbase + 34);
                        uaecptr dosinfo = get_long (rootnode + 24) << 2;
+                       console_out_f (L"ROOTNODE: %08x DOSINFO: %08x\n", rootnode, dosinfo);
                        uaecptr doslist = get_long (dosinfo + 4) << 2;
                        while (doslist) {
                                int type = get_long (doslist + 4);
index 3fe54344e8268f3e04b32c332755a63d22aea52a..a0c299a5b265baf1376e45968115a4c7f6339646 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -651,11 +651,11 @@ static void update_drive_gui (int num)
        bool writ = dskdmaen == 3 && drv->state && !((selected | disabled) & (1 << num));
 
        if (drv->state == gui_data.drive_motor[num]
-       && drv->cyl == gui_data.drive_track[num]
-       && side == gui_data.drive_side
+               && drv->cyl == gui_data.drive_track[num]
+               && side == gui_data.drive_side
                && drv->crc32 == gui_data.crc32[num]
-       && writ == gui_data.drive_writing[num]
-       && !_tcscmp (gui_data.df[num], currprefs.floppyslots[num].df))
+               && writ == gui_data.drive_writing[num]
+               && !_tcscmp (gui_data.df[num], currprefs.floppyslots[num].df))
                return;
        _tcscpy (gui_data.df[num], currprefs.floppyslots[num].df);
        gui_data.crc32[num] = drv->crc32;
@@ -3603,7 +3603,7 @@ uae_u8 *restore_disk (int num,uae_u8 *src)
        int mfmpos = restore_u32 ();
        drv->dskchange_time = 0;
        restore_u32 ();
-       s = restore_string ();
+       s = restore_path (SAVESTATE_PATH_FLOPPY);
        _tcscpy (old, currprefs.floppyslots[num].df);
        _tcsncpy (changed_prefs.floppyslots[num].df, s, 255);
        xfree (s);
@@ -3671,7 +3671,7 @@ uae_u8 *save_disk (int num, int *len, uae_u8 *dstptr, bool usepath)
        save_u8 (drv->drive_id_scnt);   /* id mode position */
        save_u32 (drv->mfmpos);                 /* disk position */
        save_u32 (getadfcrc (drv));         /* CRC of disk image */
-       save_string (usepath ? currprefs.floppyslots[num].df : L"");/* image name */
+       save_path (usepath ? currprefs.floppyslots[num].df : L"", SAVESTATE_PATH_FLOPPY);/* image name */
        save_u16 (drv->dskready_up_time);
        save_u16 (drv->dskready_down_time);
        *len = dst - dstbak;
index cf3e8a4eb96b7fa514f03cacca964e02f9bb3147..da9d0fe52d9a45545396fc1179bb56be3c1940dd 100644 (file)
@@ -554,7 +554,7 @@ static int add_filesys_unit (TCHAR *devname, TCHAR *volname, const TCHAR *rootdi
 {
        int ret;
 
-       if (nr_units() >= MAX_FILESYSTEM_UNITS)
+       if (nr_units () >= MAX_FILESYSTEM_UNITS)
                return -1;
 
        ret = set_filesys_unit_1 (-1, devname, volname, rootdir, readonly,
@@ -6123,30 +6123,30 @@ static uae_u8 *restore_filesys_hardfile (UnitInfo *ui, uae_u8 *src)
        struct hardfiledata *hfd = &ui->hf;
        TCHAR *s;
 
-       hfd->virtsize = restore_u64();
-       hfd->offset = restore_u64();
-       hfd->nrcyls = restore_u32();
-       hfd->secspertrack = restore_u32();
-       hfd->surfaces = restore_u32();
-       hfd->reservedblocks = restore_u32();
-       hfd->blocksize = restore_u32();
-       hfd->readonly = restore_u32();
-       hfd->flags = restore_u32();
-       hfd->cylinders = restore_u32();
-       hfd->sectors = restore_u32();
-       hfd->heads = restore_u32();
-       s = restore_string();
+       hfd->virtsize = restore_u64 ();
+       hfd->offset = restore_u64 ();
+       hfd->nrcyls = restore_u32 ();
+       hfd->secspertrack = restore_u32 ();
+       hfd->surfaces = restore_u32 ();
+       hfd->reservedblocks = restore_u32 ();
+       hfd->blocksize = restore_u32 ();
+       hfd->readonly = restore_u32 ();
+       hfd->flags = restore_u32 ();
+       hfd->cylinders = restore_u32 ();
+       hfd->sectors = restore_u32 ();
+       hfd->heads = restore_u32 ();
+       s = restore_string ();
        _tcscpy (hfd->vendor_id, s);
-       xfree(s);
-       s = restore_string();
+       xfree (s);
+       s = restore_string ();
        _tcscpy (hfd->product_id, s);
-       xfree(s);
-       s = restore_string();
+       xfree (s);
+       s = restore_string ();
        _tcscpy (hfd->product_rev, s);
-       xfree(s);
-       s = restore_string();
+       xfree (s);
+       s = restore_string ();
        _tcscpy (hfd->device_name, s);
-       xfree(s);
+       xfree (s);
        return src;
 }
 
@@ -6694,10 +6694,17 @@ uae_u8 *save_filesys (int num, int *len)
        save_u32 (2); /* version */
        save_u32 (ui->devno);
        save_u16 (type);
-       save_string (ui->rootdir);
+       if (type == FILESYS_VIRTUAL)
+               save_path (ui->rootdir, SAVESTATE_PATH_VDIR);
+       else if (type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB)
+               save_path (ui->rootdir, SAVESTATE_PATH_HDF);
+       else if (type == FILESYS_HARDDRIVE)
+               save_path (ui->rootdir, SAVESTATE_PATH_HD);
+       else
+               save_path (ui->rootdir, SAVESTATE_PATH);
        save_string (ui->devname);
        save_string (ui->volname);
-       save_string (ui->filesysdir);
+       save_path (ui->filesysdir, SAVESTATE_PATH);
        save_u8 (ui->bootpri);
        save_u8 (ui->readonly);
        save_u32 (ui->startup);
@@ -6717,20 +6724,28 @@ uae_u8 *restore_filesys (uae_u8 *src)
        TCHAR *devname = 0, *volname = 0, *rootdir = 0, *filesysdir = 0;
        int bootpri;
        bool readonly;
+       uae_u32 startup;
 
        if (restore_u32 () != 2)
                return src;
        devno = restore_u32 ();
        type = restore_u16 ();
-       rootdir = restore_string ();
+       if (type == FILESYS_VIRTUAL)
+               rootdir = restore_path (SAVESTATE_PATH_VDIR);
+       else if (type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB)
+               rootdir = restore_path (SAVESTATE_PATH_HDF);
+       else if (type == FILESYS_HARDDRIVE)
+               rootdir = restore_path (SAVESTATE_PATH_HD);
+       else
+               rootdir = restore_path (SAVESTATE_PATH);
        devname = restore_string ();
        volname = restore_string ();
-       filesysdir = restore_string ();
+       filesysdir = restore_path (SAVESTATE_PATH);
        bootpri = restore_u8 ();
        readonly = restore_u8 () != 0;
-       ui = &mountinfo.ui[devno];
-       ui->startup = restore_u32 ();
+       startup = restore_u32 ();
        filesys_configdev = restore_u32 ();
+       ui = &mountinfo.ui[devno];
        if (type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB) {
                src = restore_filesys_hardfile (ui, src);
                xfree (volname);
@@ -6742,6 +6757,8 @@ uae_u8 *restore_filesys (uae_u8 *src)
                        write_log (L"filesys '%s' failed to restore\n", rootdir);
                        goto end;
        }
+       ui->devno = devno;
+       ui->startup = startup;
        if (type == FILESYS_VIRTUAL)
                src = restore_filesys_virtual (ui, src, devno);
        write_log (L"'%s' restored\n", rootdir);
index a4304bc9af13cec60412966709c2c0f8ae4c073e..bb117b7e9781560d4710ea4e58ce030293c6231e 100644 (file)
@@ -114,7 +114,6 @@ extern int hsyncstartpos;
 extern int minfirstline, vblank_endline, numscrlines;
 extern int vblank_hz, fake_vblank_hz, vblank_skip, doublescan;
 extern frame_time_t syncbase;
-#define NUMSCRLINES (maxvpos + 1 - minfirstline + 1)
 
 #define DMA_AUD0      0x0001
 #define DMA_AUD1      0x0002
index 2b2a7b4298402410de79c74e3b45071a5e6b842a..c298d2a7ad18e6445b0d64358f012f95fa809d0b 100644 (file)
@@ -15,6 +15,12 @@ typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR,
 
 extern long int version;
 
+#define MAX_PATHS 8
+
+struct multipath {
+       TCHAR path[MAX_PATHS][256];
+};
+
 struct strlist {
        struct strlist *next;
        TCHAR *option, *value;
@@ -316,9 +322,10 @@ struct uae_prefs {
        TCHAR inprecfile[MAX_DPATH];
        bool inprec_autoplay;
 
-       TCHAR path_floppy[256];
-       TCHAR path_hardfile[256];
-       TCHAR path_rom[256];
+       struct multipath path_floppy;
+       struct multipath path_hardfile;
+       struct multipath path_rom;
+       struct multipath path_cd;
 
        int m68k_speed;
        int cpu_model;
index d73d09727cef8686764c73b740b0e6fe74eb617f..69168fc95abe750b01ca26ae61f4bfc5dc74520b 100644 (file)
@@ -33,6 +33,16 @@ extern uae_u8 restore_u8_func (uae_u8 **);
 extern void save_string_func (uae_u8 **, const TCHAR*);
 extern TCHAR *restore_string_func (uae_u8 **);
 
+#define SAVESTATE_PATH 0
+#define SAVESTATE_PATH_FLOPPY 1
+#define SAVESTATE_PATH_VDIR 2
+#define SAVESTATE_PATH_HDF 3
+#define SAVESTATE_PATH_HD 4
+#define SAVESTATE_PATH_CD 5
+
+extern void save_path_func (uae_u8 **, const TCHAR*, int type);
+extern TCHAR *restore_path_func (uae_u8 **, int type);
+
 #define save_u64(x) save_u64_func (&dst, (x))
 #define save_u32(x) save_u32_func (&dst, (x))
 #define save_u16(x) save_u16_func (&dst, (x))
@@ -46,6 +56,10 @@ extern TCHAR *restore_string_func (uae_u8 **);
 #define save_string(x) save_string_func (&dst, (x))
 #define restore_string() restore_string_func (&src)
 
+#define save_path(x, p) save_path_func (&dst, (x), p)
+#define restore_path(p) restore_path_func (&src, p)
+
+
 /* save, restore and initialize routines for Amiga's subsystems */
 
 extern uae_u8 *restore_cpu (uae_u8 *);
index 07831e71f98ba6ccb7313e2682f37fbe282c20ea..d0907446de5ca803bc2e7e6f2f0c023e01d76f33 100644 (file)
@@ -1643,31 +1643,34 @@ static void mouseupdate (int pct, int vsync)
 
        for (i = 0; i < 2; i++) {
 
-               v = getvelocity (i, 0, pct);
-               mxd += v;
-               mouse_x[i] += v;
-
-               v = getvelocity (i, 1, pct);
-               myd += v;
-               mouse_y[i] += v;
-
-               v = getvelocity (i, 2, pct);
-               if (v > 0)
-                       record_key (0x7a << 1);
-               else if (v < 0)
-                       record_key (0x7b << 1);
-               if (!mouse_deltanoreset[i][2])
-                       mouse_delta[i][2] = 0;
-
-               if (mouse_frame_x[i] - mouse_x[i] > max)
-                       mouse_x[i] = mouse_frame_x[i] - max;
-               if (mouse_frame_x[i] - mouse_x[i] < -max)
-                       mouse_x[i] = mouse_frame_x[i] + max;
-
-               if (mouse_frame_y[i] - mouse_y[i] > max)
-                       mouse_y[i] = mouse_frame_y[i] - max;
-               if (mouse_frame_y[i] - mouse_y[i] < -max)
-                       mouse_y[i] = mouse_frame_y[i] + max;
+               if (mouse_port[i]) {
+
+                       v = getvelocity (i, 0, pct);
+                       mxd += v;
+                       mouse_x[i] += v;
+
+                       v = getvelocity (i, 1, pct);
+                       myd += v;
+                       mouse_y[i] += v;
+
+                       v = getvelocity (i, 2, pct);
+                       if (v > 0)
+                               record_key (0x7a << 1);
+                       else if (v < 0)
+                               record_key (0x7b << 1);
+                       if (!mouse_deltanoreset[i][2])
+                               mouse_delta[i][2] = 0;
+
+                       if (mouse_frame_x[i] - mouse_x[i] > max)
+                               mouse_x[i] = mouse_frame_x[i] - max;
+                       if (mouse_frame_x[i] - mouse_x[i] < -max)
+                               mouse_x[i] = mouse_frame_x[i] + max;
+
+                       if (mouse_frame_y[i] - mouse_y[i] > max)
+                               mouse_y[i] = mouse_frame_y[i] - max;
+                       if (mouse_frame_y[i] - mouse_y[i] < -max)
+                               mouse_y[i] = mouse_frame_y[i] + max;
+               }
 
                if (!vsync) {
                        mouse_frame_x[i] = mouse_x[i];
@@ -1697,10 +1700,11 @@ static void readinput (void)
 
 }
 
-static uae_u16 getjoystate (int joy)
+static void joymousecounter (int joy)
 {
        int left = 1, right = 1, top = 1, bot = 1;
-       uae_u16 v;
+       int b9, b8, b1, b0;
+       int cntx, cnty, ocntx, ocnty;
 
        if (joydir[joy] & DIR_LEFT)
                left = 0;
@@ -1710,18 +1714,35 @@ static uae_u16 getjoystate (int joy)
                top = 0;
        if (joydir[joy] & DIR_DOWN)
                bot = 0;
+
+       b0 = (bot ^ right) ? 1 : 0;
+       b1 = (right ^ 1) ? 2 : 0;
+       b8 = (top ^ left) ? 1 : 0;
+       b9 = (left ^ 1) ? 2 : 0;
+
+       cntx = b0 | b1;
+       cnty = b8 | b9;
+       ocntx = mouse_x[joy] & 3;
+       ocnty = mouse_y[joy] & 3;
+
+       if (cntx == 3 && ocntx == 0)
+               mouse_x[joy] -= 4;
+       else if (cntx == 0 && ocntx == 3)
+               mouse_x[joy] += 4;
+       mouse_x[joy] = (mouse_x[joy] & 0xfc) | cntx;
+
+       if (cnty == 3 && ocnty == 0)
+               mouse_y[joy] -= 4;
+       else if (cnty == 0 && ocnty == 3)
+               mouse_y[joy] += 4;
+       mouse_y[joy] = (mouse_y[joy] & 0xfc) | cnty;
+}
+
+static uae_u16 getjoystate (int joy)
+{
+       uae_u16 v;
+
        v = (uae_u8)mouse_x[joy] | (mouse_y[joy] << 8);
-       if (!left || !right || !top || !bot || !mouse_port[joy]) {
-               int b9, b8, b1, b0;
-               mouse_x[joy] &= ~3;
-               mouse_y[joy] &= ~3;
-               b0 = bot ^ right;
-               b1 = right ^ 1;
-               b8 = top ^ left;
-               b9 = left ^ 1;
-               v &= ~0x0303;
-               v |= (b0 << 0) | (b1 << 1) | (b8 << 8) | (b9 << 9);
-       }
 #ifdef DONGLE_DEBUG
        if (notinrom ())
                write_log (L"JOY%dDAT %04X %s\n", joy, v, debuginfo (0));
@@ -2338,7 +2359,7 @@ void inputdevice_handle_inputcode (void)
 
        if (code == 0)
                goto end;
-       if (needcputrace (code) && can_cpu_tracer () == true && is_cpu_tracer () == false && !input_play && !input_record) {
+       if (needcputrace (code) && can_cpu_tracer () == true && is_cpu_tracer () == false && !input_play && !input_record && !debugging) {
                if (set_cpu_tracer (true)) {
                        tracer_enable = 1;
                        return; // wait for next frame
@@ -2911,6 +2932,9 @@ static int handle_input_event (int nr, int state, int max, int autofire, bool ca
                                joydir[joy] |= DIR_UP;
                        if (bot)
                                joydir[joy] |= DIR_DOWN;
+                       if (joy == 0 || joy == 1)
+                               joymousecounter (joy); 
+
                        gui_gameport_axis_change (joy, DIR_LEFT_BIT, left, 0);
                        gui_gameport_axis_change (joy, DIR_RIGHT_BIT, right, 0);
                        gui_gameport_axis_change (joy, DIR_UP_BIT, top, 0);
index 85876c76c60ca073c96ca9ba946abade461175c3..3bf6db6eb814aeacd7b5359247c933a9ea3f7d1f 100644 (file)
@@ -3333,6 +3333,8 @@ STATIC_INLINE int do_specialties (int cycles)
        while (regs.spcflags & SPCFLAG_STOP) {
                if (cpu_tracer > 0) {
                        cputrace.stopped = regs.stopped;
+                       cputrace.intmask = regs.intmask;
+                       cputrace.sr = regs.sr;
                        cputrace.state = 1;
                        cputrace.pc = m68k_getpc ();
                        cputrace.memoryoffset = 0;
@@ -4891,6 +4893,8 @@ uae_u8 *restore_cpu_extra (uae_u8 *src)
        currprefs.m68k_speed = changed_prefs.m68k_speed = 0;
        if (flags & 4)
                currprefs.m68k_speed = changed_prefs.m68k_speed = -1;
+       if (flags & 16)
+               currprefs.m68k_speed = changed_prefs.m68k_speed = (flags >> 24) * CYCLE_UNIT;
 
        currprefs.cpu060_revision = changed_prefs.cpu060_revision = restore_u8 ();
        currprefs.fpu_revision = changed_prefs.fpu_revision = restore_u8 ();
@@ -4913,6 +4917,9 @@ uae_u8 *save_cpu_extra (int *len, uae_u8 *dstptr)
        flags |= currprefs.cpu_compatible ? 2 : 0;
        flags |= currprefs.m68k_speed < 0 ? 4 : 0;
        flags |= currprefs.cachesize > 0 ? 8 : 0;
+       flags |= currprefs.m68k_speed > 0 ? 16 : 0;
+       if (currprefs.m68k_speed > 0)
+               flags |= (currprefs.m68k_speed / CYCLE_UNIT) << 24;
        save_u32 (flags);
        save_u32 (currprefs.cpu_frequency);
        save_u32 (currprefs.cpu_clock_multiplier);
index d8a44f352a668b91d22f82e0b2f489c4bc188ca2..11940e9ce8bdc65b1c1bd8afd0a756009f5030a9 100644 (file)
@@ -1079,7 +1079,7 @@ BEGIN
             VALUE "FileDescription", "WinUAE"\r
             VALUE "FileVersion", "2.3.1.0"\r
             VALUE "InternalName", "WinUAE"\r
-            VALUE "LegalCopyright", "© 1996-2010 under the GNU Public License (GPL)"\r
+            VALUE "LegalCopyright", "© 1996-2011 under the GNU Public License (GPL)"\r
             VALUE "OriginalFilename", "WinUAE.exe"\r
             VALUE "ProductName", "WinUAE"\r
             VALUE "ProductVersion", "2.3.1.0"\r
index 5de82c573569ece6792ef4d1b9f25fd3c9e0ce79..7588bb19afb333d06d9de67190a86eb4f82a1f26 100644 (file)
@@ -41,7 +41,7 @@ static int dtr;
 static int serial_period_hsyncs, serial_period_hsync_counter;
 static int ninebit;
 int serdev;
-int seriallog = 0;
+int seriallog = 0, log_sercon = 0;
 int serial_enet;
 
 void serial_open (void);
@@ -84,10 +84,16 @@ void SERPER (uae_u16 w)
        serial_period_hsyncs = (((serper & 0x7fff) + 1) * 10) / maxhpos;
        if (serial_period_hsyncs <= 0)
                serial_period_hsyncs = 1;
+
 #if SERIALLOGGING > 0
        serial_period_hsyncs = 1;
        seriallog = 1;
 #endif
+       if (log_sercon) {
+               serial_period_hsyncs = 1;
+               seriallog = 1;
+       }
+
        serial_period_hsync_counter = 0;
 
        write_log (L"SERIAL: period=%d, baud=%d, hsyncs=%d, bits=%d, PC=%x\n", w, baud, serial_period_hsyncs, ninebit ? 9 : 8, M68K_GETPC);
index 07830733d95b657a0e624aa606e9305f81242d43..6813bfe23404a7690da322bdbbf8e6f3a130c25d 100644 (file)
@@ -2216,7 +2216,7 @@ void logging_init (void)
                SystemInfo.wProcessorArchitecture, SystemInfo.wProcessorLevel, SystemInfo.wProcessorRevision,
                SystemInfo.dwNumberOfProcessors);
        write_log (L"\n(c) 1995-2001 Bernd Schmidt   - Core UAE concept and implementation."
-               L"\n(c) 1998-2010 Toni Wilen      - Win32 port, core code updates."
+               L"\n(c) 1998-2011 Toni Wilen      - Win32 port, core code updates."
                L"\n(c) 1996-2001 Brian King      - Win32 port, Picasso96 RTG, and GUI."
                L"\n(c) 1996-1999 Mathias Ortmann - Win32 port and bsdsocket support."
                L"\n(c) 2000-2001 Bernd Meyer     - JIT engine."
@@ -4342,7 +4342,7 @@ static void getstartpaths (void)
 extern void test (void);
 extern int screenshotmode, postscript_print_debugging, sound_debug, log_uaeserial, clipboard_debug;
 extern int force_direct_catweasel, sound_mode_skip, maxmem;
-extern int pngprint;
+extern int pngprint, log_sercon;
 
 extern DWORD_PTR cpu_affinity, cpu_paffinity;
 static DWORD_PTR original_affinity = -1;
@@ -4490,6 +4490,10 @@ static int parseargs (const TCHAR *argx, const TCHAR *np, const TCHAR *np2)
                log_net = 1;
                return 1;
        }
+       if (!_tcscmp (arg, L"serlog")) {
+               log_sercon = 1;
+               return 1;
+       }
        if (!_tcscmp (arg, L"a2065log")) {
                log_a2065 = 1;
                return 1;
index 499724610e627f8cec3f3fd939b540a8c782a384..46d8c730d8a735e216fa3b1ad7176e39ddfbb375 100644 (file)
@@ -18,8 +18,8 @@
 #define WINUAEPUBLICBETA 1
 #define LANG_DLL 1
 
-#define WINUAEBETA L"8"
-#define WINUAEDATE MAKEBD(2010, 12, 18)
+#define WINUAEBETA L"9"
+#define WINUAEDATE MAKEBD(2011, 1, 4)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index dcbdf5e27d57d55e28c71a9e9ff8d71104eb6a57..4886f3c5ed680eb3c0d1f4dc8c0fa0469da8de28 100644 (file)
@@ -1623,7 +1623,7 @@ int scan_roms (HWND hDlg, int show)
                break;
        }
        if (cnt == 0)
-               scan_roms_3 (fkey, paths, workprefs.path_rom);
+               scan_roms_3 (fkey, paths, workprefs.path_rom.path[0]);
 
        for (i = 0; i < MAX_ROM_PATHS; i++)
                xfree (paths[i]);
@@ -9739,7 +9739,7 @@ static void floppysetwriteprotect (HWND hDlg, int n, bool writeprotected)
 static void deletesaveimage (HWND hDlg, int num)
 {
        TCHAR *p;
-       if (!iscd (num))
+       if (iscd (num))
                return;
        p = DISK_get_saveimagepath (workprefs.floppyslots[num].df);
        if (zfile_exists (p)) {
index f72417ae3c2667c5b1fe98426d45563a52386d23..e684abc3f6daef7d986e05fbe7a53d374bab6e60 100644 (file)
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;avrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+      <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ProgramDatabaseFile>$(Platform)\$(Configuration)\winuae.pdb</ProgramDatabaseFile>
       <SubSystem>Windows</SubSystem>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <ShowProgress>NotSet</ShowProgress>
       <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+      <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ProgramDatabaseFile>$(Platform)\$(Configuration)\winuae.pdb</ProgramDatabaseFile>
       <SubSystem>Windows</SubSystem>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <ShowProgress>NotSet</ShowProgress>
       <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+      <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ProgramDatabaseFile>$(Platform)\$(Configuration)\winuae.pdb</ProgramDatabaseFile>
       <SubSystem>Windows</SubSystem>
index 89123ddcdce672f47f2a8da98a8bb8e9460edf23..478b7fb47b10ee77122cab13331d240fa5e284a6 100644 (file)
@@ -1,4 +1,17 @@
 
+Beta 9:
+
+- emulate mouse counter behavior 100% when joystick is connected (increase/decrease counter by 4 when
+  two lowest bits change from 0 to 3 or vice versa) Most likely no program cares..  Mouse cursor
+  movement is now exactly same as on real Amigas when moving joystick in mouse port..
+- "Delete Saveimage" button didn't work, broke when CD image GUI was added
+- save CPU/chipset ratio to statefile
+- attempt to load disk image and harddisk paths in statefiles from current dir, current adf/hardfile paths
+  and directory where statefile was loaded if original path or file is missing
+- harddrive statesaves didn't save correctly if more than 1 harddrive was configured
+- b3 "stop linedraw if blitter register modified while active" hack didn't always clear blitter active bit
+- stopped CPU in CE mode was saved incorrectly to statefile (introduced in some earlier beta)
+
 Beta 8:
 
 - mixed mode CD first audio track didn't always play (uaescsi.device only)
index df334f6c9166556b10bcdfc45ceb08b7979c8146..7b3980e4785d4f05cdd9207ad6eb9216631eb447 100644 (file)
@@ -641,7 +641,7 @@ int load_keyring (struct uae_prefs *p, const TCHAR *path)
                        break;
                case 2:
                        if (p) {
-                               _tcscpy (tmp, p->path_rom);
+                               _tcscpy (tmp, p->path_rom.path[0]);
                                _tcscat (tmp, L"rom.key");
                        }
                        break;
index db42313fed6d89bbd109bcc7ede7002dd778c497..6f249603b7a718cc819ef485c73b11cd8d9f56c3 100644 (file)
@@ -193,6 +193,10 @@ void save_string_func (uae_u8 **dstp, const TCHAR *from)
        *dstp = dst;
        xfree (s2);
 }
+void save_path_func (uae_u8 **dstp, const TCHAR *from, int type)
+{
+       save_string_func (dstp, from);
+}
 
 uae_u32 restore_u32_func (uae_u8 **dstp)
 {
@@ -246,6 +250,50 @@ TCHAR *restore_string_func (uae_u8 **dstp)
        xfree (to);
        return s;
 }
+TCHAR *restore_path_func (uae_u8 **dstp, int type)
+{
+       TCHAR *newpath;
+       TCHAR *s = restore_string_func (dstp);
+       TCHAR *out = NULL;
+       TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH];
+
+       if (s[0] == 0)
+               return s;
+       if (zfile_exists (s))
+               return s;
+       if (type == SAVESTATE_PATH_HD)
+               return s;
+       getfilepart (tmp, sizeof tmp / sizeof (TCHAR), s);
+       if (zfile_exists (tmp)) {
+               xfree (s);
+               return my_strdup (tmp);
+       }
+       for (int i = 0; i < MAX_PATHS; i++) {
+               newpath = NULL;
+               if (type == SAVESTATE_PATH_FLOPPY)
+                       newpath = currprefs.path_floppy.path[i];
+               else if (type == SAVESTATE_PATH_VDIR || type == SAVESTATE_PATH_HDF)
+                       newpath = currprefs.path_hardfile.path[i];
+               else if (type == SAVESTATE_PATH_CD)
+                       newpath = currprefs.path_cd.path[i];
+               if (newpath == NULL || newpath[0] == 0)
+                       break;
+               _tcscpy (tmp2, newpath);
+               _tcscat (tmp2, tmp);
+               fullpath (tmp2, sizeof tmp2 / sizeof (TCHAR));
+               if (zfile_exists (tmp2)) {
+                       xfree (s);
+                       return my_strdup (tmp2);
+               }
+       }
+       getpathpart(tmp2, sizeof tmp2 / sizeof (TCHAR), savestate_fname);
+       _tcscat (tmp2, tmp);
+       if (zfile_exists (tmp2)) {
+               xfree (s);
+               return my_strdup (tmp2);
+       }
+       return s;
+}
 
 /* read and write IFF-style hunks */