Pagina 1 di 1

[Wine] Come faccio ad implementare questa patch?

Inviato: venerdì 19 giugno 2009, 17:22
da Tetsuro
http://bugs.winehq.org/attachment.cgi?i ... ction=edit

http://bugs.winehq.org/show_bug.cgi?id=6971

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 941206c..efc9d2d 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -580,7 +580,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
    This->acquired = 1;
    if (res == DI_OK)
    {
-        This->queue_head = This->queue_tail = This->overflow = 0;
+        //This->queue_head = This->queue_tail = This->overflow = 0;//JoeFix do not reset queue on acquire
        check_dinput_hooks(iface);
    }
    LeaveCriticalSection(&This->crit);
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index 7b95be3..19e94a9 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -19,6 +19,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */

+
+
+
#include "config.h"
#include "wine/port.h"

@@ -48,7 +51,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);

static const IDirectInputDevice8AVtbl SysMouseAvt;
static const IDirectInputDevice8WVtbl SysMouseWvt;
+BOOL m_forceWarp=FALSE;

+POINT m_joeCursorPlacement;

typedef struct SysMouseImpl SysMouseImpl;

typedef enum
@@ -78,7 +84,7 @@ struct SysMouseImpl
    WARP_MOUSE                      warp_override;
};

-static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam );
+static void dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam );

const GUID DInput_Wine_Mouse_GUID = { /* 9e573ed8-7734-11d2-8d4a-23903fb6bdf7 */
    0x9e573ed8, 0x7734, 0x11d2, {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
@@ -186,7 +192,7 @@ static SysMouseImpl *alloc_device(REFGUID rguid, const void *mvt, IDirectInputIm
    unsigned i;
    char buffer[20];
    HKEY hkey, appkey;
-
+   
    newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl));
    if (!newDevice) return NULL;
    newDevice->base.lpVtbl = mvt;
@@ -230,6 +236,7 @@ failed:
    if (df) HeapFree(GetProcessHeap(), 0, df->rgodf);
    HeapFree(GetProcessHeap(), 0, df);
    HeapFree(GetProcessHeap(), 0, newDevice);
+   
    return NULL;
}

@@ -265,7 +272,7 @@ static HRESULT mousedev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid,
    *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysMouseWvt, dinput);
    TRACE("Creating a Mouse device (%p)\n", *pdev);
            if (!*pdev) return DIERR_OUTOFMEMORY;
-     return DI_OK;
+                        return DI_OK;
} else
    return DIERR_NOINTERFACE;
    }
