UE4SS-RE / RE-UE4SS

Injectable LUA scripting system, SDK generator, live property editor and other dumping utilities for UE4/5 games
http://docs.ue4ss.com/
MIT License
1.37k stars 187 forks source link

Port/inputsource: Refactor Abstracted Input Handler #558

Open Yangff opened 5 months ago

Yangff commented 5 months ago

Description

The original Input Handler only accepted input from Win32. In the refactoring we have defined the input source as Input Source, which allows different input sources to be defined for different scenarios. QueueInputSource allows messages from other threads to generate keyboard input and be dispatched and responded to by the process_event thread via the SPSC queue.

Almost all of the definitions remain unchanged, with the only exception that get_events() has been replaced by get_events_safe(), which allows the use of mutex protection when accessing m_key_set.

ModifierKeys are re-implemented using bitwise operations on uint32_t, which simplifies storing and comparing modifier keys.

This PR depends on the string change so you can see those commits...

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Compiled and tested on Palworld, may need extra tests to ensure keys are responsed correctly as I only tested basic ones.

Checklist

Please delete options that are not relevant. Update the list as the PR progresses.

Screenshots (if appropriate)

Additional context

Add any other context about the pull request here.

UE4SS commented 5 months ago

This PR is effectively impossible to review in its current state because it's based on #557. Looking past the #557 changes to try to find what this PR actually changes is not reasonable. My suggestion is to leave it alone for now, and when #557 has been merged, we can rebase this one back onto main to make the review process more sane.