Git Product home page Git Product logo

xmaplib's Introduction

XMapLib

MSBuild

A closer to the metal library for Xbox controller to keyboard and mouse input simulation on Windows

Current Features

  • Mapping of controller input to keyboard and mouse input on Windows.
  • GUI for changing key bindings
  • List of key binding presets to choose from
  • Editable list of key bindings
  • Adjustable mouse sensitivity
  • Toggleable key repeat behavior

Roadmap

  • Lower CPU usage
  • Portable input simulation thread priorities
  • Dep. injected timestamp retrieval, system calls for high res. clock are heavy
  • Make use of polar coordinates instead of scaling cartesian coordinates (PolarCode repo)

Possible Ideas

  • Integrate my PolarCode repo code
  • Portable everything
  • Run as a system service instead of on-demand app
  • Load/Save config files and share them

XMapLibSharp is a C# .NET GUI project using the C++ project code through a DLL. With this approach, the project has access to the entire .NET framework for GUI work while keeping the native performance and power of the C++ XMapLib project code.

The project utilizes

  • .NET multi-threading
  • events
  • programmatic UI element creation
  • a producer/consumer design pattern.
  • managed/native interop via custom C++ DLL

XMap-Lib-gui2 XMap-Lib-gui3

A high level code diagram of the XMapLib project code (native C++) XMapLib-uml

The project utilizes

  • C++ templates
  • Template SFINAE
  • constexpr
  • unit testing with Microsoft CppUnitTestingFramework
  • multi-threading, many threads running concurrently and interacting
  • concurrency synchronization objects, like mutexes and RAII scoped locks
  • C++ standard atomics
  • lambdas, and passing lambdas as arguments
  • usage of several Windows API functions including the XInput lib
  • operator overloads
  • input simulation
  • C++ pointer wrappers like unique_ptr
  • if-constexpr to do compile-time decisions instead of run-time
  • STL containers and algorithms
  • it is a real time system (or very close)
  • lots and lots of object oriented programming

The main classes for use in the native C++ XMapLib project are :

Also, please see the Example

The DLL API exposed from XMapLibDLL is described totally in apifuncs.h in the DLL project.

xmaplib's People

Contributors

calebtt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

xmaplib's Issues

Add initial delay for key-repeat behavior simulating keyboard functionality

Add initial delay for key-repeat behavior simulating keyboard functionality, the values returned by OS API calls were sporadic and with odd behavior, so it wasn't possible to map them directly to simulated input. This led to implementing my own behavior structure for key-presses, which is lacking in this feature.

SendInput spammed, need input queue

I believe there still exists a bug where the single thread that spams the most SendInput calls gets 100% of the calls sent and the other idles. An input queue thread is the way to go.

Store scancode to avoid unnecessary API calls

Store the scancode of a previously retrieved virtual keycode to scancode function call.
There is no reason to spam the Windows API over and over when the info can be safely and easily stored in SendKeyInput

Moving the mouse thumbstick quickly stops key-repeat events being sent by the other thumbstick.

Moving the opposite thumbstick stops key-repeat events being sent by the other thumbstick.

I have tested the behavior of the XInput library with regard to this, and it does indeed stop sending key-repeat events for the opposing thumbstick when the alternate is "activated"/depressed. That alone should not stop the key-repeat events being sent as internally XMapLib uses it's own timer for key-repeat events, there are a few likely possibilities.

-There is a bug in KeyboardTranslator that only sends repeat events when a key-repeat is sent by the XInputLib. [Likely]
-The keyboard input thread is put to sleep while the mouse movement thread occupies most of the CPU time achieving smooth mouse movements.
-Spamming calls to Windows API's SendInput() is causing the repeat events to be dropped. [Tested, ruled out]

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.