mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
service: hid: Don't try to vibrate if device isn't initialized
This commit is contained in:
parent
e04368ad7c
commit
f2012e5aff
3 changed files with 9 additions and 0 deletions
|
@ -373,6 +373,10 @@ Result ResourceManager::SendVibrationValue(u64 aruid,
|
||||||
device = GetNSVibrationDevice(handle);
|
device = GetNSVibrationDevice(handle);
|
||||||
}
|
}
|
||||||
if (device != nullptr) {
|
if (device != nullptr) {
|
||||||
|
// Prevent sending vibrations to an inactive vibration handle
|
||||||
|
if (!device->IsActive()) {
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
result = device->SendVibrationValue(value);
|
result = device->SendVibrationValue(value);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -23,6 +23,10 @@ Result NpadVibrationBase::Deactivate() {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NpadVibrationBase::IsActive() const {
|
||||||
|
return ref_counter > 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool NpadVibrationBase::IsVibrationMounted() const {
|
bool NpadVibrationBase::IsVibrationMounted() const {
|
||||||
return is_mounted;
|
return is_mounted;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
virtual Result Activate();
|
virtual Result Activate();
|
||||||
virtual Result Deactivate();
|
virtual Result Deactivate();
|
||||||
|
|
||||||
|
bool IsActive() const;
|
||||||
bool IsVibrationMounted() const;
|
bool IsVibrationMounted() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue