@@ -17,6 +17,7 @@ static bool receivingWmInputs = false;
17
17
static bool inputMenu = false ;
18
18
static bool inputFps = false ;
19
19
static bool inputFpsCycle = false ;
20
+ static bool hasGamepad = false ;
20
21
21
22
void MenuCommon::ShowTooltip (const char * tip) {
22
23
if (ImGui::IsItemHovered (ImGuiHoveredFlags_AllowWhenDisabled))
@@ -917,6 +918,14 @@ bool MenuCommon::RenderMenu()
917
918
auto dllPath = Util::DllPath ().parent_path () / " dlssg_to_fsr3_amd_is_better.dll" ;
918
919
State::Instance ().NukemsFilesAvailable = std::filesystem::exists (dllPath);
919
920
921
+ io.ClearEventsQueue ();
922
+ io.ClearInputCharacters ();
923
+ io.ClearInputKeys ();
924
+ io.ClearInputMouse ();
925
+
926
+ if (hasGamepad)
927
+ io.BackendFlags | ImGuiBackendFlags_HasGamepad;
928
+
920
929
io.ConfigFlags = ImGuiConfigFlags_NavEnableKeyboard | ImGuiConfigFlags_NavEnableGamepad;
921
930
922
931
if (pfn_ClipCursor_hooked)
@@ -931,6 +940,8 @@ bool MenuCommon::RenderMenu()
931
940
}
932
941
else
933
942
{
943
+ hasGamepad = (io.BackendFlags | ImGuiBackendFlags_HasGamepad) > 0 ;
944
+ io.BackendFlags &= 30 ;
934
945
io.ConfigFlags = ImGuiConfigFlags_NavNoCaptureKeyboard | ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoMouseCursorChange | ImGuiConfigFlags_NoKeyboard;
935
946
936
947
if (pfn_ClipCursor_hooked)
@@ -3151,7 +3162,8 @@ bool MenuCommon::RenderMenu()
3151
3162
if (ImGui::Button (" Close" ))
3152
3163
{
3153
3164
_isVisible = false ;
3154
-
3165
+ hasGamepad = (io.BackendFlags | ImGuiBackendFlags_HasGamepad) > 0 ;
3166
+ io.BackendFlags &= 30 ;
3155
3167
io.ConfigFlags = ImGuiConfigFlags_NavNoCaptureKeyboard | ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoMouseCursorChange | ImGuiConfigFlags_NoKeyboard;
3156
3168
3157
3169
if (pfn_ClipCursor_hooked)
@@ -3364,14 +3376,17 @@ void MenuCommon::Init(HWND InHwnd)
3364
3376
ImGui::StyleColorsDark ();
3365
3377
3366
3378
ImGuiIO& io = ImGui::GetIO (); (void )io;
3379
+
3380
+ hasGamepad = (io.BackendFlags | ImGuiBackendFlags_HasGamepad) > 0 ;
3381
+ io.BackendFlags &= 30 ;
3367
3382
io.ConfigFlags = ImGuiConfigFlags_NavNoCaptureKeyboard | ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoMouseCursorChange | ImGuiConfigFlags_NoKeyboard;
3368
3383
3369
3384
io.MouseDrawCursor = _isVisible;
3370
3385
io.WantCaptureKeyboard = _isVisible;
3371
3386
io.WantCaptureMouse = _isVisible;
3372
3387
io.WantSetMousePos = _isVisible;
3373
3388
3374
- io.IniFilename = io.LogFilename = nullptr ;
3389
+ io.IniFilename = io.LogFilename = nullptr ;
3375
3390
3376
3391
bool initResult = ImGui_ImplWin32_Init (InHwnd);
3377
3392
LOG_DEBUG (" ImGui_ImplWin32_Init result: {0}" , initResult);
0 commit comments