Skip to content

ActingBadly/Key_Jacker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Key_Jacker

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.

Usage

Install: Low-Level Hooking.

// 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);

Mapping keys (See KJ Key Codes in KJ_Controls.h)

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.
);

Reading Key states and dispatching events (Once per loop)

KJ_Controls_Read();

Clearing key maps (Will need to be remapped using KJ_Controls_Map)

KJ_Controls_Reset();

Cleanup

KJ_Uninstall();

Build instructions

AUTOMATED INSTALL (CMAKE)

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
)

About

Key Re-Mapper and Input extension system designed to override key commands of a targeted program

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors