From 7f963d1f0933c8de2353fb98a18988d9b20c5c44 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 15 Jun 2010 19:16:11 +0300 Subject: [PATCH] 2200b10 --- ar.cpp | 6 +- audio.cpp | 88 +++++++++++++--------- cfgfile.cpp | 10 ++- custom.cpp | 8 +- drawing.cpp | 8 +- driveclick.cpp | 41 ++++++---- gfxutil.cpp | 6 +- include/ar.h | 1 - include/drawing.h | 8 +- include/driveclick.h | 2 +- include/fsdb.h | 2 + include/options.h | 1 + include/rommgr.h | 46 +++++------ inputdevice.cpp | 21 +++--- od-win32/clipboard_win32.cpp | 3 +- od-win32/dinput.cpp | 11 +-- od-win32/fsdb_mywin32.cpp | 21 ++++++ od-win32/sounddep/sound.cpp | 2 +- od-win32/win32.h | 6 +- od-win32/win32gfx.cpp | 2 +- od-win32/win32gui.cpp | 9 ++- od-win32/winuae_msvc10/winuae_msvc.vcxproj | 6 +- od-win32/winuaechangelog.txt | 33 +++++++- rommgr.cpp | 15 +++- 24 files changed, 233 insertions(+), 123 deletions(-) diff --git a/ar.cpp b/ar.cpp index 6895c185..2cd4387e 100644 --- a/ar.cpp +++ b/ar.cpp @@ -602,6 +602,8 @@ STATIC_INLINE int ar3a (uaecptr addr, uae_u8 b, int writing) return 0; } +static void action_replay_chipwrite (void); + void REGPARAM2 chipmem_lput_actionreplay1 (uaecptr addr, uae_u32 l) { uae_u32 *m; @@ -618,7 +620,7 @@ void REGPARAM2 chipmem_wput_actionreplay1 (uaecptr addr, uae_u32 w) addr -= chipmem_start & chipmem_mask; addr &= chipmem_mask; - if (addr == 0x62 && !is_ar_pc_in_rom()) + if (addr == 0x60 && !is_ar_pc_in_rom()) action_replay_chipwrite (); m = (uae_u16 *)(chipmemory + addr); do_put_mem_word (m, w); @@ -1143,7 +1145,7 @@ int action_replay_freeze (void) return 0; } -void action_replay_chipwrite (void) +static void action_replay_chipwrite (void) { if (armodel == 2 || armodel == 3) { action_replay_flag = ACTION_REPLAY_DORESET; diff --git a/audio.cpp b/audio.cpp index 44748566..5337f684 100644 --- a/audio.cpp +++ b/audio.cpp @@ -49,18 +49,19 @@ int audio_channel_mask = 15; -STATIC_INLINE int isaudio(void) +STATIC_INLINE bool isaudio (void) { - if (!currprefs.produce_sound) - return 0; - return 1; + return currprefs.produce_sound != 0; } -static int debugchannel (int ch) +static bool debugchannel (int ch) { - if ((1 << ch) & DEBUG_CHANNEL_MASK) - return 1; - return 0; + return ((1 << ch) & DEBUG_CHANNEL_MASK) != 0; +} + +STATIC_INLINE bool usehacks (void) +{ + return currprefs.cpu_model >= 68020 && !currprefs.cpu_cycle_exact; } #define SINC_QUEUE_MAX_AGE 2048 @@ -1096,11 +1097,11 @@ static int isirq (int nr) return INTREQR () & (0x80 << nr); } -static void setirq (int nr) +static void setirq (int nr, int which) { #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log (L"SETIRQ %d %08X\n", nr, M68K_GETPC); + write_log (L"SETIRQ %d (%d) %08X\n", nr, which, M68K_GETPC); #endif INTREQ (0x8000 | (0x80 << nr)); } @@ -1159,7 +1160,7 @@ static void audio_handler (int nr) cdp->state = 1; cdp->wlen = cdp->len; /* there are too many stupid sound routines that fail on "too" fast cpus.. */ - if (currprefs.cpu_model >= 68020 && !currprefs.cpu_cycle_exact) + if (usehacks ()) cdp->pt = cdp->lc; #ifdef DEBUG_AUDIO if (debugchannel (nr)) @@ -1172,7 +1173,7 @@ static void audio_handler (int nr) } else if (!cdp->dmaen && cdp->request_word < 0 && !isirq (nr)) { cdp->evtime = 0; cdp->state = 2; - setirq (nr); + setirq (nr, 0); audio_handler (nr); return; } @@ -1200,7 +1201,7 @@ static void audio_handler (int nr) cdp->request_word = 2; return; } - setirq (nr); + setirq (nr, 5); if (!cdp->dmaen) { cdp->state = 0; cdp->request_word = 0; @@ -1230,7 +1231,7 @@ static void audio_handler (int nr) /* Period attachment? */ if (audap) { if (cdp->intreq2 && cdp->dmaen) - setirq (nr); + setirq (nr, 2); cdp->intreq2 = 0; cdp->request_word = 1; cdp->dat = cdp->dat2; @@ -1248,6 +1249,7 @@ static void audio_handler (int nr) case 3: if (currprefs.produce_sound == 0) cdp->per = PERIOD_MAX; + state23 (cdp); cdp->state = 2; cdp->evtime = cdp->per; @@ -1258,10 +1260,11 @@ static void audio_handler (int nr) if (napnav) cdp->request_word = 1; if (cdp->intreq2 && napnav) - setirq (nr); + setirq (nr, 3); } else { - if (napnav) - setirq (nr); + if (napnav) { + setirq (nr, 4); + } } cdp->intreq2 = 0; @@ -1370,7 +1373,7 @@ void check_prefs_changed_audio (void) clear_sound_buffers (); } set_audio (); - audio_activate(); + audio_activate (); } void set_audio (void) @@ -1691,7 +1694,7 @@ void AUDxDAT (int nr, uae_u16 v) write_log (L"AUD%dDAT: %04X STATE=%d IRQ=%d %08X\n", nr, v, cdp->state, isirq(nr) ? 1 : 0, M68K_GETPC); #endif - audio_activate(); + audio_activate (); update_audio (); cdp->dat2 = v; if (cdp->request_word >= 2 && cdp->request_word_skip == 0) @@ -1699,12 +1702,12 @@ void AUDxDAT (int nr, uae_u16 v) cdp->request_word = -1; cdp->request_word_skip = 0; /* cpu >= 68020: another "too fast" memory/CPU hack */ - if (cdp->state == 0 || (currprefs.cpu_model >= 68020 && !currprefs.cpu_cycle_exact)) { + if (cdp->state == 0 || usehacks ()) { cdp->state = 2; cdp->wlen = cdp->len; cdp->pt = cdp->lc; - if (currprefs.cpu_model >= 68020 && !currprefs.cpu_cycle_exact) - INTREQ (0x80 << nr); + if (usehacks ()) + setirq (nr, -1); audio_handler (nr); schedule_audio (); events_schedule (); @@ -1713,9 +1716,10 @@ void AUDxDAT (int nr, uae_u16 v) void AUDxLCH (int nr, uae_u16 v) { - audio_activate(); + struct audio_channel_data *cdp = audio_channel + nr; + audio_activate (); update_audio (); - audio_channel[nr].lc = (audio_channel[nr].lc & 0xffff) | ((uae_u32)v << 16); + cdp->lc = (cdp->lc & 0xffff) | ((uae_u32)v << 16); #ifdef DEBUG_AUDIO if (debugchannel (nr)) write_log (L"AUD%dLCH: %04X %08X\n", nr, v, M68K_GETPC); @@ -1724,9 +1728,10 @@ void AUDxLCH (int nr, uae_u16 v) void AUDxLCL (int nr, uae_u16 v) { - audio_activate(); + struct audio_channel_data *cdp = audio_channel + nr; + audio_activate (); update_audio (); - audio_channel[nr].lc = (audio_channel[nr].lc & ~0xffff) | (v & 0xFFFE); + cdp->lc = (cdp->lc & ~0xffff) | (v & 0xFFFE); #ifdef DEBUG_AUDIO if (debugchannel (nr)) write_log (L"AUD%dLCL: %04X %08X\n", nr, v, M68K_GETPC); @@ -1735,28 +1740,37 @@ void AUDxLCL (int nr, uae_u16 v) void AUDxPER (int nr, uae_u16 v) { + struct audio_channel_data *cdp = audio_channel + nr; unsigned long per = v * CYCLE_UNIT; - audio_activate(); + audio_activate (); update_audio (); if (per == 0) per = PERIOD_MAX - 1; +#if 0 + // too fast CPU compatibility hack. KS sets AUDxPER == 8 or 1 when ending the sound, this does not + // always work correctly in JIT modes if sound is immediately restarted. + if (usehacks () && per < 10 * CYCLE_UNIT && !cdp->dmaen) { + zerostate (cdp); + } +#endif + if (per < maxhpos * CYCLE_UNIT / 2 && currprefs.produce_sound < 3) per = maxhpos * CYCLE_UNIT / 2; else if (per < 4 * CYCLE_UNIT) /* smaller values would cause extremely high cpu usage */ per = 4 * CYCLE_UNIT; - if (audio_channel[nr].per == PERIOD_MAX - 1 && per != PERIOD_MAX - 1) { - audio_channel[nr].evtime = CYCLE_UNIT; - if (isaudio()) { + if (cdp->per == PERIOD_MAX - 1 && per != PERIOD_MAX - 1) { + cdp->evtime = CYCLE_UNIT; + if (isaudio ()) { schedule_audio (); events_schedule (); } } - audio_channel[nr].per = per; + cdp->per = per; #ifdef DEBUG_AUDIO if (debugchannel (nr)) write_log (L"AUD%dPER: %d %08X\n", nr, v, M68K_GETPC); @@ -1765,9 +1779,10 @@ void AUDxPER (int nr, uae_u16 v) void AUDxLEN (int nr, uae_u16 v) { - audio_activate(); + struct audio_channel_data *cdp = audio_channel + nr; + audio_activate (); update_audio (); - audio_channel[nr].len = v; + cdp->len = v; #ifdef DEBUG_AUDIO if (debugchannel (nr)) write_log (L"AUD%dLEN: %d %08X\n", nr, v, M68K_GETPC); @@ -1776,11 +1791,12 @@ void AUDxLEN (int nr, uae_u16 v) void AUDxVOL (int nr, uae_u16 v) { + struct audio_channel_data *cdp = audio_channel + nr; int v2 = v & 64 ? 63 : v & 63; - audio_activate(); + audio_activate (); update_audio (); - audio_channel[nr].vol = v2; + cdp->vol = v2; #ifdef DEBUG_AUDIO if (debugchannel (nr)) write_log (L"AUD%dVOL: %d %08X\n", nr, v2, M68K_GETPC); @@ -1818,7 +1834,7 @@ void audio_update_adkmasks (void) audio_channel[2].adk_mask = (((t >> 2) & 1) - 1); audio_channel[3].adk_mask = (((t >> 3) & 1) - 1); if ((prevcon & 0xff) != (adkcon & 0xff)) { - audio_activate(); + audio_activate (); #ifdef DEBUG_AUDIO write_log (L"ADKCON=%02x %08X\n", adkcon & 0xff, M68K_GETPC); #endif diff --git a/cfgfile.cpp b/cfgfile.cpp index 8399c0ca..6ea2a5d9 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -562,6 +562,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, L"nr_floppies", L"%d", p->nr_floppies); cfgfile_write (f, L"floppy_speed", L"%d", p->floppy_speed); cfgfile_write (f, L"floppy_volume", L"%d", p->dfxclickvolume); + cfgfile_dwrite (f, L"floppy_channel_mask", L"0x%x", p->dfxclickchannelmask); cfgfile_write_bool (f, L"parallel_on_demand", p->parallel_demand); cfgfile_write_bool (f, L"serial_on_demand", p->serial_demand); cfgfile_write_bool (f, L"serial_hardware_ctsrts", p->serial_hwctsrts); @@ -1171,6 +1172,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_intval (option, value, L"floppy1sound", &p->dfxclick[1], 1) || cfgfile_intval (option, value, L"floppy2sound", &p->dfxclick[2], 1) || cfgfile_intval (option, value, L"floppy3sound", &p->dfxclick[3], 1) + || cfgfile_intval (option, value, L"floppy_channel_mask", &p->dfxclickchannelmask, 1) || cfgfile_intval (option, value, L"floppy_volume", &p->dfxclickvolume, 1)) return 1; @@ -2449,8 +2451,11 @@ void cfgfile_backup (const TCHAR *path) fetch_configurationpath (dpath, sizeof (dpath) / sizeof (TCHAR)); _tcscat (dpath, L"configuration.backup"); + bool hidden = my_isfilehidden (dpath); my_unlink (dpath); my_rename (path, dpath); + if (hidden) + my_setfilehidden (dpath, hidden); } int cfgfile_save (struct uae_prefs *p, const TCHAR *filename, int type) @@ -3511,6 +3516,7 @@ void default_prefs (struct uae_prefs *p, int type) p->floppy_random_bits_min = 1; p->floppy_random_bits_max = 3; p->dfxclickvolume = 33; + p->dfxclickchannelmask = 0xffff; p->statecapturebuffersize = 20 * 1024 * 1024; p->statecapturerate = 5 * 50; @@ -4244,8 +4250,8 @@ void config_check_vsync (void) } cnt--; if (config_changed) { - if (config_changed == 1) - write_log (L"* configuration check trigger\n"); +// if (config_changed == 1) +// write_log (L"* configuration check trigger\n"); config_changed++; if (config_changed > 10) config_changed = 0; diff --git a/custom.cpp b/custom.cpp index 9bccf379..a3cd40fd 100644 --- a/custom.cpp +++ b/custom.cpp @@ -325,9 +325,9 @@ static int current_change_set; static struct sprite_entry sprite_entries[2][MAX_SPR_PIXELS / 16]; static struct color_change color_changes[2][MAX_REG_CHANGE]; -struct decision line_decisions[2 * (MAXVPOS + 1) + 1]; -static struct draw_info line_drawinfo[2][2 * (MAXVPOS + 1) + 1]; -#define COLOR_TABLE_SIZE (MAXVPOS + 1) * 2 +struct decision line_decisions[2 * (MAXVPOS + 2) + 1]; +static struct draw_info line_drawinfo[2][2 * (MAXVPOS + 2) + 1]; +#define COLOR_TABLE_SIZE (MAXVPOS + 2) * 2 static struct color_entry color_tables[2][COLOR_TABLE_SIZE]; static int next_sprite_entry = 0; @@ -2784,6 +2784,8 @@ void init_hz (void) dumpsync (); hzc = 1; } + if (maxvpos_nom >= MAXVPOS) + maxvpos_nom = MAXVPOS; if (currprefs.gfx_scandoubler && doublescan == 0) doublescan = -1; if (doublescan != odbl || maxvpos != omaxvpos) diff --git a/drawing.cpp b/drawing.cpp index 9c80e988..4f49adc0 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -180,9 +180,9 @@ typedef void (*line_draw_func)(int, int); #define LINE_DONE_AS_PREVIOUS 8 #define LINE_REMEMBERED_AS_PREVIOUS 9 -static uae_u8 linestate[(MAXVPOS + 1) * 2 + 1]; +static uae_u8 linestate[(MAXVPOS + 2) * 2 + 1]; -uae_u8 line_data[(MAXVPOS + 1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; +uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; /* Centering variables. */ static int min_diwstart, max_diwstop; @@ -1967,8 +1967,8 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos) switch (linestate[lineno]) { case LINE_REMEMBERED_AS_PREVIOUS: - if (!warned) - write_log (L"Shouldn't get here... this is a bug.\n"), warned++; +// if (!warned) // happens when program messes up with VPOSW +// write_log (L"Shouldn't get here... this is a bug.\n"), warned++; return; case LINE_BLACK: diff --git a/driveclick.cpp b/driveclick.cpp index 6e1b1093..45eeb80f 100644 --- a/driveclick.cpp +++ b/driveclick.cpp @@ -327,7 +327,7 @@ STATIC_INLINE uae_s16 limit (uae_s32 v) return v; } -void driveclick_mix (uae_s16 *sndbuffer, int size) +void driveclick_mix (uae_s16 *sndbuffer, int size, int channelmask) { int i; @@ -340,36 +340,49 @@ void driveclick_mix (uae_s16 *sndbuffer, int size) case 6: for (i = 0; i < size / 6; i++) { uae_s16 s = clickbuffer[i]; - sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3); - sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3); - sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3); - sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3); - sndbuffer[4] = limit (((sndbuffer[4] + s) * 2) / 3); - sndbuffer[5] = limit (((sndbuffer[5] + s) * 2) / 3); + if (channelmask & 1) + sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3); + if (channelmask & 2) + sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3); + if (channelmask & 4) + sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3); + if (channelmask & 8) + sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3); + if (channelmask & 16) + sndbuffer[4] = limit (((sndbuffer[4] + s) * 2) / 3); + if (channelmask & 32) + sndbuffer[5] = limit (((sndbuffer[5] + s) * 2) / 3); sndbuffer += 6; } break; case 4: for (i = 0; i < size / 4; i++) { uae_s16 s = clickbuffer[i]; - sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3); - sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3); - sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3); - sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3); + if (channelmask & 1) + sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3); + if (channelmask & 2) + sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3); + if (channelmask & 4) + sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3); + if (channelmask & 8) + sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3); sndbuffer += 4; } break; case 2: for (i = 0; i < size / 2; i++) { uae_s16 s = clickbuffer[i]; - sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3); - sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3); + if (channelmask & 1) + sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3); + if (channelmask & 2) + sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3); sndbuffer += 2; } break; case 1: for (i = 0; i < size; i++) { - sndbuffer[0] = limit (((sndbuffer[0] + clickbuffer[i]) * 2) / 3); + if (channelmask & 1) + sndbuffer[0] = limit (((sndbuffer[0] + clickbuffer[i]) * 2) / 3); sndbuffer++; } break; diff --git a/gfxutil.cpp b/gfxutil.cpp index 22355738..8dad9023 100644 --- a/gfxutil.cpp +++ b/gfxutil.cpp @@ -426,7 +426,7 @@ void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, in xredcolor_s = rs; xgreencolor_s = gs; xbluecolor_s = bs; - xredcolor_m = (1 << rw) - 1; - xgreencolor_m = (1 << gw) - 1; - xbluecolor_m = (1 << bw) - 1; + xredcolor_m = ((1 << rw) - 1) << xredcolor_s; + xgreencolor_m = ((1 << gw) - 1) << xgreencolor_s; + xbluecolor_m = ((1 << bw) - 1) << xbluecolor_s; } diff --git a/include/ar.h b/include/ar.h index cb74192e..88091bfd 100644 --- a/include/ar.h +++ b/include/ar.h @@ -42,7 +42,6 @@ extern int action_replay_load (void); extern void action_replay_memory_reset (void); extern void action_replay_init (int); extern void action_replay_cleanup (void); -extern void action_replay_chipwrite (void); extern void action_replay_map_banks (void); extern void REGPARAM3 chipmem_lput_actionreplay23 (uaecptr addr, uae_u32 l) REGPARAM; extern void REGPARAM3 chipmem_wput_actionreplay23 (uaecptr addr, uae_u32 w) REGPARAM; diff --git a/include/drawing.h b/include/drawing.h index 6ee3d55c..27e6fa6f 100644 --- a/include/drawing.h +++ b/include/drawing.h @@ -206,7 +206,7 @@ extern struct color_change *color_changes[2]; extern struct color_change color_changes[2][MAX_REG_CHANGE]; #endif -extern struct color_entry color_tables[2][(MAXVPOS + 1) * 2]; +extern struct color_entry color_tables[2][(MAXVPOS + 2) * 2]; extern struct color_entry *curr_color_tables, *prev_color_tables; extern struct sprite_entry *curr_sprite_entries, *prev_sprite_entries; @@ -243,10 +243,10 @@ struct draw_info { extern int next_sprite_entry; -extern struct decision line_decisions[2 * (MAXVPOS + 1) + 1]; -extern struct draw_info line_drawinfo[2][2 * (MAXVPOS + 1) + 1]; +extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1]; +extern struct draw_info line_drawinfo[2][2 * (MAXVPOS + 2) + 1]; -extern uae_u8 line_data[(MAXVPOS + 1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; +extern uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; /* Functions in drawing.c. */ extern int coord_native_to_amiga_y (int); diff --git a/include/driveclick.h b/include/driveclick.h index 6be25f24..fabc7b99 100644 --- a/include/driveclick.h +++ b/include/driveclick.h @@ -30,7 +30,7 @@ extern void driveclick_insert (int drive, int eject); extern void driveclick_init (void); extern void driveclick_free (void); extern void driveclick_reset (void); -extern void driveclick_mix (uae_s16*, int); +extern void driveclick_mix (uae_s16*, int, int); extern int driveclick_loadresource (struct drvsample*, int); extern void driveclick_check_prefs (void); extern uae_s16 *decodewav (uae_u8 *s, int *len); diff --git a/include/fsdb.h b/include/fsdb.h index 60e7e50e..08abbf3f 100644 --- a/include/fsdb.h +++ b/include/fsdb.h @@ -132,6 +132,8 @@ extern int my_mkdir (const TCHAR*); extern int my_unlink (const TCHAR*); extern int my_rename (const TCHAR*, const TCHAR*); extern int my_setcurrentdir (const TCHAR *curdir, TCHAR *oldcur); +bool my_isfilehidden (const TCHAR *path); +void my_setfilehidden (const TCHAR *path, bool hidden); extern struct my_openfile_s *my_open (const TCHAR*, int); extern void my_close (struct my_openfile_s*); diff --git a/include/options.h b/include/options.h index 9bb3a237..43ced3bd 100644 --- a/include/options.h +++ b/include/options.h @@ -324,6 +324,7 @@ struct uae_prefs { int dfxclick[4]; TCHAR dfxclickexternal[4][256]; int dfxclickvolume; + int dfxclickchannelmask; /* Target specific options */ diff --git a/include/rommgr.h b/include/rommgr.h index bd5db1b9..38281747 100644 --- a/include/rommgr.h +++ b/include/rommgr.h @@ -1,28 +1,28 @@ extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size); -#define ROMTYPE_KICK 0x000001 -#define ROMTYPE_KICKCD32 0x000002 -#define ROMTYPE_EXTCD32 0x000004 -#define ROMTYPE_EXTCDTV 0x000008 -#define ROMTYPE_A2091BOOT 0x000010 -#define ROMTYPE_A4091BOOT 0x000020 -#define ROMTYPE_AR 0x000040 -#define ROMTYPE_SUPERIV 0x000080 -#define ROMTYPE_KEY 0x000100 -#define ROMTYPE_ARCADIABIOS 0x000200 -#define ROMTYPE_ARCADIAGAME 0x000400 -#define ROMTYPE_HRTMON 0x000800 -#define ROMTYPE_NORDIC 0x001000 -#define ROMTYPE_XPOWER 0x002000 -#define ROMTYPE_CD32CART 0x004000 -#define ROMTYPE_SPECIALKICK 0x008000 -#define ROMTYPE_MASK 0x01ffff -#define ROMTYPE_EVEN 0x020000 -#define ROMTYPE_ODD 0x040000 -#define ROMTYPE_8BIT 0x080000 -#define ROMTYPE_BYTESWAP 0x100000 -#define ROMTYPE_CD32 0x200000 -#define ROMTYPE_SCRAMBLED 0x400000 +#define ROMTYPE_KICK 0x000001 +#define ROMTYPE_KICKCD32 0x000002 +#define ROMTYPE_EXTCD32 0x000004 +#define ROMTYPE_EXTCDTV 0x000008 +#define ROMTYPE_A2091BOOT 0x000010 +#define ROMTYPE_A4091BOOT 0x000020 +#define ROMTYPE_AR 0x000040 +#define ROMTYPE_SUPERIV 0x000080 +#define ROMTYPE_KEY 0x000100 +#define ROMTYPE_ARCADIABIOS 0x000200 +#define ROMTYPE_ARCADIAGAME 0x000400 +#define ROMTYPE_HRTMON 0x000800 +#define ROMTYPE_NORDIC 0x001000 +#define ROMTYPE_XPOWER 0x002000 +#define ROMTYPE_CD32CART 0x004000 +#define ROMTYPE_SPECIALKICK 0x008000 +#define ROMTYPE_MASK 0x01ffff +#define ROMTYPE_EVEN 0x020000 +#define ROMTYPE_ODD 0x040000 +#define ROMTYPE_8BIT 0x080000 +#define ROMTYPE_BYTESWAP 0x100000 +#define ROMTYPE_CD32 0x200000 +#define ROMTYPE_SCRAMBLED 0x400000 struct romheader { TCHAR *name; diff --git a/inputdevice.cpp b/inputdevice.cpp index 1f7ed072..18f7dba4 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -681,7 +681,9 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae kbr->port[i][SPARE_SUB_EVENT] && keyboard_default[k].evt == kbr->eventid[i][SPARE_SUB_EVENT] && keyboard_default[k].flags == (kbr->flags[i][SPARE_SUB_EVENT] & ID_FLAG_SAVE_MASK); - if (kbr->port[i][0] > 0 && !(kbr->flags[i][0] & ID_FLAG_GAMEPORTSCUSTOM) && (kbr->port[i][SPARE_SUB_EVENT] == 0 || isdefaultspare)) + if (kbr->port[i][0] > 0 && !(kbr->flags[i][0] & ID_FLAG_GAMEPORTSCUSTOM) && + (kbr->eventid[i][1] <= 0 && kbr->eventid[i][2] <= 0 && kbr->eventid[i][3] <= 0) && + (kbr->port[i][SPARE_SUB_EVENT] == 0 || isdefaultspare)) skip = 1; if (kbr->eventid[i][0] == 0 && (kbr->flags[i][0] & ID_FLAG_SAVE_MASK) == 0 && keyboard_default[k].scancode < 0) skip = 1; @@ -722,8 +724,7 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae } } idf->get_widget_type (devnum, i, tmp5, NULL); - p = tmp5 + _tcslen (tmp5) + 1; - _stprintf (tmp3, L"%d%s%s", kbr->extra[i], p[0] ? L"." : L"", p[0] ? p : L""); + _stprintf (tmp3, L"%d%s%s", kbr->extra[i], tmp5[0] ? L"." : L"", tmp5[0] ? tmp5 : L""); kbrlabel (tmp3); _stprintf (tmp1, L"keyboard.%d.button.%s", devnum, tmp3); _stprintf (tmp4, L"input.%d.%s", idnum + 1, tmp1); @@ -4912,10 +4913,7 @@ void inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out) { if (!out) return; - if (ie->allow_mask == AM_K) - _stprintf (out, L"%s (0x%02X)", ie->name, ie->data); - else - _tcscpy (out, ie->name); + _tcscpy (out, ie->name); } int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af) @@ -5598,7 +5596,7 @@ int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum, struct inputdevice_functions *idf; int type = IDTYPE_MOUSE; int idnum = JSEM_MICE; - if (j == 0) { + if (j > 0) { type = IDTYPE_JOYSTICK; idnum = JSEM_JOYS; } @@ -5619,20 +5617,23 @@ int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum, break; case 0: { - int start = JPORT_NONE, got = 0; + int start = JPORT_NONE, got = 0, max = 0; TCHAR *pp = 0; if (_tcsncmp (value, L"kbd", 3) == 0) { start = JSEM_KBDLAYOUT; pp = value + 3; got = 1; + max = JSEM_LASTKBD; } else if (_tcsncmp (value, L"joy", 3) == 0) { start = JSEM_JOYS; pp = value + 3; got = 1; + max = idev[IDTYPE_JOYSTICK].get_num (); } else if (_tcsncmp (value, L"mouse", 5) == 0) { start = JSEM_MICE; pp = value + 5; got = 1; + max = idev[IDTYPE_MOUSE].get_num (); } else if (_tcscmp (value, L"none") == 0) { got = 2; } else if (_tcscmp (value, L"custom") == 0) { @@ -5646,6 +5647,8 @@ int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum, if (start == JSEM_KBDLAYOUT && v > 0) v--; if (v >= 0) { + if (v >= max) + v = 0; start += v; got = 2; } diff --git a/od-win32/clipboard_win32.cpp b/od-win32/clipboard_win32.cpp index 773381c9..d43a247e 100644 --- a/od-win32/clipboard_win32.cpp +++ b/od-win32/clipboard_win32.cpp @@ -457,7 +457,8 @@ static void from_iff_ilbm (uaecptr ilbm, uae_u32 len) addr += 12; for (;;) { - uae_u8 chunk[4], csize; + int csize; + uae_u8 chunk[4]; uae_u8 *paddr, *ceaddr; paddr = addr; diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 643d6318..38ec6d1e 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -909,7 +909,7 @@ static int initialize_rawinput (void) j++; } if (!tmp[0]) - _stprintf (tmp, L"Key %02X", k + 1); + _stprintf (tmp, L"KEY_%02X", k + 1); did->buttonname[k] = my_strdup (tmp); did->buttonmappings[k] = k + 1; did->buttonsort[k] = k + 1; @@ -1847,11 +1847,8 @@ static int get_kb_widget_first (int kb, int type) static int get_kb_widget_type (int kb, int num, TCHAR *name, uae_u32 *code) { - if (name) { - _stprintf (name, L"[%02X] %s", di_keyboard[kb].buttonmappings[num], di_keyboard[kb].buttonname[num]); - name += _tcslen (name) + 1; + if (name) _tcscpy (name, di_keyboard[kb].buttonname[num]); - } if (code) *code = di_keyboard[kb].buttonmappings[num]; return IDEV_WIDGET_KEY; @@ -1890,8 +1887,8 @@ static uae_u32 get_leds (void) led |= KBLED_NUMLOCK; if (OutputBuffer.LedFlags & KEYBOARD_CAPS_LOCK_ON) led |= KBLED_CAPSLOCK; - if (OutputBuffer.LedFlags & KEYBOARD_SCROLL_LOCK_ON) led - |= KBLED_SCROLLLOCK; + if (OutputBuffer.LedFlags & KEYBOARD_SCROLL_LOCK_ON) + led |= KBLED_SCROLLLOCK; #endif } return led; diff --git a/od-win32/fsdb_mywin32.cpp b/od-win32/fsdb_mywin32.cpp index 5d647a86..be2c8e65 100644 --- a/od-win32/fsdb_mywin32.cpp +++ b/od-win32/fsdb_mywin32.cpp @@ -7,6 +7,27 @@ #include "win32.h" #include +bool my_isfilehidden (const TCHAR *path) +{ + DWORD attr = GetFileAttributes (path); + if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_HIDDEN)) + return true; + return false; +} +void my_setfilehidden (const TCHAR *path, bool hidden) +{ + DWORD attr = GetFileAttributes (path); + if (attr == INVALID_FILE_ATTRIBUTES) + return; + DWORD attro = attr; + attr &= ~FILE_ATTRIBUTE_HIDDEN; + if (hidden) + attr |= FILE_ATTRIBUTE_HIDDEN; + if (attro == attr) + return; + SetFileAttributes (path, attr); +} + int my_setcurrentdir (const TCHAR *curdir, TCHAR *oldcur) { int ret = 0; diff --git a/od-win32/sounddep/sound.cpp b/od-win32/sounddep/sound.cpp index 7e9c5f17..7271c6f2 100644 --- a/od-win32/sounddep/sound.cpp +++ b/od-win32/sounddep/sound.cpp @@ -1879,7 +1879,7 @@ void finish_sound_buffer (void) channelswap6 ((uae_s16*)paula_sndbuffer, sdp->sndbufsize / 2); } #ifdef DRIVESOUND - driveclick_mix ((uae_s16*)paula_sndbuffer, sdp->sndbufsize / 2); + driveclick_mix ((uae_s16*)paula_sndbuffer, sdp->sndbufsize / 2, currprefs.dfxclickchannelmask); #endif #ifdef AVIOUTPUT if (avioutput_enabled && avioutput_audio) diff --git a/od-win32/win32.h b/od-win32/win32.h index b708e384..397ec326 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -18,9 +18,9 @@ #define WINUAEPUBLICBETA 1 #define LANG_DLL 1 -#define WINUAEBETA L"8" -#define WINUAEDATE MAKEBD(2010, 6, 11) -#define WINUAEEXTRA L"" +#define WINUAEBETA L"10" +#define WINUAEDATE MAKEBD(2010, 6, 15) +#define WINUAEEXTRA L"RC1" #define WINUAEREV L"" #define IHF_WINDOWHIDDEN 6 diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 87124dde..831181f1 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1751,7 +1751,7 @@ bool vsync_switchmode (int hz, int oldhz) } } if (!found) { - tempvsync = currprefs.gfx_avsync; + tempvsync = currprefs.gfx_avsync != 0; changed_prefs.gfx_avsync = 0; write_log (L"refresh rate changed to %d but no matching screenmode found, vsync disabled\n", hz); } else { diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index fd8dc630..39d9494a 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -2630,9 +2630,12 @@ static void flushconfigcache (const TCHAR *cachepath) if (zcache == NULL) return; fclose (zcache); + bool hidden = my_isfilehidden (cachepath); + my_setfilehidden (cachepath, false); zcache = _tfopen (cachepath, L"w+, ccs=UTF-8"); if (zcache) fclose (zcache); + my_setfilehidden (cachepath, hidden); write_log (L"'%s' flushed\n", cachepath); } @@ -2899,6 +2902,8 @@ static void writeconfigcache (const TCHAR *path) if (!configurationcache) return; getconfigcache (cachepath, path); + bool hidden = my_isfilehidden (cachepath); + my_setfilehidden (cachepath, false); zcache = _tfopen (cachepath, L"w, ccs=UTF-8"); if (!zcache) return; @@ -2921,6 +2926,7 @@ static void writeconfigcache (const TCHAR *path) writeconfigcacheentry (zcache, path2, cs); } fclose (zcache); + my_setfilehidden (cachepath, hidden); write_log (L"'%s' created\n", cachepath); } @@ -3279,7 +3285,7 @@ static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum, if (list) { LVGROUP group; - group.cbSize = sizeof(LVGROUP); + group.cbSize = sizeof (LVGROUP); group.mask = LVGF_HEADER | LVGF_GROUPID; group.pszHeader = (TCHAR*)evt->name; group.iGroupId = cntgroup; @@ -11300,6 +11306,7 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw int op = inputmap_port; if (inputmap_handle (NULL, input_selected_device, input_selected_widget, &op, &inputmap_index, state)) { if (op == inputmap_port) { + ListView_EnsureVisible (h, 1, FALSE); ListView_EnsureVisible (h, inputmap_index, FALSE); ListView_SetItemState (h, -1, 0, LVIS_SELECTED | LVIS_FOCUSED); ListView_SetItemState (h, inputmap_index, LVIS_SELECTED , LVIS_SELECTED); diff --git a/od-win32/winuae_msvc10/winuae_msvc.vcxproj b/od-win32/winuae_msvc10/winuae_msvc.vcxproj index ea6f4f2e..1cf74857 100644 --- a/od-win32/winuae_msvc10/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc10/winuae_msvc.vcxproj @@ -363,7 +363,7 @@ true %(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\ %(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_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;%(DelayLoadDLLs) true $(Platform)\$(Configuration)\winuae.pdb Windows @@ -503,13 +503,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.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;%(AdditionalDependencies) NotSet d:\amiga\winuae64.exe true %(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\ %(IgnoreSpecificDefaultLibraries) - wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;freetype6.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.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;%(DelayLoadDLLs) true $(Platform)\$(Configuration)\winuae.pdb Windows diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index eb6a274b..81e65c57 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,8 +1,37 @@ +Beta 10: (RC1, official release before Midsummer) + +- some V(H)POSW modifications corrupted memory (AR3 for example) +- AR3 3.09 odd/even pair rom image didn't load correctly +- AR1 has never worked in cycle-exact mode +- Amiga->Windows image clipboard sharing didn't work if any IFF + chunk (except body) size was more than 255 bytes +- removed confusing and useless Input keyboard key numbers +- GamePorts test mode list vertical centering improved +- configuration file joyportX=kbdZ/joyZ/mouseZ (where Z is larger + than max available devices) was not checked +- floppy sound channel mask added, configuration file only (floppy_channel_mask), + default is all channels. 1=left,2=right,4=center,8=sub,16=surleft,32=surright. +- keyboard input configuration slots 2/3/4 not saved if slot 1 contained port + configuration and stored slot 1 was mapped to default keyboard key +- configuration.backup and configuration.cache remembers hidden file attribute + +Beta 9: + +- "megachip" was added even if disabled (was fixed in b8 update) +- fixed DX detection on XP (was fixed in b8 update) +- removed "*" from DirectInput keyboard and mouse name strings +- uaeunp/virtual archives: if input file was inside archive and it had multiple output + files (most raw disk image formats can have .ima, .adf and .ext.adf output files) + only first supported file was listed. Plain files worked correctly. +- added "scanning ROMs" dialog +- fixed old memory corruption bug if rom scan data has single rom from odd/even pair + (unpaired rom removal code was buggy) + Beta 8: -- Z3Chip is not a Z3 board anymore, now also compatible with KS 1.x (32-bit addressing - capable CPU required) +- Z3Chip is not a Z3 board anymore, now also compatible with KS 1.x (don't forget that + 32-bit addressing capable CPU is required) - rawkeyboard RIDEV_NOHOTKEYS flag was missing (Disables Windows keys etc..) - GamePorts remap/test GUI updated - GamePorts remap when in Configuration#x mode didn't update GamePorts input mappings diff --git a/rommgr.cpp b/rommgr.cpp index e3069f4b..c4d200ed 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -377,7 +377,7 @@ static void romlist_cleanup (void) } } -struct romlist **getromlistbyident(int ver, int rev, int subver, int subrev, TCHAR *model, int all) +struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, TCHAR *model, int all) { int i, j, ok, out, max; struct romdata *rd; @@ -1146,7 +1146,18 @@ struct zfile *read_rom (struct romdata **prd) } if (get_crc32 (buf, size) == crc32) { ok = 1; - } else { + } + if (!ok && (rd->type & ROMTYPE_AR)) { + uae_u8 tmp[2]; + tmp[0] = buf[0]; + tmp[1] = buf[1]; + buf[0] = buf[1] = 0; + if (get_crc32 (buf, size) == crc32) + ok = 1; + buf[0] = tmp[0]; + buf[1] = tmp[1]; + } + if (!ok) { /* perhaps it is byteswapped without byteswap entry? */ byteswap (buf, size); if (get_crc32 (buf, size) == crc32) -- 2.47.3