GithubHelp home page GithubHelp logo

ilyaki / protoinput Goto Github PK

View Code? Open in Web Editor NEW
39.0 6.0 9.0 60.16 MB

Proto Input enables split screen on PC games by hooking Windows functions and redirecting input from multiple keyboards/mice/controllers

License: MIT License

C++ 43.93% C 47.72% CMake 0.38% Assembly 0.16% Python 0.10% C# 3.59% Batchfile 0.10% PowerShell 0.09% Makefile 0.40% HTML 2.65% Shell 0.03% Gnuplot 0.01% CSS 0.02% Objective-C 0.14% Objective-C++ 0.68% GLSL 0.01%
cpp windows hooks

protoinput's Introduction

Proto Input

Proto Input is a set of libraries that enables split screen on PC games by hooking Windows functions and redirecting input from multiple keyboards/mice/controllers. ProtoInput contains many improvements over my previous works on Universal Split Screen and ZeroFox's Nucleus Coop Mod. The project is in a modular form so it can be easily used in any project with its C function API.

Proto Input is now included as part of Nucleus Co-Op. This is the best way to use Proto Input, as it is fully scriptable.

The main highlights are:

In-game GUI control interface

The GUI interface can be opened by pressing Right Ctrl + Right Alt + 1/2/3/4... (depending on the instance index). The GUI lets you enable/configure hooks, change input settings, Windows message filters, etc, all without restarting the game, so you can quickly setup a profile.

Proto Input Hooks GUI

Proto Input Host

Proto Input Host is a GUI tool that uses the API interface to set up input and hooks for processes. You can effectively think of this as a souped up Universal Split Screen.

Proto Input Host GUI

Smooth input

Unlike my previous works, ProtoInput performs all input redirection from within the target process using hooks. This gives much smoother input, and better compatibility with games. Additionally I've completely re-written most of the hooks. You should now be able to enable almost all hooks and have input working out of the box.

API interface

ProtoInput is modular by design so it can be used in another project. An external project can inject the ProtoInput hooks into a process by calling the functions in protoloader.h, e.g.

auto path = LR"(C:\WINDOWS\system32\notepad.exe)";
unsigned long pid;

// Use startup injection to create a process and inject the hooks
ProtoInstanceHandle instanceHandle = EasyHookInjectStartup(path, L"", 0, folderpath.c_str(), &pid);

// Let the hooks know it's the 1st index (So open the GUI with Right Ctrl + Right Alt + 1)
SetupState(instanceHandle, 1);

// Install the RegisterRawInput hook
InstallHook(instanceHandle, RegisterRawInputHookID);

// Tell the hooks to send mouse move, button, etc messages
SetupMessagesToSend(instanceHandle, true, true, true, true);

// Start a loop that sends WM_ACTIVATE, WM_ACTIVATEAPP, etc every 5 milliseconds
StartFocusMessageLoop(instanceHandle, 5, true, true, true, true, true);

// The processes was created in a suspended state, so now wake it up
WakeUpProcess(instanceHandle);

The API interface is C-style, so you can call it from almost any language. Some additional functionality (e.g. input locking) is provided in ProtoInputUtil, separate from the hooks.

Some minor things

  • Locking input, so the 'real' mouse/keyboard does nothing, has been greatly improved, notably with suspening explorer.exe so you no longer accidentally alt+tab or open the Start menu.
  • Startup/Runtime hooking has been merged into one. The procedure for each is almost identical in the API.
  • ProtoInput will automatically detect and use a custom cursor if a game has one.
  • I've cleaned up my old Windows message filter system, to give more control over each filter and to be able to block individual messages. Some games are particularly fussy when it comes to filtering messages, so this can be very useful.
  • More injection methods have been added, and some bugs fixed, so you can now inject hooks into games that didn't work before.
  • You can open a console window from within the hooks GUI. This lets you see the debug output without having to open a debug log.
  • (More of a note than an addition) You can attach a debugger to the game in Visual Studio, then set breakpoints/etc inside the hooks when debugging.

protoinput's People

Contributors

ilyaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

protoinput's Issues

Proto Input logo

Project could do with a logo. Maybe something like USS with the double cursors.

Additional mouse buttons don't work

Hi, I have Steelseries Rival 500, which has 10 additional mouse buttons. These do not work with ProtoInput, I tried with Guild Wars 2 and Minecraft, clicking works, but all the other buttons don't do anything. Is there a setting to enable secondary buttons?

Thanks a lot in advance!

Feature request: Command line argument field for startup injection

I'm testing ProtoInput with a game that needs startup injection, but in order to test it interactively in a good way I need to pass a command line argument when the game starts so it starts in windowed mode. As far as I can see this is not supported.
I guess the workaround for now is to connect multiple screens to the PC.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.