Skip to content

Commit

Permalink
fix(extra-natives-five): add try...catch to Windows.Gaming.Input func…
Browse files Browse the repository at this point in the history
…tion

Seems this DLL fails to initiate sometimes?
  • Loading branch information
LWSS committed Dec 12, 2023
1 parent 81f6957 commit 339c505
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions code/components/extra-natives-five/src/VehicleExtraNatives.cpp
Expand Up @@ -1774,8 +1774,16 @@ static HookFunction inputFunction([]()
return;
}

addedRevoker = Gamepad::GamepadAdded(winrt::auto_revoke, OnGamepadAdded);
removedRevoker = Gamepad::GamepadRemoved(winrt::auto_revoke, OnGamepadRemoved);
try
{
addedRevoker = Gamepad::GamepadAdded(winrt::auto_revoke, OnGamepadAdded);
removedRevoker = Gamepad::GamepadRemoved(winrt::auto_revoke, OnGamepadRemoved);
}
catch (...)
{
trace("Failed to add GamepadAdded handlers in Windows.Gaming.Input.dll");
return;
}

if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_PIN | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)hLib, &hLib))
{
Expand Down

0 comments on commit 339c505

Please sign in to comment.