mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
move dinput cursor handling into SetCooperativeLevel
This commit is contained in:
parent
e3f98c6837
commit
e8b28d193a
@ -17,6 +17,7 @@ static DICREATEDEVICEEXPROC real_di_CreateDeviceEx;
|
|||||||
static DIDSETCOOPERATIVELEVELPROC real_did_SetCooperativeLevel;
|
static DIDSETCOOPERATIVELEVELPROC real_did_SetCooperativeLevel;
|
||||||
static DIDGETDEVICEDATAPROC real_did_GetDeviceData;
|
static DIDGETDEVICEDATAPROC real_did_GetDeviceData;
|
||||||
static DIDGETDEVICESTATEPROC real_did_GetDeviceState;
|
static DIDGETDEVICESTATEPROC real_did_GetDeviceState;
|
||||||
|
static LPDIRECTINPUTDEVICEA g_mouse_device;
|
||||||
|
|
||||||
static PROC hook_func(PROC* org_func, PROC new_func)
|
static PROC hook_func(PROC* org_func, PROC new_func)
|
||||||
{
|
{
|
||||||
@ -38,6 +39,16 @@ static HRESULT WINAPI fake_did_SetCooperativeLevel(IDirectInputDeviceA* This, HW
|
|||||||
{
|
{
|
||||||
TRACE("DirectInput SetCooperativeLevel\n");
|
TRACE("DirectInput SetCooperativeLevel\n");
|
||||||
|
|
||||||
|
if (This == g_mouse_device && g_ddraw && (dwFlags & DISCL_EXCLUSIVE))
|
||||||
|
{
|
||||||
|
if (g_ddraw->locked || g_ddraw->devmode)
|
||||||
|
{
|
||||||
|
while (real_ShowCursor(FALSE) >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
InterlockedExchange((LONG*)&g_ddraw->show_cursor_count, -1);
|
||||||
|
}
|
||||||
|
|
||||||
return real_did_SetCooperativeLevel(This, hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE);
|
return real_did_SetCooperativeLevel(This, hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,14 +108,9 @@ static HRESULT WINAPI fake_di_CreateDevice(
|
|||||||
|
|
||||||
if (SUCCEEDED(result))
|
if (SUCCEEDED(result))
|
||||||
{
|
{
|
||||||
if (rguid && IsEqualGUID(&GUID_SysMouse, rguid) && g_ddraw)
|
if (rguid && IsEqualGUID(&GUID_SysMouse, rguid))
|
||||||
{
|
{
|
||||||
if (g_ddraw->locked || g_ddraw->devmode)
|
g_mouse_device = *lplpDIDevice;
|
||||||
{
|
|
||||||
while (real_ShowCursor(FALSE) >= 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
InterlockedExchange((LONG*)&g_ddraw->show_cursor_count, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!real_did_SetCooperativeLevel)
|
if (!real_did_SetCooperativeLevel)
|
||||||
@ -139,14 +145,9 @@ static HRESULT WINAPI fake_di_CreateDeviceEx(
|
|||||||
|
|
||||||
if (SUCCEEDED(result))
|
if (SUCCEEDED(result))
|
||||||
{
|
{
|
||||||
if (rguid && IsEqualGUID(&GUID_SysMouse, rguid) && g_ddraw)
|
if (rguid && IsEqualGUID(&GUID_SysMouse, rguid))
|
||||||
{
|
{
|
||||||
if (g_ddraw->locked || g_ddraw->devmode)
|
g_mouse_device = *lplpDIDevice;
|
||||||
{
|
|
||||||
while (real_ShowCursor(FALSE) >= 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
InterlockedExchange((LONG*)&g_ddraw->show_cursor_count, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!real_did_SetCooperativeLevel)
|
if (!real_did_SetCooperativeLevel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user