| Index: ThirdParty.txt |
| — | — | @@ -217,3 +217,8 @@ |
| 218 | 218 |
|
| 219 | 219 | Installer uses Nullsoft Scriptable Install System; the license for which
|
| 220 | 220 | can be viewed at http://nsis.sourceforge.net/License
|
| | 221 | +
|
| | 222 | +------------------------------------------------------------------------------
|
| | 223 | +
|
| | 224 | +Contains code contributed from the following:
|
| | 225 | +Syahmi Azhar (mouse cursor hacks) |
| \ No newline at end of file |
| Index: cfgmgr/cfgmgr.c |
| — | — | @@ -1,5 +1,6 @@ |
| 2 | 2 | // DXGL
|
| 3 | 3 | // Copyright (C) 2011-2018 William Feely
|
| | 4 | +// Portions copyright (C) 2018 Syahmi Azhar
|
| 4 | 5 |
|
| 5 | 6 | // This library is free software; you can redistribute it and/or
|
| 6 | 7 | // modify it under the terms of the GNU Lesser General Public
|
| — | — | @@ -665,6 +666,8 @@ |
| 666 | 667 | cfg->HackCrop640480to640400 = ReadBool(hKey, cfg->HackCrop640480to640400, &cfgmask->HackCrop640480to640400, _T("HackCrop640480to640400"));
|
| 667 | 668 | cfg->HackAutoScale512448to640480 = ReadBool(hKey, cfg->HackAutoScale512448to640480, &cfgmask->HackAutoScale512448to640480, _T("HackAutoScale512448to640480"));
|
| 668 | 669 | cfg->HackNoTVRefresh = ReadBool(hKey, cfg->HackNoTVRefresh, &cfgmask->HackNoTVRefresh, _T("HackNoTVRefresh"));
|
| | 670 | + cfg->HackSetCursorPos = ReadBool(hKey, cfg->HackSetCursorPos, &cfgmask->HackSetCursorPos, _T("HackSetCursorPos"));
|
| | 671 | + cfg->HackSetCursor = ReadBool(hKey, cfg->HackSetCursor, &cfgmask->HackSetCursor, _T("HackSetCursor"));
|
| 669 | 672 | if(!global && dll)
|
| 670 | 673 | {
|
| 671 | 674 | sizeout = 0;
|
| — | — | @@ -815,6 +818,8 @@ |
| 816 | 819 | WriteBool(hKey, cfg->HackCrop640480to640400, cfgmask->HackCrop640480to640400, _T("HackCrop640480to640400"));
|
| 817 | 820 | WriteBool(hKey, cfg->HackAutoScale512448to640480, cfgmask->HackAutoScale512448to640480, _T("HackAutoScale512448to640480"));
|
| 818 | 821 | WriteBool(hKey, cfg->HackNoTVRefresh, cfgmask->HackNoTVRefresh, _T("HackNoTVRefresh"));
|
| | 822 | + WriteBool(hKey, cfg->HackSetCursorPos, cfgmask->HackSetCursorPos, _T("HackSetCursorPos"));
|
| | 823 | + WriteBool(hKey, cfg->HackSetCursor, cfgmask->HackSetCursor, _T("HackSetCursor"));
|
| 819 | 824 | }
|
| 820 | 825 |
|
| 821 | 826 | TCHAR newregname[MAX_PATH+65];
|
| — | — | @@ -1087,6 +1092,8 @@ |
| 1088 | 1093 | if (!stricmp(section, "HackCrop640480to640400")) cfg->HackCrop640480to640400 = INIBoolValue(value);
|
| 1089 | 1094 | if (!stricmp(section, "HackAutoScale512448to640480")) cfg->HackAutoScale512448to640480 = INIBoolValue(value);
|
| 1090 | 1095 | if (!stricmp(section, "HackNoTVRefresh")) cfg->HackNoTVRefresh = INIBoolValue(value);
|
| | 1096 | + if (!stricmp(section, "HackSetCursorPos")) cfg->HackSetCursorPos = INIBoolValue(value);
|
| | 1097 | + if (!stricmp(section, "HackSetCursor")) cfg->HackSetCursor = INIBoolValue(value);
|
| 1091 | 1098 | }
|
| 1092 | 1099 | return 1;
|
| 1093 | 1100 | }
|
| Index: cfgmgr/cfgmgr.h |
| — | — | @@ -1,5 +1,6 @@ |
| 2 | 2 | // DXGL
|
| 3 | 3 | // Copyright (C) 2011-2018 William Feely
|
| | 4 | +// Portions copyright (C) 2018 Syahmi Azhar
|
| 4 | 5 |
|
| 5 | 6 | // This library is free software; you can redistribute it and/or
|
| 6 | 7 | // modify it under the terms of the GNU Lesser General Public
|
| — | — | @@ -93,6 +94,8 @@ |
| 94 | 95 | BOOL HackCrop640480to640400;
|
| 95 | 96 | BOOL HackAutoScale512448to640480;
|
| 96 | 97 | BOOL HackNoTVRefresh;
|
| | 98 | + BOOL HackSetCursorPos;
|
| | 99 | + BOOL HackSetCursor;
|
| 97 | 100 | // internal
|
| 98 | 101 | BOOL Windows8Detected;
|
| 99 | 102 | BOOL ParsedAddColorDepths;
|
| Index: ddraw/hooks.c |
| — | — | @@ -1,5 +1,6 @@ |
| 2 | 2 | // DXGL
|
| 3 | 3 | // Copyright (C) 2014-2015 William Feely
|
| | 4 | +// Portions copyright (C) 2018 Syahmi Azhar
|
| 4 | 5 |
|
| 5 | 6 | // This library is free software; you can redistribute it and/or
|
| 6 | 7 | // modify it under the terms of the GNU Lesser General Public
|
| — | — | @@ -49,6 +50,8 @@ |
| 50 | 51 | #define _GetWindowLongPtrA _GetWindowLongA
|
| 51 | 52 | #define _GetWindowLongPtrW _GetWindowLongW
|
| 52 | 53 | #endif
|
| | 54 | +BOOL(WINAPI *_SetCursorPos)(int X, int Y) = NULL;
|
| | 55 | +HCURSOR(WINAPI *_SetCursor)(HCURSOR hCursor) = NULL;
|
| 53 | 56 | UINT wndhook_count = 0;
|
| 54 | 57 |
|
| 55 | 58 | int hwndhookcmp(const HWND_HOOK *key, const HWND_HOOK *cmp)
|
| — | — | @@ -161,6 +164,8 @@ |
| 162 | 165 | MH_CreateHook(&GetWindowLongPtrA, HookGetWindowLongPtrA, &_GetWindowLongPtrA);
|
| 163 | 166 | MH_CreateHook(&GetWindowLongPtrW, HookGetWindowLongPtrW, &_GetWindowLongPtrW);
|
| 164 | 167 | #endif
|
| | 168 | + MH_CreateHook(&SetCursorPos, HookSetCursorPos, &_SetCursorPos);
|
| | 169 | + MH_CreateHook(&SetCursor, HookSetCursor, &_SetCursor);
|
| 165 | 170 | hooks_init = TRUE;
|
| 166 | 171 | LeaveCriticalSection(&hook_cs);
|
| 167 | 172 | }
|
| — | — | @@ -179,6 +184,8 @@ |
| 180 | 185 | MH_RemoveHook(&GetWindowLongPtrA);
|
| 181 | 186 | MH_RemoveHook(&GetWindowLongPtrW);
|
| 182 | 187 | #endif
|
| | 188 | + MH_RemoveHook(&SetCursorPos);
|
| | 189 | + MH_RemoveHook(&SetCursor);
|
| 183 | 190 | MH_Uninitialize();
|
| 184 | 191 | wndhook_count = 0;
|
| 185 | 192 | hooks_init = FALSE;
|
| — | — | @@ -201,6 +208,8 @@ |
| 202 | 209 | MH_EnableHook(&GetWindowLongPtrA);
|
| 203 | 210 | MH_EnableHook(&GetWindowLongPtrW);
|
| 204 | 211 | #endif
|
| | 212 | + MH_EnableHook(&SetCursorPos);
|
| | 213 | + MH_EnableHook(&SetCursor);
|
| 205 | 214 | }
|
| 206 | 215 | LeaveCriticalSection(&hook_cs);
|
| 207 | 216 | }
|
| — | — | @@ -223,6 +232,8 @@ |
| 224 | 233 | MH_DisableHook(&GetWindowLongPtrA);
|
| 225 | 234 | MH_DisableHook(&GetWindowLongPtrW);
|
| 226 | 235 | #endif
|
| | 236 | + MH_DisableHook(&SetCursorPos);
|
| | 237 | + MH_DisableHook(&SetCursor);
|
| 227 | 238 | }
|
| 228 | 239 | LeaveCriticalSection(&hook_cs);
|
| 229 | 240 | }
|
| — | — | @@ -480,3 +491,46 @@ |
| 481 | 492 | return (LONG_PTR)wndhook->wndproc;
|
| 482 | 493 | }
|
| 483 | 494 | #endif
|
| | 495 | +BOOL WINAPI HookSetCursorPos(int x, int y)
|
| | 496 | +{
|
| | 497 | + HWND_HOOK *wndhook;
|
| | 498 | + LONG sizes[6];
|
| | 499 | + POINT pt;
|
| | 500 | + int winWidth, winHeight;
|
| | 501 | +
|
| | 502 | + if (!dxglcfg.HackSetCursorPos) {
|
| | 503 | + return _SetCursorPos(x, y);
|
| | 504 | + }
|
| | 505 | +
|
| | 506 | + wndhook = GetWndHook(GetActiveWindow());
|
| | 507 | + if (!wndhook) {
|
| | 508 | + return _SetCursorPos(x, y);
|
| | 509 | + }
|
| | 510 | +
|
| | 511 | + pt.x = 0;
|
| | 512 | + pt.y = 0;
|
| | 513 | + glDirectDraw7_GetSizes(wndhook->lpDD7, sizes);
|
| | 514 | + ClientToScreen(wndhook->hwnd, &pt);
|
| | 515 | +
|
| | 516 | + return _SetCursorPos(x * sizes[4] / sizes[2] + pt.x, y * sizes[5] / sizes[3] + pt.y);
|
| | 517 | +}
|
| | 518 | +HCURSOR WINAPI HookSetCursor(HCURSOR hCursor)
|
| | 519 | +{
|
| | 520 | + static HCURSOR prevCursor = NULL;
|
| | 521 | + static BOOLEAN prevCursorSet = FALSE;
|
| | 522 | +
|
| | 523 | + if (!dxglcfg.HackSetCursor) {
|
| | 524 | + return _SetCursor(hCursor);
|
| | 525 | + }
|
| | 526 | +
|
| | 527 | + if (!prevCursorSet) {
|
| | 528 | + prevCursorSet = TRUE;
|
| | 529 | + prevCursor = GetCursor();
|
| | 530 | + }
|
| | 531 | +
|
| | 532 | + if (hCursor == NULL) {
|
| | 533 | + prevCursor = _SetCursor(hCursor);
|
| | 534 | + }
|
| | 535 | +
|
| | 536 | + return prevCursor;
|
| | 537 | +}
|
| Index: ddraw/hooks.h |
| — | — | @@ -1,5 +1,6 @@ |
| 2 | 2 | // DXGL
|
| 3 | 3 | // Copyright (C) 2014-2015 William Feely
|
| | 4 | +// Portions copyright (C) 2018 Syahmi Azhar
|
| 4 | 5 |
|
| 5 | 6 | // This library is free software; you can redistribute it and/or
|
| 6 | 7 | // modify it under the terms of the GNU Lesser General Public
|
| — | — | @@ -48,6 +49,8 @@ |
| 49 | 50 | LONG_PTR WINAPI HookGetWindowLongPtrA(HWND hWnd, int nIndex);
|
| 50 | 51 | LONG_PTR WINAPI HookGetWindowLongPtrW(HWND hWnd, int nIndex);
|
| 51 | 52 | #endif
|
| | 53 | +BOOL WINAPI HookSetCursorPos(int x, int y);
|
| | 54 | +HCURSOR WINAPI HookSetCursor(HCURSOR hCursor);
|
| 52 | 55 |
|
| 53 | 56 | #ifdef __cplusplus
|
| 54 | 57 | }
|
| Index: dxglcfg/dxglcfg.cpp |
| — | — | @@ -1,5 +1,6 @@ |
| 2 | 2 | // DXGL
|
| 3 | 3 | // Copyright (C) 2011-2018 William Feely
|
| | 4 | +// Portions copyright (C) 2018 Syahmi Azhar
|
| 4 | 5 |
|
| 5 | 6 | // This library is free software; you can redistribute it and/or
|
| 6 | 7 | // modify it under the terms of the GNU Lesser General Public
|
| — | — | @@ -2295,6 +2296,14 @@ |
| 2296 | 2297 | *value = cfg->HackNoTVRefresh;
|
| 2297 | 2298 | *mask = cfgmask->HackNoTVRefresh;
|
| 2298 | 2299 | break;
|
| | 2300 | + case 3:
|
| | 2301 | + *value = cfg->HackSetCursorPos;
|
| | 2302 | + *mask = cfgmask->HackSetCursorPos;
|
| | 2303 | + break;
|
| | 2304 | + case 4:
|
| | 2305 | + *value = cfg->HackSetCursor;
|
| | 2306 | + *mask = cfgmask->HackSetCursor;
|
| | 2307 | + break;
|
| 2299 | 2308 | default:
|
| 2300 | 2309 | *value = FALSE;
|
| 2301 | 2310 | *mask = FALSE;
|
| — | — | @@ -2317,6 +2326,15 @@ |
| 2318 | 2327 | case 2:
|
| 2319 | 2328 | cfg->HackNoTVRefresh = value;
|
| 2320 | 2329 | cfgmask->HackNoTVRefresh = mask;
|
| | 2330 | + break;
|
| | 2331 | + case 3:
|
| | 2332 | + cfg->HackSetCursorPos = value;
|
| | 2333 | + cfgmask->HackSetCursorPos = mask;
|
| | 2334 | + break;
|
| | 2335 | + case 4:
|
| | 2336 | + cfg->HackSetCursor = value;
|
| | 2337 | + cfgmask->HackSetCursor = mask;
|
| | 2338 | + break;
|
| 2321 | 2339 | default:
|
| 2322 | 2340 | break;
|
| 2323 | 2341 | }
|
| — | — | @@ -3143,6 +3161,10 @@ |
| 3144 | 3162 | SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
| 3145 | 3163 | _tcscpy(buffer, _T("Remove TV-compatible refresh rates"));
|
| 3146 | 3164 | SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
| | 3165 | + _tcscpy(buffer, _T("SetCursorPos centered"));
|
| | 3166 | + SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
| | 3167 | + _tcscpy(buffer, _T("SetCursor hide visibility"));
|
| | 3168 | + SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
| 3147 | 3169 | // About text
|
| 3148 | 3170 | _tcscpy(abouttext, _T("DXGL\r\nVersion "));
|
| 3149 | 3171 | _tcscat(abouttext, _T(DXGLVERSTRING));
|
| Index: patches/SetCursorPos hack.patch |
| — | — | @@ -0,0 +1,202 @@ |
| | 2 | +Index: cfgmgr/cfgmgr.c
|
| | 3 | +===================================================================
|
| | 4 | +--- cfgmgr/cfgmgr.c (revision 798)
|
| | 5 | +@@ -665,6 +665,8 @@
|
| | 6 | + cfg->HackCrop640480to640400 = ReadBool(hKey, cfg->HackCrop640480to640400, &cfgmask->HackCrop640480to640400, _T("HackCrop640480to640400"));
|
| | 7 | + cfg->HackAutoScale512448to640480 = ReadBool(hKey, cfg->HackAutoScale512448to640480, &cfgmask->HackAutoScale512448to640480, _T("HackAutoScale512448to640480"));
|
| | 8 | + cfg->HackNoTVRefresh = ReadBool(hKey, cfg->HackNoTVRefresh, &cfgmask->HackNoTVRefresh, _T("HackNoTVRefresh"));
|
| | 9 | ++ cfg->HackSetCursorPos = ReadBool(hKey, cfg->HackSetCursorPos, &cfgmask->HackSetCursorPos, _T("HackSetCursorPos"));
|
| | 10 | ++ cfg->HackSetCursor = ReadBool(hKey, cfg->HackSetCursor, &cfgmask->HackSetCursor, _T("HackSetCursor"));
|
| | 11 | + if(!global && dll)
|
| | 12 | + {
|
| | 13 | + sizeout = 0;
|
| | 14 | +@@ -815,6 +817,8 @@
|
| | 15 | + WriteBool(hKey, cfg->HackCrop640480to640400, cfgmask->HackCrop640480to640400, _T("HackCrop640480to640400"));
|
| | 16 | + WriteBool(hKey, cfg->HackAutoScale512448to640480, cfgmask->HackAutoScale512448to640480, _T("HackAutoScale512448to640480"));
|
| | 17 | + WriteBool(hKey, cfg->HackNoTVRefresh, cfgmask->HackNoTVRefresh, _T("HackNoTVRefresh"));
|
| | 18 | ++ WriteBool(hKey, cfg->HackSetCursorPos, cfgmask->HackSetCursorPos, _T("HackSetCursorPos"));
|
| | 19 | ++ WriteBool(hKey, cfg->HackSetCursor, cfgmask->HackSetCursor, _T("HackSetCursor"));
|
| | 20 | + }
|
| | 21 | +
|
| | 22 | + TCHAR newregname[MAX_PATH+65];
|
| | 23 | +@@ -1087,6 +1091,8 @@
|
| | 24 | + if (!stricmp(section, "HackCrop640480to640400")) cfg->HackCrop640480to640400 = INIBoolValue(value);
|
| | 25 | + if (!stricmp(section, "HackAutoScale512448to640480")) cfg->HackAutoScale512448to640480 = INIBoolValue(value);
|
| | 26 | + if (!stricmp(section, "HackNoTVRefresh")) cfg->HackNoTVRefresh = INIBoolValue(value);
|
| | 27 | ++ if (!stricmp(section, "HackSetCursorPos")) cfg->HackSetCursorPos = INIBoolValue(value);
|
| | 28 | ++ if (!stricmp(section, "HackSetCursor")) cfg->HackSetCursor = INIBoolValue(value);
|
| | 29 | + }
|
| | 30 | + return 1;
|
| | 31 | + }
|
| | 32 | +Index: cfgmgr/cfgmgr.h
|
| | 33 | +===================================================================
|
| | 34 | +--- cfgmgr/cfgmgr.h (revision 798)
|
| | 35 | +@@ -93,6 +93,8 @@
|
| | 36 | + BOOL HackCrop640480to640400;
|
| | 37 | + BOOL HackAutoScale512448to640480;
|
| | 38 | + BOOL HackNoTVRefresh;
|
| | 39 | ++ BOOL HackSetCursorPos;
|
| | 40 | ++ BOOL HackSetCursor;
|
| | 41 | + // internal
|
| | 42 | + BOOL Windows8Detected;
|
| | 43 | + BOOL ParsedAddColorDepths;
|
| | 44 | +Index: ddraw/hooks.c
|
| | 45 | +===================================================================
|
| | 46 | +--- ddraw/hooks.c (revision 798)
|
| | 47 | +@@ -38,6 +38,8 @@
|
| | 48 | + LONG(WINAPI *_SetWindowLongW)(HWND hWnd, int nIndex, LONG dwNewLong) = NULL;
|
| | 49 | + LONG(WINAPI *_GetWindowLongA)(HWND hWnd, int nIndex) = NULL;
|
| | 50 | + LONG(WINAPI *_GetWindowLongW)(HWND hWnd, int nIndex) = NULL;
|
| | 51 | ++BOOL(WINAPI *_SetCursorPos)(int X, int Y) = NULL;
|
| | 52 | ++HCURSOR (WINAPI *_SetCursor)(HCURSOR hCursor) = NULL;
|
| | 53 | + #ifdef _M_X64
|
| | 54 | + LONG_PTR(WINAPI *_SetWindowLongPtrA)(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
|
| | 55 | + LONG_PTR(WINAPI *_SetWindowLongPtrW)(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
|
| | 56 | +@@ -155,6 +157,8 @@
|
| | 57 | + MH_CreateHook(&SetWindowLongW, HookSetWindowLongW, &_SetWindowLongW);
|
| | 58 | + MH_CreateHook(&GetWindowLongA, HookGetWindowLongA, &_GetWindowLongA);
|
| | 59 | + MH_CreateHook(&GetWindowLongW, HookGetWindowLongW, &_GetWindowLongW);
|
| | 60 | ++ MH_CreateHook(&SetCursorPos, HookSetCursorPos, &_SetCursorPos);
|
| | 61 | ++ MH_CreateHook(&SetCursor, HookSetCursor, &_SetCursor);
|
| | 62 | + #ifdef _M_X64
|
| | 63 | + MH_CreateHook(&SetWindowLongPtrA, HookSetWindowLongPtrA, &_SetWindowLongPtrA);
|
| | 64 | + MH_CreateHook(&SetWindowLongPtrW, HookSetWindowLongPtrW, &_SetWindowLongPtrW);
|
| | 65 | +@@ -173,6 +177,8 @@
|
| | 66 | + MH_RemoveHook(&SetWindowLongW);
|
| | 67 | + MH_RemoveHook(&GetWindowLongA);
|
| | 68 | + MH_RemoveHook(&GetWindowLongW);
|
| | 69 | ++ MH_RemoveHook(&SetCursorPos);
|
| | 70 | ++ MH_RemoveHook(&SetCursor);
|
| | 71 | + #ifdef _M_X64
|
| | 72 | + MH_RemoveHook(&SetWindowLongPtrA);
|
| | 73 | + MH_RemoveHook(&SetWindowLongPtrW);
|
| | 74 | +@@ -195,6 +201,8 @@
|
| | 75 | + MH_EnableHook(&SetWindowLongW);
|
| | 76 | + MH_EnableHook(&GetWindowLongA);
|
| | 77 | + MH_EnableHook(&GetWindowLongW);
|
| | 78 | ++ MH_EnableHook(&SetCursorPos);
|
| | 79 | ++ MH_EnableHook(&SetCursor);
|
| | 80 | + #ifdef _M_X64
|
| | 81 | + MH_EnableHook(&SetWindowLongPtrA);
|
| | 82 | + MH_EnableHook(&SetWindowLongPtrW);
|
| | 83 | +@@ -217,6 +225,8 @@
|
| | 84 | + MH_DisableHook(&SetWindowLongW);
|
| | 85 | + MH_DisableHook(&GetWindowLongA);
|
| | 86 | + MH_DisableHook(&GetWindowLongW);
|
| | 87 | ++ MH_DisableHook(&SetCursorPos);
|
| | 88 | ++ MH_DisableHook(&SetCursor);
|
| | 89 | + #ifdef _M_X64
|
| | 90 | + MH_DisableHook(&SetWindowLongPtrA);
|
| | 91 | + MH_DisableHook(&SetWindowLongPtrW);
|
| | 92 | +@@ -440,6 +450,49 @@
|
| | 93 | + if (!wndhook) return _GetWindowLongW(hWnd, nIndex);
|
| | 94 | + return (LONG)wndhook->wndproc;
|
| | 95 | + }
|
| | 96 | ++BOOL WINAPI HookSetCursorPos(int x, int y)
|
| | 97 | ++{
|
| | 98 | ++ HWND_HOOK *wndhook;
|
| | 99 | ++ LONG sizes[6];
|
| | 100 | ++ POINT pt;
|
| | 101 | ++ int winWidth, winHeight;
|
| | 102 | ++
|
| | 103 | ++ if (!dxglcfg.HackSetCursorPos) {
|
| | 104 | ++ return _SetCursorPos(x, y);
|
| | 105 | ++ }
|
| | 106 | ++
|
| | 107 | ++ wndhook = GetWndHook(GetActiveWindow());
|
| | 108 | ++ if (!wndhook) {
|
| | 109 | ++ return _SetCursorPos(x, y);
|
| | 110 | ++ }
|
| | 111 | ++
|
| | 112 | ++ pt.x = 0;
|
| | 113 | ++ pt.y = 0;
|
| | 114 | ++ glDirectDraw7_GetSizes(wndhook->lpDD7, sizes);
|
| | 115 | ++ ClientToScreen(wndhook->hwnd, &pt);
|
| | 116 | ++
|
| | 117 | ++ return _SetCursorPos(x * sizes[4] / sizes[2] + pt.x, y * sizes[5] / sizes[3] + pt.y);
|
| | 118 | ++}
|
| | 119 | ++HCURSOR WINAPI HookSetCursor(HCURSOR hCursor)
|
| | 120 | ++{
|
| | 121 | ++ static HCURSOR prevCursor = NULL;
|
| | 122 | ++ static BOOLEAN prevCursorSet = FALSE;
|
| | 123 | ++
|
| | 124 | ++ if (!dxglcfg.HackSetCursor) {
|
| | 125 | ++ return _SetCursor(hCursor);
|
| | 126 | ++ }
|
| | 127 | ++
|
| | 128 | ++ if (!prevCursorSet) {
|
| | 129 | ++ prevCursorSet = TRUE;
|
| | 130 | ++ prevCursor = GetCursor();
|
| | 131 | ++ }
|
| | 132 | ++
|
| | 133 | ++ if (hCursor == NULL) {
|
| | 134 | ++ prevCursor = _SetCursor(hCursor);
|
| | 135 | ++ }
|
| | 136 | ++
|
| | 137 | ++ return prevCursor;
|
| | 138 | ++}
|
| | 139 | + #ifdef _M_X64
|
| | 140 | + LONG_PTR WINAPI HookSetWindowLongPtrA(HWND hWnd, int nIndex, LONG_PTR dwNewLong)
|
| | 141 | + {
|
| | 142 | +Index: ddraw/hooks.h
|
| | 143 | +===================================================================
|
| | 144 | +--- ddraw/hooks.h (revision 798)
|
| | 145 | +@@ -42,6 +42,8 @@
|
| | 146 | + LONG WINAPI HookSetWindowLongW(HWND hWnd, int nIndex, LONG dwNewLong);
|
| | 147 | + LONG WINAPI HookGetWindowLongA(HWND hWnd, int nIndex);
|
| | 148 | + LONG WINAPI HookGetWindowLongW(HWND hWnd, int nIndex);
|
| | 149 | ++BOOL WINAPI HookSetCursorPos(int x, int y);
|
| | 150 | ++HCURSOR WINAPI HookSetCursor(HCURSOR hCursor);
|
| | 151 | + #ifdef _M_X64
|
| | 152 | + LONG_PTR WINAPI HookSetWindowLongPtrA(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
|
| | 153 | + LONG_PTR WINAPI HookSetWindowLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
|
| | 154 | +Index: dxglcfg/dxglcfg.cpp
|
| | 155 | +===================================================================
|
| | 156 | +--- dxglcfg/dxglcfg.cpp (revision 798)
|
| | 157 | +@@ -2295,6 +2295,14 @@
|
| | 158 | + *value = cfg->HackNoTVRefresh;
|
| | 159 | + *mask = cfgmask->HackNoTVRefresh;
|
| | 160 | + break;
|
| | 161 | ++ case 3:
|
| | 162 | ++ *value = cfg->HackSetCursorPos;
|
| | 163 | ++ *mask = cfgmask->HackSetCursorPos;
|
| | 164 | ++ break;
|
| | 165 | ++ case 4:
|
| | 166 | ++ *value = cfg->HackSetCursor;
|
| | 167 | ++ *mask = cfgmask->HackSetCursor;
|
| | 168 | ++ break;
|
| | 169 | + default:
|
| | 170 | + *value = FALSE;
|
| | 171 | + *mask = FALSE;
|
| | 172 | +@@ -2317,6 +2325,15 @@
|
| | 173 | + case 2:
|
| | 174 | + cfg->HackNoTVRefresh = value;
|
| | 175 | + cfgmask->HackNoTVRefresh = mask;
|
| | 176 | ++ break;
|
| | 177 | ++ case 3:
|
| | 178 | ++ cfg->HackSetCursorPos = value;
|
| | 179 | ++ cfgmask->HackSetCursorPos = mask;
|
| | 180 | ++ break;
|
| | 181 | ++ case 4:
|
| | 182 | ++ cfg->HackSetCursor = value;
|
| | 183 | ++ cfgmask->HackSetCursor = mask;
|
| | 184 | ++ break;
|
| | 185 | + default:
|
| | 186 | + break;
|
| | 187 | + }
|
| | 188 | +@@ -3143,6 +3160,10 @@
|
| | 189 | + SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
| | 190 | + _tcscpy(buffer, _T("Remove TV-compatible refresh rates"));
|
| | 191 | + SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
| | 192 | ++ _tcscpy(buffer, _T("SetCursorPos centered"));
|
| | 193 | ++ SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
| | 194 | ++ _tcscpy(buffer, _T("SetCursor hide visibility"));
|
| | 195 | ++ SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
| | 196 | + // About text
|
| | 197 | + _tcscpy(abouttext, _T("DXGL\r\nVersion "));
|
| | 198 | + _tcscat(abouttext, _T(DXGLVERSTRING)); |
| \ No newline at end of file |
| Index: patches/readme.txt |
| — | — | @@ -0,0 +1,3 @@ |
| | 2 | +These files have already been merged into DXGL, but are provided for reference purposes.
|
| | 3 | +
|
| | 4 | +SetCursorPos hack.patch - Copyright (C) 2018 Syahmi Azhar - Merged manually against revision 799. |
| \ No newline at end of file |