]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
RP update.
authorToni Wilen <twilen@winuae.net>
Tue, 10 Jul 2018 06:59:36 +0000 (09:59 +0300)
committerToni Wilen <twilen@winuae.net>
Tue, 10 Jul 2018 06:59:36 +0000 (09:59 +0300)
od-win32/cloanto/RetroPlatformIPC.h
od-win32/dinput.cpp
od-win32/rp.cpp
od-win32/rp.h

index e849a66a83c9e34e49f1316c44f7b44886efc4b3..efa04874e7827f6f2a4b83498287d10584b8b578 100644 (file)
@@ -9,7 +9,7 @@
          : Software Foundation.
  Authors : os, m
  Created : 2007-08-27 13:55:49
- Updated : 2017-09-10 12:13:00
+ Updated : 2018-07-08 10:54:00
  Comment : RetroPlatform Player interprocess communication include file
  *****************************************************************************/
 
@@ -18,9 +18,9 @@
 
 #include <windows.h>
 
-#define RETROPLATFORM_API_VER       "7.2"
+#define RETROPLATFORM_API_VER       "7.3"
 #define RETROPLATFORM_API_VER_MAJOR  7
-#define RETROPLATFORM_API_VER_MINOR  2
+#define RETROPLATFORM_API_VER_MINOR  3
 
 #define RPIPC_HostWndClass   "RetroPlatformHost%s"
 #define RPIPC_GuestWndClass  "RetroPlatformGuest%d"
@@ -62,6 +62,8 @@
 #define RP_IPC_TO_HOST_PRIVATE_TYPECLIPDONE (WM_APP + 32) // introduced in RetroPlatform API 7.2
 #define RP_IPC_TO_HOST_PRIVATE_KEYEVENT     (WM_APP + 33) // introduced in RetroPlatform API 7.2
 #define RP_IPC_TO_HOST_PRIVATE_GUESTEVENT   (WM_APP + 34) // introduced in RetroPlatform API 7.2
+#define RP_IPC_TO_HOST_PRIVATE_KEYREMINDER  (WM_APP + 35) // introduced in RetroPlatform API 7.2
+#define RP_IPC_TO_HOST_RAWINPUT_EVENT       (WM_APP + 36) // introduced in RetroPlatform API 7.3
 
 // ****************************************************************************
 //  Host-to-Guest Messages
@@ -92,6 +94,7 @@
 #define        RP_IPC_TO_GUEST_PRIVATE_CANESCAPE    (WM_APP + 226) // introduced in RetroPlatform API 7.2
 #define        RP_IPC_TO_GUEST_PRIVATE_LOGGING      (WM_APP + 227) // introduced in RetroPlatform API 7.2
 #define        RP_IPC_TO_GUEST_PRIVATE_INPUTDEVICES (WM_APP + 228) // introduced in RetroPlatform API 7.2
+#define RP_IPC_TO_GUEST_PRIVATE_KEYREMINDER  (WM_APP + 229) // introduced in RetroPlatform API 7.2
 
 // ****************************************************************************
 //  Message Data Structures and Defines
 #define RP_FEATURE_MEMORY_BASIC                    0x02000000 // Memory I/O basic features: Read, Write
 #define RP_FEATURE_MEMORY_ADVANCED                 0x04000000 // Memory I/O advanced features: Watch, Find, Alert, Freeze, Lock, Unlock, Off (must set both flags if full set is supported!)
 #define RP_FEATURE_SCREENCAPTURE                       0x08000000 // new screen capture functionality is available (see RP_IPC_TO_GUEST_SCREENCAPTURE message)
