Rename KeyDef to InputMapping and give it responsibility for Axis encoding

This commit is contained in:
Henrik Rydgård 2023-03-29 11:59:31 +02:00
parent 3c9e968ca0
commit d00809ae53
13 changed files with 165 additions and 204 deletions

View file

@ -13,8 +13,8 @@ namespace KeyMap {
struct DefMappingStruct {
int pspKey;
int key;
int direction;
int keyOrAxis;
int direction; // if 0, it's a key, otherwise an axis.
};
static const DefMappingStruct defaultQwertyKeyboardKeyMap[] = {
@ -341,9 +341,9 @@ static const DefMappingStruct defaultVRRightController[] = {
static void SetDefaultKeyMap(int deviceId, const DefMappingStruct *array, size_t count, bool replace) {
for (size_t i = 0; i < count; i++) {
if (array[i].direction == 0)
SetKeyMapping(array[i].pspKey, KeyDef(deviceId, array[i].key), replace);
SetInputMapping(array[i].pspKey, InputMapping(deviceId, array[i].keyOrAxis), replace);
else
SetAxisMapping(array[i].pspKey, deviceId, array[i].key, array[i].direction, replace);
SetInputMapping(array[i].pspKey, InputMapping(deviceId, array[i].keyOrAxis, array[i].direction), replace);
}
g_seenDeviceIds.insert(deviceId);
}