added more checks to filter user_index out of range
This commit is contained in:
parent
52ba854e4a
commit
e9c802dfcf
|
@ -30,6 +30,10 @@ X_RESULT InputSystem::GetCapabilities(uint32_t user_index, uint32_t flags,
|
|||
X_INPUT_CAPABILITIES* out_caps) {
|
||||
SCOPE_profile_cpu_f("hid");
|
||||
|
||||
if (user_index && user_index != 0xFF) {
|
||||
return X_ERROR_NO_SUCH_USER;
|
||||
}
|
||||
|
||||
bool any_connected = false;
|
||||
for (auto& driver : drivers_) {
|
||||
X_RESULT result = driver->GetCapabilities(user_index, flags, out_caps);
|
||||
|
@ -46,6 +50,10 @@ X_RESULT InputSystem::GetCapabilities(uint32_t user_index, uint32_t flags,
|
|||
X_RESULT InputSystem::GetState(uint32_t user_index, X_INPUT_STATE* out_state) {
|
||||
SCOPE_profile_cpu_f("hid");
|
||||
|
||||
if (user_index && user_index != 0xFF) {
|
||||
return X_ERROR_NO_SUCH_USER;
|
||||
}
|
||||
|
||||
bool any_connected = false;
|
||||
for (auto& driver : drivers_) {
|
||||
X_RESULT result = driver->GetState(user_index, out_state);
|
||||
|
@ -63,6 +71,10 @@ X_RESULT InputSystem::SetState(uint32_t user_index,
|
|||
X_INPUT_VIBRATION* vibration) {
|
||||
SCOPE_profile_cpu_f("hid");
|
||||
|
||||
if (user_index && user_index != 0xFF) {
|
||||
return X_ERROR_NO_SUCH_USER;
|
||||
}
|
||||
|
||||
bool any_connected = false;
|
||||
for (auto& driver : drivers_) {
|
||||
X_RESULT result = driver->SetState(user_index, vibration);
|
||||
|
@ -80,6 +92,10 @@ X_RESULT InputSystem::GetKeystroke(uint32_t user_index, uint32_t flags,
|
|||
X_INPUT_KEYSTROKE* out_keystroke) {
|
||||
SCOPE_profile_cpu_f("hid");
|
||||
|
||||
if (user_index && user_index != 0xFF) {
|
||||
return X_ERROR_NO_SUCH_USER;
|
||||
}
|
||||
|
||||
bool any_connected = false;
|
||||
for (auto& driver : drivers_) {
|
||||
X_RESULT result = driver->GetKeystroke(user_index, flags, out_keystroke);
|
||||
|
|
|
@ -152,11 +152,12 @@ X_HRESULT_result_t XamUserGetSigninInfo(dword_t user_index, dword_t flags,
|
|||
return X_E_INVALIDARG;
|
||||
}
|
||||
|
||||
std::memset(info, 0, sizeof(X_USER_SIGNIN_INFO));
|
||||
if (user_index && user_index != 0xFF) {
|
||||
return X_E_NO_SUCH_USER;
|
||||
}
|
||||
|
||||
std::memset(info, 0, sizeof(X_USER_SIGNIN_INFO));
|
||||
|
||||
const auto& user_profile = kernel_state()->user_profile();
|
||||
info->xuid = user_profile->xuid();
|
||||
info->signin_state = ((cvars::signin_state) ? 1 : 0);
|
||||
|
|
Loading…
Reference in New Issue