1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-25 10:07:47 +01:00

make sure cursor is hidden in all dinput games

This commit is contained in:
FunkyFr3sh 2021-06-25 14:36:26 +02:00
parent 46d09b2175
commit 4afc715660

View File

@ -95,7 +95,7 @@ static HRESULT WINAPI fake_di_CreateDevice(
HRESULT result = real_di_CreateDevice(This, rguid, lplpDIDevice, pUnkOuter);
if (SUCCEEDED(result) && !real_did_SetCooperativeLevel)
if (SUCCEEDED(result))
{
if (rguid && IsEqualGUID(&GUID_SysMouse, rguid) && g_ddraw)
{
@ -107,6 +107,8 @@ static HRESULT WINAPI fake_di_CreateDevice(
InterlockedExchange((LONG*)&g_ddraw->show_cursor_count, -1);
}
if (!real_did_SetCooperativeLevel)
{
real_did_SetCooperativeLevel =
(DIDSETCOOPERATIVELEVELPROC)hook_func(
(PROC*)&(*lplpDIDevice)->lpVtbl->SetCooperativeLevel, (PROC)fake_did_SetCooperativeLevel);
@ -119,6 +121,7 @@ static HRESULT WINAPI fake_di_CreateDevice(
(DIDGETDEVICESTATEPROC)hook_func(
(PROC*)&(*lplpDIDevice)->lpVtbl->GetDeviceState, (PROC)fake_did_GetDeviceState);
}
}
return result;
}
@ -134,7 +137,19 @@ static HRESULT WINAPI fake_di_CreateDeviceEx(
HRESULT result = real_di_CreateDeviceEx(This, rguid, riid, lplpDIDevice, pUnkOuter);
if (SUCCEEDED(result) && !real_did_SetCooperativeLevel)
if (SUCCEEDED(result))
{
if (rguid && IsEqualGUID(&GUID_SysMouse, rguid) && g_ddraw)
{
if (g_ddraw->locked || g_ddraw->devmode)
{
while (real_ShowCursor(FALSE) >= 0);
}
InterlockedExchange((LONG*)&g_ddraw->show_cursor_count, -1);
}
if (!real_did_SetCooperativeLevel)
{
real_did_SetCooperativeLevel =
(DIDSETCOOPERATIVELEVELPROC)hook_func(
@ -148,6 +163,7 @@ static HRESULT WINAPI fake_di_CreateDeviceEx(
(DIDGETDEVICESTATEPROC)hook_func(
(PROC*)&(*lplpDIDevice)->lpVtbl->GetDeviceState, (PROC)fake_did_GetDeviceState);
}
}
return result;
}