From: Toni Wilen Date: Sat, 21 Apr 2012 09:54:23 +0000 (+0300) Subject: 2410b8 X-Git-Tag: 2410~7 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=088ad2cf30f28c97ef0d0f5e0d510085ac1f1c59;p=francis%2Fwinuae.git 2410b8 --- diff --git a/cia.cpp b/cia.cpp index 2326eaeb..b0611c60 100644 --- a/cia.cpp +++ b/cia.cpp @@ -1834,6 +1834,7 @@ void restore_cia_finish (void) CIA_update (); CIA_calctimers (); compute_passed_time (); + eventtab[ev_cia].oldcycles -= div10; //dumpcia (); DISK_select_set (ciabprb); } diff --git a/filesys.cpp b/filesys.cpp index 7fe9428b..9c012fa3 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -54,6 +54,9 @@ #include "consolehook.h" #include "blkdev.h" #include "isofs_api.h" +#ifdef RETROPLATFORM +#include "rp.h" +#endif #define TRACING_ENABLED 0 #if TRACING_ENABLED @@ -603,6 +606,12 @@ static int add_filesys_unit (TCHAR *devname, TCHAR *volname, const TCHAR *rootdi ret = set_filesys_unit_1 (-1, devname, volname, rootdir, readonly, secspertrack, surfaces, reserved, blocksize, bootpri, donotmount, autoboot, filesysdir, hdc, flags); +#ifdef RETROPLATFORM + if (ret >= 0) { + rp_hd_device_enable (ret, true); + rp_harddrive_image_change (ret, readonly, rootdir); + } +#endif return ret; } @@ -644,13 +653,14 @@ static void filesys_addexternals (void); static void initialize_mountinfo (void) { - int i; + int nr; struct uaedev_config_info *uci; UnitInfo *uip = &mountinfo.ui[0]; cd_unit_offset = MAX_FILESYSTEM_UNITS; - for (i = 0; i < currprefs.mountitems; i++) { - uci = &currprefs.mountconfig[i]; + + for (nr = 0; nr < currprefs.mountitems; nr++) { + uci = &currprefs.mountconfig[nr]; if (uci->controller == HD_CONTROLLER_UAE) { int idx = set_filesys_unit_1 (-1, uci->devname, uci->ishdf ? NULL : uci->volname, uci->rootdir, uci->readonly, uci->sectors, uci->surfaces, uci->reserved, @@ -700,9 +710,11 @@ static void initialize_mountinfo (void) int idx = set_filesys_unit_1 (i + cd_unit_offset, cdname, NULL, _T("/"), true, 1, 1, 0, 2048, 0, false, false, NULL, 0, 0); if (idx >= 0) { UnitInfo *ui; + uci = &currprefs.mountconfig[nr]; uci->configoffset = idx; ui = &mountinfo.ui[idx]; ui->configureddrive = 1; + nr++; } } } @@ -1362,6 +1374,12 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) zfile_fclose_archive (u->zarchive); u->zarchive = NULL; u->ui.unknown_media = false; +#ifdef RETROPLATFORM + if (ui->unit_type == UNIT_CDFS) + rp_cd_image_change (ui->cddevno, NULL); + else + rp_harddrive_image_change (nr, false, NULL); +#endif } else { u->mount_changed = 0; } @@ -1396,9 +1414,11 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) u->ui.volname = ui->volname = my_strdup (ii.volumename); ctime = ii.creation; set_highcyl (ui, ii.blocks); +#ifdef RETROPLATFORM + rp_cd_image_change (ui->cddevno, ii.devname); +#endif } } - } else { if (set_filesys_volume (u->mount_rootdir, &u->mount_flags, &u->mount_readonly, &emptydrive, &u->zarchive) < 0) return 0; @@ -1406,6 +1426,9 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) return 0; xfree (u->ui.volname); ui->volname = u->ui.volname = filesys_createvolname (u->mount_volume, u->mount_rootdir, _T("removable")); +#ifdef RETROPLATFORM + rp_harddrive_image_change (nr, u->mount_readonly, u->mount_rootdir); +#endif } if (u->ui.unknown_media) { write_log (_T("FILESYS: inserted unreadable volume NR=%d RO=%d\n"), nr, u->mount_readonly); @@ -2356,6 +2379,9 @@ static bool mount_cd (UnitInfo *uinfo, int nr, uae_u32 *ctime, uae_u64 *uniq) write_log (_T("Failed attempt to open CD unit %d\n"), uinfo->cddevno); return false; } +#ifdef RETROPLATFORM + rp_cd_device_enable (uinfo->cddevno, true); +#endif uinfo->cdfs_superblock = isofs_mount(uinfo->cddevno, uniq); uinfo->wasisempty = true; struct isofs_info ii; @@ -2368,11 +2394,17 @@ static bool mount_cd (UnitInfo *uinfo, int nr, uae_u32 *ctime, uae_u64 *uniq) if (ctime) *ctime = ii.creation; set_highcyl (uinfo, ii.totalblocks); +#ifdef RETROPLATFORM + rp_cd_image_change (uinfo->cddevno, ii.devname); +#endif } } uinfo->unknown_media = ii.unknown_media; } uinfo->cd_open = true; + + + return true; } diff --git a/include/inputdevice.h b/include/inputdevice.h index ca620056..055855ec 100644 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -134,7 +134,7 @@ struct inputevent { #define ID_AXIS_TOTAL 32 extern int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af); -extern bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, int port); +extern bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, int flags, int port); extern int inputdevice_set_mapping (int devnum, int num, const TCHAR *name, TCHAR *custom, int flags, int port, int sub); extern int inputdevice_get_mapping (int devnum, int num, int *pflags, int *port, TCHAR *name, TCHAR *custom, int sub); extern void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst); diff --git a/include/isofs_api.h b/include/isofs_api.h index c601956c..4487a11a 100644 --- a/include/isofs_api.h +++ b/include/isofs_api.h @@ -7,6 +7,7 @@ struct isofs_info bool media; bool unknown_media; TCHAR volumename[256]; + TCHAR devname[256]; uae_u32 blocks; uae_u32 totalblocks; uae_u32 blocksize; diff --git a/inputdevice.cpp b/inputdevice.cpp index bf57cfd1..8a1cc728 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -4681,7 +4681,7 @@ static void matchdevices_all (struct uae_prefs *prefs) } } -bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, int port) +bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, int flags, int port) { TCHAR name[256]; struct inputevent *ie; @@ -4702,7 +4702,7 @@ bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int } if (sub >= MAX_INPUT_SUB_EVENT) sub = MAX_INPUT_SUB_EVENT - 1; - inputdevice_set_mapping (devnum, num, name, NULL, IDEV_MAPPED_GAMEPORTSCUSTOM1, port + 1, sub); + inputdevice_set_mapping (devnum, num, name, NULL, IDEV_MAPPED_GAMEPORTSCUSTOM1 | flags, port + 1, sub); joysticks = prefs->joystick_settings[prefs->input_selected_setting]; mice = prefs->mouse_settings[prefs->input_selected_setting]; diff --git a/isofs.cpp b/isofs.cpp index 774bbee8..c2b3a56e 100644 --- a/isofs.cpp +++ b/isofs.cpp @@ -2426,8 +2426,11 @@ bool isofs_mediainfo(void *sbp, struct isofs_info *ii) uae_u32 totalblocks = 0; ii->media = true; di.cylinders = 0; - if (sys_command_info (sb->unitnum, &di, true)) + _stprintf (ii->devname, _T("CD%d"), sb->unitnum); + if (sys_command_info (sb->unitnum, &di, true)) { totalblocks = di.cylinders * di.sectorspertrack * di.trackspercylinder; + _tcscpy (ii->devname, di.label); + } ii->unknown_media = sb->unknown_media; ii->blocksize = 2048; if (sb->root) { diff --git a/memory.cpp b/memory.cpp index 8be7b56f..38749be2 100644 --- a/memory.cpp +++ b/memory.cpp @@ -47,9 +47,9 @@ static bool isdirectjit (void) static bool canjit (void) { - if (currprefs.cpu_model < 68020 && currprefs.address_space_24) - return 0; - return 1; + if (currprefs.cpu_model < 68020 || currprefs.address_space_24) + return false; + return true; } static void nocanbang (void) diff --git a/newcpu.cpp b/newcpu.cpp index b43c064a..5d0e7320 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -313,6 +313,7 @@ static bool get_trace (uaecptr addr, int accessmode, int size, uae_u32 *data) x_do_cycles (c); } else if (cputrace.cyclecounter_pre) { check_trace (); + *data = ctm->data; return true; // argh, need to rerun the memory access.. } } @@ -4809,7 +4810,7 @@ uae_u8 *restore_cpu (uae_u8 *src) int i, flags, model; uae_u32 l; - changed_prefs.cpu_model = model = restore_u32 (); + currprefs.cpu_model = changed_prefs.cpu_model = model = restore_u32 (); flags = restore_u32 (); changed_prefs.address_space_24 = 0; if (flags & CPUTYPE_EC) diff --git a/od-win32/cloanto/RetroPlatformGuestIPC.cpp b/od-win32/cloanto/RetroPlatformGuestIPC.cpp index e0a3bf9b..a929792a 100644 --- a/od-win32/cloanto/RetroPlatformGuestIPC.cpp +++ b/od-win32/cloanto/RetroPlatformGuestIPC.cpp @@ -84,7 +84,7 @@ HRESULT RPInitializeGuest(RPGUESTINFO *pInfo, HINSTANCE hInstance, LPCTSTR pszHo // register with the host // - if (!RPSendMessage(RPIPCGM_REGISTER, 0, 0, g_szRegistration, sizeof(g_szRegistration), pInfo, &lr)) + if (!RPSendMessage(RP_IPC_TO_HOST_REGISTER, 0, 0, g_szRegistration, sizeof(g_szRegistration), pInfo, &lr)) { RPUninitializeGuest(pInfo); return HRESULT_FROM_WIN32(ERROR_HOST_UNREACHABLE); diff --git a/od-win32/cloanto/RetroPlatformIPC.h b/od-win32/cloanto/RetroPlatformIPC.h index 8d891b72..31fad917 100644 --- a/od-win32/cloanto/RetroPlatformIPC.h +++ b/od-win32/cloanto/RetroPlatformIPC.h @@ -8,8 +8,8 @@ : version 2.0 as published by Mozilla Corporation. Authors : os, mcb Created : 2007-08-27 13:55:49 - Updated : 2012-03-27 16:00:00 - Comment : RP Player interprocess communication include file + Updated : 2012-04-20 14:49:00 + Comment : RetroPlatform Player interprocess communication include file *****************************************************************************/ #ifndef __CLOANTO_RETROPLATFORMIPC_H__ @@ -17,9 +17,9 @@ #include -#define RETROPLATFORM_API_VER "3.2" +#define RETROPLATFORM_API_VER "3.3" #define RETROPLATFORM_API_VER_MAJOR 3 -#define RETROPLATFORM_API_VER_MINOR 2 +#define RETROPLATFORM_API_VER_MINOR 3 #define RPIPC_HostWndClass "RetroPlatformHost%s" #define RPIPC_GuestWndClass "RetroPlatformGuest%d" @@ -101,7 +101,7 @@ #define RP_FEATURE_INPUTDEVICE_MOUSE 0x00008000 // supports emulation of mouse #define RP_FEATURE_INPUTDEVICE_JOYSTICK 0x00010000 // supports emulation of one/two-button joystick #define RP_FEATURE_INPUTDEVICE_GAMEPAD 0x00020000 // supports emulation of multi-button joystick (if 3+ buttons available) -#define RP_FEATURE_INPUTDEVICE_JOYPAD 0x00040000 // supports emulation of amiga cd32 Joypad +#define RP_FEATURE_INPUTDEVICE_JOYPAD 0x00040000 // supports emulation of amiga cd32 joypad #define RP_FEATURE_INPUTDEVICE_PADDLE 0x00080000 // supports emulation of analog paddle #define RP_FEATURE_INPUTDEVICE_ANALOGSTICK 0x00100000 // supports emulation of analog joystick #define RP_FEATURE_INPUTDEVICE_LIGHTPEN 0x00200000 // supports emulation of light pen @@ -111,7 +111,7 @@ typedef struct RPScreenMode { DWORD dwScreenMode; // RP_SCREENMODE_* values and flags - LONG lClipLeft; // in guest pixel units; -1 = ignore (0 is a valid value) + LONG lClipLeft; // in guest pixel units; -1 = ignore (0 is a valid value); see http://www.retroplatform.com/kb/19-115 LONG lClipTop; // in guest pixel units; -1 = ignore (0 is a valid value) LONG lClipWidth; // in guest pixel units; -1 = ignore LONG lClipHeight; // in guest pixel units; -1 = ignore @@ -217,6 +217,8 @@ typedef struct RPScreenMode // // Notes // +// For information on display clipping values, see http://www.retroplatform.com/kb/19-115 +// // If the user wants to adjust clipping, or for automated grabs and calculations, it is possible to set RP_CLIPFLAGS_NOCLIP, which will widen the window to the maximum (within lTargetWidth+lTargetHeight/fullscreen constraints). // // Whenever the guest sets or changes the "container" window size or scaling factor (initially, or due to a command it receives, or due to Amiga-sourced changes), it sends an RPScreenMode update to the host. @@ -232,7 +234,7 @@ typedef struct RPScreenMode typedef struct RPInputDeviceDescription { DWORD dwHostInputType; // host-side input device type (RP_HOSTINPUT_MOUSE, RP_HOSTINPUT_JOYSTICK, etc.) - WCHAR szHostInputID[260]; // host device "ProductGUID InstanceGUID", GUID, etc. (can be any format, as long as string is unique across all devices; keyboard layout strings must not contain spaces) + WCHAR szHostInputID[260]; // host device "ProductGUID InstanceGUID", GUID, etc. (can be any format, as long as the string is unique across all devices; keyboard layout strings must not contain spaces) WCHAR szHostInputName[260]; // host device product description string ("5-Axis,12-Button with POV", "HID keyboard device", etc.) as listed by Windows; identical devices will result in identical strings (it is up to the host to add " (2)" etc. to the display names) DWORD dwHostInputVendorID; // host device Vendor ID (identification as issued by usb.org and found in USB and DirectInput device descriptors), or 0 if not available DWORD dwHostInputProductID; // host device Product ID (identification as assigned by manufacturer and used in USB and DirectInput device descriptors), or 0 if not available @@ -245,31 +247,39 @@ typedef struct RPInputDeviceDescription typedef struct RPDeviceContent { - BYTE btDeviceCategory; // RP_DEVICE_* value + BYTE btDeviceCategory; // RP_DEVICECATEGORY_* value BYTE btDeviceNumber; // device number (range 0..31), e.g. Amiga floppy drive unit 0, C64 disk unit 8 or 9, etc. DWORD dwInputDevice; // (guest-side) input device type (RP_INPUTDEVICE_MOUSE, RP_INPUTDEVICE_JOYSTICK, etc.); currently set to 0 if not RP_DEVICE_INPUTPORT DWORD dwFlags; // flags (or 0); e.g. see RP_DEVICEFLAGS_MOUSE_ (for "mouse hack"), RP_DEVICEFLAGS_RW_ (for read/write status) - WCHAR szContent[260]; // if RP_DEVICECATEGORY_INPUTPORT, then host device ID, otherwise full path and name of the media image file to load, if file content (not used for input devices, which only use szHostInputID); see comment for format of KeyboardCustom string; szContent is ignored if btDeviceCategory == RP_DEVICECATEGORY_INPUTPORT and dwInputDevice == RP_INPUTDEVICE_EMPTY + WCHAR szContent[260]; // if RP_DEVICECATEGORY_INPUTPORT, then host device ID, otherwise full path and name of the media image file to load, if file content (not used for input devices, which only use szHostInputID); see comment for format of KeyboardJoystick string; szContent is ignored if btDeviceCategory == RP_DEVICECATEGORY_INPUTPORT and dwInputDevice == RP_INPUTDEVICE_EMPTY } RPDEVICECONTENT; // // Keyboard layouts for joystick emulation // -// These are virtual devices enumerated and named by the guest, rather than by the operating system. Any device name set by the guest will do, as long as it does not contain space characters. +// These are virtual devices enumerated and named by the guest, rather than by the operating system. Any device name set by the guest will do, as long as it is unique and does not contain space characters. Each device is enumerated only once. // // In the initial device enumeration (guest to host), the szHostInputID strings are enumerated with names like -// "KeyboardLayout1", "KeyboardLayout2", "KeyboardLayout3" and "KeyboardCustom" +// "KeyboardLayout1", "KeyboardLayout2", "KeyboardLayout3" and "KeyboardJoystick" // // In dwHostInputType: // - "KeyboardLayout1", "KeyboardLayout2", "KeyboardLayout3" are flagged // RP_HOSTINPUT_KEYJOY_MAP1, RP_HOSTINPUT_KEYJOY_MAP2, RP_HOSTINPUT_KEYJOY_MAP3 -// - "KeyboardCustom" is flagged RP_HOSTINPUT_KEYJOY_CUSTOM +// - "KeyboardJoystick" is flagged RP_HOSTINPUT_KEYBOARD +// +// In RP_IPC_TO_GUEST_DEVICECONTENT (host to guest) messages for RP_HOSTINPUT_KEYBOARD, the key code strings are appended to the device string in szContent. Multiple joysticks can be set up in this way. // -// In RP_IPC_TO_GUEST_DEVICECONTENT (host to guest) messages, the key code strings are appended to the device string in szContent. // For example: -// "KeyboardCustom Left=0xC8 Right=0xD0 Up=0xCB Down=0xCD Fire=0x39" +// "KeyboardJoystick Left=0x4B Right=0x4D Up=0x48 Down=0x50 Fire=0x4C Autofire=0x38 Fire2=0x52 Rewind=0xB5 Play=0x37 FastForward=0x4A Green=0x47 Yellow=0x49 Red=0x4F Blue=0x51" +// +// The example sets a layout based mostly on the numeric keyboard: +// - 8, 2, 4, 6 for direction, 5 to fire +// - an additional "Fire2" button (as on the X-Arcade), set to the 0 key +// - an additional Autofire button, set to Left Alt +// - additional CD32 Joypad buttons: Rewind, Play, Fast Forward, Green, Yellow, Red, Blue (set to /, *, -, 7, 9, 1, 3) // +// Full set of button definitions: as in the above example, plus "Fire3" (currently not used) // Device Categories @@ -290,12 +300,12 @@ typedef struct RPDeviceContent #define RP_HOSTINPUT_MOUSE 0 // Mouse/trackball (supports relative moves) #define RP_HOSTINPUT_TABLET 1 // Pen tablet (no relative moves, only absolute positions) #define RP_HOSTINPUT_JOYSTICK 2 // PC joystick, gamepad, trackball, etc. -#define RP_HOSTINPUT_KEYJOY_MAP1 3 // Keyboard Layout 1; Amiga/C64: Keyboard Layout A for WinUAE/VICE (8, 2, 4, 6 on keypad, 0 to fire, etc.) -#define RP_HOSTINPUT_KEYJOY_MAP2 4 // Keyboard Layout 2; Amiga/C64: Keyboard Layout B for WinUAE/VICE (cursor keys, right Control to fire, etc.) -#define RP_HOSTINPUT_KEYJOY_MAP3 5 // Keyboard Layout 3; Amiga/C64: Keyboard Layout C for WinUAE/VICE (W, S, A, D keys, left Alt to fire, etc.) -#define RP_HOSTINPUT_ARCADE_LEFT 6 // Left part of arcade dual joystick input device ("player 1") -#define RP_HOSTINPUT_ARCADE_RIGHT 7 // Right part of arcade dual joystick input device ("player 2") -#define RP_HOSTINPUT_KEYJOY_CUSTOM 8 // Custom Keyboard Layout (e.g. "KeyboardCustom Left=0xC8 Right=0xD0 Up=0xCB Down=0xCD Fire=0x39" set in szContent) +#define RP_HOSTINPUT_KEYJOY_MAP1 3 // [LEGACY] Keyboard Layout 1; Amiga/C64: Keyboard Layout A for WinUAE/VICE (8, 2, 4, 6 on keypad, 0 to fire, etc.) +#define RP_HOSTINPUT_KEYJOY_MAP2 4 // [LEGACY] Keyboard Layout 2; Amiga/C64: Keyboard Layout B for WinUAE/VICE (cursor keys, right Control to fire, etc.) +#define RP_HOSTINPUT_KEYJOY_MAP3 5 // [LEGACY] Keyboard Layout 3; Amiga/C64: Keyboard Layout C for WinUAE/VICE (W, S, A, D keys, left Alt to fire, etc.) +#define RP_HOSTINPUT_ARCADE_LEFT 6 // [LEGACY] Left part of arcade dual joystick input device ("player 1") +#define RP_HOSTINPUT_ARCADE_RIGHT 7 // [LEGACY] Right part of arcade dual joystick input device ("player 2") +#define RP_HOSTINPUT_KEYBOARD 8 // Keyboard Layout (e.g. "KeyboardJoystick Left=0x4B Right=0x4D Up=0x48 Down=0x50 Fire=0x4C Autofire=0x38 Fire2=0x52 Rewind=0xB5 Play=0x37 FastForward=0x4A Green=0x47 Yellow=0x49 Red=0x4F Blue=0x51" set in szContent); introduced in RP API 3.3 to replace other keyboard layout modes #define RP_HOSTINPUT_COUNT 9 // total number of device types // Host Input Device Flags @@ -311,10 +321,10 @@ typedef struct RPDeviceContent #define RP_INPUTDEVICE_JOYSTICK 2 // One/Two-button joystick #define RP_INPUTDEVICE_GAMEPAD 3 // Multi-button joystick (if 3+ buttons available); on Amiga: pull-up resistors emulated #define RP_INPUTDEVICE_JOYPAD 4 // Amiga: CD32 Joypad -#define RP_INPUTDEVICE_PADDLE 5 // [currently unused] Analog paddle (e.g. as in VIC 20 470 kohm paddles); one paddle is mapped to one host-side device -#define RP_INPUTDEVICE_ANALOGSTICK 6 // [currently unused] Analog joystick; on Amiga: 2nd and 3rd button lines used as analog X/Y axes, digital directions used as buttons 1-4, plus original fire -#define RP_INPUTDEVICE_LIGHTPEN 7 // [currently unused] Light pen -#define RP_INPUTDEVICE_TABLET 8 // [currently unused] Pen tablet (no relative moves, only absolute positions); on Amiga: pressure support as per Electronic Arts Tablet.library +#define RP_INPUTDEVICE_PADDLE 5 // [CURRENTLY UNUSED] Analog paddle (e.g. as in VIC 20 470 kohm paddles); one paddle is mapped to one host-side device +#define RP_INPUTDEVICE_ANALOGSTICK 6 // [CURRENTLY UNUSED] Analog joystick; on Amiga: 2nd and 3rd button lines used as analog X/Y axes, digital directions used as buttons 1-4, plus original fire +#define RP_INPUTDEVICE_LIGHTPEN 7 // [CURRENTLY UNUSED] Light pen +#define RP_INPUTDEVICE_TABLET 8 // [CURRENTLY UNUSED] Pen tablet (no relative moves, only absolute positions); on Amiga: pressure support as per Electronic Arts Tablet.library #define RP_INPUTDEVICE_COUNT 9 // total number of device types // Device Read/Write status (used in RP_IPC_TO_HOST_DEVICECONTENT, RP_IPC_TO_GUEST_DEVICECONTENT; used for device categories RP_DEVICECATEGORY_FLOPPY, RP_DEVICECATEGORY_HD, RP_DEVICECATEGORY_TAPE, RP_DEVICECATEGORY_CARTRIDGE) @@ -377,7 +387,7 @@ typedef struct RPDeviceContent #define RP_HOSTVERSION_BUILD(ver) ((ver) & 0x3FF) #define RP_MAKE_HOSTVERSION(major,minor,build) ((LPARAM) (((LPARAM)((major) & 0xFFF)<<20) | ((LPARAM)((minor) & 0x3FF)<<10) | ((LPARAM)((build) & 0x3FF)))) - +#if 0 // Legacy Compatibility (pre-3.0) #define RP_IPC_TO_HOST_DEVICECONTENT_LEGACY (WM_APP + 16) #define RP_IPC_TO_GUEST_DEVICECONTENT_LEGACY (WM_APP + 205) @@ -466,5 +476,5 @@ typedef struct RPDeviceContent_Legacy #define RPIPCHM_GUESTAPIVERSION RP_IPC_TO_GUEST_GUESTAPIVERSION #define RPIPCHM_DEVICECONTENT RP_IPC_TO_GUEST_DEVICECONTENT // End of Legacy Compatibility - +#endif #endif // __CLOANTO_RETROPLATFORMIPC_H__ diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 75e32477..875e42c8 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -1251,6 +1251,14 @@ static const struct hidquirk quirks[] = { { 0 } }; +static const struct hidquirk hidnorawinput[] = { + { 0x0583, 0x2030 }, // Rockfire RM-203 1 + { 0x0583, 0x2031 }, // Rockfire RM-203 2 + { 0x0583, 0x2032 }, // Rockfire RM-203 3 + { 0x0583, 0x2033 }, // Rockfire RM-203 4 + { 0 } +}; + static void fixhidvcaps (RID_DEVICE_INFO_HID *hid, HIDP_VALUE_CAPS *caps) { int pid = hid->dwProductId; @@ -1276,7 +1284,105 @@ static void fixhidvcaps (RID_DEVICE_INFO_HID *hid, HIDP_VALUE_CAPS *caps) break; } } +} +static void dumphidvaluecaps (PHIDP_VALUE_CAPS vcaps, int size) +{ + for (int i = 0; i < size; i++) { + HIDP_VALUE_CAPS caps = vcaps[i]; + write_log (L"******** VALUE_CAPS: %d ********\n", i); + write_log (L"UsagePage: %u\n", caps.UsagePage); + write_log (L"ReportID: %u\n", caps.ReportID); + write_log (L"IsAlias: %u\n", caps.IsAlias); + write_log (L"BitField: %u\n", caps.BitField); + write_log (L"LinkCollection: %u\n", caps.LinkCollection); + write_log (L"LinkUsage: %u\n", caps.LinkUsage); + write_log (L"LinkUsagePage: %u\n", caps.LinkUsagePage); + write_log (L"IsRange: %u\n", caps.IsRange); + write_log (L"IsStringRange: %u\n", caps.IsStringRange); + write_log (L"IsDesignatorRange: %u\n", caps.IsDesignatorRange); + write_log (L"IsAbsolute: %u\n", caps.IsAbsolute); + write_log (L"HasNull: %u\n", caps.HasNull); + write_log (L"BitSize: %u\n", caps.BitSize); + write_log (L"ReportCount: %u\n", caps.ReportCount); + write_log (L"UnitsExp: %u\n", caps.UnitsExp); + write_log (L"Units: %u\n", caps.Units); + write_log (L"LogicalMin: %u\n", caps.LogicalMin); + write_log (L"LogicalMax: %u\n", caps.LogicalMax); + write_log (L"PhysicalMin: %u\n", caps.PhysicalMin); + write_log (L"PhysicalMax: %u\n", caps.PhysicalMax); + if (caps.IsRange) { + write_log (L"UsageMin: %u\n", caps.Range.UsageMin); + write_log (L"UsageMax: %u\n", caps.Range.UsageMax); + write_log (L"StringMin: %u\n", caps.Range.StringMin); + write_log (L"StringMax: %u\n", caps.Range.StringMax); + write_log (L"DesignatorMin: %u\n", caps.Range.DesignatorMin); + write_log (L"DesignatorMax: %u\n", caps.Range.DesignatorMax); + write_log (L"DataIndexMin: %u\n", caps.Range.DataIndexMin); + write_log (L"DataIndexMax: %u\n", caps.Range.DataIndexMax); + } else { + write_log (L"Usage: %u\n", caps.NotRange.Usage); + write_log (L"StringIndex: %u\n", caps.NotRange.StringIndex); + write_log (L"DesignatorIndex: %u\n", caps.NotRange.DesignatorIndex); + write_log (L"DataIndex: %u\n", caps.NotRange.DataIndex); + } + } +} + +static void dumphidbuttoncaps (PHIDP_BUTTON_CAPS pcaps, int size) +{ + for (int i = 0; i < size; i++) { + HIDP_BUTTON_CAPS caps = pcaps[i]; + write_log (L"******** BUTTON_CAPS: %d ********\n", i); + write_log (L"UsagePage: %u\n", caps.UsagePage); + write_log (L"ReportID: %u\n", caps.ReportID); + write_log (L"IsAlias: %u\n", caps.IsAlias); + write_log (L"BitField: %u\n", caps.BitField); + write_log (L"LinkCollection: %u\n", caps.LinkCollection); + write_log (L"LinkUsage: %u\n", caps.LinkUsage); + write_log (L"LinkUsagePage: %u\n", caps.LinkUsagePage); + write_log (L"IsRange: %u\n", caps.IsRange); + write_log (L"IsStringRange: %u\n", caps.IsStringRange); + write_log (L"IsDesignatorRange: %u\n", caps.IsDesignatorRange); + write_log (L"IsAbsolute: %u\n", caps.IsAbsolute); + if (caps.IsRange) { + write_log (L"UsageMin: %u\n", caps.Range.UsageMin); + write_log (L"UsageMax: %u\n", caps.Range.UsageMax); + write_log (L"StringMin: %u\n", caps.Range.StringMin); + write_log (L"StringMax: %u\n", caps.Range.StringMax); + write_log (L"DesignatorMin: %u\n", caps.Range.DesignatorMin); + write_log (L"DesignatorMax: %u\n", caps.Range.DesignatorMax); + write_log (L"DataIndexMin: %u\n", caps.Range.DataIndexMin); + write_log (L"DataIndexMax: %u\n", caps.Range.DataIndexMax); + } else { + write_log (L"Usage: %u\n", caps.NotRange.Usage); + write_log (L"StringIndex: %u\n", caps.NotRange.StringIndex); + write_log (L"DesignatorIndex: %u\n", caps.NotRange.DesignatorIndex); + write_log (L"DataIndex: %u\n", caps.NotRange.DataIndex); + } + } +} + +static void dumphidcaps (struct didata *did) +{ + HIDP_CAPS caps = did->hidcaps; + + write_log (_T("\n******** USB HID: '%s'\n"), did->name); + write_log (_T("Usage: %04x\n"), caps.Usage); + write_log (_T("UsagePage: %04x\n"), caps.UsagePage); + write_log (_T("InputReportByteLength: %u\n"), caps.InputReportByteLength); + write_log (_T("OutputReportByteLength: %u\n"), caps.OutputReportByteLength); + write_log (_T("FeatureReportByteLength: %u\n"), caps.FeatureReportByteLength); + write_log (_T("NumberLinkCollectionNodes: %u\n"), caps.NumberLinkCollectionNodes); + write_log (_T("NumberInputButtonCaps: %u\n"), caps.NumberInputButtonCaps); + write_log (_T("NumberInputValueCaps: %u\n"), caps.NumberInputValueCaps); + write_log (_T("NumberInputDataIndices: %u\n"), caps.NumberInputDataIndices); + write_log (_T("NumberOutputButtonCaps: %u\n"), caps.NumberOutputButtonCaps); + write_log (_T("NumberOutputValueCaps: %u\n"), caps.NumberOutputValueCaps); + write_log (_T("NumberOutputDataIndices: %u\n"), caps.NumberOutputDataIndices); + write_log (_T("NumberFeatureButtonCaps: %u\n"), caps.NumberFeatureButtonCaps); + write_log (_T("NumberFeatureValueCaps: %u\n"), caps.NumberFeatureValueCaps); + write_log (_T("NumberFeatureDataIndices: %u\n"), caps.NumberFeatureDataIndices); } static bool initialize_rawinput (void) @@ -1307,6 +1413,34 @@ static bool initialize_rawinput (void) write_log (_T("RAWINPUT didn't find any devices\n")); goto error2; } + + if (rawinput_enabled_hid) { + for (int rawcnt = 0; rawcnt < gotnum; rawcnt++) { + int type = ridl[rawcnt].dwType; + HANDLE h = ridl[rawcnt].hDevice; + PRID_DEVICE_INFO rdi; + + if (type != RIM_TYPEHID) + continue; + rdi = (PRID_DEVICE_INFO)buf2; + memset (rdi, 0, sizeof (RID_DEVICE_INFO)); + rdi->cbSize = sizeof (RID_DEVICE_INFO); + if (GetRawInputDeviceInfo (h, RIDI_DEVICEINFO, NULL, &vtmp) == -1) + continue; + if (vtmp >= bufsize) + continue; + if (GetRawInputDeviceInfo (h, RIDI_DEVICEINFO, buf2, &vtmp) == -1) + continue; + for (int i = 0; hidnorawinput[i].vid; i++) { + if (hidnorawinput[i].vid == rdi->hid.dwVendorId && hidnorawinput[i].pid == rdi->hid.dwProductId) { + write_log (_T("Found USB HID device that requires calibration (%04x/%04x), disabling HID RAWINPUT support\n"), + rdi->hid.dwVendorId, rdi->hid.dwProductId); + rawinput_enabled_hid = 0; + } + } + } + } + rnum_raw = rnum_mouse = rnum_kb = rnum_hid = 0; for (int rawcnt = 0; rawcnt < gotnum; rawcnt++) { int type = ridl[rawcnt].dwType; @@ -1399,7 +1533,11 @@ static bool initialize_rawinput (void) if (rdi->hid.usUsage != 4 && rdi->hid.usUsage != 5) { continue; } - if (num_joystick >= MAX_INPUT_DEVICES) + for (i = 0; hidnorawinput[i].vid; i++) { + if (rdi->hid.dwProductId == hidnorawinput[i].pid && rdi->hid.dwVendorId == hidnorawinput[i].vid) + break; + } + if (hidnorawinput[i].vid || num_joystick >= MAX_INPUT_DEVICES) continue; did += num_joystick; num_joystick++; @@ -1485,8 +1623,10 @@ static bool initialize_rawinput (void) if (HidP_GetCaps (did->hidpreparseddata, &did->hidcaps) == HIDP_STATUS_SUCCESS) { PHIDP_BUTTON_CAPS bcaps; USHORT size = did->hidcaps.NumberInputButtonCaps; + dumphidcaps (did); bcaps = xmalloc (HIDP_BUTTON_CAPS, size); if (HidP_GetButtonCaps (HidP_Input, bcaps, &size, did->hidpreparseddata) == HIDP_STATUS_SUCCESS) { + dumphidbuttoncaps (bcaps, size); int buttoncnt = 0; for (i = 0; i < size && buttoncnt < MAX_MAPPINGS; i++) { int first, last; @@ -1521,6 +1661,7 @@ static bool initialize_rawinput (void) size = did->hidcaps.NumberInputValueCaps; vcaps = xmalloc (HIDP_VALUE_CAPS, size); if (HidP_GetValueCaps (HidP_Input, vcaps, &size, did->hidpreparseddata) == HIDP_STATUS_SUCCESS) { + dumphidvaluecaps (vcaps, size); int axiscnt = 0; for (i = 0; i < size && axiscnt < MAX_MAPPINGS; i++) { int first, last; @@ -1621,7 +1762,6 @@ static bool initialize_rawinput (void) return 1; - write_log (_T("RAWINPUT not available or failed to initialize\n")); error2: xfree (ridl); xfree (bufp); @@ -1873,6 +2013,8 @@ static void handle_rawinput_2 (RAWINPUT *raw) v = extractbits (val, vcaps->BitSize, vcaps->LogicalMin < 0); + //write_log (L"%d %d: %d\n", num, axisnum, v); + if (v < vcaps->LogicalMin) v = vcaps->LogicalMin; else if (v > vcaps->LogicalMax) @@ -2281,8 +2423,9 @@ static BOOL di_enumcallback2 (LPCDIDEVICEINSTANCE lpddi, int joy) TCHAR *typetxt; TCHAR tmp[100]; - if (rawinput_enabled_hid && (lpddi->dwDevType & DIDEVTYPE_HID)) + if (rawinput_enabled_hid && (lpddi->dwDevType & DIDEVTYPE_HID)) { return 1; + } type = lpddi->dwDevType & 0xff; if (type == DI8DEVTYPE_MOUSE || type == DI8DEVTYPE_SCREENPOINTER) { diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index d447279a..dcf6c6f7 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -1664,8 +1664,8 @@ static void setupscenecoords (void) sw = dw * tin_w / window_w; sh = dh * tin_h / window_h; - sw -= 0.5f; - sh += 0.5f; + //sw -= 0.5f; + //sh += 0.5f; tx += xshift; ty += yshift; @@ -2318,10 +2318,10 @@ bool D3D_alloctexture (int w, int h) changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen | STATUSLINE_TARGET; - if (!createamigatexture (tin_w, tin_h)) - return false; if (!createtexture (tout_w, tout_h, window_w, window_h)) return false; + if (!createamigatexture (tin_w, tin_h)) + return false; return true; } diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index 64ea3dee..fa01142f 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -86,48 +86,48 @@ static const TCHAR *getmsg (int msg) { switch (msg) { - case RPIPCGM_REGISTER: return _T("RPIPCGM_REGISTER"); - case RPIPCGM_FEATURES: return _T("RPIPCGM_FEATURES"); - case RPIPCGM_CLOSED: return _T("RPIPCGM_CLOSED"); - case RPIPCGM_ACTIVATED: return _T("RPIPCGM_ACTIVATED"); - case RPIPCGM_DEACTIVATED: return _T("RPIPCGM_DEACTIVATED"); - case RPIPCGM_SCREENMODE: return _T("RPIPCGM_SCREENMODE"); - case RPIPCGM_POWERLED: return _T("RPIPCGM_POWERLED"); - case RPIPCGM_DEVICES: return _T("RPIPCGM_DEVICES"); - case RPIPCGM_DEVICEACTIVITY: return _T("RPIPCGM_DEVICEACTIVITY"); - case RPIPCGM_MOUSECAPTURE: return _T("RPIPCGM_MOUSECAPTURE"); - case RPIPCGM_HOSTAPIVERSION: return _T("RPIPCGM_HOSTAPIVERSION"); - case RPIPCGM_PAUSE: return _T("RPIPCGM_PAUSE"); - case RPIPCGM_DEVICECONTENT: return _T("RPIPCGM_DEVICECONTENT"); - case RPIPCGM_TURBO: return _T("RPIPCGM_TURBO"); - case RPIPCGM_PING: return _T("RPIPCGM_PING"); - case RPIPCGM_VOLUME: return _T("RPIPCGM_VOLUME"); - case RPIPCGM_ESCAPED: return _T("RPIPCGM_ESCAPED"); - case RPIPCGM_PARENT: return _T("RPIPCGM_PARENT"); - case RPIPCGM_DEVICESEEK: return _T("RPIPCGM_DEVICESEEK"); - case RPIPCGM_CLOSE: return _T("RPIPCGM_CLOSE"); - case RPIPCGM_DEVICEREADWRITE: return _T("RPIPCGM_DEVICEREADWRITE"); - case RPIPCGM_HOSTVERSION: return _T("RPIPCGM_HOSTVERSION"); - case RPIPCGM_INPUTDEVICE: return _T("RPIPCGM_INPUTDEVICE"); - - case RPIPCHM_CLOSE: return _T("RPIPCHM_CLOSE"); - case RPIPCHM_SCREENMODE: return _T("RPIPCHM_SCREENMODE"); - case RPIPCHM_SCREENCAPTURE: return _T("RPIPCHM_SCREENCAPTURE"); - case RPIPCHM_PAUSE: return _T("RPIPCHM_PAUSE"); - case RPIPCHM_DEVICECONTENT: return _T("RPIPCHM_DEVICECONTENT"); - case RPIPCHM_RESET: return _T("RPIPCHM_RESET"); - case RPIPCHM_TURBO: return _T("RPIPCHM_TURBO"); - case RPIPCHM_PING: return _T("RPIPCHM_PING"); - case RPIPCHM_VOLUME: return _T("RPIPCHM_VOLUME"); - case RPIPCHM_ESCAPEKEY: return _T("RPIPCHM_ESCAPEKEY"); - case RPIPCHM_EVENT: return _T("RPIPCHM_EVENT"); - case RPIPCHM_MOUSECAPTURE: return _T("RPIPCHM_MOUSECAPTURE"); - case RPIPCHM_SAVESTATE: return _T("RPIPCHM_SAVESTATE"); - case RPIPCHM_LOADSTATE: return _T("RPIPCHM_LOADSTATE"); - case RPIPCHM_FLUSH: return _T("RPIPCHM_FLUSH"); - case RPIPCHM_DEVICEREADWRITE: return _T("RPIPCHM_DEVICEREADWRITE"); - case RPIPCHM_QUERYSCREENMODE: return _T("RPIPCHM_QUERYSCREENMODE"); - case RPIPCHM_GUESTAPIVERSION : return _T("RPIPCHM_GUESTAPIVERSION"); + case RP_IPC_TO_HOST_REGISTER: return _T("RP_IPC_TO_HOST_REGISTER"); + case RP_IPC_TO_HOST_FEATURES: return _T("RP_IPC_TO_HOST_FEATURES"); + case RP_IPC_TO_HOST_CLOSED: return _T("RP_IPC_TO_HOST_CLOSED"); + case RP_IPC_TO_HOST_ACTIVATED: return _T("RP_IPC_TO_HOST_ACTIVATED"); + case RP_IPC_TO_HOST_DEACTIVATED: return _T("RP_IPC_TO_HOST_DEACTIVATED"); + case RP_IPC_TO_HOST_SCREENMODE: return _T("RP_IPC_TO_HOST_SCREENMODE"); + case RP_IPC_TO_HOST_POWERLED: return _T("RP_IPC_TO_HOST_POWERLED"); + case RP_IPC_TO_HOST_DEVICES: return _T("RP_IPC_TO_HOST_DEVICES"); + case RP_IPC_TO_HOST_DEVICEACTIVITY: return _T("RP_IPC_TO_HOST_DEVICEACTIVITY"); + case RP_IPC_TO_HOST_MOUSECAPTURE: return _T("RP_IPC_TO_HOST_MOUSECAPTURE"); + case RP_IPC_TO_HOST_HOSTAPIVERSION: return _T("RP_IPC_TO_HOST_HOSTAPIVERSION"); + case RP_IPC_TO_HOST_PAUSE: return _T("RP_IPC_TO_HOST_PAUSE"); + case RP_IPC_TO_HOST_DEVICECONTENT: return _T("RP_IPC_TO_HOST_DEVICECONTENT"); + case RP_IPC_TO_HOST_TURBO: return _T("RP_IPC_TO_HOST_TURBO"); + case RP_IPC_TO_HOST_PING: return _T("RP_IPC_TO_HOST_PING"); + case RP_IPC_TO_HOST_VOLUME: return _T("RP_IPC_TO_HOST_VOLUME"); + case RP_IPC_TO_HOST_ESCAPED: return _T("RP_IPC_TO_HOST_ESCAPED"); + case RP_IPC_TO_HOST_PARENT: return _T("RP_IPC_TO_HOST_PARENT"); + case RP_IPC_TO_HOST_DEVICESEEK: return _T("RP_IPC_TO_HOST_DEVICESEEK"); + case RP_IPC_TO_HOST_CLOSE: return _T("RP_IPC_TO_HOST_CLOSE"); + case RP_IPC_TO_HOST_DEVICEREADWRITE: return _T("RP_IPC_TO_HOST_DEVICEREADWRITE"); + case RP_IPC_TO_HOST_HOSTVERSION: return _T("RP_IPC_TO_HOST_HOSTVERSION"); + case RP_IPC_TO_HOST_INPUTDEVICE: return _T("RP_IPC_TO_HOST_INPUTDEVICE"); + + case RP_IPC_TO_GUEST_CLOSE: return _T("RP_IPC_TO_GUEST_CLOSE"); + case RP_IPC_TO_GUEST_SCREENMODE: return _T("RP_IPC_TO_GUEST_SCREENMODE"); + case RP_IPC_TO_GUEST_SCREENCAPTURE: return _T("RP_IPC_TO_GUEST_SCREENCAPTURE"); + case RP_IPC_TO_GUEST_PAUSE: return _T("RP_IPC_TO_GUEST_PAUSE"); + case RP_IPC_TO_GUEST_DEVICECONTENT: return _T("RP_IPC_TO_GUEST_DEVICECONTENT"); + case RP_IPC_TO_GUEST_RESET: return _T("RP_IPC_TO_GUEST_RESET"); + case RP_IPC_TO_GUEST_TURBO: return _T("RP_IPC_TO_GUEST_TURBO"); + case RP_IPC_TO_GUEST_PING: return _T("RP_IPC_TO_GUEST_PING"); + case RP_IPC_TO_GUEST_VOLUME: return _T("RP_IPC_TO_GUEST_VOLUME"); + case RP_IPC_TO_GUEST_ESCAPEKEY: return _T("RP_IPC_TO_GUEST_ESCAPEKEY"); + case RP_IPC_TO_GUEST_EVENT: return _T("RP_IPC_TO_GUEST_EVENT"); + case RP_IPC_TO_GUEST_MOUSECAPTURE: return _T("RP_IPC_TO_GUEST_MOUSECAPTURE"); + case RP_IPC_TO_GUEST_SAVESTATE: return _T("RP_IPC_TO_GUEST_SAVESTATE"); + case RP_IPC_TO_GUEST_LOADSTATE: return _T("RP_IPC_TO_GUEST_LOADSTATE"); + case RP_IPC_TO_GUEST_FLUSH: return _T("RP_IPC_TO_GUEST_FLUSH"); + case RP_IPC_TO_GUEST_DEVICEREADWRITE: return _T("RP_IPC_TO_GUEST_DEVICEREADWRITE"); + case RP_IPC_TO_GUEST_QUERYSCREENMODE: return _T("RP_IPC_TO_GUEST_QUERYSCREENMODE"); + case RP_IPC_TO_GUEST_GUESTAPIVERSION : return _T("RP_IPC_TO_GUEST_GUESTAPIVERSION"); default: return _T("UNKNOWN"); } } @@ -158,14 +158,52 @@ struct rp_customevent int evt; }; -static const TCHAR *customeventorder[] = { +static const TCHAR *customeventorder_joy[] = { _T("Left"), _T("Right"), _T("Up"), _T("Down"), _T("Fire"), + _T("Fire2"), + _T("Fire3"), NULL }; +static const TCHAR *customeventorder_cd32[] = { + _T("Left"), + _T("Right"), + _T("Up"), + _T("Down"), + _T("Red"), + _T("Blue"), + _T("Green"), + _T("Yellow"), + _T("Rewind"), + _T("FastForward"), + _T("Play"), + NULL +}; + +static const TCHAR **getcustomeventorder(int *devicetype) +{ + int devicetype2 = -1; + for (int i = 0; inputdevmode[i * 2]; i++) { + if (inputdevmode[i * 2 + 0] == *devicetype) { + devicetype2 = inputdevmode[i * 2 + 1]; + break; + } + } + if (devicetype2 < 0) + return NULL; + + *devicetype = devicetype2; + if (devicetype2 == JSEM_MODE_JOYSTICK) + return customeventorder_joy; + if (devicetype2 == JSEM_MODE_GAMEPAD) + return customeventorder_joy; + if (devicetype2 == JSEM_MODE_JOYSTICK_CD32) + return customeventorder_cd32; + return NULL; +} bool port_get_custom (int inputmap_port, TCHAR *out) { @@ -174,16 +212,31 @@ bool port_get_custom (int inputmap_port, TCHAR *out) TCHAR *p = out; int mode, *events, *axistable; int max; + const TCHAR **eventorder; max = inputdevice_get_compatibility_input (&currprefs, inputmap_port, &mode, &events, &axistable); if (!max) return false; + int devicetype = -1; + for (int i = 0; inputdevmode[i * 2]; i++) { + if (inputdevmode[i * 2 + 1] == currprefs.jports[inputmap_port].mode) { + devicetype = inputdevmode[i * 2 + 0]; + break; + } + } + if (devicetype < 0) + return false; + + eventorder = getcustomeventorder (&devicetype); + if (!eventorder) + return FALSE; + _tcscpy (p, KEYBOARDCUSTOM); p += _tcslen (p); kb = inputdevice_get_device_total (IDTYPE_JOYSTICK) + inputdevice_get_device_total (IDTYPE_MOUSE); int kbnum = 0; - for (int i = 0; customeventorder[i]; i++) { + for (int i = 0; eventorder[i]; i++) { int evtnum = events[i]; for (int j = 0; j < inputdevicefunc_keyboard.get_widget_num (kbnum); j++) { int flags, port; @@ -194,7 +247,13 @@ bool port_get_custom (int inputmap_port, TCHAR *out) if (!first) *p++ = ' '; first = false; - _stprintf (p, _T("%s=0x%02X"), customeventorder[i], kc); + _tcscpy (p, eventorder[i]); + p += _tcslen (p); + if (flags & IDEV_MAPPED_AUTOFIRE_SET) { + _tcscpy (p, _T(".autorepeat")); + p += _tcslen (p); + } + _stprintf (p, _T("=%02X"), kc); p += _tcslen (p); break; } @@ -211,30 +270,46 @@ int port_insert_custom (int inputmap_port, int devicetype, DWORD flags, const TC int mode, *events, *axistable; int max, evtnum; int kb; + const TCHAR **eventorder; + + eventorder = getcustomeventorder (&devicetype); + if (!eventorder) + return FALSE; kb = inputdevice_get_device_total (IDTYPE_JOYSTICK) + inputdevice_get_device_total (IDTYPE_MOUSE); inputdevice_updateconfig_internal (&changed_prefs); - inputdevice_compa_prepare_custom (&changed_prefs, inputmap_port, JSEM_MODE_JOYSTICK); + inputdevice_compa_prepare_custom (&changed_prefs, inputmap_port, devicetype); inputdevice_updateconfig_internal (&changed_prefs); max = inputdevice_get_compatibility_input (&changed_prefs, inputmap_port, &mode, &events, &axistable); - write_log (_T("custom='%s' max=%d port=%d kb=%d kbnum=%d\n"), custom, max, inputmap_port, kb, inputdevice_get_device_total (IDTYPE_KEYBOARD)); + write_log (_T("custom='%s' max=%d port=%d dt=%d kb=%d kbnum=%d\n"), custom, max, inputmap_port, devicetype, kb, inputdevice_get_device_total (IDTYPE_KEYBOARD)); if (!max) return FALSE; while (p && p[0]) { int idx = -1, kc = -1; + int flags = 0; + int eventlen; + const TCHAR *p2 = _tcschr (p, '='); if (!p2) break; - for (int i = 0; customeventorder[i]; i++) { - if (!_tcsncmp (p, customeventorder[i], p2 - p)) { + const TCHAR *p3 = _tcschr (p, '.'); + if (!p3 || p3 >= p2) { + p3 = NULL; + eventlen = p2 - p; + } else { + eventlen = p3 - p; + if (!_tcsncmp (p3, L"autorepeat", p2 - p3)) + flags |= IDEV_MAPPED_AUTOFIRE_SET; + } + + for (int i = 0; eventorder[i]; i++) { + if (_tcslen (eventorder[i]) == eventlen && !_tcsncmp (p, eventorder[i], eventlen)) { idx = i; break; } } - if (idx < 0 || idx > 4) - break; p2++; if (p2[0] == '0' && (p2[1] == 'x' || p2[1] == 'X')) kc = _tcstol (p2 + 2, NULL, 16); @@ -243,11 +318,15 @@ int port_insert_custom (int inputmap_port, int devicetype, DWORD flags, const TC p = _tcschr (p2, ' '); if (p) p++; + + if (idx < 0) + continue; if (kc < 0) - break; + continue; + evtnum = events[idx]; - write_log (_T("kb=%d evt=%d kc=%d\n"), kb, evtnum, kc); + write_log (_T("kb=%d evt=%d kc=%02x flags=%08x\n"), kb, evtnum, kc, flags); for (int j = 0; j < inputdevice_get_device_total (IDTYPE_KEYBOARD); j++) { int wdnum = -1; @@ -261,10 +340,10 @@ int port_insert_custom (int inputmap_port, int devicetype, DWORD flags, const TC } if (wdnum >= 0) { write_log (_T("kb=%d (%s) wdnum=%d\n"), j, inputdevicefunc_keyboard.get_friendlyname (j), wdnum); - inputdevice_set_gameports_mapping (&changed_prefs, kb + j, wdnum, evtnum, inputmap_port); - inputdevice_set_gameports_mapping (&currprefs, kb + j, wdnum, evtnum, inputmap_port); + inputdevice_set_gameports_mapping (&changed_prefs, kb + j, wdnum, evtnum, flags, inputmap_port); + inputdevice_set_gameports_mapping (&currprefs, kb + j, wdnum, evtnum, flags, inputmap_port); } else { - write_log (_T("kb=%d (%): keycode %x not found!\n"), j, inputdevicefunc_keyboard.get_friendlyname (j), kc); + write_log (_T("kb=%d (%): keycode %02x not found!\n"), j, inputdevicefunc_keyboard.get_friendlyname (j), kc); } } } @@ -333,7 +412,7 @@ static BOOL RPPostMessagex(UINT uMessage, WPARAM wParam, LPARAM lParam, const RP write_log (_T("RPPOST: pInfo == NULL!\n")); return FALSE; } - if (uMessage == RPIPCGM_DEVICESEEK || uMessage == RPIPCGM_DEVICEACTIVITY) + if (uMessage == RP_IPC_TO_HOST_DEVICESEEK || uMessage == RP_IPC_TO_HOST_DEVICEACTIVITY) dolog = 0; recursive++; cnt++; @@ -367,7 +446,7 @@ static BOOL RPSendMessagex (UINT uMessage, WPARAM wParam, LPARAM lParam, write_log (_T("RPSEND: pInfo->hHostMessageWindow == NULL!\n")); return FALSE; } - if (uMessage == RPIPCGM_DEVICESEEK) + if (uMessage == RP_IPC_TO_HOST_DEVICESEEK) dolog = 0; recursive++; cnt++; @@ -468,7 +547,7 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) vmult = p->gfx_filter_vert_zoom_mult > 0 ? 1000 * 256 / p->gfx_filter_vert_zoom_mult : 256; sm->hGuestWindow = guestwindow; - m = RP_SCREENMODE_1X; + m = RP_SCREENMODE_SCALE_1X; cf = 0; if (WIN32GFX_IsPicassoScreen ()) { @@ -499,9 +578,9 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) vres = VRES_QUAD; if (hres == RES_HIRES) - m = RP_SCREENMODE_2X; + m = RP_SCREENMODE_SCALE_2X; else if (hres >= RES_SUPERHIRES) - m = RP_SCREENMODE_4X; + m = RP_SCREENMODE_SCALE_4X; if (log_rp) write_log (_T("GET_RPSM: hres=%d (%d) vres=%d (%d) full=%d xcpos=%d ycpos=%d w=%d h=%d vm=%d hm=%d\n"), @@ -528,17 +607,17 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) m |= p->gfx_apmode[APMODE_NATIVE].gfx_display << 8; } if (full > 1) - m |= RP_SCREENMODE_FULLWINDOW; + m |= RP_SCREENMODE_FULLSCREEN_SHARED; - sm->dwScreenMode = m | (storeflags & (RP_SCREENMODE_STRETCH | RP_SCREENMODE_SUBPIXEL)); + sm->dwScreenMode = m | (storeflags & (RP_SCREENMODE_SCALING_STRETCH | RP_SCREENMODE_SCALING_SUBPIXEL)); sm->lTargetHeight = 0; sm->lTargetWidth = 0; - if ((storeflags & RP_SCREENMODE_MODEMASK) == RP_SCREENMODE_XX) { - sm->dwScreenMode &= ~RP_SCREENMODE_MODEMASK; - sm->dwScreenMode |= RP_SCREENMODE_XX; - } else if ((storeflags & RP_SCREENMODE_MODEMASK) == RP_SCREENMODE_WW) { - sm->dwScreenMode &= ~RP_SCREENMODE_MODEMASK; - sm->dwScreenMode = RP_SCREENMODE_WW; + if ((storeflags & RP_SCREENMODE_SCALEMASK) == RP_SCREENMODE_SCALE_MAX) { + sm->dwScreenMode &= ~RP_SCREENMODE_SCALEMASK; + sm->dwScreenMode |= RP_SCREENMODE_SCALE_MAX; + } else if ((storeflags & RP_SCREENMODE_SCALEMASK) == RP_SCREENMODE_SCALE_TARGET) { + sm->dwScreenMode &= ~RP_SCREENMODE_SCALEMASK; + sm->dwScreenMode = RP_SCREENMODE_SCALE_TARGET; sm->lTargetWidth = p->gfx_size_win.width; sm->lTargetHeight = p->gfx_size_win.height; } @@ -561,7 +640,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) struct MultiDisplay *disp; bool keepaspect = (sm->dwScreenMode & RP_SCREENMODE_SCALING_SUBPIXEL) && !(sm->dwScreenMode & RP_SCREENMODE_SCALING_STRETCH); bool stretch = (sm->dwScreenMode & RP_SCREENMODE_SCALING_STRETCH) != 0; - bool forcesize = smm == RP_SCREENMODE_WW && sm->lTargetWidth > 0 && sm->lTargetHeight > 0; + bool forcesize = smm == RP_SCREENMODE_SCALE_TARGET && sm->lTargetWidth > 0 && sm->lTargetHeight > 0; bool integerscale = !(sm->dwScreenMode & RP_SCREENMODE_SCALING_SUBPIXEL) && !(sm->dwScreenMode & RP_SCREENMODE_SCALING_STRETCH) && smm >= RP_SCREENMODE_SCALE_TARGET; int width, height; @@ -570,7 +649,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) if (display) { p->gfx_apmode[APMODE_NATIVE].gfx_display = display; p->gfx_apmode[APMODE_RTG].gfx_display = display; - if (sm->dwScreenMode & RP_SCREENMODE_FULLWINDOW) + if (sm->dwScreenMode & RP_SCREENMODE_FULLSCREEN_SHARED) fs = 2; else fs = 1; @@ -590,14 +669,14 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) hdbl = RES_LORES; vdbl = VRES_NONDOUBLE; - if (smm == RP_SCREENMODE_2X || smm == RP_SCREENMODE_3X) { + if (smm == RP_SCREENMODE_SCALE_2X || smm == RP_SCREENMODE_SCALE_3X) { hdbl = RES_HIRES; vdbl = VRES_DOUBLE; - } else if (smm == RP_SCREENMODE_4X) { + } else if (smm == RP_SCREENMODE_SCALE_4X) { hdbl = RES_SUPERHIRES; vdbl = VRES_DOUBLE; } - if (smm > RP_SCREENMODE_4X || smm == RP_SCREENMODE_XX) { + if (smm > RP_SCREENMODE_SCALE_4X || smm == RP_SCREENMODE_SCALE_MAX) { hdbl = max_horiz_dbl; vdbl = max_vert_dbl; } @@ -738,7 +817,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM if (log_rp) { write_log (_T("RPFUNC(%s [%d], %08x, %08x, %08x, %d, %08x)\n"), getmsg (uMessage), uMessage - WM_APP, wParam, lParam, pData, dwDataSize, lMsgFunctionParam); - if (uMessage == RPIPCHM_DEVICECONTENT) { + if (uMessage == RP_IPC_TO_GUEST_DEVICECONTENT) { struct RPDeviceContent *dc = (struct RPDeviceContent*)pData; write_log (_T(" Cat=%d Num=%d Flags=%08x '%s'\n"), dc->btDeviceCategory, dc->btDeviceNumber, dc->dwFlags, dc->szContent); @@ -750,15 +829,15 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM default: write_log (_T("RP: Unknown or unsupported command %x\n"), uMessage); break; - case RPIPCHM_PING: + case RP_IPC_TO_GUEST_PING: return TRUE; - case RPIPCHM_CLOSE: + case RP_IPC_TO_GUEST_CLOSE: uae_quit (); return TRUE; - case RPIPCHM_RESET: + case RP_IPC_TO_GUEST_RESET: uae_reset (wParam == RP_RESET_SOFT ? 0 : -1); return TRUE; - case RPIPCHM_TURBO: + case RP_IPC_TO_GUEST_TURBO: { if (wParam & RP_TURBO_CPU) warpmode ((lParam & RP_TURBO_CPU) ? 1 : 0); @@ -767,7 +846,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM config_changed = 1; } return TRUE; - case RPIPCHM_PAUSE: + case RP_IPC_TO_GUEST_PAUSE: currentpausemode = pause_emulation; if (wParam ? 1 : 0 != pause_emulation ? 1 : 0) { pausemode (wParam ? -1 : 0); @@ -777,15 +856,15 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM } } return 1; - case RPIPCHM_VOLUME: + case RP_IPC_TO_GUEST_VOLUME: currprefs.sound_volume = changed_prefs.sound_volume = 100 - wParam; set_volume (currprefs.sound_volume, 0); return TRUE; - case RPIPCHM_ESCAPEKEY: + case RP_IPC_TO_GUEST_ESCAPEKEY: rp_rpescapekey = wParam; rp_rpescapeholdtime = lParam; return TRUE; - case RPIPCHM_MOUSECAPTURE: + case RP_IPC_TO_GUEST_MOUSECAPTURE: { if (wParam & RP_MOUSECAPTURE_CAPTURED) setmouseactive (1); @@ -793,7 +872,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM setmouseactive (0); } return TRUE; - case RPIPCHM_DEVICECONTENT: + case RP_IPC_TO_GUEST_DEVICECONTENT: { struct RPDeviceContent *dc = (struct RPDeviceContent*)pData; TCHAR *n = dc->szContent; @@ -801,31 +880,31 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM int ok = FALSE; switch (dc->btDeviceCategory) { - case RP_DEVICE_FLOPPY: + case RP_DEVICECATEGORY_FLOPPY: if (n == NULL || n[0] == 0) disk_eject (num); else disk_insert (num, n); ok = TRUE; break; - case RP_DEVICE_INPUTPORT: + case RP_DEVICECATEGORY_INPUTPORT: ok = port_insert (num, dc->dwInputDevice, dc->dwFlags, n); if (ok) inputdevice_updateconfig (&currprefs); break; - case RP_DEVICE_CD: + case RP_DEVICECATEGORY_CD: ok = cd_insert (num, n); break; } return ok; } - case RPIPCHM_SCREENMODE: + case RP_IPC_TO_GUEST_SCREENMODE: { struct RPScreenMode *sm = (struct RPScreenMode*)pData; set_screenmode (sm, &changed_prefs); return (LRESULT)INVALID_HANDLE_VALUE; } - case RPIPCHM_EVENT: + case RP_IPC_TO_GUEST_EVENT: { TCHAR out[256]; TCHAR *s = (WCHAR*)pData; @@ -839,7 +918,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM } return TRUE; } - case RPIPCHM_SCREENCAPTURE: + case RP_IPC_TO_GUEST_SCREENCAPTURE: { extern int screenshotf (const TCHAR *spath, int mode, int doprepare); extern int screenshotmode; @@ -851,7 +930,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM screenshotmode = ossm; return ok ? TRUE : FALSE; } - case RPIPCHM_SAVESTATE: + case RP_IPC_TO_GUEST_SAVESTATE: { TCHAR *s = (TCHAR*)pData; DWORD ret = FALSE; @@ -869,7 +948,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM } return ret; } - case RPIPCHM_LOADSTATE: + case RP_IPC_TO_GUEST_LOADSTATE: { TCHAR *s = (WCHAR*)pData; DWORD ret = FALSE; @@ -881,11 +960,11 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM } return ret; } - case RPIPCHM_DEVICEREADWRITE: + case RP_IPC_TO_GUEST_DEVICEREADWRITE: { DWORD ret = FALSE; int device = LOBYTE(wParam); - if (device == RP_DEVICE_FLOPPY) { + if (device == RP_DEVICECATEGORY_FLOPPY) { int num = HIBYTE(wParam); if (lParam == RP_DEVICE_READONLY || lParam == RP_DEVICE_READWRITE) { ret = disk_setwriteprotect (&currprefs, num, currprefs.floppyslots[num].df, lParam == RP_DEVICE_READONLY); @@ -893,14 +972,14 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM } return ret ? (LPARAM)1 : 0; } - case RPIPCHM_FLUSH: + case RP_IPC_TO_GUEST_FLUSH: return 1; - case RPIPCHM_QUERYSCREENMODE: + case RP_IPC_TO_GUEST_QUERYSCREENMODE: { screenmode_request = true; return 1; } - case RPIPCHM_GUESTAPIVERSION: + case RP_IPC_TO_GUEST_GUESTAPIVERSION: { return MAKELONG(3, 0); } @@ -921,7 +1000,7 @@ static LRESULT CALLBACK RPHostMsgFunction (UINT uMessage, WPARAM wParam, LPARAM static int rp_hostversion (int *ver, int *rev, int *build) { LRESULT lr = 0; - if (!RPSendMessagex (RPIPCGM_HOSTVERSION, 0, 0, NULL, 0, &guestinfo, &lr)) + if (!RPSendMessagex (RP_IPC_TO_HOST_HOSTVERSION, 0, 0, NULL, 0, &guestinfo, &lr)) return 0; *ver = RP_HOSTVERSION_MAJOR(lr); *rev = RP_HOSTVERSION_MINOR(lr); @@ -956,7 +1035,7 @@ void rp_free (void) if (hwndset) rp_set_hwnd (NULL); initialized = 0; - RPPostMessagex (RPIPCGM_CLOSED, 0, 0, &guestinfo); + RPPostMessagex (RP_IPC_TO_HOST_CLOSED, 0, 0, &guestinfo); RPUninitializeGuest (&guestinfo); } @@ -965,7 +1044,7 @@ int rp_close (void) { if (!cando ()) return 0; - RPSendMessagex (RPIPCGM_CLOSE, 0, 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_CLOSE, 0, 0, NULL, 0, &guestinfo, NULL); return 1; } @@ -974,7 +1053,7 @@ HWND rp_getparent (void) LRESULT lr; if (!initialized) return NULL; - RPSendMessagex (RPIPCGM_PARENT, 0, 0, NULL, 0, &guestinfo, &lr); + RPSendMessagex (RP_IPC_TO_HOST_PARENT, 0, 0, NULL, 0, &guestinfo, &lr); return (HWND)lr; } @@ -985,13 +1064,13 @@ static void sendenum (void) TCHAR tmp[MAX_DPATH]; TCHAR *p1, *p2; struct RPInputDeviceDescription desc; - int cnt; + int cnt, max = 3; WIN32GUI_LoadUIString (IDS_KEYJOY, tmp, sizeof tmp / sizeof (TCHAR)); _tcscat (tmp, _T("\n")); p1 = tmp; cnt = 0; - for (;;) { + while (max--) { p2 = _tcschr (p1, '\n'); if (p2 && _tcslen (p2) > 0) { TCHAR tmp2[100]; @@ -1006,7 +1085,7 @@ static void sendenum (void) desc.dwInputDeviceFeatures |= RP_FEATURE_INPUTDEVICE_JOYPAD; if (log_rp) write_log(_T("Enum%d: '%s' '%s'\n"), cnt, desc.szHostInputName, desc.szHostInputID); - RPSendMessagex (RPIPCGM_INPUTDEVICE, 0, 0, &desc, sizeof desc, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_INPUTDEVICE, 0, 0, &desc, sizeof desc, &guestinfo, NULL); cnt++; p1 = p2; } else { @@ -1016,15 +1095,15 @@ static void sendenum (void) memset (&desc, 0, sizeof desc); _tcscpy (desc.szHostInputID, _T("KeyboardCustom")); _tcscpy (desc.szHostInputName, _T("KeyboardCustom")); - desc.dwHostInputType = RP_HOSTINPUT_KEYJOY_CUSTOM; + desc.dwHostInputType = RP_HOSTINPUT_KEYBOARD; desc.dwInputDeviceFeatures = RP_FEATURE_INPUTDEVICE_JOYSTICK | RP_FEATURE_INPUTDEVICE_JOYPAD; - RPSendMessagex (RPIPCGM_INPUTDEVICE, 0, 0, &desc, sizeof desc, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_INPUTDEVICE, 0, 0, &desc, sizeof desc, &guestinfo, NULL); cnt = 0; while ((cnt = rp_input_enum (&desc, cnt)) >= 0) { if (log_rp) write_log(_T("Enum%d: '%s' '%s' (%x/%x)\n"), cnt, desc.szHostInputName, desc.szHostInputID, desc.dwHostInputVendorID, desc.dwHostInputProductID); - RPSendMessagex (RPIPCGM_INPUTDEVICE, 0, 0, &desc, sizeof desc, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_INPUTDEVICE, 0, 0, &desc, sizeof desc, &guestinfo, NULL); } } @@ -1035,7 +1114,7 @@ static void sendfeatures (void) feat = RP_FEATURE_POWERLED | RP_FEATURE_SCREEN1X | RP_FEATURE_FULLSCREEN; feat |= RP_FEATURE_PAUSE | RP_FEATURE_TURBO | RP_FEATURE_VOLUME | RP_FEATURE_SCREENCAPTURE; feat |= RP_FEATURE_STATE | RP_FEATURE_SCANLINES | RP_FEATURE_DEVICEREADWRITE; - feat |= RP_FEATURE_RESIZE_SUBPIXEL | RP_FEATURE_RESIZE_STRETCH; + feat |= RP_FEATURE_SCALING_SUBPIXEL | RP_FEATURE_SCALING_STRETCH; if (!WIN32GFX_IsPicassoScreen ()) feat |= RP_FEATURE_SCREEN2X | RP_FEATURE_SCREEN4X; feat |= RP_FEATURE_INPUTDEVICE_MOUSE; @@ -1044,7 +1123,7 @@ static void sendfeatures (void) feat |= RP_FEATURE_INPUTDEVICE_JOYPAD; feat |= RP_FEATURE_INPUTDEVICE_ANALOGSTICK; feat |= RP_FEATURE_INPUTDEVICE_LIGHTPEN; - RPSendMessagex (RPIPCGM_FEATURES, feat, 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_FEATURES, feat, 0, NULL, 0, &guestinfo, NULL); } static int gethdnum (int n) @@ -1103,9 +1182,9 @@ void rp_fixup_options (struct uae_prefs *p) if (p->floppyslots[i].dfxtype >= 0) floppy_mask |= 1 << i; } - RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_FLOPPY, floppy_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICES, RP_DEVICECATEGORY_FLOPPY, floppy_mask, NULL, 0, &guestinfo, NULL); - RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_INPUTPORT, (1 << maxjports) - 1, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICES, RP_DEVICECATEGORY_INPUTPORT, (1 << maxjports) - 1, NULL, 0, &guestinfo, NULL); rp_input_change (0); rp_input_change (1); rp_input_change (2); @@ -1119,7 +1198,7 @@ void rp_fixup_options (struct uae_prefs *p) if (num >= 0) hd_mask |= 1 << num; } - RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_HD, hd_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICES, RP_DEVICECATEGORY_HD, hd_mask, NULL, 0, &guestinfo, NULL); if (hd_mask) { for (i = 0; i < currprefs.mountitems; i++) { struct uaedev_config_info *uci = &currprefs.mountconfig[i]; @@ -1133,7 +1212,7 @@ void rp_fixup_options (struct uae_prefs *p) if (p->cdslots[i].inuse) cd_mask |= 1 << i; } - RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICES, RP_DEVICECATEGORY_CD, cd_mask, NULL, 0, &guestinfo, NULL); if (cd_mask) { for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { if (p->cdslots[i].inuse) @@ -1155,7 +1234,7 @@ static void rp_device_writeprotect (int dev, int num, bool writeprotected) return; if (rp_version * 256 + rp_revision < 2 * 256 + 3) return; - RPSendMessagex (RPIPCGM_DEVICEREADWRITE, MAKEWORD(dev, num), writeprotected ? RP_DEVICE_READONLY : RP_DEVICE_READWRITE, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICEREADWRITE, MAKEWORD(dev, num), writeprotected ? RP_DEVICE_READONLY : RP_DEVICE_READWRITE, NULL, 0, &guestinfo, NULL); } static void rp_device_change (int dev, int num, int mode, bool readonly, const TCHAR *content) @@ -1172,9 +1251,9 @@ static void rp_device_change (int dev, int num, int mode, bool readonly, const T if (content) _tcscpy (dc.szContent, content); if (log_rp) - write_log (_T("RPIPCGM_DEVICECONTENT cat=%d num=%d type=%d '%s'\n"), + write_log (_T("RP_IPC_TO_HOST_DEVICECONTENT cat=%d num=%d type=%d '%s'\n"), dc.btDeviceCategory, dc.btDeviceNumber, dc.dwInputDevice, dc.szContent); - RPSendMessagex (RPIPCGM_DEVICECONTENT, 0, 0, &dc, sizeof(struct RPDeviceContent), &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICECONTENT, 0, 0, &dc, sizeof(struct RPDeviceContent), &guestinfo, NULL); } void rp_input_change (int num) @@ -1211,7 +1290,7 @@ void rp_input_change (int num) } void rp_disk_image_change (int num, const TCHAR *name, bool writeprotected) { - rp_device_change (RP_DEVICE_FLOPPY, num, 0, writeprotected == false, name); + rp_device_change (RP_DEVICECATEGORY_FLOPPY, num, 0, writeprotected == false, name); rp_device_writeprotect (RP_DEVICECATEGORY_FLOPPY, num, writeprotected); } void rp_harddrive_image_change (int num, bool readonly, const TCHAR *name) @@ -1231,7 +1310,7 @@ void rp_floppy_device_enable (int num, bool enabled) floppy_mask |= 1 << num; else floppy_mask &= ~(1 << num); - RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICECATEGORY_FLOPPY, floppy_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICES, RP_DEVICECATEGORY_FLOPPY, floppy_mask, NULL, 0, &guestinfo, NULL); } void rp_hd_device_enable (int num, bool enabled) @@ -1242,7 +1321,7 @@ void rp_hd_device_enable (int num, bool enabled) hd_mask |= 1 << num; else hd_mask &= ~(1 << num); - RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICECATEGORY_HD, hd_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICES, RP_DEVICECATEGORY_HD, hd_mask, NULL, 0, &guestinfo, NULL); } void rp_cd_device_enable (int num, bool enabled) @@ -1253,7 +1332,7 @@ void rp_cd_device_enable (int num, bool enabled) cd_mask |= 1 << num; else cd_mask &= ~(1 << num); - RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICECATEGORY_CD, cd_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICES, RP_DEVICECATEGORY_CD, cd_mask, NULL, 0, &guestinfo, NULL); } void rp_floppy_track (int floppy, int track) @@ -1264,7 +1343,7 @@ void rp_floppy_track (int floppy, int track) if (oldtrack[floppy] == track) return; oldtrack[floppy] = track; - RPPostMessagex (RPIPCGM_DEVICESEEK, MAKEWORD (RP_DEVICECATEGORY_FLOPPY, floppy), track, &guestinfo); + RPPostMessagex (RP_IPC_TO_HOST_DEVICESEEK, MAKEWORD (RP_DEVICECATEGORY_FLOPPY, floppy), track, &guestinfo); } void rp_update_leds (int led, int onoff, int write) @@ -1283,7 +1362,7 @@ void rp_update_leds (int led, int onoff, int write) if (ledstate == oldled[led]) return; oldled[led] = ledstate; - RPSendMessage (RPIPCGM_POWERLED, ledstate, 0, NULL, 0, &guestinfo, NULL); + RPSendMessage (RP_IPC_TO_HOST_POWERLED, ledstate, 0, NULL, 0, &guestinfo, NULL); break; case 1: case 2: @@ -1294,7 +1373,7 @@ void rp_update_leds (int led, int onoff, int write) if (ledstate == oldled[led]) return; oldled[led] = ledstate; - RPPostMessagex (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_FLOPPY, led - 1), + RPPostMessagex (RP_IPC_TO_HOST_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_FLOPPY, led - 1), MAKELONG ((ledstate & 1) ? -1 : 0, (ledstate & 2) ? RP_DEVICEACTIVITY_WRITE : RP_DEVICEACTIVITY_READ) , &guestinfo); break; } @@ -1314,7 +1393,7 @@ void rp_update_gameport (int port, int mask, int onoff) else gameportmask[port] &= ~mask; if (old != gameportmask[port]) { - RPPostMessagex (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_INPUTPORT, port), + RPPostMessagex (RP_IPC_TO_HOST_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_INPUTPORT, port), gameportmask[port], &guestinfo); } } @@ -1334,7 +1413,7 @@ void rp_hd_activity (int num, int onoff, int write) return; oldleds[num] = state; if (state & 1) { - RPPostMessagex (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_HD, num), + RPPostMessagex (RP_IPC_TO_HOST_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_HD, num), MAKELONG (200, (state & 2) ? RP_DEVICEACTIVITY_WRITE : RP_DEVICEACTIVITY_READ), &guestinfo); } } @@ -1347,10 +1426,10 @@ void rp_cd_activity (int num, int onoff) return; if (onoff && !(cd_mask & (1 << num))) { cd_mask |= 1 << num; - RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICECATEGORY_CD, cd_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_DEVICES, RP_DEVICECATEGORY_CD, cd_mask, NULL, 0, &guestinfo, NULL); } if (onoff) { - RPPostMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_CD, num), + RPPostMessage (RP_IPC_TO_HOST_DEVICEACTIVITY, MAKEWORD (RP_DEVICECATEGORY_CD, num), MAKELONG (200, RP_DEVICEACTIVITY_READ), &guestinfo); } } @@ -1359,7 +1438,7 @@ void rp_update_volume (struct uae_prefs *p) { if (!cando ()) return; - RPSendMessagex (RPIPCGM_VOLUME, (WPARAM)(100 - p->sound_volume), 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_VOLUME, (WPARAM)(100 - p->sound_volume), 0, NULL, 0, &guestinfo, NULL); } void rp_pause (int paused) @@ -1369,7 +1448,7 @@ void rp_pause (int paused) if (isrecursive ()) return; if (currentpausemode != paused) - RPSendMessagex (RPIPCGM_PAUSE, (WPARAM)paused, 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_PAUSE, (WPARAM)paused, 0, NULL, 0, &guestinfo, NULL); currentpausemode = paused; } @@ -1383,7 +1462,7 @@ static void rp_mouse (void) flags |= RP_MOUSECAPTURE_MAGICMOUSE; if (mousecapture) flags |= RP_MOUSECAPTURE_CAPTURED; - RPSendMessagex (RPIPCGM_MOUSECAPTURE, flags, 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_MOUSECAPTURE, flags, 0, NULL, 0, &guestinfo, NULL); } void rp_mouse_capture (int captured) @@ -1402,7 +1481,7 @@ void rp_activate (int active, LPARAM lParam) { if (!cando ()) return; - RPSendMessagex (active ? RPIPCGM_ACTIVATED : RPIPCGM_DEACTIVATED, 0, lParam, NULL, 0, &guestinfo, NULL); + RPSendMessagex (active ? RP_IPC_TO_HOST_ACTIVATED : RP_IPC_TO_HOST_DEACTIVATED, 0, lParam, NULL, 0, &guestinfo, NULL); } void rp_turbo_cpu (int active) @@ -1411,7 +1490,7 @@ void rp_turbo_cpu (int active) return; if (recursive_device) return; - RPSendMessagex (RPIPCGM_TURBO, RP_TURBO_CPU, active ? RP_TURBO_CPU : 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_TURBO, RP_TURBO_CPU, active ? RP_TURBO_CPU : 0, NULL, 0, &guestinfo, NULL); } void rp_turbo_floppy (int active) @@ -1420,7 +1499,7 @@ void rp_turbo_floppy (int active) return; if (recursive_device) return; - RPSendMessagex (RPIPCGM_TURBO, RP_TURBO_FLOPPY, active ? RP_TURBO_FLOPPY : 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_TURBO, RP_TURBO_FLOPPY, active ? RP_TURBO_FLOPPY : 0, NULL, 0, &guestinfo, NULL); } void rp_set_hwnd (HWND hWnd) @@ -1433,14 +1512,14 @@ void rp_set_hwnd (HWND hWnd) get_screenmode (&sm, &currprefs); if (hWnd != NULL) hwndset = 1; - RPSendMessagex (RPIPCGM_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); } void rp_set_enabledisable (int enabled) { if (!cando ()) return; - RPSendMessagex (enabled ? RPIPCGM_ENABLED : RPIPCGM_DISABLED, 0, 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (enabled ? RP_IPC_TO_HOST_ENABLED : RP_IPC_TO_HOST_DISABLED, 0, 0, NULL, 0, &guestinfo, NULL); } void rp_rtg_switch (void) @@ -1476,7 +1555,7 @@ void rp_vsync (void) if (screenmode_request) { struct RPScreenMode sm = { 0 }; get_screenmode (&sm, &currprefs); - RPSendMessagex (RPIPCGM_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); screenmode_request = false; } if (magicmouse_alive () != mousemagic) @@ -1485,7 +1564,7 @@ void rp_vsync (void) return; t = gett (); if (t >= esctime) { - RPSendMessagex (RPIPCGM_ESCAPED, 0, 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RP_IPC_TO_HOST_ESCAPED, 0, 0, NULL, 0, &guestinfo, NULL); ignorerelease = 1; esctime = 0; } diff --git a/od-win32/sounddep/sound.cpp b/od-win32/sounddep/sound.cpp index f0d87cf2..146aca3b 100644 --- a/od-win32/sounddep/sound.cpp +++ b/od-win32/sounddep/sound.cpp @@ -128,8 +128,8 @@ struct sound_dp #define SND_STATUSCNT 10 -#define ADJUST_SIZE 30 -#define EXP 2.1 +#define ADJUST_SIZE 20 +#define EXP 1.9 #define ADJUST_VSSIZE 10 #define EXPVS 1.6 @@ -268,6 +268,34 @@ static void docorrection (struct sound_dp *s, int sndbuf, double sync, int granu } } + +static double sync_sound (double m) +{ + double skipmode; + if (0 && isvsync ()) { + + skipmode = pow (m < 0 ? -m : m, EXPVS) / 9; + if (m < 0) + skipmode = -skipmode; + if (skipmode < -ADJUST_VSSIZE) + skipmode = -ADJUST_VSSIZE; + if (skipmode > ADJUST_VSSIZE) + skipmode = ADJUST_VSSIZE; + + } else if (1) { + + skipmode = pow (m < 0 ? -m : m, EXP) / 2; + if (m < 0) + skipmode = -skipmode; + if (skipmode < -ADJUST_SIZE) + skipmode = -ADJUST_SIZE; + if (skipmode > ADJUST_SIZE) + skipmode = ADJUST_SIZE; + } + + return skipmode; +} + static void clearbuffer_ds (struct sound_data *sd) { void *buffer; @@ -1859,32 +1887,6 @@ int get_offset_sound_device (struct sound_data *sd) return -1; } -static double sync_sound (double m) -{ - double skipmode; - if (isvsync () || 1) { - - skipmode = pow (m < 0 ? -m : m, EXPVS) / 9; - if (m < 0) - skipmode = -skipmode; - if (skipmode < -ADJUST_VSSIZE) - skipmode = -ADJUST_VSSIZE; - if (skipmode > ADJUST_VSSIZE) - skipmode = ADJUST_VSSIZE; - - } else if (1) { - - skipmode = pow (m < 0 ? -m : m, EXP) / 2; - if (m < 0) - skipmode = -skipmode; - if (skipmode < -ADJUST_SIZE) - skipmode = -ADJUST_SIZE; - if (skipmode > ADJUST_SIZE) - skipmode = ADJUST_SIZE; - } - - return skipmode; -} static void finish_sound_buffer_xaudio2 (struct sound_data *sd, uae_u16 *sndbuffer) { @@ -2510,12 +2512,12 @@ int enumerate_sound_devices (void) if (!num_sound_devices) { HMODULE l = NULL; write_log (_T("Enumerating DirectSound devices..\n")); - if (os_vista && (sounddrivermask & SOUNDDRIVER_WASAPI)) - wasapi_enum (sound_devices); if ((1 || force_directsound || !os_vista) && (sounddrivermask & SOUNDDRIVER_DS)) { DirectSoundEnumerate ((LPDSENUMCALLBACK)DSEnumProc, sound_devices); } DirectSoundCaptureEnumerate ((LPDSENUMCALLBACK)DSEnumProc, record_devices); + if (os_vista && (sounddrivermask & SOUNDDRIVER_WASAPI)) + wasapi_enum (sound_devices); if (sounddrivermask & SOUNDDRIVE_XAUDIO2) xaudioenumerate (sound_devices); if (sounddrivermask & SOUNDDRIVER_OPENAL) { diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index fc2ef579..96cfefbf 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -99,7 +99,7 @@ int log_scsi; int log_net; int log_vsync; int uaelib_debug; -int pissoff_value = 25000 * CYCLE_UNIT; +int pissoff_value = 8000 * CYCLE_UNIT; unsigned int fpucontrol; int extraframewait = 0; diff --git a/od-win32/win32.h b/od-win32/win32.h index 59ed8110..3a591049 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,8 +19,8 @@ #define LANG_DLL 1 //#define WINUAEBETA _T("") -#define WINUAEBETA _T("Beta 7") -#define WINUAEDATE MAKEBD(2012, 4, 18) +#define WINUAEBETA _T("Beta 8") +#define WINUAEDATE MAKEBD(2012, 4, 21) #define WINUAEEXTRA _T("") //#define WINUAEEXTRA _T("AmiKit Preview") #define WINUAEREV _T("") diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index b0312668..d14d92a8 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -11822,7 +11822,7 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw } //write_log (_T("%d %d %d %s\n"), input_selected_device, input_selected_widget, evtnum, name); - inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, evtnum, inputmap_port); + inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, evtnum, 0, inputmap_port); InitializeListView (hDlg); inputmap_remap_counter += cntadd; ListView_EnsureVisible (h, inputmap_remap_counter, FALSE); diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 38ab1204..89c91cba 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -2,6 +2,17 @@ - restore only single input target to default. - hdd from command line +Beta 8: + +- 68EC020/68020 state files didn't load properly if current CPU config didn't match. +- Adjusted JIT timing a bit, possible fix for slowdowns on some systems. +- Made sound sync a bit more aggressive. (2.4.0 relaxed it a bit too much, I think) +- D3D crash fixed (b7) +- CIA related rare statefile CPU TRACE error fixed. +- Crash fixed when CDFS CD drives enabled without any harddrives. +- Disable USB HID RAWINPUT (Fallback to Direct Input) if "blacklisted" devices found, added + RM-203 USB adapter to list because it requires calibration which WinUAE can't support. + Beta 7: - DirectDraw full-window mode on non-primary monitor was blank.