This is a utility that prevents games from pausing/muting on background by making sure the unfocus message doesn't get to it.
This will break some things but uhh
Uses injection since I can't really find any other way to do what I need.
Use this utility at your own risk! This utility uses process injection.
Don't use in multiplayer games, only use in games that actually need it. Be careful which process you inject into, as it could cause a softlock, requiring a restart.
- Launch NoFocusLossGUI.exe
- Press Refresh. This may take a short while.
- From the list on top, select the window name of the game you want to fix. You can also type the name on your keyboard after clicking on any item for it to be selected. Magic!
- Click on Inject
- Enjoy!
To revert the fix, click on the game in the bottom list and click Unload.
Multimonitor users
Magic beyond my comprehension (I will forget how this entire repo works within a week)
Really though, it's just replacing the window's WndProc to block certain messages and detouring calls to GetForegroundWindow and SetCursorPos
- Alt-tab during cutscenes without having to worry about them pausing or muting
- Play games on background using a controller as long as they're using xinput and not Windows.Gaming.Input (Thanks Microsoft)
- Bypass Unity's shit no good very bad input system that makes you unable to use controllers when the game isn't focused, even in VR
- Stops mouse capture by disabling calls to SetCursorPos (which is a dumb way to do capture in the first place)
- For now only affects the main window of the injected program
- Injection, maybe don't use it in multiplayer games
- While active makes it very difficult, if not impossible, to interact with window title bar elements, such as dragging, minimize/maximize and close if the game captures the mouse cursor
- Teardown
- Alan Wake
- Need For Speed 2015 (2016)
- I Expect You To Die 3 (yay, this fixed controller input)
- The Long Dark
- EA's Origin overlay appears frozen, until you try alt-tabbing which forces it to refresh
- Figure out automatic injection?
- Maybe a truly global solution?
- Try to do this with UWP apps (Yeah, good luck)
- Add support for doing this for multiple app windows, and specifying a window you want to do this with other than the supposedly main one
- Maybe add some way to force games that use SetCursorPos for mouse capture to use ClipCursor instead, a counter that would count the amount of SetCursorPos calls per second and then redirect?