DSprtn / GTFO_VR_Plugin

A plugin to add full roomscale Virtual Reality support to your favorite game!
MIT License
143 stars 13 forks source link

Fix terminal issues caused by 2022-08-19 patch #42

Closed Nordskog closed 1 year ago

Nordskog commented 1 year ago

What & How

This PR fixes some issues with the terminal keyboard introduced by the 2022-08-19 patch.

Problem # 1: Keyboard stops responding ( except for exit button ) after hitting backspace or the arrow keys.

Dummy_InputHandler, responsible for actions triggered by the keyboards such as InputAction.TerminalDel and InputAction.TerminalUp assumed that getDown() would be called before getState() or getUp(), or at least called at some point.

As of the patch, only getState() and getUp() are queried for these InputActions, resulting in the key being stuck in a down state, breaking the rest of the keyboard.

This was fixed by moving the figure-out-what-the-states-should-be logic to a single shared DummyAction.Evaluate() that is run regardless of whether getDown(), getUp(), or getState() is called.

Problem # 2: The Backspace button doesn't actually do anything anymore.

After fixing the above problem the keyboard no longer breaks, and the arrow keys that also rely on InputActions work correctly, but, despite being queried, the Backspace key does not actually do anything.

Most likely they moved some logic around and this is now a text input instead of an InputAction, though I haven't decompiled it to confirm.

Solved by having the Backspace button input a \u0008 Backspace character instead of triggering InputAction.TerminalDel

Other changes In addition to these changes, Dummy_InputHandler now defaults to holding the key down for 5 frames before releasing it, instead of a single frame, and Backspace, ESC, and all the Arrow keys now also trigger their corresponding KeyCode.

This may or may not fix a very rare issue where Exit button on the keyboard will not exit the terminal, and you have to use reload/dismiss instead.

DSprtn commented 1 year ago

Nicu!