Set mouse as used when mouse is moved instead of disabling it when gamepad is in use
This commit is contained in:
parent
e49e17d6e6
commit
30c90e5985
@ -1428,28 +1428,16 @@ namespace Components
|
|||||||
return gamePads[0].inUse;
|
return gamePads[0].inUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(naked) void Gamepad::CL_MouseEvent_Stub()
|
int Gamepad::CL_MouseEvent_Hk(const int x, const int y, const int dx, const int dy)
|
||||||
{
|
{
|
||||||
__asm
|
if(dx != 0 || dy != 0)
|
||||||
{
|
{
|
||||||
pushad
|
gamePads[0].inUse = false;
|
||||||
cmp eax, 6
|
gpad_in_use.setRaw(false);
|
||||||
jz hideCursor
|
}
|
||||||
|
|
||||||
call IsGamePadInUse
|
// Call original function
|
||||||
test al, al
|
return Utils::Hook::Call<int(int, int, int, int)>(0x4D7C50)(x, y, dx, dy);
|
||||||
jnz hideCursor
|
|
||||||
|
|
||||||
// Continue checks
|
|
||||||
popad
|
|
||||||
push 0x4D7C68
|
|
||||||
retn;
|
|
||||||
|
|
||||||
hideCursor:
|
|
||||||
popad
|
|
||||||
push 0x4D7C8A
|
|
||||||
retn
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Gamepad::UI_RefreshViewport_Hk()
|
bool Gamepad::UI_RefreshViewport_Hk()
|
||||||
@ -1514,9 +1502,11 @@ namespace Components
|
|||||||
// Mark controller as unused when keyboard key is pressed
|
// Mark controller as unused when keyboard key is pressed
|
||||||
Utils::Hook(0x43D179, CL_KeyEvent_Hk, HOOK_CALL).install()->quick();
|
Utils::Hook(0x43D179, CL_KeyEvent_Hk, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
|
// Mark controller as unused when mouse is moved
|
||||||
|
Utils::Hook(0x64C507, CL_MouseEvent_Hk, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
// Hide cursor when controller is active
|
// Hide cursor when controller is active
|
||||||
Utils::Hook(0x4D7C63, CL_MouseEvent_Stub, HOOK_JUMP).install()->quick(); // Disable cursor
|
Utils::Hook(0x48E527, UI_RefreshViewport_Hk, HOOK_CALL).install()->quick();
|
||||||
Utils::Hook(0x48E527, UI_RefreshViewport_Hk, HOOK_CALL).install()->quick(); // Do not draw cursor
|
|
||||||
|
|
||||||
// Only return gamepad keys when gamepad enabled and only non gamepad keys when not
|
// Only return gamepad keys when gamepad enabled and only non gamepad keys when not
|
||||||
Utils::Hook(0x5A7A23, Key_GetCommandAssignmentInternal_Hk, HOOK_CALL).install()->quick();
|
Utils::Hook(0x5A7A23, Key_GetCommandAssignmentInternal_Hk, HOOK_CALL).install()->quick();
|
||||||
|
@ -354,7 +354,7 @@ namespace Components
|
|||||||
static int Key_GetCommandAssignmentInternal_Hk(const char* cmd, int(*keys)[2]);
|
static int Key_GetCommandAssignmentInternal_Hk(const char* cmd, int(*keys)[2]);
|
||||||
static bool IsGamePadInUse();
|
static bool IsGamePadInUse();
|
||||||
static void CL_KeyEvent_Hk(int localClientNum, int key, int down, unsigned int time);
|
static void CL_KeyEvent_Hk(int localClientNum, int key, int down, unsigned int time);
|
||||||
static void CL_MouseEvent_Stub();
|
static int CL_MouseEvent_Hk(int x, int y, int dx, int dy);
|
||||||
static bool UI_RefreshViewport_Hk();
|
static bool UI_RefreshViewport_Hk();
|
||||||
static void CreateKeyNameMap();
|
static void CreateKeyNameMap();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user