@@ -286,25 +293,31 @@ const struct dinput_device mouse_device = {
  */

/* low-level mouse hook */
-static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
+static void dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
{
    MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
    SysMouseImpl* This = (SysMouseImpl*) iface;
    DWORD dwCoop;
-    int wdata = 0, inst_id = -1, ret;
+    POINT pt, pt1;
+    RECT rect;
+    int mouseForceOffset=4;
+     

-    TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
+    int wdata = 0, inst_id = -1;
+    //TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);

    EnterCriticalSection(&This->base.crit);
    dwCoop = This->base.dwCoopLevel;
-    ret = dwCoop & DISCL_EXCLUSIVE;
-
+           
    switch(wparam) {
        case WM_MOUSEMOVE:
        {
-            POINT pt, pt1;
+            POINT ptTarget;

            GetCursorPos(&pt);
+            ptTarget=pt;
+           
+           
            This->m_state.lX += pt.x = hook->pt.x - pt.x;
            This->m_state.lY += pt.y = hook->pt.y - pt.y;

@@ -315,24 +328,65 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
            } else
                pt1 = pt;

+            //FIXME("MouseMove Pt.x%d,pt.y%d\n",pt.x,pt.y);
+            //FIXME("MouseMove Pt1.x%d,pt1.y%d\n",pt1.x,pt1.y);
+
            if (pt.x)
            {
                inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS;
                wdata = pt1.x;
            }
+           
            if (pt.y)
            {
                /* Already have X, need to queue it */
-                if (inst_id != -1)
+                if (inst_id != -1) {
                    queue_event((LPDIRECTINPUTDEVICE8A)This, id_to_offset(&This->base.data_format, inst_id),
                                wdata, GetCurrentTime(), This->base.dinput->evsequence);
+                    //FIXME("EVENT Queued\n");
+                }
                inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS;
                wdata = pt1.y;
            }
-
+            if (pt.x) {
+              if (pt1.x) {
+                  m_joeCursorPlacement.x=pt1.x;
+              }
+            }
+            if (pt.y) {
+              if (pt1.y) {
+                  m_joeCursorPlacement.y=pt1.y;
+              }
+            }
+            if (m_forceWarp) {
+                /* Get the window dimension and find the center */
+              //GetWindowRect(This->base.win, &rect);
+              //This->win_centerX = (rect.right  - rect.left) / 2;
+              //This->win_centerY = (rect.bottom - rect.top ) / 2; 
+              //This->mapped_center.x = This->win_centerX;
+              //This->mapped_center.y = This->win_centerY;
+              //MapWindowPoints(This->base.win, HWND_DESKTOP, &This->mapped_center, 1);
+              if (This->need_warp) {
+                  This->need_warp=FALSE;
+              } else {
+              This->need_warp = (hook->pt.xpt.ypt.x>=((2 * This->win_centerX)-mouseForceOffset) ||
+                                  hook->pt.y>=((2 * This->win_centerY)-mouseForceOffset) );
+              }                 
+            }   
+            else {
            This->need_warp = This->warp_override != WARP_DISABLE &&
                              (pt.x || pt.y) &&
                              (dwCoop & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON);
+            }
+            //if (!pt.x || !pt.y) {
+            //  This->need_warp=FALSE;
+            //}
+           
+            if ((pt.x || pt.y)) {
+              //SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+            }
            break;
        }
        case WM_MOUSEWHEEL:
@@ -371,20 +425,24 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
            inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_BUTTONS_INSTANCE + 2 + HIWORD(hook->mouseData)) | DIDFT_PSHBUTTON;
            This->m_state.rgbButtons[2 + HIWORD(hook->mouseData)] = wdata = 0x00;
            break;
-        default:
-            ret = 0;
    }


    if (inst_id != -1)
    {
        _dump_mouse_state(&This->m_state);
+     
        queue_event((LPDIRECTINPUTDEVICE8A)This, id_to_offset(&This->base.data_format, inst_id),
                    wdata, GetCurrentTime(), This->base.dinput->evsequence++);
-    }
+        //FIXME("EVENT Queued\n");
+    }

+   
+   
    LeaveCriticalSection(&This->base.crit);
-    return ret;
+   
+   
+   
}

