Key input system designed to run code on input states and/or override key commands of a targeted program.
Key_Jacker was used in Wing Loader to handle keypresses and run functions on Press, Hold & Release. It has been modified to provide low-level hooks for inputs to block keypresses underneath re-mapped keys (Keyboard, Mouse & Joystick), added virtual inputs support for Xbox & DualSense controllers allowing for injecting modern control types in older games but also serve as a input standard for applications.
// We need to pass and HINSTANCE and a HWND to make sure to send the signal to the correct window and only when the windows is in focus.
// Enable control methods (Keyboard, Mouse(Untested) & Joystick)
// Xbox & DuelSense Controllers do not need overrides.
#include "Key_Jacker.h"
KJ_Install(HINSTANCE hInstance, HWND targetHwnd, bool EnableKeyboardHook, bool EnableMouseHook, bool EnableJoystickHook);KJ_Controls_Map(KJ_KEY_C,
[]{ onPress Code }, // Fires only once when key is pressed.
[]{ onHold Code }, // Fires repeatedly every loop.
[]{ onRelease Code } // Fires only once when key is released.
);KJ_Controls_Read();KJ_Controls_Reset();KJ_Uninstall();include(FetchContent)
# If you have `Key_Jacker` cloned locally, set `""` to its location to avoid fetching it from GitHub.
set(Key_JackerKey_Jacker_LOCAL_PATH "" CACHE PATH "CACHE_Key_Jacker" FORCE)
if(Key_Jacker_LOCAL_PATH)
FetchContent_Declare(
Key_Jacker
SOURCE_DIR ${Key_Jacker_LOCAL_PATH}
)
else()
FetchContent_Declare(
Key_Jacker
GIT_REPOSITORY https://github.com/ActingBadly/Key_Jacker.git
GIT_TAG main
)
endif()
FetchContent_MakeAvailable(Key_Jacker)
target_include_directories(Key_Jacker PUBLIC ${Key_Jacker_SOURCE_DIR})
target_link_libraries(APP_NAME PRIVATE
Key_Jacker
)