Some more fixes for controllers

This commit is contained in:
Grinch_ 2021-10-02 21:30:17 +06:00
parent 7e589bb4a6
commit 1fedaadc04
3 changed files with 73 additions and 49 deletions

View File

@ -6,10 +6,10 @@
"${workspaceFolder}/**", "${workspaceFolder}/**",
"${PLUGIN_SDK_DIR}/*", "${PLUGIN_SDK_DIR}/*",
"${DIRECTX9_SDK_DIR}/Include/*", "${DIRECTX9_SDK_DIR}/Include/*",
// "${PLUGIN_SDK_DIR}/plugin_sa/*", "${PLUGIN_SDK_DIR}/plugin_sa/*",
// "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*", "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*",
"${PLUGIN_SDK_DIR}/plugin_vc/*", // "${PLUGIN_SDK_DIR}/plugin_vc/*",
"${PLUGIN_SDK_DIR}/plugin_vc/game_vc/*", // "${PLUGIN_SDK_DIR}/plugin_vc/game_vc/*",
"${PLUGIN_SDK_DIR}/shared/*", "${PLUGIN_SDK_DIR}/shared/*",
"${PLUGIN_SDK_DIR}/shared/game/*", "${PLUGIN_SDK_DIR}/shared/game/*",
"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*", "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*",
@ -20,7 +20,7 @@
"IS_PLATFORM_WIN", "IS_PLATFORM_WIN",
"_CRT_SECURE_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS",
"_CRT_NON_CONFORMING_SWPRINTFS", "_CRT_NON_CONFORMING_SWPRINTFS",
"GTAVC", "GTASA",
"_DX9_SDK_INSTALLED", "_DX9_SDK_INSTALLED",
"PLUGIN_SGV_10US" "PLUGIN_SGV_10US"
], ],

View File