static BOOL dinput_window_check(SysMouseImpl* This) {
@@ -410,13 +468,21 @@ static BOOL dinput_window_check(SysMouseImpl* This) {
/******************************************************************************
  *    Acquire : gets exclusive control of the mouse
  */
+
+static HRESULT WINAPI SysMouseAImpl_AcquireJoe(LPDIRECTINPUTDEVICE8A iface)
+{
+      m_forceWarp=(getenv("WINEFORCEMOUSEWARP") == NULL) ? FALSE : TRUE;
+      return DI_OK;
+}
+
static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
{
    SysMouseImpl *This = (SysMouseImpl *)iface;
    RECT  rect;
    POINT point;
    HRESULT res;
-   
+    m_forceWarp=(getenv("WINEFORCEMOUSEWARP") == NULL) ? FALSE : TRUE;
+
    TRACE("(this=%p)\n",This);

    if ((res = IDirectInputDevice2AImpl_Acquire(iface)) != DI_OK) return res;
@@ -432,6 +498,8 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
      This->m_state.lY = 0;
      This->org_coords = point;
    }
+    //m_joeCursorPlacement=point;
+   
    This->m_state.lZ = 0;
    This->m_state.rgbButtons[0] = GetKeyState(VK_LBUTTON) & 0x80;
    This->m_state.rgbButtons[1] = GetKeyState(VK_RBUTTON) & 0x80;
@@ -460,20 +528,28 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
    GetWindowRect(This->base.win, &rect);
    This->win_centerX = (rect.right  - rect.left) / 2;
    This->win_centerY = (rect.bottom - rect.top ) / 2;
-
+   
    /* Warp the mouse to the center of the window */
-    if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
+   
+    if ((This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON) 
+     
+      )
    {
      This->mapped_center.x = This->win_centerX;
      This->mapped_center.y = This->win_centerY;
      MapWindowPoints(This->base.win, HWND_DESKTOP, &This->mapped_center, 1);
      TRACE("Warping mouse to %d - %d\n", This->mapped_center.x, This->mapped_center.y);
+      This->need_warp = FALSE;
      SetCursorPos( This->mapped_center.x, This->mapped_center.y );
+      GetCursorPos( &m_joeCursorPlacement);
      This->last_warped = GetCurrentTime();
-
-      This->need_warp = FALSE;
    }
-
+    else {
+   
+        GetCursorPos(&m_joeCursorPlacement);
+        SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+    }
+   
    return DI_OK;
}

@@ -482,9 +558,14 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
  */
static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
{
+
+  return DI_OK; 
+}
+
+static HRESULT WINAPI SysMouseAImpl_Unacquire25(LPDIRECTINPUTDEVICE8A iface)
+{ 
    SysMouseImpl *This = (SysMouseImpl *)iface;
    HRESULT res;
-   
    TRACE("(this=%p)\n",This);

    if ((res = IDirectInputDevice2AImpl_Unacquire(iface)) != DI_OK) return res;
@@ -496,13 +577,21 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
    }

    /* And put the mouse cursor back where it was at acquire time */
-    if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
-    {
-      TRACE(" warping mouse back to (%d , %d)\n", This->org_coords.x, This->org_coords.y);
-      SetCursorPos(This->org_coords.x, This->org_coords.y);
+    if ((This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON) 
+       
+      )
+  {
+      //TRACE(" warping mouse back to (%d , %d)\n", This->org_coords.x, This->org_coords.y);
+      //SetCursorPos(This->org_coords.x, This->org_coords.y);
+      GetCursorPos(&m_joeCursorPlacement);
+    }
+    else {
+     
+      SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+      GetCursorPos(&m_joeCursorPlacement);
    }

-    return DI_OK;
+    return DI_OK;
}

/******************************************************************************
@@ -540,11 +629,20 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
        if(!dinput_window_check(This))
            return DIERR_GENERIC;
TRACE("Warping mouse to %d - %d\n", This->mapped_center.x, This->mapped_center.y);
- SetCursorPos( This->mapped_center.x, This->mapped_center.y );
+
+        SetCursorPos( This->mapped_center.x, This->mapped_center.y );
+        GetCursorPos(&m_joeCursorPlacement);
+       
        This->last_warped = GetCurrentTime();

        This->need_warp = FALSE;
    }
+    else {
+        //FIXME("JoeFix SetcursorPos(GetCursorPos) in DxInput.mouse.GetDevicestate\n");
+        GetCursorPos(&m_joeCursorPlacement);
+        SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+
+    }
   
    return DI_OK;
}
@@ -562,16 +660,29 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
    if (FAILED(res)) return res;

    /* Check if we need to do a mouse warping */
-    if (This->need_warp && (GetCurrentTime() - This->last_warped > 10))
-    {
+    if ((This->need_warp) && (GetCurrentTime() - This->last_warped > 10))
+    { 
        if(!dinput_window_check(This))
            return DIERR_GENERIC;
TRACE("Warping mouse to %d - %d\n", This->mapped_center.x, This->mapped_center.y);
+       
SetCursorPos( This->mapped_center.x, This->mapped_center.y );
+        GetCursorPos(&m_joeCursorPlacement);
+       
        This->last_warped = GetCurrentTime();
-
+       
        This->need_warp = FALSE;
    }
+    else {
+        GetCursorPos(&m_joeCursorPlacement);
+        SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+    }
+    //if (m_forceWarp && (!This->need_warp)) {
+    //     
+    //      SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+    //}
+   
+   
    return res;
}

@@ -607,8 +718,10 @@ static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
    /* Querying the range of either the X or the Y axis.  As I do
      not know the range, do as if the range were
      unrestricted...*/
-     pr->lMin = DIPROPRANGE_NOMIN;
-     pr->lMax = DIPROPRANGE_NOMAX;
+     //pr->lMin = DIPROPRANGE_NOMIN;
+     //pr->lMax = DIPROPRANGE_NOMAX;
+                    pr->lMin = 0; //JoeFix MAX RANGE
+     pr->lMax = 1280;
}

