Validate NpadId for ActivateVibrationDevice

This commit is contained in:
Dima 2022-11-22 14:53:50 +03:00 committed by Billy Laws
parent 4bdd033354
commit ebcbc5b05b
2 changed files with 4 additions and 3 deletions

View File

@ -83,7 +83,7 @@ namespace skyline::input {
/**
* @brief Checks if the NpadId is valid
*/
bool IsNpadIdValid(NpadId id) {
static bool IsNpadIdValid(NpadId id) {
switch (id) {
case NpadId::Player1:
case NpadId::Player2:

View File

@ -12,6 +12,7 @@ namespace skyline::service::hid {
Result IActiveVibrationDeviceList::ActivateVibrationDevice(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
auto handle{request.Pop<NpadDeviceHandle>()};
if (NpadManager::IsNpadIdValid(handle.id))
if (!handle.isRight)
state.input->npad.at(handle.id).vibrationRight = NpadVibrationValue{};