Skip to content

Commit c3c1295

Browse files
committed
Stop processing background gamepad input if SKIF is in the foreground
1 parent 590438f commit c3c1295

3 files changed

Lines changed: 30 additions & 12 deletions

File tree

CHANGELOG.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
26.4.17.2
1+
26.4.17.3
2+
=========
3+
+ Stop processing background gamepad input if SKIF is in the foreground.
4+
5+
26.4.17.2
26
=========
37
+ Reduced the amount of time SK's framerate limiter spends busy-waiting for
48
common FPS targets (very high framerates always require busy-wait).

include/SpecialK/DLL_VERSION.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#define SK_YEAR 26
44
#define SK_MONTH 4
55
#define SK_DATE 17
6-
#define SK_REV_N 2
7-
#define SK_REV 2
6+
#define SK_REV_N 3
7+
#define SK_REV 3
88

99
#ifndef _A2
1010
#define _A2(a) #a

include/imgui/imgui_user.inl

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3832,14 +3832,30 @@ SK_ImGui_UpdateGamepadProcessingEligibility (void)
38323832

38333833
if (process_input)
38343834
{
3835-
static std::unordered_map <HWND, BOOL> injected_pid_cache;
3835+
static std::unordered_map <HWND, DWORD> injected_pid_cache;
38363836

38373837
bool any_injected = false;
38383838

3839+
DWORD dwPidOfSKIF = 0;
3840+
HWND hWndSKIF = 0;
3841+
bool game_iconic = IsIconic (game_window.hWnd);
3842+
38393843
for ( auto& window : windows_above )
38403844
{
38413845
if (injected_pid_cache.find (window) == injected_pid_cache.end ())
38423846
{
3847+
if (! game_iconic)
3848+
{
3849+
if (hWndSKIF == 0)
3850+
hWndSKIF = FindWindow (L"SKIF_ImGuiWindow", nullptr);
3851+
if (hWndSKIF == 0)
3852+
hWndSKIF = (HWND)-1;
3853+
else if (dwPidOfSKIF == 0)
3854+
{
3855+
SK_GetWindowThreadProcessId (hWndSKIF, &dwPidOfSKIF);
3856+
}
3857+
}
3858+
38433859
DWORD dwPid = 0x0;
38443860
SK_GetWindowThreadProcessId (window, &dwPid);
38453861

@@ -3850,8 +3866,8 @@ SK_ImGui_UpdateGamepadProcessingEligibility (void)
38503866
OpenEventW (EVENT_ALL_ACCESS, FALSE, wszInjectionSignature)
38513867
);
38523868

3853-
injected_pid_cache [window] =
3854-
hInjectionSignature.isValid ();
3869+
injected_pid_cache [window] = ( (dwPid == dwPidOfSKIF ) ||
3870+
hInjectionSignature.isValid () ) ? dwPid : 0x0;
38553871
}
38563872

38573873
if (! any_injected)
@@ -3878,13 +3894,11 @@ SK_ImGui_UpdateGamepadProcessingEligibility (void)
38783894

38793895
for ( auto& window : windows_above )
38803896
{
3881-
if (IsWindowOverlapping (window, rcVisibleWindow))
3897+
if (IsWindowOverlapping (window, rcVisibleWindow) &&
3898+
injected_pid_cache [window])
38823899
{
3883-
if (injected_pid_cache [window])
3884-
{
3885-
process_input = false;
3886-
break;
3887-
}
3900+
process_input = false;
3901+
break;
38883902
}
38893903
}
38903904
}

0 commit comments

Comments
 (0)