break;

Re: [Wine] Come faccio ad implementare questa patch?

Inviato: martedì 23 giugno 2009, 16:15
da xela92
Alessandro Pedarra ha scritto: http://bugs.winehq.org/attachment.cgi?i ... ction=edit

http://bugs.winehq.org/show_bug.cgi?id=6971

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 941206c..efc9d2d 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -580,7 +580,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
     This->acquired = 1;
     if (res == DI_OK)
     {
-        This->queue_head = This->queue_tail = This->overflow = 0;
+        //This->queue_head = This->queue_tail = This->overflow = 0;//JoeFix do not reset queue on acquire
         check_dinput_hooks(iface);
     }
     LeaveCriticalSection(&This->crit);
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index 7b95be3..19e94a9 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -19,6 +19,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */

+
+
+
#include "config.h"
#include "wine/port.h"

@@ -48,7 +51,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);

static const IDirectInputDevice8AVtbl SysMouseAvt;
static const IDirectInputDevice8WVtbl SysMouseWvt;
+BOOL m_forceWarp=FALSE;

+POINT m_joeCursorPlacement;
+   
typedef struct SysMouseImpl SysMouseImpl;

typedef enum
@@ -78,7 +84,7 @@ struct SysMouseImpl
     WARP_MOUSE                      warp_override;
};

-static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam );
+static void dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam );

const GUID DInput_Wine_Mouse_GUID = { /* 9e573ed8-7734-11d2-8d4a-23903fb6bdf7 */
     0x9e573ed8, 0x7734, 0x11d2, {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
@@ -186,7 +192,7 @@ static SysMouseImpl *alloc_device(REFGUID rguid, const void *mvt, IDirectInputIm
     unsigned i;
     char buffer[20];
     HKEY hkey, appkey;
-
+     
     newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl));
     if (!newDevice) return NULL;
     newDevice->base.lpVtbl = mvt;
@@ -230,6 +236,7 @@ failed:
     if (df) HeapFree(GetProcessHeap(), 0, df->rgodf);
     HeapFree(GetProcessHeap(), 0, df);
     HeapFree(GetProcessHeap(), 0, newDevice);
+   
     return NULL;
}

@@ -265,7 +272,7 @@ static HRESULT mousedev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid,
    *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysMouseWvt, dinput);
    TRACE("Creating a Mouse device (%p)\n", *pdev);
             if (!*pdev) return DIERR_OUTOFMEMORY;
-     return DI_OK;
+                        return DI_OK;
} else
    return DIERR_NOINTERFACE;
     }
