-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b6cd038
Showing
7 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.obj | ||
*.exe | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2022 BlueAmulet | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# XInputUWPFix | ||
|
||
Disables the use of a game controller to navigate UWP applications. This program installs a Low Level Keyboard Hook to filter out keyboard events with VK Codes between 0xC3 and 0xDA. | ||
|
||
Download the latest release [here](https://github.com/BlueAmulet/XInputUWPFix/releases/latest) | ||
|
||
Disclaimer: Due to the use of a global hook, antivirus or anti-cheat software may complain about the use of this program. I am not responsible for any issues or damages that may result from the use of this program. | ||
|
||
## Installation | ||
|
||
A `install.bat` and `uninstall.bat` file is provided to add/remove the program to run on startup. | ||
|
||
## Building | ||
|
||
This program is designed to be built with Visual Studio 2022. Open a `x64 Native Tools Command Prompt` and run `build.bat` | ||
|
||
The linker options used are designed to make the exe small. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> | ||
|
||
static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) | ||
{ | ||
if (nCode >= 0) | ||
{ | ||
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT)lParam; | ||
if (p->vkCode >= 195 && p->vkCode <= 218) | ||
{ | ||
return 1; | ||
} | ||
} | ||
return CallNextHookEx(NULL, nCode, wParam, lParam); | ||
} | ||
|
||
void __stdcall EntryPoint(void) | ||
{ | ||
// Prevent application from running multiple times | ||
CreateMutexA(0, FALSE, "Local\\$XInputUWPFix$"); | ||
if (GetLastError() != ERROR_ALREADY_EXISTS) | ||
{ | ||
// Add Low Level Keyboard Hook to filter keyboard messages | ||
HHOOK hhkLowLevelKbd = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, 0, 0); | ||
|
||
// Process messages so hook works | ||
MSG msg; | ||
while (GetMessage(&msg, NULL, 0, 0)) | ||
{ | ||
TranslateMessage(&msg); | ||
DispatchMessage(&msg); | ||
} | ||
|
||
// Cleanup | ||
UnhookWindowsHookEx(hhkLowLevelKbd); | ||
} | ||
ExitProcess(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@cl /O1 XInputUWPFix.c /link /nodefaultlib /subsystem:windows /entry:EntryPoint /debug:none /emitpogophaseinfo /emittoolversioninfo:no /merge:.pdata=.rdata kernel32.lib user32.lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v XInputUWPFix /d "\"%~dp0\XInputUWPFix.exe\"" /f | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v XInputUWPFix /f | ||
pause |