[HID] Added keyboard_user_index cvar

This commit is contained in:
NicknineTheEagle 2024-06-19 11:20:13 +03:00 committed by Radosław Gliński
parent 5610116131
commit 738c8dbd11
1 changed files with 7 additions and 4 deletions

View File

@ -25,6 +25,9 @@
#include "winkey_binding_table.inc"
#undef XE_HID_WINKEY_BINDING
DEFINE_int32(keyboard_user_index, 0, "Controller port that keyboard emulates",
"HID.WinKey");
namespace xe {
namespace hid {
namespace winkey {
@ -101,7 +104,7 @@ X_STATUS WinKeyInputDriver::Setup() { return X_STATUS_SUCCESS; }
X_RESULT WinKeyInputDriver::GetCapabilities(uint32_t user_index, uint32_t flags,
X_INPUT_CAPABILITIES* out_caps) {
if (user_index != 0) {
if (user_index != cvars::keyboard_user_index) {
return X_ERROR_DEVICE_NOT_CONNECTED;
}
@ -123,7 +126,7 @@ X_RESULT WinKeyInputDriver::GetCapabilities(uint32_t user_index, uint32_t flags,
X_RESULT WinKeyInputDriver::GetState(uint32_t user_index,
X_INPUT_STATE* out_state) {
if (user_index != 0) {
if (user_index != cvars::keyboard_user_index) {
return X_ERROR_DEVICE_NOT_CONNECTED;
}
@ -238,7 +241,7 @@ X_RESULT WinKeyInputDriver::GetState(uint32_t user_index,
X_RESULT WinKeyInputDriver::SetState(uint32_t user_index,
X_INPUT_VIBRATION* vibration) {
if (user_index != 0) {
if (user_index != cvars::keyboard_user_index) {
return X_ERROR_DEVICE_NOT_CONNECTED;
}
@ -247,7 +250,7 @@ X_RESULT WinKeyInputDriver::SetState(uint32_t user_index,
X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
X_INPUT_KEYSTROKE* out_keystroke) {
if (user_index != 0) {
if (user_index != cvars::keyboard_user_index) {
return X_ERROR_DEVICE_NOT_CONNECTED;
}