@@ -286,25 +293,31 @@ const struct dinput_device mouse_device = {
  */

/* low-level mouse hook */
-static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
+static void dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
{
     MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
     SysMouseImpl* This = (SysMouseImpl*) iface;
     DWORD dwCoop;
-    int wdata = 0, inst_id = -1, ret;
+    POINT pt, pt1;
+    RECT rect;
+    int mouseForceOffset=4;
+     

-    TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
+    int wdata = 0, inst_id = -1;
+    //TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);

     EnterCriticalSection(&This->base.crit);
     dwCoop = This->base.dwCoopLevel;
-    ret = dwCoop & DISCL_EXCLUSIVE;
-
+           
     switch(wparam) {
         case WM_MOUSEMOVE:
         {
-            POINT pt, pt1;
+            POINT ptTarget;

             GetCursorPos(&pt);
+            ptTarget=pt;
+           
+           
             This->m_state.lX += pt.x = hook->pt.x - pt.x;
             This->m_state.lY += pt.y = hook->pt.y - pt.y;

@@ -315,24 +328,65 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
             } else
                 pt1 = pt;

+            //FIXME("MouseMove Pt.x%d,pt.y%d\n",pt.x,pt.y);
+            //FIXME("MouseMove Pt1.x%d,pt1.y%d\n",pt1.x,pt1.y);
+
             if (pt.x)
             {
                 inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS;
                 wdata = pt1.x;
             }
+           
             if (pt.y)
             {
                 /* Already have X, need to queue it */
-                if (inst_id != -1)
+                if (inst_id != -1) {
                     queue_event((LPDIRECTINPUTDEVICE8A)This, id_to_offset(&This->base.data_format, inst_id),
                                 wdata, GetCurrentTime(), This->base.dinput->evsequence);
+                    //FIXME("EVENT Queued\n");
+                }
                 inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS;
                 wdata = pt1.y;
             }
-
+            if (pt.x) {
+               if (pt1.x) {
+                   m_joeCursorPlacement.x=pt1.x;
+               }
+            }
+            if (pt.y) {
+               if (pt1.y) {
+                   m_joeCursorPlacement.y=pt1.y;
+               }
+            }
+            if (m_forceWarp) {
+                /* Get the window dimension and find the center */
+               //GetWindowRect(This->base.win, &rect);
+               //This->win_centerX = (rect.right  - rect.left) / 2;
+               //This->win_centerY = (rect.bottom - rect.top ) / 2; 
+               //This->mapped_center.x = This->win_centerX;
+               //This->mapped_center.y = This->win_centerY;
+               //MapWindowPoints(This->base.win, HWND_DESKTOP, &This->mapped_center, 1);
+               if (This->need_warp) {
+                   This->need_warp=FALSE;
+               } else {
+               This->need_warp = (hook->pt.xpt.ypt.x>=((2 * This->win_centerX)-mouseForceOffset) ||
+                                  hook->pt.y>=((2 * This->win_centerY)-mouseForceOffset) );
+               }                   
+            }   
+            else {
             This->need_warp = This->warp_override != WARP_DISABLE &&
                               (pt.x || pt.y) &&
                               (dwCoop & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON);
+            }
+            //if (!pt.x || !pt.y) {
+            //   This->need_warp=FALSE;
+            //}
+             
+            if ((pt.x || pt.y)) {
+              //SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+            }
             break;
         }
         case WM_MOUSEWHEEL:
@@ -371,20 +425,24 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
             inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_BUTTONS_INSTANCE + 2 + HIWORD(hook->mouseData)) | DIDFT_PSHBUTTON;
             This->m_state.rgbButtons[2 + HIWORD(hook->mouseData)] = wdata = 0x00;
             break;
-        default:
-            ret = 0;
     }


     if (inst_id != -1)
     {
         _dump_mouse_state(&This->m_state);
+       
         queue_event((LPDIRECTINPUTDEVICE8A)This, id_to_offset(&This->base.data_format, inst_id),
                     wdata, GetCurrentTime(), This->base.dinput->evsequence++);
-    }
+        //FIXME("EVENT Queued\n");
+    }

+   
+     
     LeaveCriticalSection(&This->base.crit);
-    return ret;
+   
+   
+   
}

