From d04feb142bac569377bf77908cfe4dad87b3aa25 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 4 Jan 2011 17:57:42 +0200 Subject: [PATCH] 2310b9 --- blitter.cpp | 1 + blkdev.cpp | 4 +- cfgfile.cpp | 88 ++++++++++++------ cia.cpp | 2 + custom.cpp | 5 +- debug.cpp | 1 + disk.cpp | 12 +-- filesys.cpp | 71 ++++++++------ include/custom.h | 1 - include/options.h | 13 ++- include/savestate.h | 14 +++ inputdevice.cpp | 102 +++++++++++++-------- newcpu.cpp | 7 ++ od-win32/resources/winuae.rc | 2 +- od-win32/serial_win32.cpp | 8 +- od-win32/win32.cpp | 8 +- od-win32/win32.h | 4 +- od-win32/win32gui.cpp | 4 +- od-win32/winuae_msvc10/winuae_msvc.vcxproj | 12 +-- od-win32/winuaechangelog.txt | 13 +++ rommgr.cpp | 2 +- savestate.cpp | 48 ++++++++++ 22 files changed, 300 insertions(+), 122 deletions(-) diff --git a/blitter.cpp b/blitter.cpp index 8e447814..e659131e 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -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"); } diff --git a/blkdev.cpp b/blkdev.cpp index 5ecdcef9..8e7fe837 100644 --- a/blkdev.cpp +++ b/blkdev.cpp @@ -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) { diff --git a/cfgfile.cpp b/cfgfile.cpp index a8d8ae26..9297a048 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -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 4418f070..1336b61b 100644 --- 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); } diff --git a/custom.cpp b/custom.cpp index 6ea56076..910f97e0 100644 --- a/custom.cpp +++ b/custom.cpp @@ -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; diff --git a/debug.cpp b/debug.cpp index 93bcf23b..1dfa5963 100644 --- 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); diff --git a/disk.cpp b/disk.cpp index 3fe54344..a0c299a5 100644 --- 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; diff --git a/filesys.cpp b/filesys.cpp index cf3e8a4e..da9d0fe5 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -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); diff --git a/include/custom.h b/include/custom.h index a4304bc9..bb117b7e 100644 --- a/include/custom.h +++ b/include/custom.h @@ -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 diff --git a/include/options.h b/include/options.h index 2b2a7b42..c298d2a7 100644 --- a/include/options.h +++ b/include/options.h @@ -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; diff --git a/include/savestate.h b/include/savestate.h index d73d0972..69168fc9 100644 --- a/include/savestate.h +++ b/include/savestate.h @@ -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 *); diff --git a/inputdevice.cpp b/inputdevice.cpp index 07831e71..d0907446 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -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); diff --git a/newcpu.cpp b/newcpu.cpp index 85876c76..3bf6db6e 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -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); diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index d8a44f35..11940e9c 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -1079,7 +1079,7 @@ BEGIN VALUE "FileDescription", "WinUAE" VALUE "FileVersion", "2.3.1.0" VALUE "InternalName", "WinUAE" - VALUE "LegalCopyright", "© 1996-2010 under the GNU Public License (GPL)" + VALUE "LegalCopyright", "© 1996-2011 under the GNU Public License (GPL)" VALUE "OriginalFilename", "WinUAE.exe" VALUE "ProductName", "WinUAE" VALUE "ProductVersion", "2.3.1.0" diff --git a/od-win32/serial_win32.cpp b/od-win32/serial_win32.cpp index 5de82c57..7588bb19 100644 --- a/od-win32/serial_win32.cpp +++ b/od-win32/serial_win32.cpp @@ -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); diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 07830733..6813bfe2 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -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; diff --git a/od-win32/win32.h b/od-win32/win32.h index 49972461..46d8c730 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -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"" diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index dcbdf5e2..4886f3c5 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -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)) { diff --git a/od-win32/winuae_msvc10/winuae_msvc.vcxproj b/od-win32/winuae_msvc10/winuae_msvc.vcxproj index f72417ae..e684abc3 100644 --- a/od-win32/winuae_msvc10/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc10/winuae_msvc.vcxproj @@ -216,11 +216,11 @@ 0x0409 - 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) + 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) $(OutDir)$(TargetName)$(TargetExt) true %(IgnoreSpecificDefaultLibraries) - wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;%(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) true $(Platform)\$(Configuration)\winuae.pdb Windows @@ -356,13 +356,13 @@ 0x0409 - 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) + 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) NotSet $(OutDir)$(TargetName)$(TargetExt) true %(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\ %(IgnoreSpecificDefaultLibraries) - wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;%(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) true $(Platform)\$(Configuration)\winuae.pdb Windows @@ -500,13 +500,13 @@ 0x0409 - 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) + 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) NotSet $(OutDir)$(TargetName)$(TargetExt) true %(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\ %(IgnoreSpecificDefaultLibraries) - wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;%(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) true $(Platform)\$(Configuration)\winuae.pdb Windows diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 89123ddc..478b7fb4 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -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) diff --git a/rommgr.cpp b/rommgr.cpp index df334f6c..7b3980e4 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -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; diff --git a/savestate.cpp b/savestate.cpp index db42313f..6f249603 100644 --- a/savestate.cpp +++ b/savestate.cpp @@ -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 */ -- 2.47.3