From: Toni Wilen Date: Sat, 13 Nov 2010 16:25:36 +0000 (+0200) Subject: 2310b4 X-Git-Tag: 2310~10 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=96762cd86a0c9f86f5ad334b2d23fdafd026593e;p=francis%2Fwinuae.git 2310b4 --- diff --git a/blkdev_cdimage.cpp b/blkdev_cdimage.cpp index 65434c3d..4c485dbc 100644 --- a/blkdev_cdimage.cpp +++ b/blkdev_cdimage.cpp @@ -1492,7 +1492,7 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img) } if (!cdu->tracks) { uae_u64 siz = zfile_size (zcue); - if (siz >= 16384 && (siz % 2048) == 0 || (siz % 2352) == 0) { + if (siz >= 16384 && ((siz % 2048) == 0 || (siz % 2352) == 0)) { struct cdtoc *t = &cdu->toc[0]; cdu->tracks = 1; t->ctrl = 4; @@ -1501,12 +1501,15 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img) t->handle = zcue; t->size = (siz % 2048) == 0 ? 2048 : 2352; t->filesize = siz; - write_log (L"CUE: plain CD image mounted!\n"); + write_log (L"CD: plain CD image mounted!\n"); cdu->toc[1].address = t->address + t->filesize / t->size; zcue = NULL; } } + if (!cdu->tracks) + write_log (L"CD: couldn't mount '%s'!\n", img); + for (i = 0; i <= cdu->tracks; i++) { struct cdtoc *t = &cdu->toc[i]; uae_u32 msf = lsn2msf (t->address); diff --git a/cfgfile.cpp b/cfgfile.cpp index 45d96300..b1ff815f 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -690,6 +690,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_bool (f, L"magic_mouse", p->input_magic_mouse); cfgfile_dwrite_str (f, L"magic_mousecursor", magiccursors[p->input_magic_mouse_cursor]); cfgfile_dwrite_str (f, L"absolute_mouse", abspointers[p->input_tablet]); + cfgfile_dwrite_bool (f, L"clipboard_sharing", p->clipboard_sharing); cfgfile_write (f, L"gfx_display", L"%d", p->gfx_display); cfgfile_write_str (f, L"gfx_display_name", p->gfx_display_name); @@ -1294,6 +1295,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_yesno (option, value, L"magic_mouse", &p->input_magic_mouse) || cfgfile_yesno (option, value, L"warp", &p->turbo_emulation) || cfgfile_yesno (option, value, L"headless", &p->headless) + || cfgfile_yesno (option, value, L"clipboard_sharing", &p->clipboard_sharing) || cfgfile_yesno (option, value, L"bsdsocket_emu", &p->socket_emu)) return 1; @@ -3577,6 +3579,7 @@ void default_prefs (struct uae_prefs *p, int type) p->picasso96_nocustom = 1; p->cart_internal = 1; p->sana2 = 0; + p->clipboard_sharing = true; p->cs_compatible = 1; p->cs_rtc = 2; diff --git a/custom.cpp b/custom.cpp index b6c60245..f53fae88 100644 --- a/custom.cpp +++ b/custom.cpp @@ -5088,7 +5088,6 @@ static void vsync_handler_pre (void) #endif audio_vsync (); blkdev_vsync (); - DISK_vsync (); CIA_vsync_prehandler (); if (quit_program > 0) { @@ -5151,6 +5150,7 @@ static void vsync_handler_post (void) if ((intreq & 0x0020) && (intena & 0x0020)) write_log (L"vblank interrupt not cleared\n"); #endif + DISK_vsync (); if (bplcon0 & 4) lof_store = lof_store ? 0 : 1; lof_current = lof_store; @@ -5500,8 +5500,8 @@ static void hsync_handler_pre (bool isvsync) } set_hpos (); #if 0 - static int ppp = 1; - if (input_record && hsync_counter == 50 * 313 + 1) { + static int ppp = 2; + if (input_record && hsync_counter == 100 * 313 + 1) { ppp--; if (ppp == 0) activate_debugger (); @@ -5845,6 +5845,7 @@ void custom_reset (int hardreset) sprite_width = GET_SPRITEWIDTH (fmode); beamcon0 = new_beamcon0 = currprefs.ntscmode ? 0x00 : 0x20; bltstate = BLT_done; + blit_interrupt = 1; lof_store = lof_current = 1; } @@ -7174,9 +7175,9 @@ STATIC_INLINE int dma_cycle (void) { int hpos, hpos_old; - if (cpu_tracer < 0) - return current_hpos (); blitter_nasty = 1; + if (cpu_tracer == -1) + return current_hpos (); for (;;) { int bpldma; int blitpri = dmacon & DMA_BLITPRI; diff --git a/debug.cpp b/debug.cpp index 0053316c..5bab88fb 100644 --- a/debug.cpp +++ b/debug.cpp @@ -897,20 +897,27 @@ struct dma_rec *record_dma (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos, in return dr; } -static void decode_dma_record (int hpos, int vpos, int toggle) +static void decode_dma_record (int hpos, int vpos, int toggle, bool logfile) { struct dma_rec *dr; int h, i, maxh, cnt; + uae_u32 cycles; if (!dma_record[0]) return; dr = &dma_record[dma_record_toggle ^ toggle][vpos * NR_DMA_REC_HPOS]; - console_out_f (L"Line: %02X %3d HPOS %02X %3d:\n", vpos, vpos, hpos, hpos); + if (logfile) + write_dlog (L"Line: %02X %3d HPOS %02X %3d:\n", vpos, vpos, hpos, hpos); + else + console_out_f (L"Line: %02X %3d HPOS %02X %3d:\n", vpos, vpos, hpos, hpos); h = hpos; dr += hpos; maxh = hpos + 80; if (maxh > maxhpos) maxh = maxhpos; + cycles = vsync_cycles; + if (toggle) + cycles -= maxvpos * maxhpos * CYCLE_UNIT; cnt = 0; while (h < maxh) { int col = 9; @@ -977,7 +984,7 @@ static void decode_dma_record (int hpos, int vpos, int toggle) l3[cl2++] = 'I'; if (dr->evt & DMA_EVENT_INTREQ) l3[cl2++] = 'i'; - _stprintf (l5 + cl, L"%08X", vsync_cycles + (vpos * maxhpos + (hpos + cnt)) * CYCLE_UNIT); + _stprintf (l5 + cl, L"%08X", cycles + (vpos * maxhpos + (hpos + cnt)) * CYCLE_UNIT); if (i < cols - 1 && h < maxh - 1) { l1[cl + col - 1] = 32; l2[cl + col - 1] = 32; @@ -987,14 +994,29 @@ static void decode_dma_record (int hpos, int vpos, int toggle) } cnt++; } - console_out_f (L"%s\n", l1); - console_out_f (L"%s\n", l2); - console_out_f (L"%s\n", l3); - console_out_f (L"%s\n", l4); - console_out_f (L"%s\n", l5); - console_out_f (L"\n"); + if (logfile) { + write_dlog (L"%s\n", l1); + write_dlog (L"%s\n", l2); + write_dlog (L"%s\n", l3); + write_dlog (L"%s\n", l4); + write_dlog (L"%s\n", l5); + write_dlog (L"\n"); + } else { + console_out_f (L"%s\n", l1); + console_out_f (L"%s\n", l2); + console_out_f (L"%s\n", l3); + console_out_f (L"%s\n", l4); + console_out_f (L"%s\n", l5); + console_out_f (L"\n"); + } } } +void log_dma_record (void) +{ + if (!debug_dma) + debug_dma = 1; + decode_dma_record (0, 0, 0, true); +} void record_copper (uaecptr addr, int hpos, int vpos) { @@ -2447,6 +2469,59 @@ static void show_exec_lists (TCHAR t) uaecptr execbase = get_long (4); uaecptr list = 0, node; + if (_totupper (t) == 'I') { + static const int it[] = { 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0 }; + static const int it2[] = { 1, 1, 1, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7 }; + list = execbase + 84; + for (int i = 0; i < 16; i++) { + console_out_f (L"%2d %d: %08x\n", i + 1, it2[i], list); + if (it[i]) { + console_out_f (L" [H] %08x\n", get_long (list)); + node = get_long (list + 8); + if (node) { + uae_u8 *addr = get_real_address (get_long (node + 10)); + TCHAR *name = addr ? au ((char*)addr) : au(""); + console_out_f (L" %08x (C=%08X D=%08X) '%s'\n", node, get_long (list + 4), get_long (list), name); + xfree (name); + } + } else { + int cnt = 0; + node = get_long (list); + node = get_long (node); + while (get_long (node)) { + uae_u8 *addr = get_real_address (get_long (node + 10)); + TCHAR *name = addr ? au ((char*)addr) : au(""); + console_out_f (L" [S] %08x (C=%08x D=%08X) '%s'\n", node, get_long (node + 18), get_long (node + 14), name); + if (i == 4 - 1 || i == 14 - 1) { + if (!_tcsicmp (name, L"cia-a") || !_tcsicmp (name, L"cia-b")) { + static const TCHAR *ciai[] = { L"A", L"B", L"ALRM", L"SP", L"FLG" }; + uaecptr cia = node + 22; + for (int j = 0; j < 5; j++) { + uaecptr ciap = get_long (cia); + console_out_f (L" %5s: %08x", ciai[j], ciap); + if (ciap) { + uae_u8 *addr2 = get_real_address (get_long (ciap + 10)); + TCHAR *name2 = addr ? au ((char*)addr2) : au(""); + console_out_f (L" (C=%08x D=%08X) '%s'", get_long (ciap + 18), get_long (ciap + 14), name2); + xfree (name2); + } + console_out_f (L"\n"); + cia += 4; + } + } + } + xfree (name); + node = get_long (node); + cnt++; + } + if (!cnt) + console_out_f (L" [S] \n"); + } + list += 12; + } + return; + } + switch (_totupper (t)) { case 'R': @@ -3341,7 +3416,7 @@ static void debug_1 (void) if (more_params (&inptr)) v2 = readint (&inptr); if (debug_dma) { - decode_dma_record (v2, v1, cmd == 'v'); + decode_dma_record (v2, v1, cmd == 'v', false); } else { debug_dma = v1 < 0 ? -v1 : 1; console_out_f (L"DMA debugger enabled, mode=%d.\n", debug_dma); diff --git a/disk.cpp b/disk.cpp index a552b2e8..67bbcc16 100644 --- a/disk.cpp +++ b/disk.cpp @@ -2381,7 +2381,7 @@ void DISK_vsync (void) if (drv->dskready_down_time > 0) drv->dskready_down_time--; /* emulate drive motor turn on time */ - if (drv->dskready_up_time > 0 && !drive_empty(drv)) { + if (drv->dskready_up_time > 0 && !drive_empty (drv)) { drv->dskready_up_time--; if (drv->dskready_up_time == 0 && !drv->motoroff) drv->dskready = true; @@ -2394,7 +2394,6 @@ void DISK_vsync (void) if (disk_debug_logging > 0) write_log (L"delayed insert, drive %d, image '%s'\n", i, drv->newname); update_drive_gui (i); - } } } @@ -2433,7 +2432,7 @@ void DISK_select (uae_u8 data) step_pulse = data & 1; if (disk_debug_logging > 1) - write_log (L"%08X %02X %s drvmask=%x", M68K_GETPC, data, tobin(data), selected ^ 15); + write_log (L"%08X %02X->%02X %s drvmask=%x", M68K_GETPC, prev_data, data, tobin(data), selected ^ 15); #ifdef AMAX if (currprefs.amaxromfile[0]) @@ -3190,6 +3189,7 @@ void DSKLEN (uae_u16 v, int hpos) write_log (L"disk %s DMA started, drvmask=%x motormask=%x PC=%08x\n", dskdmaen == 3 ? L"write" : L"read", selected ^ 15, motormask, M68K_GETPC); noselected = 1; + activate_debugger(); } else { if (disk_debug_logging > 0) { write_log (L"disk %s DMA started, drvmask=%x track %d mfmpos %d dmaen=%d PC=%08X\n", @@ -3543,6 +3543,12 @@ void DISK_restore_custom (uae_u32 pdskpt, uae_u16 pdsklength, uae_u16 pdskbytr) void restore_disk_finish (void) { + int cnt = 0; + for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) { + if (currprefs.floppyslots[i].dfxtype >= 0) + cnt++; + } + currprefs.nr_floppies = changed_prefs.nr_floppies = cnt; DISK_check_change (); setamax (); if (dskdmaen) @@ -3571,8 +3577,6 @@ uae_u8 *restore_disk (int num,uae_u8 *src) } else { drv->motoroff = (state & 1) ? 0 : 1; drv->idbit = (state & 4) ? 1 : 0; - if (changed_prefs.nr_floppies < num) - changed_prefs.nr_floppies = num; switch (drv->drive_id) { case DRIVE_ID_35HD: @@ -3585,7 +3589,7 @@ uae_u8 *restore_disk (int num,uae_u8 *src) dfxtype = DRV_35_DD; break; } - changed_prefs.floppyslots[num].dfxtype = dfxtype; + currprefs.floppyslots[num].dfxtype = changed_prefs.floppyslots[num].dfxtype = dfxtype; } drv->dskchange = (state & 8) ? 1 : 0; side = (state & 16) ? 1 : 0; @@ -3604,6 +3608,8 @@ uae_u8 *restore_disk (int num,uae_u8 *src) _tcscpy (old, currprefs.floppyslots[num].df); _tcsncpy (changed_prefs.floppyslots[num].df, s, 255); xfree (s); + int dskready_up_time = restore_u16 (); + int dskready_down_time = restore_u16 (); newis = changed_prefs.floppyslots[num].df[0] ? 1 : 0; if (!(disabled & (1 << num))) { if (!newis && old[0]) { @@ -3623,6 +3629,8 @@ uae_u8 *restore_disk (int num,uae_u8 *src) } drv->mfmpos = mfmpos; drv->prevtracklen = drv->tracklen; + drv->dskready_up_time = dskready_up_time; + drv->dskready_down_time = dskready_down_time; reset_drive_gui (num); return src; } @@ -3644,8 +3652,6 @@ uae_u8 *restore_disk2 (int num,uae_u8 *src) if (m & 2) drv->tracktiming[j] = restore_u16 (); } - drv->dskready_up_time = restore_u16 (); - drv->dskready_down_time = restore_u16 (); } return src; } @@ -3667,6 +3673,8 @@ uae_u8 *save_disk (int num, int *len, uae_u8 *dstptr, bool usepath) 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_u16 (drv->dskready_up_time); + save_u16 (drv->dskready_down_time); *len = dst - dstbak; return dstbak; } @@ -3703,8 +3711,6 @@ uae_u8 *save_disk2 (int num, int *len, uae_u8 *dstptr) if (drv->tracktiming[0]) save_u16 (drv->tracktiming[j]); } - save_u16 (drv->dskready_up_time); - save_u16 (drv->dskready_down_time); *len = dst - dstbak; return dstbak; diff --git a/drawing.cpp b/drawing.cpp index d414cbb2..06ecf42e 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -349,6 +349,11 @@ int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy) if (gclow > 0 && gcloh > 0) ret = -1; + last_planes_vpos = (last_planes_vpos) & ~1; + plflastline_total = (plflastline_total) & ~1; + if (!plflastline_total) + plflastline_total = last_planes_vpos; + if (doublescan <= 0) { int min = coord_diw_to_window_x (94); int max = coord_diw_to_window_x (460); diff --git a/expansion.cpp b/expansion.cpp index c959f1a0..01f20971 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -234,7 +234,6 @@ static uae_u32 REGPARAM2 expamem_bget (uaecptr addr) #endif addr &= 0xFFFF; b = expamem[addr]; - //write_log (L"%08x=%02X\n", addr, b); return b; } diff --git a/filesys.cpp b/filesys.cpp index 458af87a..0f4aaafe 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -5996,6 +5996,8 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *context) } else if (mode == 14) { amiga_clipboard_task_start (m68k_dreg (regs, 0)); } else if (mode == 15) { + if (!currprefs.clipboard_sharing) + return 0; amiga_clipboard_init (); } else if (mode == 16) { uaecptr a2 = m68k_areg (regs, 2); diff --git a/gayle.cpp b/gayle.cpp index 232467d5..1155da6f 100644 --- a/gayle.cpp +++ b/gayle.cpp @@ -1187,10 +1187,10 @@ static uae_u32 gayle2_read (uaecptr addr) addr &= 0xffff; if (addr == 0x1000) { /* Gayle ID */ - if ((gayle_id_cnt & 3) == 2) - v = 0x7f; - else + if (gayle_id_cnt == 0 || gayle_id_cnt == 1 || gayle_id_cnt == 3 || ((currprefs.chipset_mask & CSMASK_AGA) && gayle_id_cnt == 7)) v = 0x80; + else + v = 0x00; gayle_id_cnt++; } return v; diff --git a/include/debug.h b/include/debug.h index 8f49ac7b..2d2cd37e 100644 --- a/include/debug.h +++ b/include/debug.h @@ -39,6 +39,7 @@ extern uaecptr dumpmem2 (uaecptr addr, TCHAR *out, int osize); extern void update_debug_info (void); extern int instruction_breakpoint (TCHAR **c); extern int debug_bankchange (int); +extern void log_dma_record (void); #define BREAKPOINT_TOTAL 8 struct breakpoint_node { diff --git a/include/newcpu.h b/include/newcpu.h index 9a0f523d..42a296ca 100644 --- a/include/newcpu.h +++ b/include/newcpu.h @@ -202,6 +202,8 @@ struct cputracestruct uae_u32 cacheholdingaddr020; struct cache020 caches020[CACHELINES020]; + uae_u32 startcycles; + int needendcycles; int memoryoffset; int cyclecounter, cyclecounter_pre, cyclecounter_post; int readcounter, writecounter; diff --git a/include/options.h b/include/options.h index 3b53deae..dc90476d 100644 --- a/include/options.h +++ b/include/options.h @@ -346,6 +346,7 @@ struct uae_prefs { bool filesys_custom_uaefsdb; bool mmkeyboard; int uae_hide; + bool clipboard_sharing; int mountitems; struct uaedev_config_info mountconfig[MOUNT_CONFIG_SIZE]; @@ -422,6 +423,7 @@ struct uae_prefs { struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES]; struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES]; int dongle; + int input_contact_bounce; }; extern int config_changed; diff --git a/inputdevice.cpp b/inputdevice.cpp index 25703aab..f4d69bc4 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -126,7 +126,6 @@ static struct teststore testmode_wait[TESTMODE_MAX]; static int bouncy; static signed long bouncy_cycles; -#define BOUNCY_CYCLES 30 static int handle_input_event (int nr, int state, int max, int autofire, bool canstoprecord, bool playbackevent); @@ -185,13 +184,15 @@ static int **keyboard_default_kbmaps; static int mouse_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS]; static int oldm_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS]; -static int mouse_x[MAX_JPORTS], mouse_y[MAX_JPORTS]; -static int mouse_delta[MAX_JPORTS][MAX_INPUT_DEVICE_EVENTS]; -static int mouse_deltanoreset[MAX_JPORTS][MAX_INPUT_DEVICE_EVENTS]; +#define MOUSE_AXIS_TOTAL 4 + +static uae_s16 mouse_x[MAX_JPORTS], mouse_y[MAX_JPORTS]; +static uae_s16 mouse_delta[MAX_JPORTS][MOUSE_AXIS_TOTAL]; +static uae_s16 mouse_deltanoreset[MAX_JPORTS][MOUSE_AXIS_TOTAL]; static int joybutton[MAX_JPORTS]; static int joydir[MAX_JPORTS]; static int joydirpot[MAX_JPORTS][2]; -static int mouse_frame_x[MAX_JPORTS], mouse_frame_y[MAX_JPORTS]; +static uae_s16 mouse_frame_x[MAX_JPORTS], mouse_frame_y[MAX_JPORTS]; static int mouse_port[NORMAL_JPORTS]; static int cd32_shifter[NORMAL_JPORTS]; @@ -531,6 +532,7 @@ void write_inputdevice_config (struct uae_prefs *p, struct zfile *f) cfgfile_write (f, L"input.analog_joystick_offset", L"%d", p->input_analog_joystick_offset); cfgfile_write (f, L"input.mouse_speed", L"%d", p->input_mouse_speed); cfgfile_write (f, L"input.autofire_speed", L"%d", p->input_autofire_linecnt); + cfgfile_dwrite (f, L"input.contact_bounce", L"%d", p->input_contact_bounce); for (id = 0; id < MAX_INPUT_SETTINGS; id++) { for (i = 0; i < MAX_INPUT_DEVICES; i++) write_config (f, id, i, L"joystick", &p->joystick_settings[id][i], &joysticks2[i], &idev[IDTYPE_JOYSTICK]); @@ -776,6 +778,8 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR * pr->input_analog_joystick_mult = _tstol (value); if (!strcasecmp (p, L"analog_joystick_offset")) pr->input_analog_joystick_offset = _tstol (value); + if (!strcasecmp (p, L"contact_bounce")) + pr->input_contact_bounce = _tstol (value); idnum = _tstol (p); if (idnum <= 0 || idnum > MAX_INPUT_SETTINGS) @@ -2696,10 +2700,10 @@ static int handle_input_event (int nr, int state, int max, int autofire, bool ca } if (ie->data == 0 && old != (joybutton[joy] & (1 << ie->data)) && currprefs.cpu_cycle_exact) { - if (!input_record && !input_play) { + if (!input_record && !input_play && currprefs.input_contact_bounce) { // emulate contact bounce, 1st button only, others have capacitors bouncy = 1; - bouncy_cycles = get_cycles () + CYCLE_UNIT * BOUNCY_CYCLES; + bouncy_cycles = get_cycles () + CYCLE_UNIT * currprefs.input_contact_bounce; } } @@ -5745,6 +5749,14 @@ uae_u8 *save_inputstate (int *len, uae_u8 *dstptr) save_u16 (joydirpot[i][j]); } } + for (int i = 0; i < NORMAL_JPORTS; i++) { + for (int j = 0; j < MOUSE_AXIS_TOTAL; j++) { + save_u16 (mouse_delta[i][j]); + save_u16 (mouse_deltanoreset[i][j]); + } + save_u16 (mouse_frame_x[i]); + save_u16 (mouse_frame_y[i]); + } *len = dst - dstbak; return dstbak; } @@ -5766,6 +5778,14 @@ uae_u8 *restore_inputstate (uae_u8 *src) joydirpot[i][j] = restore_u16 (); } } + for (int i = 0; i < NORMAL_JPORTS; i++) { + for (int j = 0; j < MOUSE_AXIS_TOTAL; j++) { + mouse_delta[i][j] = restore_u16 (); + mouse_deltanoreset[i][j] = restore_u16 (); + } + mouse_frame_x[i] = restore_u16 (); + mouse_frame_y[i] = restore_u16 (); + } return src; } diff --git a/inputrecord.cpp b/inputrecord.cpp index a63dc71c..fb677894 100644 --- a/inputrecord.cpp +++ b/inputrecord.cpp @@ -207,7 +207,11 @@ static int inprec_pstart (uae_u8 type) hc2_orig = hc2; if (type2 == type && hc > hc2) { write_log (L"INPREC: %010d/%03d > %010d/%03d: %d missed!\n", hc, hpos, hc2, hpos2, p[0]); +#if ENABLE_DEBUGGER == 0 gui_message (L"INPREC missed error"); +#else + activate_debugger (); +#endif lastcycle = cycles; inprec_plast = p; inprec_plastptr = p + 12; @@ -343,6 +347,9 @@ int inprec_open (const TCHAR *fname, const TCHAR *statefilename) inprec_zf = zfile_fopen (fname, input_record ? L"wb" : L"rb", ZFD_NORMAL); if (inprec_zf == NULL) return 0; + + currprefs.cs_rtc = changed_prefs.cs_rtc = 0; + inprec_path[0] = 0; if (fname) getpathpart (inprec_path, sizeof inprec_path / sizeof (TCHAR), fname); @@ -534,13 +541,17 @@ void inprec_playdiskchange (void) while (inprec_pstart (INPREC_DISKINSERT)) { int drv = inprec_pu8 (); bool wp = inprec_pu8 () != 0; - TCHAR tmp[MAX_DPATH]; + TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH]; inprec_pstr (tmp); + _tcscpy (tmp2, tmp); if (!zfile_exists (tmp)) { - TCHAR tmp2[MAX_DPATH]; - _tcscpy (tmp2, inprec_path); - _tcscat (tmp2, tmp); - _tcscpy (tmp, tmp2); + TCHAR tmp3[MAX_DPATH]; + _tcscpy (tmp3, inprec_path); + _tcscat (tmp3, tmp); + _tcscpy (tmp, tmp3); + } + if (!zfile_exists (tmp)) { + gui_message (L"INPREC: Disk image\n'%s'\nnot found!\n", tmp2); } _tcscpy (currprefs.floppyslots[drv].df, tmp); _tcscpy (changed_prefs.floppyslots[drv].df, tmp); @@ -556,7 +567,7 @@ bool inprec_playevent (int *nr, int *state, int *max, int *autofire) if (inprec_pstart (INPREC_EVENT)) { *nr = inprec_ps16 (); *state = inprec_ps16 (); - *max = inprec_ps16 (); + *max = inprec_pu16 (); *autofire = inprec_ps16 () & 1; inprec_pend (); return true; @@ -783,6 +794,32 @@ void inprec_setposition (int offset, int replaycounter) inprec_realtime (false); } +static void savelog (const TCHAR *path, const TCHAR *file) +{ + TCHAR tmp[MAX_DPATH]; + + _tcscpy (tmp, path); + _tcscat (tmp, file); + _tcscat (tmp, L".log.txt"); + struct zfile *zfd = zfile_fopen (tmp, L"wb"); + if (zfd) { + int loglen; + uae_u8 *log; + loglen = 0; + log = save_log (TRUE, &loglen); + if (log) + zfile_fwrite (log, loglen, 1, zfd); + xfree (log); + loglen = 0; + log = save_log (FALSE, &loglen); + if (log) + zfile_fwrite (log, loglen, 1, zfd); + xfree (log); + zfile_fclose (zfd); + write_log (L"log '%s' saved\n", tmp); + } +} + static int savedisk (const TCHAR *path, const TCHAR *file, uae_u8 *data, uae_u8 *outdata) { int len = 0; @@ -870,6 +907,7 @@ void inprec_save (const TCHAR *filename, const TCHAR *statefilename) } xfree (data); zfile_fclose (zf); + savelog (path, file); write_log (L"inputfile '%s' saved\n", filename); } else { write_log (L"failed to open '%s'\n", filename); diff --git a/memory.cpp b/memory.cpp index fdf91200..bf16e837 100644 --- a/memory.cpp +++ b/memory.cpp @@ -1229,6 +1229,7 @@ uae_u8 *REGPARAM2 default_xlate (uaecptr a) uaecptr a2 = a - 32; uaecptr a3 = m68k_getpc () - 32; write_log (L"Your Amiga program just did something terribly stupid %08X PC=%08X\n", a, M68K_GETPC); + //activate_debugger(); m68k_dumpstate (0, 0); for (i = 0; i < 10; i++) { write_log (L"%08X ", i >= 5 ? a3 : a2); diff --git a/newcpu.cpp b/newcpu.cpp index c6cdcbeb..c0b8f861 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -226,6 +226,13 @@ static bool check_trace (void) { if (!cpu_tracer) return true; + if (!cputrace.readcounter && !cputrace.writecounter && !cputrace.cyclecounter) { + if (cpu_tracer != -2) { + write_log (L"CPU trace: dma_cycle() enabled. %08x %08x NOW=%08X\n", + cputrace.cyclecounter_pre, cputrace.cyclecounter_post, get_cycles ()); + cpu_tracer = -2; // dma_cycle() allowed to work now + } + } if (cputrace.readcounter || cputrace.writecounter || cputrace.cyclecounter || cputrace.cyclecounter_pre || cputrace.cyclecounter_post) return false; @@ -245,7 +252,8 @@ static bool check_trace (void) x_do_cycles = x2_do_cycles; x_do_cycles_pre = x2_do_cycles_pre; x_do_cycles_post = x2_do_cycles_post; - write_log (L"CPU tracer playback complete\n"); + write_log (L"CPU tracer playback complete. STARTCYCLES=%08x NOWCYCLES=%08x\n", cputrace.startcycles, get_cycles ()); + cputrace.needendcycles = 1; cpu_tracer = 0; return true; } @@ -257,10 +265,10 @@ static bool get_trace (uaecptr addr, int accessmode, int size, uae_u32 *data) struct cputracememory *ctm = &cputrace.ctm[i]; if (ctm->addr == addr && ctm->mode == mode) { ctm->mode = 0; - write_log (L"CPU trace: GET %d: PC=%08x %08x=%08x %d %d %08x/%08x/%08x %d/%d\n", + write_log (L"CPU trace: GET %d: PC=%08x %08x=%08x %d %d %08x/%08x/%08x %d/%d (%08X)\n", i, cputrace.pc, addr, ctm->data, accessmode, size, cputrace.cyclecounter, cputrace.cyclecounter_pre, cputrace.cyclecounter_post, - cputrace.readcounter, cputrace.writecounter); + cputrace.readcounter, cputrace.writecounter, get_cycles ()); if (accessmode == 1) cputrace.writecounter--; else @@ -271,7 +279,6 @@ static bool get_trace (uaecptr addr, int accessmode, int size, uae_u32 *data) cputrace.cyclecounter_post = 0; x_do_cycles (c); } else if (cputrace.cyclecounter_pre) { - cputrace.cyclecounter_pre = 0; check_trace (); return true; // argh, need to rerun the memory access.. } @@ -527,6 +534,21 @@ static void cputracefunc_x_do_cycles (unsigned long cycles) x2_do_cycles (cycles); } } + +static void cputracefunc2_x_do_cycles (unsigned long cycles) +{ + if (cputrace.cyclecounter > cycles) { + cputrace.cyclecounter -= cycles; + return; + } + cycles -= cputrace.cyclecounter; + cputrace.cyclecounter = 0; + check_trace (); + x_do_cycles = x2_do_cycles; + if (cycles > 0) + x_do_cycles (cycles); +} + static void cputracefunc_x_do_cycles_pre (unsigned long cycles) { cputrace.cyclecounter_post = 0; @@ -542,37 +564,6 @@ static void cputracefunc_x_do_cycles_pre (unsigned long cycles) } cputrace.cyclecounter_pre = 0; } -static void cputracefunc_x_do_cycles_post (unsigned long cycles, uae_u32 v) -{ - struct cputracememory *ctm = &cputrace.ctm[cputrace.memoryoffset - 1]; - ctm->data = v; - cputrace.cyclecounter_post = cycles; - cputrace.cyclecounter_pre = 0; - while (cycles >= CYCLE_UNIT) { - cycles -= CYCLE_UNIT; - cputrace.cyclecounter_post -= CYCLE_UNIT; - x2_do_cycles (CYCLE_UNIT); - } - if (cycles > 0) { - cputrace.cyclecounter_post -= cycles; - x2_do_cycles (cycles); - } - cputrace.cyclecounter_post = 0; -} - -static void cputracefunc2_x_do_cycles (unsigned long cycles) -{ - if (cputrace.cyclecounter > cycles) { - cputrace.cyclecounter -= cycles; - return; - } - cycles -= cputrace.cyclecounter; - cputrace.cyclecounter = 0; - check_trace (); - x_do_cycles = x2_do_cycles; - if (cycles > 0) - x_do_cycles (cycles); -} // cyclecounter_pre = how many cycles we need to SWALLOW // -1 = rerun whole access static void cputracefunc2_x_do_cycles_pre (unsigned long cycles) @@ -581,6 +572,7 @@ static void cputracefunc2_x_do_cycles_pre (unsigned long cycles) cputrace.cyclecounter_pre = 0; check_trace (); check_trace2 (); + x_do_cycles (cycles); return; } if (cputrace.cyclecounter_pre > cycles) { @@ -593,6 +585,24 @@ static void cputracefunc2_x_do_cycles_pre (unsigned long cycles) if (cycles > 0) x_do_cycles (cycles); } + +static void cputracefunc_x_do_cycles_post (unsigned long cycles, uae_u32 v) +{ + struct cputracememory *ctm = &cputrace.ctm[cputrace.memoryoffset - 1]; + ctm->data = v; + cputrace.cyclecounter_post = cycles; + cputrace.cyclecounter_pre = 0; + while (cycles >= CYCLE_UNIT) { + cycles -= CYCLE_UNIT; + cputrace.cyclecounter_post -= CYCLE_UNIT; + x2_do_cycles (CYCLE_UNIT); + } + if (cycles > 0) { + cputrace.cyclecounter_post -= cycles; + x2_do_cycles (cycles); + } + cputrace.cyclecounter_post = 0; +} // cyclecounter_post = how many cycles we need to WAIT static void cputracefunc2_x_do_cycles_post (unsigned long cycles, uae_u32 v) { @@ -2985,7 +2995,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) if ((opcode & 0xF000) == 0xF000) { if (warned < 20) { - write_log (L"B-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p); + //write_log (L"B-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p); warned++; } Exception (0xB); @@ -2994,7 +3004,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) } if ((opcode & 0xF000) == 0xA000) { if (warned < 20) { - write_log (L"A-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p); + //write_log (L"A-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p); warned++; } Exception (0xA); @@ -3320,6 +3330,14 @@ STATIC_INLINE int do_specialties (int cycles) } while (regs.spcflags & SPCFLAG_STOP) { + if (cpu_tracer > 0) { + cputrace.stopped = regs.stopped; + cputrace.state = 1; + cputrace.pc = m68k_getpc (); + cputrace.memoryoffset = 0; + cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0; + cputrace.readcounter = cputrace.writecounter = 0; + } x_do_cycles (currprefs.cpu_cycle_exact ? 2 * CYCLE_UNIT : 4 * CYCLE_UNIT); if (regs.spcflags & SPCFLAG_COPPER) do_copper (); @@ -3564,6 +3582,7 @@ static void m68k_run_1_ce (void) for (;;) { uae_u16 opcode = r->ir; + #if DEBUG_CD32CDTVIO out_cd32io (m68k_getpc ()); #endif @@ -3579,6 +3598,7 @@ static void m68k_run_1_ce (void) cputrace.stopped = r->stopped; cputrace.state = 1; cputrace.pc = m68k_getpc (); + cputrace.startcycles = get_cycles (); cputrace.memoryoffset = 0; cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0; cputrace.readcounter = cputrace.writecounter = 0; @@ -3596,6 +3616,12 @@ static void m68k_run_1_ce (void) cputrace.state = 0; } cont: + if (cputrace.needendcycles) { + cputrace.needendcycles = 0; + write_log (L"STARTCYCLES=%08x ENDCYCLES=%08x\n", cputrace.startcycles, get_cycles ()); + log_dma_record (); + } + if (r->spcflags || time_for_interrupt ()) { if (do_specialties (0)) return; @@ -3980,8 +4006,10 @@ static void m68k_run_2 (void) struct regstruct *r = ®s; for (;;) { + r->instruction_pc = m68k_getpc (); uae_u16 opcode = get_iword (0); count_instr (opcode); + #if 0 if (!used[opcode]) { write_log (L"%04X ", opcode); @@ -4794,8 +4822,9 @@ uae_u8 *save_cpu_trace (int *len, uae_u8 *dstptr) save_u32 (cputrace.readcounter); save_u32 (cputrace.writecounter); save_u32 (cputrace.memoryoffset); - write_log (L"CPUT SAVE: PC=%08x %08x %08x %08x %d %d %d\n", - cputrace.pc, cputrace.cyclecounter, cputrace.cyclecounter_pre, cputrace.cyclecounter_post, + write_log (L"CPUT SAVE: PC=%08x C=%08X %08x %08x %08x %d %d %d\n", + cputrace.pc, cputrace.startcycles, + cputrace.cyclecounter, cputrace.cyclecounter_pre, cputrace.cyclecounter_post, cputrace.readcounter, cputrace.writecounter, cputrace.memoryoffset); for (int i = 0; i < cputrace.memoryoffset; i++) { save_u32 (cputrace.ctm[i].addr); @@ -4803,7 +4832,9 @@ uae_u8 *save_cpu_trace (int *len, uae_u8 *dstptr) save_u32 (cputrace.ctm[i].mode); write_log (L"CPUT%d: %08x %08x %08x\n", i, cputrace.ctm[i].addr, cputrace.ctm[i].data, cputrace.ctm[i].mode); } + save_u32 (cputrace.startcycles); *len = dst - dstbak; + cputrace.needendcycles = 1; return dstbak; } @@ -4837,6 +4868,8 @@ uae_u8 *restore_cpu_trace (uae_u8 *src) cputrace.ctm[i].data = restore_u32 (); cputrace.ctm[i].mode = restore_u32 (); } + cputrace.startcycles = restore_u32 (); + cputrace.needendcycles = 1; if (v && cputrace.state) cpu_tracer = -1; diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index e2978514..61a77ca2 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -2679,7 +2679,7 @@ static void read_joystick (void) data = 0; } if (axisold[i][k] != data) { - setjoystickstate (i, k, data, 32768); + setjoystickstate (i, k, data, 32767); axisold[i][k] = data; } } diff --git a/od-win32/midi.cpp b/od-win32/midi.cpp index 7afc9510..80cd6f68 100644 --- a/od-win32/midi.cpp +++ b/od-win32/midi.cpp @@ -44,11 +44,11 @@ #else #define TRACE(x) #endif -#define MIDI_INBUFFERS 800 //use 13 MB Buffer with this settings +#define MIDI_INBUFFERS 100 //use 13 MB Buffer with this settings //on my system it work ok with 10 but who //know when windows rest for a while //with sysex size of 40 win can 8 sec sleep -#define INBUFFLEN 16000 //if this is not enough a warning come +#define INBUFFLEN 24000 //if this is not enough a warning come static int overflow,only_one_time; BOOL midi_ready = FALSE; BOOL midi_in_ready = FALSE; diff --git a/od-win32/serial_win32.cpp b/od-win32/serial_win32.cpp index 744fa0ac..a894c928 100644 --- a/od-win32/serial_win32.cpp +++ b/od-win32/serial_win32.cpp @@ -278,7 +278,7 @@ void SERDAT (uae_u16 w) #endif if (seriallog) - console_out_f (L"%c", dochar (w)); + write_log (L"%c", dochar (w)); if (serper == 372) { if (enforcermode & 2) { diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 2d32073d..1dfc46fa 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -2249,8 +2249,8 @@ uae_u8 *save_log (int bootlog, int *len) fseek (f, 0, SEEK_END); size = ftell (f); fseek (f, 0, SEEK_SET); - if (size > 30000) - size = 30000; + if (*len > 0 && size > *len) + size = *len; if (size > 0) { dst = xcalloc (uae_u8, size + 1); if (dst) @@ -5019,6 +5019,7 @@ static void savedump (MINIDUMPWRITEDUMP dump, HANDLE f, struct _EXCEPTION_POINTE int loglen; musip = NULL; + loglen = 30000; log = save_log (TRUE, &loglen); if (log) { musi.UserStreamArray = mus; @@ -5028,6 +5029,7 @@ static void savedump (MINIDUMPWRITEDUMP dump, HANDLE f, struct _EXCEPTION_POINTE musp->Buffer = log; musp->BufferSize = loglen; musip = &musi; + loglen = 30000; log = save_log (FALSE, &loglen); if (log) { musi.UserStreamCount++; diff --git a/od-win32/win32.h b/od-win32/win32.h index a7897e05..9b528bae 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"3" -#define WINUAEDATE MAKEBD(2010, 10, 26) +#define WINUAEBETA L"4" +#define WINUAEDATE MAKEBD(2010, 11, 13) #define WINUAEEXTRA L"" #define WINUAEREV L"" diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 9fa8aada..c6001dd9 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -281,7 +281,7 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height lastresize--; if (lastresize > 0) { if (cw != lcw || ch != lch || cx != lcx || cy != lcy) - lastresize = 50; + lastresize = 10; useold = 1; } else if (lastdelay == 0) { lastdelay = 2; @@ -309,10 +309,9 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height och = ch; ocx = cx; ocy = cy; - lastresize = 50; + lastresize = 10; lastdelay = 0; } - SetRect (sr, 0, 0, cw * scale, ch * scale); dr->left = (temp_width - aws) /2; dr->top = (temp_height - ahs) / 2; @@ -321,9 +320,13 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height OffsetRect (zr, cx * scale, cy * scale); int ww = dr->right - dr->left; int hh = dr->bottom - dr->top; + int oldwinw = currprefs.gfx_size_win.width; + int oldwinh = currprefs.gfx_size_win.width; changed_prefs.gfx_size_win.width = ww; changed_prefs.gfx_size_win.height = hh; fixup_prefs_dimensions (&changed_prefs); + if (oldwinw != changed_prefs.gfx_size_win.width || oldwinh != changed_prefs.gfx_size_win.height) + config_changed = 1; OffsetRect (zr, -(changed_prefs.gfx_size_win.width - ww + 1) / 2, -(changed_prefs.gfx_size_win.height - hh + 1) / 2); filteroffsetx = -zr->left / scale; filteroffsety = -zr->top / scale; diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index b7c8c739..48584417 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,16 @@ +Beta 4: + +- automatically disable battery backed up clock when input recorder is enabled +- automatic resize didn't set "configuration changed" flag when window size changed, size timeout also changed to 10 frames (was 50) +- 2352 byte sector plain iso images didn't mount (misplaced parenthesis in mode test..) +- exception return address error in non-JIT fastest possible CPU modes (b1) +- increased MIDI sysex buffer size (16000 byte buffer is not large enough, some devices send about 18000 bytes) +- copy also log file (if enabled) when saving input recording +- clipboard sharing can be disabled (config file only) +- joystick/mouse button contact bounce is now off by default (config file only) +- Gayle ID update, 0xD1 (AA), 0xD0 (normal). Real A600/A1200 confirmed (unless there are other revisions) + Rerecorder features: Re-recorder = combined input and state recorder. diff --git a/od-win32/writelog.cpp b/od-win32/writelog.cpp index 6a8c00f4..cf778ce3 100644 --- a/od-win32/writelog.cpp +++ b/od-win32/writelog.cpp @@ -373,35 +373,52 @@ static TCHAR *writets (void) return out; } - void write_dlog (const TCHAR *format, ...) { int count; TCHAR buffer[WRITE_LOG_BUF_SIZE]; - TCHAR *ts; + int bufsize = WRITE_LOG_BUF_SIZE; + TCHAR *bufp; va_list parms; - if (!SHOW_CONSOLE && !console_logging && !debugfile) + if (!cs_init) return; + premsg (); + EnterCriticalSection (&cs); va_start (parms, format); - count = _vsntprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms); - ts = writets (); + bufp = buffer; + for (;;) { + count = _vsntprintf (bufp, bufsize - 1, format, parms); + if (count < 0) { + bufsize *= 10; + if (bufp != buffer) + xfree (bufp); + bufp = xmalloc (TCHAR, bufsize); + continue; + } + break; + } + bufp[bufsize - 1] = 0; + if (!_tcsncmp (bufp, L"write ", 6)) + bufsize--; + if (bufp[0] == '*') + count++; if (SHOW_CONSOLE || console_logging) { - if (lfdetected && ts) - writeconsole (ts); - writeconsole (buffer); + writeconsole (bufp); } if (debugfile) { - if (lfdetected && ts) - _ftprintf (debugfile, L"%s", ts); - _ftprintf (debugfile, L"%s", buffer); + _ftprintf (debugfile, L"%s", bufp); } lfdetected = 0; - if (_tcslen (buffer) > 0 && buffer[_tcslen(buffer) - 1] == '\n') + if (_tcslen (bufp) > 0 && bufp[_tcslen (bufp) - 1] == '\n') lfdetected = 1; va_end (parms); + if (bufp != buffer) + xfree (bufp); + if (always_flush_log) + flush_log (); LeaveCriticalSection (&cs); } @@ -416,7 +433,7 @@ void write_log (const TCHAR *format, ...) if (!cs_init) return; - premsg(); + premsg (); EnterCriticalSection (&cs); va_start (parms, format); diff --git a/savestate.cpp b/savestate.cpp index e3b4d012..db42313f 100644 --- a/savestate.cpp +++ b/savestate.cpp @@ -959,6 +959,7 @@ static int save_state_internal (struct zfile *f, const TCHAR *description, int c save_chunk (f, dst, len, L"CONF", comp); xfree(dst); } + len = 30000; dst = save_log (TRUE, &len); if (dst) { save_chunk (f, dst, len, L"LOG ", comp);