@ -6194,23 +6194,23 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID); window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
PushClipRect(host_rect.Min, host_rect.Max, false); PushClipRect(host_rect.Min, host_rect.Max, false);
// Draw modal window background (darkens what is behind them, all viewports) // // Draw modal window background (darkens what is behind them, all viewports)
const bool dim_bg_for_modal = (flags & ImGuiWindowFlags_Modal) && window == GetTopMostPopupModal() && window->HiddenFramesCannotSkipItems <= 0; // const bool dim_bg_for_modal = (flags & ImGuiWindowFlags_Modal) && window == GetTopMostPopupModal() && window->HiddenFramesCannotSkipItems <= 0;
const bool dim_bg_for_window_list = g.NavWindowingTargetAnim && (window == g.NavWindowingTargetAnim->RootWindow); // const bool dim_bg_for_window_list = g.NavWindowingTargetAnim && (window == g.NavWindowingTargetAnim->RootWindow);
if (dim_bg_for_modal || dim_bg_for_window_list) // if (dim_bg_for_modal || dim_bg_for_window_list)
{ // {
const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio); // const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio);
window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, dim_bg_col); // window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, dim_bg_col);
} // }
// Draw navigation selection/windowing rectangle background // // Draw navigation selection/windowing rectangle background
if (dim_bg_for_window_list && window == g.NavWindowingTargetAnim) // if (dim_bg_for_window_list && window == g.NavWindowingTargetAnim)
{ // {
ImRect bb = window->Rect(); // ImRect bb = window->Rect();
bb.Expand(g.FontSize); // bb.Expand(g.FontSize);
if (!bb.Contains(viewport_rect)) // Avoid drawing if the window covers all the viewport anyway // if (!bb.Contains(viewport_rect)) // Avoid drawing if the window covers all the viewport anyway
window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha * 0.25f), g.Style.WindowRounding); // window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha * 0.25f), g.Style.WindowRounding);
} // }
// Since 1.71, child window can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call. // Since 1.71, child window can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call.
// When using overlapping child windows, this will break the assumption that child z-order is mapped to submission order. // When using overlapping child windows, this will break the assumption that child z-order is mapped to submission order.
@ -6234,19 +6234,19 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->DrawList = &window->DrawListInst; window->DrawList = &window->DrawListInst;
} }
// Draw navigation selection/windowing rectangle border // // Draw navigation selection/windowing rectangle border
if (g.NavWindowingTargetAnim == window) // if (g.NavWindowingTargetAnim == window)
{ // {
float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding); // float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding);
ImRect bb = window->Rect(); // ImRect bb = window->Rect();
bb.Expand(g.FontSize); // bb.Expand(g.FontSize);
if (bb.Contains(viewport_rect)) // If a window fits the entire viewport, adjust its highlight inward // if (bb.Contains(viewport_rect)) // If a window fits the entire viewport, adjust its highlight inward
{ // {
bb.Expand(-g.FontSize - 1.0f); // bb.Expand(-g.FontSize - 1.0f);
rounding = window->WindowRounding; // rounding = window->WindowRounding;
} // }
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), rounding, 0, 3.0f); // window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), rounding, 0, 3.0f);
} // }
// UPDATE RECTANGLES (2- THOSE AFFECTED BY SCROLLING) // UPDATE RECTANGLES (2- THOSE AFFECTED BY SCROLLING)
@ -9537,8 +9537,8 @@ static void ImGui::NavEndFrame()
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
// Show CTRL+TAB list window // Show CTRL+TAB list window
if (g.NavWindowingTarget != NULL) // if (g.NavWindowingTarget != NULL)
NavUpdateWindowingOverlay(); // NavUpdateWindowingOverlay();
// Perform wrap-around in menus // Perform wrap-around in menus
ImGuiWindow* window = g.NavWrapRequestWindow; ImGuiWindow* window = g.NavWrapRequestWindow;
@ -9827,19 +9827,19 @@ void ImGui::NavUpdateWindowingOverlay()
SetNextWindowPos(viewport->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f)); SetNextWindowPos(viewport->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
PushStyleVar(ImGuiStyleVar_WindowPadding, g.Style.WindowPadding * 2.0f); PushStyleVar(ImGuiStyleVar_WindowPadding, g.Style.WindowPadding * 2.0f);
// Begin("###NavWindowingList", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings); Begin("###NavWindowingList", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings);
// for (int n = g.WindowsFocusOrder.Size - 1; n >= 0; n--) for (int n = g.WindowsFocusOrder.Size - 1; n >= 0; n--)
// { {
// ImGuiWindow* window = g.WindowsFocusOrder[n]; ImGuiWindow* window = g.WindowsFocusOrder[n];
// IM_ASSERT(window != NULL); // Fix static analyzers IM_ASSERT(window != NULL); // Fix static analyzers
// if (!IsWindowNavFocusable(window)) if (!IsWindowNavFocusable(window))
// continue; continue;
// const char* label = window->Name; const char* label = window->Name;
// if (label == FindRenderedTextEnd(label)) if (label == FindRenderedTextEnd(label))
// label = GetFallbackWindowNameForWindowingList(window); label = GetFallbackWindowNameForWindowingList(window);
// Selectable(label, g.NavWindowingTarget == window); Selectable(label, g.NavWindowingTarget == window);
// } }
// End(); End();
PopStyleVar(); PopStyleVar();
} }

View File

@ -156,6 +156,30 @@ HRESULT Hook::Dx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Fl
void Hook::ShowMouse(bool state) void Hook::ShowMouse(bool state)
{ {
// Disable player controls for controllers
#if GTASA
bool bMouseDisabled = false;
if (patch::Get<BYTE>(0xBA6818) && (m_bShowMouse || bMouseDisabled))
{
CPlayerPed *player = FindPlayerPed();
if (player && player->GetPadFromPlayer())
{
if (m_bShowMouse)
{
bMouseDisabled = true;
player->GetPadFromPlayer()->DisablePlayerControls = true;
}
else
{
bMouseDisabled = false;
player->GetPadFromPlayer()->DisablePlayerControls = false;
}
}
}
#endif
if (m_bMouseVisibility != m_bShowMouse) if (m_bMouseVisibility != m_bShowMouse)
{ {
ImGui::GetIO().MouseDrawCursor = state; ImGui::GetIO().MouseDrawCursor = state;