static BOOL dinput_window_check(SysMouseImpl* This) {
@@ -410,13 +468,21 @@ static BOOL dinput_window_check(SysMouseImpl* This) {
/******************************************************************************
   *     Acquire : gets exclusive control of the mouse
   */
+
+static HRESULT WINAPI SysMouseAImpl_AcquireJoe(LPDIRECTINPUTDEVICE8A iface)
+{
+      m_forceWarp=(getenv("WINEFORCEMOUSEWARP") == NULL) ? FALSE : TRUE;
+      return DI_OK;
+}
+
static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
{
     SysMouseImpl *This = (SysMouseImpl *)iface;
     RECT  rect;
     POINT point;
     HRESULT res;
-   
+    m_forceWarp=(getenv("WINEFORCEMOUSEWARP") == NULL) ? FALSE : TRUE;
+
     TRACE("(this=%p)\n",This);

     if ((res = IDirectInputDevice2AImpl_Acquire(iface)) != DI_OK) return res;
@@ -432,6 +498,8 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
       This->m_state.lY = 0;
       This->org_coords = point;
     }
+    //m_joeCursorPlacement=point;
+   
     This->m_state.lZ = 0;
     This->m_state.rgbButtons[0] = GetKeyState(VK_LBUTTON) & 0x80;
     This->m_state.rgbButtons[1] = GetKeyState(VK_RBUTTON) & 0x80;
@@ -460,20 +528,28 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
     GetWindowRect(This->base.win, &rect);
     This->win_centerX = (rect.right  - rect.left) / 2;
     This->win_centerY = (rect.bottom - rect.top ) / 2;
-
+   
     /* Warp the mouse to the center of the window */
-    if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
+   
+    if ((This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON) 
+       
+       )
     {
       This->mapped_center.x = This->win_centerX;
       This->mapped_center.y = This->win_centerY;
       MapWindowPoints(This->base.win, HWND_DESKTOP, &This->mapped_center, 1);
       TRACE("Warping mouse to %d - %d\n", This->mapped_center.x, This->mapped_center.y);
+      This->need_warp = FALSE;
       SetCursorPos( This->mapped_center.x, This->mapped_center.y );
+      GetCursorPos( &m_joeCursorPlacement);
       This->last_warped = GetCurrentTime();
-
-      This->need_warp = FALSE;
     }
-
+    else {
+   
+         GetCursorPos(&m_joeCursorPlacement);
+         SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+    }
+   
     return DI_OK;
}

@@ -482,9 +558,14 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
   */
static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
{
+
+  return DI_OK;   
+}
+
+static HRESULT WINAPI SysMouseAImpl_Unacquire25(LPDIRECTINPUTDEVICE8A iface)
+{   
     SysMouseImpl *This = (SysMouseImpl *)iface;
     HRESULT res;
-   
     TRACE("(this=%p)\n",This);

     if ((res = IDirectInputDevice2AImpl_Unacquire(iface)) != DI_OK) return res;
@@ -496,13 +577,21 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
     }

     /* And put the mouse cursor back where it was at acquire time */
-    if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
-    {
-      TRACE(" warping mouse back to (%d , %d)\n", This->org_coords.x, This->org_coords.y);
-      SetCursorPos(This->org_coords.x, This->org_coords.y);
+    if ((This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON) 
+         
+       )
+   {
+      //TRACE(" warping mouse back to (%d , %d)\n", This->org_coords.x, This->org_coords.y);
+      //SetCursorPos(This->org_coords.x, This->org_coords.y);
+      GetCursorPos(&m_joeCursorPlacement);
+    }
+    else {
+     
+      SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+      GetCursorPos(&m_joeCursorPlacement);
     }

-    return DI_OK;
+     return DI_OK;
}

/******************************************************************************
@@ -540,11 +629,20 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
         if(!dinput_window_check(This))
             return DIERR_GENERIC;
TRACE("Warping mouse to %d - %d\n", This->mapped_center.x, This->mapped_center.y);
- SetCursorPos( This->mapped_center.x, This->mapped_center.y );
+
+        SetCursorPos( This->mapped_center.x, This->mapped_center.y );
+        GetCursorPos(&m_joeCursorPlacement);
+       
         This->last_warped = GetCurrentTime();

         This->need_warp = FALSE;
     }
+    else {
+         //FIXME("JoeFix SetcursorPos(GetCursorPos) in DxInput.mouse.GetDevicestate\n");
+         GetCursorPos(&m_joeCursorPlacement);
+         SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+
+    }
     
     return DI_OK;
}
@@ -562,16 +660,29 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
     if (FAILED(res)) return res;

     /* Check if we need to do a mouse warping */
-    if (This->need_warp && (GetCurrentTime() - This->last_warped > 10))
-    {
+    if ((This->need_warp) && (GetCurrentTime() - This->last_warped > 10))
+    {   
         if(!dinput_window_check(This))
             return DIERR_GENERIC;
TRACE("Warping mouse to %d - %d\n", This->mapped_center.x, This->mapped_center.y);
+         
SetCursorPos( This->mapped_center.x, This->mapped_center.y );
+        GetCursorPos(&m_joeCursorPlacement);
+       
         This->last_warped = GetCurrentTime();
-
+       
         This->need_warp = FALSE;
     }
+    else {
+         GetCursorPos(&m_joeCursorPlacement);
+         SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+    }
+    //if (m_forceWarp && (!This->need_warp)) {
+    //     
+    //      SetCursorPos(m_joeCursorPlacement.x,m_joeCursorPlacement.y);
+    //}
+   
+   
     return res;
}

@@ -607,8 +718,10 @@ static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
    /* Querying the range of either the X or the Y axis.  As I do
       not know the range, do as if the range were
       unrestricted...*/
-     pr->lMin = DIPROPRANGE_NOMIN;
-     pr->lMax = DIPROPRANGE_NOMAX;
+     //pr->lMin = DIPROPRANGE_NOMIN;
+     //pr->lMax = DIPROPRANGE_NOMAX;
+                    pr->lMin = 0; //JoeFix MAX RANGE
+     pr->lMax = 1280;
}

