From: Toni Wilen Date: Wed, 19 May 2010 15:55:28 +0000 (+0300) Subject: 2200b3 X-Git-Tag: 2200~31 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=115423ca39b28f152b8854985bccb32307e5e7ae;p=francis%2Fwinuae.git 2200b3 --- diff --git a/cfgfile.cpp b/cfgfile.cpp index 4525f2bf..c99f63fd 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -167,7 +167,7 @@ static const TCHAR *abspointers[] = { L"none", L"mousehack", L"tablet", 0 }; static const TCHAR *magiccursors[] = { L"both", L"native", L"host", 0 }; static const TCHAR *autoscale[] = { L"none", L"scale", L"resize", 0 }; static const TCHAR *joyportmodes[] = { L"", L"mouse", L"djoy", L"ajoy", L"cdtvjoy", L"cd32joy", L"lightpen", 0 }; -static const TCHAR *joyaf[] = { L"none", L"pushpull", L"toggle", 0 }; +static const TCHAR *joyaf[] = { L"none", L"normal", L"toggle", 0 }; static const TCHAR *epsonprinter[] = { L"none", L"ascii", L"epson_matrix_9pin", L"epson_matrix_24pin", L"epson_matrix_48pin", 0 }; static const TCHAR *aspects[] = { L"none", L"vga", L"tv", 0 }; static const TCHAR *vsyncmodes[] = { L"false", L"true", L"autoswitch", 0 }; diff --git a/include/inputdevice.h b/include/inputdevice.h index e3e12f5f..605ca574 100644 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -128,7 +128,6 @@ extern int getjoystickstate (int mouse); void setmousestate (int mouse, int axis, int data, int isabs); extern int getmousestate (int mouse); extern void inputdevice_updateconfig (struct uae_prefs *prefs); -extern void inputdevice_mergeconfig (struct uae_prefs *prefs); extern void inputdevice_devicechange (struct uae_prefs *prefs); extern int inputdevice_translatekeycode (int keyboard, int scancode, int state); @@ -142,6 +141,7 @@ extern int inputdevice_get_compatibility_input (struct uae_prefs*, int, int*, in extern struct inputevent *inputdevice_get_eventinfo (int evt); extern void inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out); extern void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index); +extern void inputdevice_compa_clear (struct uae_prefs *prefs, int index); extern int intputdevice_compa_get_eventtype (int evt, int **axistable); diff --git a/include/options.h b/include/options.h index e0257982..6686ce49 100644 --- a/include/options.h +++ b/include/options.h @@ -52,6 +52,8 @@ struct jport { }; #define JPORT_NONE -1 #define JPORT_CUSTOM -2 +#define JPORT_AF_NORMAL 1 +#define JPORT_AF_TOGGLE 2 #define MAX_SPARE_DRIVES 20 #define MAX_CUSTOM_MEMORY_ADDRS 2 diff --git a/include/zarchive.h b/include/zarchive.h index 309e37bd..d8353a93 100644 --- a/include/zarchive.h +++ b/include/zarchive.h @@ -83,7 +83,6 @@ struct zarchive_info }; #define ArchiveFormat7Zip '7z ' -#define ArchiveFormatXZ 'xz ' #define ArchiveFormatRAR 'rar ' #define ArchiveFormatZIP 'zip ' #define ArchiveFormatLHA 'lha ' @@ -98,15 +97,16 @@ struct zarchive_info #define ArchiveFormatTAR 'tar ' #define PEEK_BYTES 1024 +#define FILE_PEEK 1 -extern int zfile_is_ignore_ext(const TCHAR *name); +extern int zfile_is_ignore_ext (const TCHAR *name); -extern struct zvolume *zvolume_alloc(struct zfile *z, unsigned int id, void *handle, const TCHAR*); -extern struct zvolume *zvolume_alloc_empty(struct zvolume *zv, const TCHAR *name); +extern struct zvolume *zvolume_alloc (struct zfile *z, unsigned int id, void *handle, const TCHAR*); +extern struct zvolume *zvolume_alloc_empty (struct zvolume *zv, const TCHAR *name); -extern struct znode *zvolume_addfile_abs(struct zvolume *zv, struct zarchive_info*); -extern struct znode *zvolume_adddir_abs(struct zvolume *zv, struct zarchive_info *zai); -extern struct znode *znode_adddir(struct znode *parent, const TCHAR *name, struct zarchive_info*); +extern struct znode *zvolume_addfile_abs (struct zvolume *zv, struct zarchive_info*); +extern struct znode *zvolume_adddir_abs (struct zvolume *zv, struct zarchive_info *zai); +extern struct znode *znode_adddir (struct znode *parent, const TCHAR *name, struct zarchive_info*); extern struct zvolume *archive_directory_plain (struct zfile *zf); extern struct zfile *archive_access_plain (struct znode *zn); @@ -116,8 +116,6 @@ extern struct zvolume *archive_directory_zip(struct zfile *zf); extern struct zfile *archive_access_zip (struct znode *zn, int flags); extern struct zvolume *archive_directory_7z (struct zfile *z); extern struct zfile *archive_access_7z (struct znode *zn); -extern struct zvolume *archive_directory_xz (struct zfile *z); -extern struct zfile *archive_access_xz (struct znode *zn); extern struct zvolume *archive_directory_rar (struct zfile *z); extern struct zfile *archive_access_rar (struct znode *zn); extern struct zvolume *archive_directory_lzx (struct zfile *in_file); @@ -142,6 +140,6 @@ extern void archive_access_scan (struct zfile *zf, zfile_callback zc, void *user extern void archive_access_close (void *handle, unsigned int id); -extern struct zfile *archive_getzfile(struct znode *zn, unsigned int id, int flags); +extern struct zfile *archive_getzfile (struct znode *zn, unsigned int id, int flags); extern struct zfile *decompress_zfd (struct zfile*); \ No newline at end of file diff --git a/include/zfile.h b/include/zfile.h index 325e134b..9d7f86b0 100644 --- a/include/zfile.h +++ b/include/zfile.h @@ -32,6 +32,7 @@ typedef int (*zfile_callback)(struct zfile*, void*); extern struct zfile *zfile_fopen (const TCHAR *, const TCHAR *, int mask); extern struct zfile *zfile_fopen2 (const TCHAR *, const TCHAR *, int mask, int index); extern struct zfile *zfile_fopen_empty (struct zfile*, const TCHAR *name, uae_u64 size); +extern struct zfile *zfile_fopen_empty (struct zfile*, const TCHAR *name); extern struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, uae_u8 *data); extern struct zfile *zfile_fopen_parent (struct zfile*, const TCHAR*, uae_u64 offset, uae_u64 size); diff --git a/inputdevice.cpp b/inputdevice.cpp index 7db48564..02efdf0f 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -3,7 +3,7 @@ * * joystick/mouse emulation * -* Copyright 2001-2008 Toni Wilen +* Copyright 2001-2010 Toni Wilen * * new fetures: * - very configurable (and very complex to configure :) @@ -456,6 +456,7 @@ static void copyjport (const struct uae_prefs *src, struct uae_prefs *dst, int n _tcscpy (dst->jports[num].name, src->jports[num].name); dst->jports[num].id = src->jports[num].id; dst->jports[num].mode = src->jports[num].mode; + dst->jports[num].autofire = src->jports[num].autofire; } static void out_config (struct zfile *f, int id, int num, TCHAR *s1, TCHAR *s2) @@ -1897,8 +1898,10 @@ uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra) case 1: v = ((pra & dra) | (dra ^ 0xff)) & 0x7; if (parport_joystick_enabled) { - if (getbuttonstate (2, 0)) v &= ~4; - if (getbuttonstate (3, 0)) v &= ~1; + if (getbuttonstate (2, 0)) + v &= ~4; + if (getbuttonstate (3, 0)) + v &= ~1; } return v; default: @@ -1907,6 +1910,15 @@ uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra) } } +/* p5 is 1 or floating = cd32 2-button mode */ +static bool cd32padmode (uae_u16 p5dir, uae_u16 p5dat) +{ + if (!(potgo_value & p5dir) || ((potgo_value & p5dat) && (potgo_value & p5dir))) + return false; + return true; +} + + static void charge_cap (int joy, int idx, int charge) { if (charge < -1 || charge > 1) @@ -1927,10 +1939,19 @@ static void cap_check (void) int charge = 0, dong, joypot; uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */ uae_u16 pdat = 0x0100 << (joy * 4 + i * 2); /* data */ + uae_u16 p5dir = 0x0200 << (joy * 4); + uae_u16 p5dat = 0x0100 << (joy * 4); int isbutton = getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2); - if (cd32_pad_enabled[joy]) - continue; + if (cd32_pad_enabled[joy]) { + if (i != 0) // 3rd button? + continue; + if (cd32padmode (p5dir, p5dat)) + continue; + // only red and blue can be read if CD32 pad and only if it is in normal pad mode + isbutton |= getbuttonstate (joy, JOYBUTTON_CD32_BLUE); + } + dong = dongle_analogjoy (joy, i); if (dong >= 0) { isbutton = 0; @@ -2010,8 +2031,7 @@ uae_u8 handle_joystick_buttons (uae_u8 dra) uae_u16 p5dir = 0x0200 << (i * 4); uae_u16 p5dat = 0x0100 << (i * 4); but |= 0x40 << i; - /* Red button is connected to fire when p5 is 1 or floating */ - if (!(potgo_value & p5dir) || ((potgo_value & p5dat) && (potgo_value & p5dir))) { + if (!cd32padmode (p5dir, p5dat)) { if (getbuttonstate (i, JOYBUTTON_CD32_RED)) but &= ~(0x40 << i); } @@ -2060,7 +2080,7 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor) uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */ - if (cd32_pad_enabled[i]) { + if (cd32_pad_enabled[i] && cd32padmode (p5dir, p5dat)) { /* p5 is floating in input-mode */ potgor &= ~p5dat; @@ -2076,15 +2096,18 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor) if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2)))) potgor &= ~p9dat; - } else { + } else { potgor &= ~p5dat; if (pot_cap[i][0] > 100) potgor |= p5dat; - potgor &= ~p9dat; - if (pot_cap[i][1] > 100) - potgor |= p9dat; + + if (!cd32_pad_enabled[i]) { + potgor &= ~p9dat; + if (pot_cap[i][1] > 100) + potgor |= p9dat; + } } } @@ -3481,7 +3504,6 @@ static void clearevent (struct uae_input_device *uid, int evt) static void clearkbrevent (struct uae_input_device *uid, int evt) { for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { - bool found = false; for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { if (uid->eventid[i][j] == evt) { uid->eventid[i][j] = 0; @@ -3562,50 +3584,33 @@ void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index) freejport (prefs, index); resetjport (prefs, index); if (mode == 0) - mode = index == 0 ? JSEM_MODE_MOUSE : JSEM_MODE_JOYSTICK; + mode = index == 0 ? JSEM_MODE_MOUSE : (prefs->cs_cd32cd ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK); prefs->jports[index].mode = mode; prefs->jports[index].id = -2; remove_compa_config (prefs, index); } +// clear device before switching to new one +void inputdevice_compa_clear (struct uae_prefs *prefs, int index) +{ + freejport (prefs, index); + resetjport (prefs, index); + remove_compa_config (prefs, index); +} + static void cleardev (struct uae_input_device *uid, int num) { for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { uid[num].eventid[i][j] = 0; + uid[num].flags[i][j] = 0; + xfree (uid[num].custom[i][j]); + uid[num].custom[i][j] = NULL; } } } -static void setjoyinputs (struct uae_prefs *prefs, int port) -{ - joyinputs[port] = NULL; - switch (joymodes[port]) - { - case JSEM_MODE_JOYSTICK: - if (port >= 2) - joyinputs[port] = port == 3 ? ip_parjoy2 : ip_parjoy1; - else - joyinputs[port] = port == 1 ? ip_joy2 : ip_joy1; - break; - case JSEM_MODE_JOYSTICK_CD32: - joyinputs[port] = port ? ip_joycd322 : ip_joycd321; - break; - case JSEM_MODE_JOYSTICK_ANALOG: - joyinputs[port] = port ? ip_analog2 : ip_analog1; - break; - case JSEM_MODE_MOUSE: - joyinputs[port] = port ? ip_mouse2 : ip_mouse1; - break; - case JSEM_MODE_LIGHTPEN: - joyinputs[port] = port ? ip_lightpen2 : ip_lightpen1; - break; - case JSEM_MODE_MOUSE_CDTV: - joyinputs[port] = ip_mousecdtv; - break; - } -} static void enablejoydevice (struct uae_input_device *uid, int evtnum) { @@ -3627,10 +3632,10 @@ static void setjoydevices (struct uae_prefs *prefs, int port) enablejoydevice (&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); enablejoydevice (&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); } - for (int i = 0; axistable[i] >= 0; i += 3) { - if (evtnum == axistable[i] || evtnum == axistable[i + 1] || evtnum == axistable[i + 2]) { + for (int k = 0; axistable[k] >= 0; k += 3) { + if (evtnum == axistable[k] || evtnum == axistable[k + 1] || evtnum == axistable[k + 2]) { for (int j = 0; j < 3; j++) { - int evtnum2 = axistable[i + j]; + int evtnum2 = axistable[k + j]; for (int l = 0; l < MAX_INPUT_DEVICES; l++) { enablejoydevice (&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2); enablejoydevice (&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2); @@ -3644,6 +3649,35 @@ static void setjoydevices (struct uae_prefs *prefs, int port) } } +static void setjoyinputs (struct uae_prefs *prefs, int port) +{ + joyinputs[port] = NULL; + switch (joymodes[port]) + { + case JSEM_MODE_JOYSTICK: + if (port >= 2) + joyinputs[port] = port == 3 ? ip_parjoy2 : ip_parjoy1; + else + joyinputs[port] = port == 1 ? ip_joy2 : ip_joy1; + break; + case JSEM_MODE_JOYSTICK_CD32: + joyinputs[port] = port ? ip_joycd322 : ip_joycd321; + break; + case JSEM_MODE_JOYSTICK_ANALOG: + joyinputs[port] = port ? ip_analog2 : ip_analog1; + break; + case JSEM_MODE_MOUSE: + joyinputs[port] = port ? ip_mouse2 : ip_mouse1; + break; + case JSEM_MODE_LIGHTPEN: + joyinputs[port] = port ? ip_lightpen2 : ip_lightpen1; + break; + case JSEM_MODE_MOUSE_CDTV: + joyinputs[port] = ip_mousecdtv; + break; + } +} + static void setautofire (struct uae_input_device *uid, int port, int af) { int *afp = af_ports[port]; @@ -3651,7 +3685,11 @@ static void setautofire (struct uae_input_device *uid, int port, int af) for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { if (uid->eventid[i][j] == afp[k]) { - uid->flags[i][j] |= ID_FLAG_AUTOFIRE; + uid->flags[i][j] &= ~(ID_FLAG_AUTOFIRE | ID_FLAG_TOGGLE); + if (af >= JPORT_AF_NORMAL) + uid->flags[i][j] |= ID_FLAG_AUTOFIRE; + if (af == JPORT_AF_TOGGLE) + uid->flags[i][j] |= ID_FLAG_TOGGLE; } } } @@ -3711,8 +3749,8 @@ static void compatibility_copy (struct uae_prefs *prefs) case JSEM_MODE_JOYSTICK_CD32: default: { - int iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); - joymodes[i] = mode == JSEM_MODE_JOYSTICK_CD32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK; + bool iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); + joymodes[i] = iscd32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK; if (!iscd32) joyinputs[i] = i ? ip_joy2 : ip_joy1; else @@ -3737,7 +3775,7 @@ static void compatibility_copy (struct uae_prefs *prefs) break; } } else if (prefs->jports[i].id >= 0) { - prefs->jports[i].mode = joymodes[i] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_MOUSE; + joymodes[i] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_MOUSE; joyinputs[i] = i ? ip_joy2 : ip_mouse1; } } @@ -3798,9 +3836,9 @@ static void compatibility_copy (struct uae_prefs *prefs) case JSEM_MODE_JOYSTICK_CD32: default: { - int iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); + bool iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); input_get_default_joystick (joysticks, joy, i, iscd32 ? JSEM_MODE_JOYSTICK_CD32 : 0); - joymodes[i] = mode == JSEM_MODE_JOYSTICK_CD32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK; + joymodes[i] = iscd32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK; break; } case JSEM_MODE_JOYSTICK_ANALOG: @@ -3846,7 +3884,7 @@ static void compatibility_copy (struct uae_prefs *prefs) int mode = prefs->jports[i].mode; for (joy = 0; used[joy]; joy++); if (JSEM_ISANYKBD (i, prefs)) { - int cd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); + bool cd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); if (JSEM_ISNUMPAD (i, prefs)) { if (cd32) kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_CD32_NP]; @@ -3935,10 +3973,8 @@ static void compatibility_copy (struct uae_prefs *prefs) } } } - for (i = 0; i < MAX_JPORTS; i++) { - if (prefs->jports[i].autofire) - setautofires (prefs, i, prefs->jports[i].autofire); - } + for (i = 0; i < MAX_JPORTS; i++) + setautofires (prefs, i, prefs->jports[i].autofire); for (i = 0; i < MAX_JPORTS; i++) { setjoyinputs (prefs, i); @@ -4021,7 +4057,7 @@ static void matchdevices_all (struct uae_prefs *prefs) } } -static void inputdevice_updateconfig2 (struct uae_prefs *prefs) +void inputdevice_updateconfig (struct uae_prefs *prefs) { int i; @@ -4092,16 +4128,6 @@ static void inputdevice_updateconfig2 (struct uae_prefs *prefs) config_changed = 1; } -void inputdevice_mergeconfig (struct uae_prefs *prefs) -{ - inputdevice_updateconfig2 (prefs); -} -void inputdevice_updateconfig (struct uae_prefs *prefs) -{ - inputdevice_updateconfig2 (prefs); -} - - /* called when devices get inserted or removed * store old devices temporarily, enumerate all devices * restore old devices back (order may have changed) @@ -4290,7 +4316,7 @@ static int inputdevice_translatekeycode_2 (int keyboard, int scancode, int state #define STEALTHF_SPECIAL 0x02 #define STEALTHF_E1KEY 0x01 -static void sendmmcodes(int code, int newstate) +static void sendmmcodes (int code, int newstate) { uae_u8 b; @@ -4735,7 +4761,6 @@ static void swapjoydevice (struct uae_input_device *uid, int **swaps) uid->eventid[i][j] = swaps[1 - k][kk]; found = true; } else { -#if 1 for (int jj = 0; axistable[jj] >= 0; jj += 3) { if (evtnum == axistable[jj] || evtnum == axistable[jj + 1] || evtnum == axistable[jj + 2]) { for (int ii = 0; ii < 3; ii++) { @@ -4751,7 +4776,6 @@ static void swapjoydevice (struct uae_input_device *uid, int **swaps) } } } -#endif } } } @@ -4964,6 +4988,8 @@ void setjoybuttonstate (int joy, int button, int state) { if (testmode) { inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, state); + if (state < 0) + inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, 0); return; } #if 0 diff --git a/main.cpp b/main.cpp index e4f5f44d..537665b5 100644 --- a/main.cpp +++ b/main.cpp @@ -110,7 +110,7 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs) { fixup_prefs_dim2 (&prefs->gfx_size_fs); fixup_prefs_dim2 (&prefs->gfx_size_win); - if (prefs->gfx_filter == 0 && prefs->gfx_filter_autoscale) + if (prefs->gfx_filter == 0 && prefs->gfx_filter_autoscale && !prefs->gfx_api) prefs->gfx_filter = 1; if (prefs->gfx_filter_autoscale) { prefs->gfx_filter_horiz_zoom_mult = 0; diff --git a/od-win32/clirun.cpp b/od-win32/clirun.cpp index 44fa857f..4190a570 100644 --- a/od-win32/clirun.cpp +++ b/od-win32/clirun.cpp @@ -1,3 +1,5 @@ +#if 0 +#define XFD 0 #include @@ -220,13 +222,20 @@ static int runxfd(int argc,wchar_t *argv[]) f = _tfopen(L"xfd-out-text.txt", L"rb"); if (f) { char tmp[1000]; - int first = 1; while (fgets(tmp, sizeof tmp, f)) { if (strlen(tmp) <= 1) continue; - if (first) { - first = 0; - continue; + for (int i = 0; tmp[i]; i++) { + if (tmp[i] == -101 || (tmp[i] == 27 && tmp[i + 1] == '[')) { + int j = i + 1; + if (tmp[i] == 27) + j++; + while (tmp[j] > 0 && tmp[j] < 0x40) + j++; + if (tmp[j]) + j++; + memmove (tmp + i, tmp + j, strlen(tmp + j) + 1); + } } if (tmp[strlen(tmp)-1] == 10) tmp[strlen(tmp)-1] = 0; @@ -248,6 +257,11 @@ static int runxfd(int argc,wchar_t *argv[]) int wmain (int argc, wchar_t *argv[], wchar_t *envp[]) { - //return runxfd (argc, argv); +#if XFD + return runxfd (argc, argv); +#else return runmain (argc, argv); +#endif } + +#endif diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 8aed842c..db30073d 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -3,7 +3,7 @@ * * Win32 DirectInput/Windows XP RAWINPUT interface * -* Copyright 2002 - 2004 Toni Wilen +* Copyright 2002 - 2010 Toni Wilen */ #define _WIN32_WINNT 0x501 /* enable RAWINPUT support */ @@ -856,7 +856,7 @@ static int initialize_rawinput (void) did->axissort[2] = 2; did->axisname[2] = my_strdup (L"Wheel"); addplusminus (did, 2); - if (rdim->fHasHorizontalWheel) { + if (1 || rdim->fHasHorizontalWheel) { // why is this always false? did->axissort[3] = 3; did->axisname[3] = my_strdup (L"HWheel"); did->axles++; @@ -1005,14 +1005,19 @@ static void handle_rawinput_2 (RAWINPUT *raw) } lastmbr[num] = rm->ulRawButtons; } - if (rm->usButtonFlags & RI_MOUSE_WHEEL) { - int val = (short)rm->usButtonData; - int bnum = did->buttons_real; - setmousestate (num, 2, val, 0); - if (val < 0) - setmousebuttonstate (num, bnum + 0, -1); - else if (val > 0) - setmousebuttonstate (num, bnum + 1, -1); + for (i = 0; i < 2; i++) { + int bnum = did->buttons_real + (i * 2); + // RI_MOUSE_WHEEL << 1 = HWHEEL + if (rm->usButtonFlags & (RI_MOUSE_WHEEL << i)) { + int val = (short)rm->usButtonData; + setmousestate (num, 2, val, 0); + if (istest) + setmousestate (num, 2, 0, 0); + if (val < 0) + setmousebuttonstate (num, bnum + 0, -1); + else if (val > 0) + setmousebuttonstate (num, bnum + 1, -1); + } } if (istest) { if (abs (rm->lLastX - lastx[num]) > 7) { @@ -1069,7 +1074,6 @@ static void handle_rawinput_2 (RAWINPUT *raw) if (scancode == 0xaa) return; -#if 1 for (num = 0; num < num_keyboard; num++) { did = &di_keyboard[num]; if (did->acquired && did->rawinput == raw->header.hDevice) @@ -1080,9 +1084,10 @@ static void handle_rawinput_2 (RAWINPUT *raw) inputdevice_add_inputcode (AKS_ENTERGUI, 1); return; } -#endif - if (rawkeystate[scancode] == pressed) + + if (rawkeystate[scancode] == pressed) { return; + } rawkeystate[scancode] = pressed; if (istest) { if (pressed && (scancode == DIK_F12 || scancode == DIK_F11)) @@ -1106,22 +1111,6 @@ static void handle_rawinput_2 (RAWINPUT *raw) } } -#if 0 -static void read_rawinput (void) -{ - RAWINPUT raw; - int size, ret; - - for(;;) { - size = sizeof (RAWINPUT); - ret = pGetRawInputBuffer (&raw, &size, sizeof (RAWINPUTHEADER)); - if (ret <= 0) - return; - handle_rawinput_2 (&raw); - } -} -#endif - void handle_rawinput (LPARAM lParam) { UINT dwSize; @@ -2033,6 +2022,7 @@ void release_keys (void) } } } + memset (rawkeystate, 0, sizeof rawkeystate); } diff --git a/od-win32/keyboard_win32.cpp b/od-win32/keyboard_win32.cpp index 5f715d8a..0fdee133 100644 --- a/od-win32/keyboard_win32.cpp +++ b/od-win32/keyboard_win32.cpp @@ -180,13 +180,16 @@ static struct uae_input_device_kbr_default keytrans[] = { static int kb_np[] = { DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD8, -1, DIK_NUMPAD2, -1, DIK_NUMPAD0, DIK_NUMPAD5, -1, DIK_DECIMAL, DIK_DIVIDE, DIK_NUMPADENTER, -1, -1 }; static int kb_ck[] = { DIK_LEFT, -1, DIK_RIGHT, -1, DIK_UP, -1, DIK_DOWN, -1, DIK_RCONTROL, DIK_RMENU, -1, DIK_RSHIFT, -1, -1 }; static int kb_se[] = { DIK_A, -1, DIK_D, -1, DIK_W, -1, DIK_S, -1, DIK_LMENU, -1, DIK_LSHIFT, -1, -1 }; -static int kb_cd32_np[] = { DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD8, -1, DIK_NUMPAD2, -1, DIK_NUMPAD1, -1, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; -static int kb_cd32_ck[] = { DIK_LEFT, -1, DIK_RIGHT, -1, DIK_UP, -1, DIK_DOWN, -1, DIK_NUMPAD1, -1, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; -static int kb_cd32_se[] = { DIK_A, -1, DIK_D, -1, DIK_W, -1, DIK_S, -1, DIK_NUMPAD1, -1, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; + +static int kb_cd32_np[] = { DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD8, -1, DIK_NUMPAD2, -1, DIK_NUMPAD0, DIK_NUMPAD5, DIK_NUMPAD1, -1, DIK_DECIMAL, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; +static int kb_cd32_ck[] = { DIK_LEFT, -1, DIK_RIGHT, -1, DIK_UP, -1, DIK_DOWN, -1, DIK_RCONTROL, -1, DIK_RMENU, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; +static int kb_cd32_se[] = { DIK_A, -1, DIK_D, -1, DIK_W, -1, DIK_S, -1, -1, DIK_LMENU, -1, DIK_LSHIFT, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; + static int kb_xa1[] = { DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD8, -1, DIK_NUMPAD2, DIK_NUMPAD5, -1, DIK_LCONTROL, -1, DIK_LMENU, -1, DIK_SPACE, -1, -1 }; static int kb_xa2[] = { DIK_D, -1, DIK_G, -1, DIK_R, -1, DIK_F, -1, DIK_A, -1, DIK_S, -1, DIK_Q, -1 }; static int kb_arcadia[] = { DIK_F2, -1, DIK_1, -1, DIK_2, -1, DIK_5, -1, DIK_6, -1, -1 }; static int kb_arcadiaxa[] = { DIK_1, -1, DIK_2, -1, DIK_3, -1, DIK_4, -1, DIK_6, -1, DIK_LBRACKET, DIK_LSHIFT, -1, DIK_RBRACKET, -1, DIK_C, -1, DIK_5, -1, DIK_Z, -1, DIK_X, -1, -1 }; + static int *kbmaps[] = { kb_np, kb_ck, kb_se, kb_cd32_np, kb_cd32_ck, kb_cd32_se, kb_xa1, kb_xa2, kb_arcadia, kb_arcadiaxa }; extern int ispressed (int key); @@ -246,39 +249,6 @@ int getcapslock (void) return capslockstate; } -#ifdef ARCADIA - -static int handlearcadia (int scancode, int state) -{ - int e = 0; - if (!arcadia_bios) - return 0; - switch (scancode) - { - case DIK_F2: - e = INPUTEVENT_SPC_ARCADIA_DIAGNOSTICS; - break; - case DIK_1: - e = INPUTEVENT_SPC_ARCADIA_PLAYER1; - break; - case DIK_2: - e = INPUTEVENT_SPC_ARCADIA_PLAYER2; - break; - case DIK_5: - e = INPUTEVENT_SPC_ARCADIA_COIN1; - break; - case DIK_6: - e = INPUTEVENT_SPC_ARCADIA_COIN2; - break; - } - if (!e) - return 0; - handle_input_event (e, state, 1, 0); - return 1; -} - -#endif - void clearallkeys (void) { inputdevice_updateconfig (&currprefs); diff --git a/od-win32/resources/resource b/od-win32/resources/resource index 6e11945e..a9e63f2c 100644 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -336,7 +336,6 @@ #define IDS_CD 361 #define IDS_BUFFER_SINGLE 362 #define IDS_BUFFER_DOUBLE 363 -#define IDS_BUFFER_TRIPPLE 364 #define IDS_BUFFER_TRIPLE 364 #define IDS_QS_MODELS 1000 #define IDS_QS_MODEL_A500 1001 @@ -388,6 +387,9 @@ #define IDC_PORT2_JOYS 1031 #define IDC_PORT3_JOYS 1032 #define IDC_PARALLEL 1033 +#define IDC_PORT0_AF 1033 +#define IDC_PORT0_AF2 1034 +#define IDC_PORT1_AF 1034 #define IDC_JULIAN 1040 #define IDC_FOCUSMINIMIZE 1041 #define IDC_FASTTEXT 1043 @@ -1024,12 +1026,10 @@ #define IDC_DD_SURFACETYPE 1791 #define IDC_RTG_SCALE_ALLOW 1791 #define IDC_CPU_FREQUENCY 1791 -#define IDC_PORT0_AUTOFIRE 1791 #define IDC_RTG_SCALE_ASPECTRATIO 1792 #define IDC_ASSOCIATE_ON 1792 #define IDC_DD_SURFACETYPE2 1792 #define IDC_DXMODE 1792 -#define IDC_PORT1_AUTOFIRE 1792 #define IDC_RTG_VBLANKRATE 1793 #define IDC_DF0WPTEXTQ 1793 #define IDC_DF1WPTEXTQ 1794 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index d428acfc..3036de62 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -408,17 +408,17 @@ BEGIN GROUPBOX "Mouse and Joystick settings",IDC_STATIC,0,3,299,181 RTEXT "Port 0:",IDC_STATIC,11,16,25,15,SS_CENTERIMAGE COMBOBOX IDC_PORT0_JOYS,45,17,241,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PORT0_JOYSMODE,104,35,87,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Test [] Test Port 0 (mouse) configuration.",IDC_PORT0_TEST,196,35,44,14 - PUSHBUTTON "Remap [] Remap Port 0 configurarion.",IDC_PORT0_REMAP,245,35,41,14 + COMBOBOX IDC_PORT0_JOYSMODE,127,35,87,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Test [] Test Port 0 (mouse) configuration.",IDC_PORT0_TEST,218,35,34,14 + PUSHBUTTON "Remap [] Remap Port 0 configurarion.",IDC_PORT0_REMAP,256,35,31,14 RTEXT "Port 1:",IDC_STATIC,11,52,25,15,SS_CENTERIMAGE COMBOBOX IDC_PORT1_JOYS,45,53,241,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Swap ports [] Swap ports 0 and 1.",IDC_SWAP,113,93,53,14 - COMBOBOX IDC_PORT1_JOYSMODE,104,70,88,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Test [] Test Port 1 (joystick) configuration.",IDC_PORT1_TEST,196,70,44,14 - PUSHBUTTON "Remap [] Remap Port 1 configuration.",IDC_PORT1_REMAP,245,70,41,14 - LTEXT "Parallel port joystick adapter",IDC_STATIC,10,96,95,15,SS_CENTERIMAGE - LTEXT "X-Arcade layout information []#1",IDC_STATIC,177,96,109,15,SS_NOTIFY | SS_CENTERIMAGE + PUSHBUTTON "Swap ports [] Swap ports 0 and 1.",IDC_SWAP,118,93,53,14 + COMBOBOX IDC_PORT1_JOYSMODE,127,70,88,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Test [] Test Port 1 (joystick) configuration.",IDC_PORT1_TEST,218,70,34,14 + PUSHBUTTON "Remap [] Remap Port 1 configuration.",IDC_PORT1_REMAP,256,70,31,14 + LTEXT "Parallel port joystick adapter",IDC_STATIC,10,96,99,15,SS_CENTERIMAGE + LTEXT "X-Arcade layout information []#1",IDC_STATIC,184,96,109,15,SS_NOTIFY | SS_CENTERIMAGE COMBOBOX IDC_PORT2_JOYS,45,114,241,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Test [] Test Parallel port joystick port 0 configuration.",IDC_PORT2_TEST,196,131,44,14 PUSHBUTTON "Remap [] Remap Parallel port joystick port 0 configurarion.",IDC_PORT2_REMAP,245,131,41,14 @@ -434,8 +434,8 @@ BEGIN COMBOBOX IDC_PORT_TABLET_CURSOR,167,214,119,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Full tablet input emulation",IDC_PORT_TABLET_FULL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,167,233,121,10 - CONTROL "Autofire",IDC_PORT0_AUTOFIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,46,37,53,10 - CONTROL "Autofire",IDC_PORT1_AUTOFIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,46,72,53,10 + COMBOBOX IDC_PORT0_AF,45,35,78,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_PORT1_AF,45,70,78,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_CONTRIBUTORS DIALOGEX 0, 0, 411, 242 diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 737ddc34..0eb5907e 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -3524,12 +3524,14 @@ static void WIN32_HandleRegistryStuff (void) reopen_console (); fetch_path (L"ConfigurationPath", path, sizeof (path) / sizeof (TCHAR)); path[_tcslen (path) - 1] = 0; - createdir (path); - _tcscat (path, L"\\Host"); - createdir (path); - fetch_path (L"ConfigurationPath", path, sizeof (path) / sizeof (TCHAR)); - _tcscat (path, L"Hardware"); - createdir (path); + if (GetFileAttributes (path) == 0xffffffff) { + createdir (path); + _tcscat (path, L"\\Host"); + createdir (path); + fetch_path (L"ConfigurationPath", path, sizeof (path) / sizeof (TCHAR)); + _tcscat (path, L"Hardware"); + createdir (path); + } fetch_path (L"StatefilePath", path, sizeof (path) / sizeof (TCHAR)); createdir (path); _tcscat (path, L"default.uss"); diff --git a/od-win32/win32.h b/od-win32/win32.h index 1fe378c2..6e54e1b8 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"2" -#define WINUAEDATE MAKEBD(2010, 5, 15) +#define WINUAEBETA L"3" +#define WINUAEDATE MAKEBD(2010, 5, 19) #define WINUAEEXTRA L"" #define WINUAEREV L"" diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 83527f63..9a60d476 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -141,7 +141,8 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height int filter_vert_zoom_mult = currprefs.gfx_filter_vert_zoom_mult; int filter_horiz_offset = currprefs.gfx_filter_horiz_offset; int filter_vert_offset = currprefs.gfx_filter_vert_offset; - if (!usedfilter) { + + if (!usedfilter && !currprefs.gfx_api) { filter_horiz_zoom = filter_vert_zoom = 0; filter_horiz_zoom_mult = filter_vert_zoom_mult = 1000; filter_horiz_offset = filter_vert_offset = 0; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index e62b8a08..d4681cfa 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -3173,11 +3173,13 @@ static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum, int devnum; int flags, status; TCHAR name[256]; - bool found = false; int *atp = axistable; int atpidx; int item; + bool found = false; + TCHAR target[MAX_DPATH]; + target[0] = 0; if (list) { lvstruct.mask = LVIF_TEXT | LVIF_PARAM; lvstruct.pszText = (TCHAR*)evt->name; @@ -3203,17 +3205,19 @@ static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum, while (atpidx >= 0) { devnum = 0; while ((status = inputdevice_get_device_status (devnum)) >= 0) { - if (1 || status) { + if ((1 || status) && !found) { for (int j = 0; j < inputdevice_get_widget_num (devnum); j++) { for (int sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { - if (inputdevice_get_mapped_name (devnum, j, &flags, NULL, NULL, sub) == evtnum && !found) { - TCHAR tmp[MAX_DPATH]; + if (inputdevice_get_mapped_name (devnum, j, &flags, NULL, NULL, sub) == evtnum) { inputdevice_get_widget_type (devnum, j, name); if (list) { - _tcscpy (tmp, name); - _tcscat (tmp, L","); - _tcscat (tmp, inputdevice_get_device_name2 (devnum)); - ListView_SetItemText (list, item, 1, tmp); + if (_tcslen (target) < MAX_DPATH / 2) { + if (target[0]) + _tcscat (target, L" "); + _tcscat (target, name); + _tcscat (target, L","); + _tcscat (target, inputdevice_get_device_name2 (devnum)); + } found = true; } else if (currentdevnum == devnum) { if (currentwidgetnum == j) { @@ -3234,6 +3238,8 @@ static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum, evtnum = *atp++; atpidx--; } + if (found) + ListView_SetItemText (list, item, 1, target); cnt++; } } @@ -4333,7 +4339,7 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM const GUID pathsguid = { 0x5674338c, 0x7a0b, 0x4565, { 0xbf, 0x75, 0x62, 0x8c, 0x80, 0x4a, 0xef, 0xf7 } }; void create_afnewdir(int); static int recursive; - static int ptypes[3], numtypes; + static int ptypes[10], numtypes; int val, selpath = 0; TCHAR tmp[MAX_DPATH], pathmode[32]; @@ -5345,7 +5351,7 @@ static void display_fromselect (int val, int *fs, bool *vsync, int p96) break; case 4: *fs = 2; - if (workprefs.gfx_filter == 0 && *fs != ofs) { + if (workprefs.gfx_filter == 0 && *fs != ofs && !workprefs.gfx_api) { workprefs.gfx_filter = 1; workprefs.gfx_filter_horiz_zoom = 0; workprefs.gfx_filter_vert_zoom = 0; @@ -10008,7 +10014,7 @@ static void enable_for_portsdlg (HWND hDlg) static int joys[] = { IDC_PORT0_JOYS, IDC_PORT1_JOYS, IDC_PORT2_JOYS, IDC_PORT3_JOYS }; static int joysm[] = { IDC_PORT0_JOYSMODE, IDC_PORT1_JOYSMODE, -1, -1 }; -static int joysaf[] = { IDC_PORT0_AUTOFIRE, IDC_PORT1_AUTOFIRE, -1, -1 }; +static int joysaf[] = { IDC_PORT0_AF, IDC_PORT1_AF, -1, -1 }; static void updatejoyport (HWND hDlg) { @@ -10076,7 +10082,7 @@ static void updatejoyport (HWND hDlg) idx = 0; SendDlgItemMessage (hDlg, id, CB_SETCURSEL, idx, 0); if (joysaf[i] >= 0) - CheckDlgButton (hDlg, joysaf[i], workprefs.jports[i].autofire); + SendDlgItemMessage (hDlg, joysaf[i], CB_SETCURSEL, workprefs.jports[i].autofire, 0); } } @@ -10168,10 +10174,10 @@ static void values_from_gameportsdlg (HWND hDlg, int d) } if (joysaf[i] >= 0) { - int is = ischecked (hDlg, joysaf[i]) ? 1 : 0; - if (is != workprefs.jports[i].autofire) + int af = SendDlgItemMessage (hDlg, joysaf[i], CB_GETCURSEL, 0, 0L); + if (af != CB_ERR && af != workprefs.jports[i].autofire) workprefs.input_selected_setting = GAMEPORT_INPUT_SETTINGS; - workprefs.jports[i].autofire = is; + workprefs.jports[i].autofire = af; } if (*port != prevport) changed = 1; @@ -10496,7 +10502,7 @@ static void ports_remap (HWND, int); static void processport (HWND hDlg, bool reset, int port) { if (reset) - inputdevice_compa_prepare_custom (&workprefs, port); + inputdevice_compa_clear (&workprefs, port); values_from_gameportsdlg (hDlg, 0); enable_for_gameportsdlg (hDlg); updatejoyport (hDlg); @@ -10527,6 +10533,14 @@ static INT_PTR CALLBACK GamePortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP joyxprevious[3] = -1; } + for (i = 0; joysaf[i] >= 0; i++) { + int id = joysaf[i]; + SendDlgItemMessage (hDlg, id, CB_RESETCONTENT, 0, 0L); + SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)L"No autofire"); + SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)L"Autofire"); + SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)L"Autofire (toggle)"); + } + SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_RESETCONTENT, 0, 0L); WIN32GUI_LoadUIString (IDS_TABLET_BOTH_CURSORS, tmp, MAX_DPATH); SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_ADDSTRING, 0, (LPARAM)tmp); @@ -10577,10 +10591,6 @@ static INT_PTR CALLBACK GamePortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP joyxprevious[1] = temp; enable_for_gameportsdlg (hDlg); updatejoyport (hDlg); - } else if (LOWORD (wParam) == IDC_PORT0_AUTOFIRE) { - processport (hDlg, false, 0); - } else if (LOWORD (wParam) == IDC_PORT1_AUTOFIRE) { - processport (hDlg, false, 1); } else if (LOWORD (wParam) == IDC_PORT0_REMAP) { ports_remap (hDlg, 0); } else if (LOWORD (wParam) == IDC_PORT1_REMAP) { @@ -10600,6 +10610,12 @@ static INT_PTR CALLBACK GamePortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP } else if (HIWORD (wParam) == CBN_SELCHANGE) { switch (LOWORD (wParam)) { + case IDC_PORT0_AF: + processport (hDlg, false, 0); + break; + case IDC_PORT1_AF: + processport (hDlg, false, 1); + break; case IDC_PORT0_JOYS: case IDC_PORT1_JOYS: case IDC_PORT2_JOYS: @@ -11169,6 +11185,11 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw } else { // input panel + if (od != devnum) + init_inputdlg (hDlg); + else + init_inputdlg_2 (hDlg); + static int toggle, skipactive; if (cnt == 2 && !skipactive) { toggle ^= 1; @@ -11186,10 +11207,6 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw inputdevice_set_device_status (devnum, TRUE); values_to_inputdlg (hDlg); } - if (od != devnum) - init_inputdlg (hDlg); - else - init_inputdlg_2 (hDlg); ListView_EnsureVisible (GetDlgItem (hDlg, IDC_INPUTLIST), input_selected_widget, FALSE); ListView_SetItemState (GetDlgItem (hDlg, IDC_INPUTLIST), -1, 0, LVIS_SELECTED | LVIS_FOCUSED); ListView_SetItemState (GetDlgItem (hDlg, IDC_INPUTLIST), input_selected_widget, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); @@ -11576,7 +11593,7 @@ static void enable_for_hw3ddlg (HWND hDlg) vv3 = TRUE; if (v && uf->x[0]) vv4 = TRUE; - if (workprefs.gfx_api && isfilter) + if (workprefs.gfx_api) v = vv = vv2 = vv3 = vv4 = TRUE; ew (hDlg, IDC_FILTERHZ, v); @@ -12089,7 +12106,7 @@ static void filter_handle (HWND hDlg) hw3d_changed = 1; } } - if (workprefs.gfx_filter == 0) + if (workprefs.gfx_filter == 0 && !workprefs.gfx_api) workprefs.gfx_filter_autoscale = 0; } item = SendDlgItemMessage (hDlg, IDC_FILTEROVERLAY, CB_GETCURSEL, 0, 0L); @@ -12197,7 +12214,7 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM item = SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_GETCURSEL, 0, 0L); if (item != CB_ERR) { workprefs.gfx_filter_autoscale = item; - if (workprefs.gfx_filter_autoscale && workprefs.gfx_filter == 0) + if (workprefs.gfx_filter_autoscale && workprefs.gfx_filter == 0 && !workprefs.gfx_api) workprefs.gfx_filter = 1; // NULL values_to_hw3ddlg (hDlg); enable_for_hw3ddlg (hDlg); @@ -13682,8 +13699,9 @@ static int GetSettings (int all_options, HWND hwnd) handlerawinput (msg.hwnd, msg.message, msg.wParam, msg.lParam); continue; } - // eat all keyboard accelerators - if (msg.message == WM_KEYDOWN) + // eat all accelerators + if (msg.message == WM_KEYDOWN || msg.message == WM_MOUSEMOVE || msg.message == WM_MOUSEWHEEL + || msg.message == WM_MOUSEHWHEEL || msg.message == WM_LBUTTONDOWN) continue; } // IsDialogMessage() eats WM_INPUT messages?!?! diff --git a/od-win32/winuae_msvc10/winuae_msvc.sln b/od-win32/winuae_msvc10/winuae_msvc.sln index f0d5bad3..6622de73 100644 --- a/od-win32/winuae_msvc10/winuae_msvc.sln +++ b/od-win32/winuae_msvc10/winuae_msvc.sln @@ -125,7 +125,7 @@ Global {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.FullRelease|Win32.ActiveCfg = Release|Win32 {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.FullRelease|x64.ActiveCfg = Release|Win32 {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Release|Win32.ActiveCfg = Release|Win32 - {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Release|x64.ActiveCfg = Release|Win32 + {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Release|x64.ActiveCfg = Release|x64 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Debug|Win32.ActiveCfg = Debug|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Debug|x64.ActiveCfg = Debug|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.FullRelease|Win32.ActiveCfg = Release|Win32 diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index f2f3c96a..281251b6 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,23 @@ +Beta 3: + +- added XZ compressed file support +- Paths panel "Reset to defaults" was unreliable if more than 3 choices was available +- mouse horizontal wheel (HWheel) works in raw mouse mode, it is now always listed because + for some unknown reason RID_DEVICE_INFO_MOUSE.fHasHorizontalWheel is always false, + even when mouse has working horizontal scroll wheel +- fixed unreliable device switching in input test/remap mode +- fixed CD32 extra buttons not automatically getting enabled when joystick/pad was in + "default" mode +- "default" was changed to "joystick" or "mouse" when switching between device types +- CD32 default button change, Red and Blue buttons are automatically read as a fire + and second button if pad is read in standard 2-button mode (previously they did nothing + in normal mode, required fire and 2nd button mapped) +- CD32 2-button mode 2nd button (CD32 Blue button as 2nd button) fixed, never worked previously +- Game Ports Test mode now shows mappings that have multiple input targets +- added "toggle" autofire mode to ports panel +- D3D "none" filter allows again all filter setting adjustments + Beta 2: - reverted filesystem indirect memory change, it can't never work because filesystem diff --git a/uaeunp.cpp b/uaeunp.cpp index 7ec5a98a..3dab5fb8 100644 --- a/uaeunp.cpp +++ b/uaeunp.cpp @@ -582,7 +582,7 @@ static int scanpath (TCHAR *src, TCHAR *outpath) return 1; } -int wmain (int argc, wchar_t *argv[], wchar_t *envp[]) +int __cdecl wmain (int argc, wchar_t *argv[], wchar_t *envp[]) { int ok = 0, i; int list = 0, xtract = 0, extract = 0; @@ -715,9 +715,7 @@ int wmain (int argc, wchar_t *argv[], wchar_t *envp[]) _tprintf (L"Supported archive formats:\n"); _tprintf (L" 7ZIP, LHA, LZX, RAR (unrar.dll), TAR, ZIP, ArchiveAccess.DLL\n"); _tprintf (L"Miscellaneous formats:\n"); - _tprintf (L" RDB partition table, GZIP\n"); - - + _tprintf (L" RDB partition table, GZIP, XZ\n"); } return 0; } diff --git a/zfile.cpp b/zfile.cpp index 2f5ecf7d..4569df21 100644 --- a/zfile.cpp +++ b/zfile.cpp @@ -31,7 +31,7 @@ static struct zfile *zlist = 0; -const TCHAR *uae_archive_extensions[] = { L"zip", L"rar", L"7z", L"xz", L"lha", L"lzh", L"lzx", L"tar", NULL }; +const TCHAR *uae_archive_extensions[] = { L"zip", L"rar", L"7z", L"lha", L"lzh", L"lzx", L"tar", NULL }; #define MAX_CACHE_ENTRIES 10 @@ -1030,6 +1030,85 @@ static struct zfile *wrp (struct zfile *z) return unwarp (z); } +#include "7z/xz.h" +#include "7z/lzmadec.h" +#include "7z/7zcrc.h" + +static void *SzAlloc (void *p, size_t size) +{ + return xmalloc (uae_u8, size); +} +static void SzFree(void *p, void *address) +{ + xfree (address); +} +#define XZ_OUT_SIZE 10000 +#define XZ_IN_SIZE 10000 +static struct zfile *xz (struct zfile *z) +{ + static bool iscrc; + ISzAlloc allocImp; + CXzUnpacker cx; + ECoderStatus status; + struct zfile *zo = NULL; + uae_u8 out[XZ_OUT_SIZE], in[XZ_IN_SIZE]; + + memset (&cx, 0, sizeof cx); + allocImp.Alloc = SzAlloc; + allocImp.Free = SzFree; + if (!iscrc) + CrcGenerateTable (); + iscrc = true; + if (XzUnpacker_Create (&cx, &allocImp) != SZ_OK) + return NULL; + int outwritten = 0; + int towrite = 0; + bool first = true; + for (;;) { + int read = zfile_fread (in, 1, XZ_IN_SIZE, z); + if (first) { + if (!(in[0] == 0xfd && in[1] == 0x37 && in[2] == 0x7a && in[3] == 0x58 && in[4] == 0x5a && in[5] == 0)) + break; + } + first = false; + if (read == 0) + break; + if (read < 0) { + zfile_fclose (zo); + zo = NULL; + break; + } + if (!zo) + zo = zfile_fopen_empty (z, z->name); + if (!zo) + break; + uae_u8 *inp = in; + for (;;) { + SizeT srclen = read; + SizeT outlen = XZ_OUT_SIZE; + if (XzUnpacker_Code (&cx, out, &outlen, inp, &srclen, LZMA_FINISH_ANY, &status) != SZ_OK) { + zfile_fclose (zo); + zo = NULL; + break; + } + if (status != CODER_STATUS_NEEDS_MORE_INPUT && status != CODER_STATUS_NOT_FINISHED) { + zfile_fclose (zo); + zo = NULL; + break; + } + zfile_fwrite (out, outlen, 1, zo); + if (status == CODER_STATUS_FINISHED_WITH_MARK) + break; + if (srclen == read) + break; + inp += srclen; + read -= srclen; + } + } + XzUnpacker_Free (&cx); + return zo; +} + static struct zfile *dms (struct zfile *z, int index, int *retcode) { int ret; @@ -1144,14 +1223,14 @@ static const TCHAR *archive_extensions[] = { L"hdf", L"tar", NULL }; -static const TCHAR *plugins_7z[] = { L"7z", L"xz", L"rar", L"zip", L"lha", L"lzh", L"lzx", L"adf", L"dsq", L"hdf", L"tar", NULL }; -static const uae_char *plugins_7z_x[] = { "7z", "xz", "Rar!", "MK", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; +static const TCHAR *plugins_7z[] = { L"7z", L"rar", L"zip", L"lha", L"lzh", L"lzx", L"adf", L"dsq", L"hdf", L"tar", NULL }; +static const uae_char *plugins_7z_x[] = { "7z", "Rar!", "MK", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; static const int plugins_7z_t[] = { - ArchiveFormat7Zip, ArchiveFormatXZ, ArchiveFormatRAR, ArchiveFormatZIP, ArchiveFormatLHA, ArchiveFormatLHA, ArchiveFormatLZX, + ArchiveFormat7Zip, ArchiveFormatRAR, ArchiveFormatZIP, ArchiveFormatLHA, ArchiveFormatLHA, ArchiveFormatLZX, ArchiveFormatADF, ArchiveFormatADF, ArchiveFormatADF, ArchiveFormatTAR }; static const int plugins_7z_m[] = { - ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, + ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ADF, ZFD_ADF, ZFD_ADF, ZFD_ARCHIVE }; @@ -1183,11 +1262,6 @@ int iszip (struct zfile *z) return ArchiveFormat7Zip; return 0; } - if (!strcasecmp (ext, L".xz")) { - if (header[1] == '7' && header[2] == 'z' && header[3] == 'X' && header[4] == 'Z') - return ArchiveFormatXZ; - return 0; - } if (!strcasecmp (ext, L".rar")) { if (header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!') return ArchiveFormatRAR; @@ -1261,8 +1335,6 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, if (mask & ZFD_ARCHIVE) { if (strcasecmp (ext, L"7z") == 0) return archive_access_select (parent, z, ArchiveFormat7Zip, dodefault, retcode, index); - if (strcasecmp (ext, L"xz") == 0) - return archive_access_select (parent, z, ArchiveFormatXZ, dodefault, retcode, index); if (strcasecmp (ext, L"zip") == 0) return archive_access_select (parent, z, ArchiveFormatZIP, dodefault, retcode, index); if (strcasecmp (ext, L"lha") == 0 || strcasecmp (ext, L"lzh") == 0) @@ -1286,6 +1358,8 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, return zfile_gunzip (z); if (strcasecmp (ext, L"wrp") == 0) return wrp (z); + if (strcasecmp (ext, L"xz") == 0) + return xz (z); } if (strcasecmp (ext, L"dms") == 0) return dms (z, index, retcode); @@ -1318,13 +1392,14 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, return NULL; return vhd (z); } - if (mask & ZFD_UNPACK) { if (index == 0) { if (header[0] == 0x1f && header[1] == 0x8b) return zfile_gunzip (z); if (header[0] == 'P' && header[1] == 'K' && header[2] == 'D') return dsq (z, 0); + if (header[0] == 0xfd && header[1] == 0x37 && header[2] == 0x7a && header[3] == 0x58 && header[4] == 0x5a && header[5] == 0) + return xz (z); } if (header[0] == 'D' && header[1] == 'M' && header[2] == 'S' && header[3] == '!') return dms (z, index, retcode); @@ -1825,6 +1900,10 @@ struct zfile *zfile_fopen_empty (struct zfile *prev, const TCHAR *name, uae_u64 } return l; } +struct zfile *zfile_fopen_empty (struct zfile *prev, const TCHAR *name) +{ + return zfile_fopen_empty (prev, name, 10000); +} struct zfile *zfile_fopen_parent (struct zfile *z, const TCHAR *name, uae_u64 offset, uae_u64 size) { @@ -1917,7 +1996,9 @@ size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z) return z->zfileread (b, l1, l2, z); if (z->data) { if (z->datasize < z->size && z->seek + l1 * l2 > z->datasize) { - ; + write_log (L"zfile_fread(%s) attempted to read past PEEK_BYTES\n", z->name); + + return 0; } if (z->seek + l1 * l2 > z->size) { if (l1) @@ -1963,7 +2044,7 @@ size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z) int off = z->seek + l1 * l2; if (off > z->size) { z->data = xrealloc (uae_u8, z->data, off); - z->size = off; + z->datasize = z->size = off; } memcpy (z->data + z->seek, b, l1 * l2); z->seek += l1 * l2; @@ -2397,8 +2478,6 @@ static struct zvolume *zfile_fopen_archive_ext (struct znode *parent, struct zfi zv = archive_directory_zip (zf); if (strcasecmp (ext, L"7z") == 0) zv = archive_directory_7z (zf); - if (strcasecmp (ext, L"xz") == 0) - zv = archive_directory_xz (zf); if (strcasecmp (ext, L"lzx") == 0) zv = archive_directory_lzx (zf); if (strcasecmp (ext, L"rar") == 0) diff --git a/zfile_archive.cpp b/zfile_archive.cpp index 1aea5222..97f64602 100644 --- a/zfile_archive.cpp +++ b/zfile_archive.cpp @@ -24,8 +24,6 @@ #include - - static time_t fromdostime (uae_u32 dd) { struct tm tm; @@ -56,9 +54,6 @@ static struct zvolume *getzvolume (struct znode *parent, struct zfile *zf, unsig case ArchiveFormat7Zip: zv = archive_directory_7z (zf); break; - case ArchiveFormatXZ: - zv = archive_directory_xz (zf); - break; case ArchiveFormatRAR: zv = archive_directory_rar (zf); break; @@ -193,7 +188,7 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns if (zf->zipname && zf->zipname[0] == '#' && _tstol (zf->zipname + 1) == zipcnt) select = -1; if (select && we_have_file < 10) { - struct zfile *zt = archive_getzfile (zn, id, 1); + struct zfile *zt = archive_getzfile (zn, id, FILE_PEEK); if (zt) { int ft = zfile_gettype (zt); TCHAR *ext = _tcsrchr (zn->fullname, '.'); @@ -442,7 +437,7 @@ struct zfile *archive_access_zip (struct znode *zn, int flags) return 0; z = zfile_fopen_empty (NULL, zn->fullname, zn->size); if (z) { -// if (flags) +// if (flags & FILE_PEEK) // z->datasize = PEEK_BYTES; err = unzReadCurrentFile (uz, z->data, z->datasize); } @@ -530,11 +525,6 @@ static void archive_close_7z (void *ctx) #define EPOCH_DIFF 0x019DB1DED53E8000LL /* 116444736000000000 nsecs */ #define RATE_DIFF 10000000 /* 100 nsecs */ -struct zvolume *archive_directory_xz (struct zfile *z) -{ - return NULL; -} - struct zvolume *archive_directory_7z (struct zfile *z) { SRes res; @@ -588,11 +578,6 @@ struct zvolume *archive_directory_7z (struct zfile *z) return zv; } -struct zfile *archive_access_xz (struct znode *zn) -{ - return NULL; -} - struct zfile *archive_access_7z (struct znode *zn) { SRes res; @@ -692,16 +677,6 @@ struct RARContext HANDLE hArcData; }; -static int rar_resetf (struct zfile *z) -{ - z->f = _tfopen (z->name, z->mode); - if (!z->f) { - zfile_fclose (z); - return 0; - } - return 1; -} - static void archive_close_rar (void *ctx) { struct RARContext* rc = (struct RARContext*)ctx; @@ -722,17 +697,11 @@ struct zvolume *archive_directory_rar (struct zfile *z) return archive_directory_arcacc (z, ArchiveFormatRAR); rc = xcalloc (struct RARContext, 1); zv = zvolume_alloc (z, ArchiveFormatRAR, rc, NULL); - //fclose (z->f); /* bleh, unrar.dll fails to open the archive if it is already open.. */ - //z->f = NULL; rc->OpenArchiveData.ArcNameW = z->name; rc->OpenArchiveData.OpenMode = RAR_OM_LIST; rc->hArcData = pRAROpenArchiveEx (&rc->OpenArchiveData); if (rc->OpenArchiveData.OpenResult != 0) { xfree (rc); -// if (!rar_resetf (z)) { -// zfile_fclose_archive (zv); -// return NULL; -// } zfile_fclose_archive (zv); return archive_directory_arcacc (z, ArchiveFormatRAR); }