+#define RP_FEATURE_RAWINPUT_EVENT                      0x10000000 // RawInput mouse buttons events are forwarded via RP_IPC_TO_HOST_RAWINPUT_EVENT messages
 
 typedef struct RPScreenMode
 {
index 078ce625b1e01aac81e67d12aa12a9e42e3233d2..03e20a67f4806f9ab1fdd2829cc3d7aa354fab54 100644 (file)
@@ -2106,7 +2106,7 @@ static void initialize_windowsmouse (void)
 
 static uae_u8 rawkeystate[256];
 static int rawprevkey;
-static void handle_rawinput_2 (RAWINPUT *raw)
+static void handle_rawinput_2 (RAWINPUT *raw, LPARAM lParam)
 {
        int i, num;
        struct didata *did;
@@ -2156,12 +2156,20 @@ static void handle_rawinput_2 (RAWINPUT *raw)
                if (num == num_mouse)
                        return;
 
+               USHORT usButtonFlags = rm->usButtonFlags;
+
+#ifdef RETROPLATFORM
+               if (isfocus() > 0 && usButtonFlags) {
+                       usButtonFlags = rp_rawbuttons(lParam, usButtonFlags);
+               }
+#endif
+
                if (isfocus () > 0 || istest) {
                        static int lastx[MAX_INPUT_DEVICES], lasty[MAX_INPUT_DEVICES];
                        static int lastmbr[MAX_INPUT_DEVICES];
                        for (i = 0; i < (5 > did->buttons ? did->buttons : 5); i++) {
-                               if (rm->usButtonFlags & (3 << (i * 2))) {
-                                       int state = (rm->usButtonFlags & (1 << (i * 2))) ? 1 : 0;
+                               if (usButtonFlags & (3 << (i * 2))) {
+                                       int state = (usButtonFlags & (1 << (i * 2))) ? 1 : 0;
                                        if (!istest && i == 2 && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON))
                                                continue;
                                        setmousebuttonstate (num, i, state);
@@ -2215,7 +2223,7 @@ static void handle_rawinput_2 (RAWINPUT *raw)
                        }
                }
                if (isfocus () && !istest) {
-                       if (did->buttons >= 3 && (rm->usButtonFlags & RI_MOUSE_MIDDLE_BUTTON_DOWN)) {
+                       if (did->buttons >= 3 && (usButtonFlags & RI_MOUSE_MIDDLE_BUTTON_DOWN)) {
                                if (currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) {
                                        if ((isfullscreen() < 0 && currprefs.win32_minimize_inactive) || isfullscreen() > 0)
                                                minimizewindow(0);
@@ -2720,7 +2728,7 @@ void handle_rawinput (LPARAM lParam)
                        if (GetRawInputData ((HRAWINPUT)lParam, RID_INPUT, lpb, &dwSize, sizeof (RAWINPUTHEADER)) == dwSize) {
                                raw = (RAWINPUT*)lpb;
                                if (!isguiactive() || (inputdevice_istest() && isguiactive())) {
-                                       handle_rawinput_2 (raw);
+                                       handle_rawinput_2 (raw, lParam);
                                }
                                DefRawInputProc (&raw, 1, sizeof (RAWINPUTHEADER));
                        } else {
index b93759ad2b041652c7853e5a80be013e804bb523..fe8b6b33abc9661da084c2693f278fee7e720b3a 100644 (file)
@@ -1557,6 +1557,7 @@ static void sendfeatures (void)
        feat |= RP_FEATURE_INPUTDEVICE_JOYPAD;
        feat |= RP_FEATURE_INPUTDEVICE_ANALOGSTICK;
        feat |= RP_FEATURE_INPUTDEVICE_LIGHTPEN;
+       feat |= RP_FEATURE_RAWINPUT_EVENT;
        write_log (_T("RP_IPC_TO_HOST_FEATURES=%x %d\n"), feat, WIN32GFX_IsPicassoScreen(mon));
        RPSendMessagex (RP_IPC_TO_HOST_FEATURES, feat, 0, NULL, 0, &guestinfo, NULL);
 }
@@ -2098,6 +2099,16 @@ end:
        return 0;
 }
 
+USHORT rp_rawbuttons(LPARAM lParam, USHORT usButtonFlags)
+{
+       LRESULT lr;
+       if (!initialized)
+               return usButtonFlags;
+       if (RPSendMessage(RP_IPC_TO_HOST_RAWINPUT_EVENT, 0, lParam, NULL, 0, &guestinfo, &lr))
+               usButtonFlags = (USHORT)lr;
+       return usButtonFlags;
+}
+
 int rp_isactive (void)
 {
        return initialized;
index 9bdbc6d60c0373892aed67df6e45b00a4d0abda5..58aab764e95a21d1a694b3f923ecee797583e0bc 100644 (file)
@@ -19,6 +19,7 @@ extern HWND rp_getparent (void);
 extern void rp_rtg_switch (void);
 extern void rp_screenmode_changed (void);
 extern void rp_keymap(TrapContext*, uaecptr, uae_u32);
+extern USHORT rp_rawbuttons(LPARAM lParam, USHORT usButtonFlags);
 
 extern TCHAR *rp_param;
 extern int rp_rpescapekey;