break;


Da quel che so devi scaricarti i sorgenti di wine e applicarla usando patch. Non ne ho mai avuto bisogno, in effetti, però tu dai man patch e vedi un po' se devi passargli qualche parametro particolare...
Ciao!

Re: [Wine] Come faccio ad implementare questa patch?

Inviato: mercoledì 24 giugno 2009, 15:09
da Tetsuro
C'avevo provato ma era un casino assurdo (mi avevano spiegato passo-passo ma qualcosa finiva sempre male), sarebbe stato carino se qualcuno (degli sviluppatori) avesse fornito un pacchetto .deb. Aspetterò la versione ufficiale (sai che palle!  (bad) ).

Re: [Wine] Come faccio ad implementare questa patch?

Inviato: venerdì 26 giugno 2009, 22:07
da xela92
Alessandro Pedarra ha scritto: C'avevo provato ma era un casino assurdo (mi avevano spiegato passo-passo ma qualcosa finiva sempre male), sarebbe stato carino se qualcuno (degli sviluppatori) avesse fornito un pacchetto .deb. Aspetterò la versione ufficiale (sai che palle!  (bad) ).
Ah sì? Strano... Se sai dove applicarla una patch è una stronzata di solito, lui va a vedere le linee da sostituire e te le sostituisce... Non è che gli errori venivano dalla successiva compilazione? Magari ti mancavano dipendenze...

Re: [Wine] Come faccio ad implementare questa patch?

Inviato: sabato 27 giugno 2009, 9:02
da Tetsuro
xela92 ha scritto:
Alessandro Pedarra ha scritto: C'avevo provato ma era un casino assurdo (mi avevano spiegato passo-passo ma qualcosa finiva sempre male), sarebbe stato carino se qualcuno (degli sviluppatori) avesse fornito un pacchetto .deb. Aspetterò la versione ufficiale (sai che palle!  (bad) ).
Ah sì? Strano... Se sai dove applicarla una patch è una stronzata di solito, lui va a vedere le linee da sostituire e te le sostituisce... Non è che gli errori venivano dalla successiva compilazione? Magari ti mancavano dipendenze...
Purtroppo per me è arabo. :(

Re: [Wine] Come faccio ad implementare questa patch?

Inviato: sabato 27 giugno 2009, 13:36
da xela92
Alessandro Pedarra ha scritto:
xela92 ha scritto:
Alessandro Pedarra ha scritto: C'avevo provato ma era un casino assurdo (mi avevano spiegato passo-passo ma qualcosa finiva sempre male), sarebbe stato carino se qualcuno (degli sviluppatori) avesse fornito un pacchetto .deb. Aspetterò la versione ufficiale (sai che palle!  (bad) ).
Ah sì? Strano... Se sai dove applicarla una patch è una stronzata di solito, lui va a vedere le linee da sostituire e te le sostituisce... Non è che gli errori venivano dalla successiva compilazione? Magari ti mancavano dipendenze...
Purtroppo per me è arabo. :(
lol :D
Comunque dopo averla applicata nella guida c'era scritto di dare qualcosa come "./configure" "make" e "sudo make install" ?

Re: [Wine] Come faccio ad implementare questa patch?

Inviato: sabato 27 giugno 2009, 15:29
da Tetsuro
Si, ma forse il primo l'avevo saltato. :-\

Re: [Wine] Come faccio ad implementare questa patch?

Inviato: venerdì 3 luglio 2009, 11:33
da xela92
Alessandro Pedarra ha scritto: Si, ma forse il primo l'avevo saltato. :-\
Ah ecco XD