hid: Rewrite shared memory management (#2257)

* hid: Rewrite shared memory management

This entirely rewrite our ancient (and original) HID shared memory
interface to be more usable and accurate.

HID update logics were updated to reflect those changes but should work
still the same way it previously did.

This need heavy testing just in case to avoid possible regressions.

* Silence warnings

* Address gdkchan's comments

* Address Ac_K's comments

* Address one missing nit
This commit is contained in:
Mary 2021-05-02 22:01:30 +02:00 committed by GitHub
parent d278aaa5cd
commit f404c39b7e
77 changed files with 1395 additions and 624 deletions

View file

@ -456,14 +456,14 @@ namespace Ryujinx.Input.HLE
KeyboardInput hidKeyboard = new KeyboardInput
{
Modifier = 0,
Keys = new int[0x8]
Keys = new ulong[0x4]
};
foreach (HLEKeyboardMappingEntry entry in KeyMapping)
{
int value = keyboardState.IsPressed(entry.TargetKey) ? 1 : 0;
ulong value = keyboardState.IsPressed(entry.TargetKey) ? 1UL : 0UL;
hidKeyboard.Keys[entry.Target / 0x20] |= (value << (entry.Target % 0x20));
hidKeyboard.Keys[entry.Target / 0x40] |= (value << (entry.Target % 0x40));
}
foreach (HLEKeyboardMappingEntry entry in KeyModifierMapping)