diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index aa011ad..9bf22bb 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -6,10 +6,10 @@ "${workspaceFolder}/**", "${PLUGIN_SDK_DIR}/*", "${DIRECTX9_SDK_DIR}/Include/*", - "${PLUGIN_SDK_DIR}/plugin_sa/*", - "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*", - // "${PLUGIN_SDK_DIR}/plugin_vc/*", - // "${PLUGIN_SDK_DIR}/plugin_vc/game_vc/*", + // "${PLUGIN_SDK_DIR}/plugin_sa/*", + // "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*", + "${PLUGIN_SDK_DIR}/plugin_vc/*", + "${PLUGIN_SDK_DIR}/plugin_vc/game_vc/*", "${PLUGIN_SDK_DIR}/shared/*", "${PLUGIN_SDK_DIR}/shared/game/*", "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*", @@ -20,7 +20,7 @@ "IS_PLATFORM_WIN", "_CRT_SECURE_NO_WARNINGS", "_CRT_NON_CONFORMING_SWPRINTFS", - "GTASA", + "GTAVC", "_DX9_SDK_INSTALLED", "PLUGIN_SGV_10US" ], diff --git a/src/hook.cpp b/src/hook.cpp index 60e02e2..1845998 100644 --- a/src/hook.cpp +++ b/src/hook.cpp @@ -158,27 +158,31 @@ void Hook::ShowMouse(bool state) { // Disable player controls for controllers -#if GTASA bool bMouseDisabled = false; - - if (patch::Get(0xBA6818) && (m_bShowMouse || bMouseDisabled)) + if (patch::Get(BY_GAME(0xBA6818, 0x86968B)) && (m_bShowMouse || bMouseDisabled)) { + +#ifdef GTASA CPlayerPed *player = FindPlayerPed(); - if (player && player->GetPadFromPlayer()) + CPad *pad = player ? player->GetPadFromPlayer() : NULL; +#elif GTAVC + CPad *pad = CPad::GetPad(0); +#endif + + if (pad) { if (m_bShowMouse) { bMouseDisabled = true; - player->GetPadFromPlayer()->DisablePlayerControls = true; + pad->DisablePlayerControls = true; } else { bMouseDisabled = false; - player->GetPadFromPlayer()->DisablePlayerControls = false; + pad->DisablePlayerControls = false; } } } -#endif if (m_bMouseVisibility != m_bShowMouse) {