mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 23:57:19 +02:00
Show gamepad's vibration status in Toast
This commit is contained in:
parent
2a104cef24
commit
63f6db443a
@ -11876,6 +11876,7 @@ MkbHandler.setupEvents();
|
|||||||
|
|
||||||
// Show a toast when connecting/disconecting controller
|
// Show a toast when connecting/disconecting controller
|
||||||
function showGamepadToast(gamepad) {
|
function showGamepadToast(gamepad) {
|
||||||
|
console.log(gamepad);
|
||||||
let text = '🎮';
|
let text = '🎮';
|
||||||
|
|
||||||
if (getPref(Preferences.LOCAL_CO_OP_ENABLED)) {
|
if (getPref(Preferences.LOCAL_CO_OP_ENABLED)) {
|
||||||
@ -11885,7 +11886,14 @@ function showGamepadToast(gamepad) {
|
|||||||
// Remove "(STANDARD GAMEPAD Vendor: xxx Product: xxx)" from ID
|
// Remove "(STANDARD GAMEPAD Vendor: xxx Product: xxx)" from ID
|
||||||
const gamepadId = gamepad.id.replace(/ \(.*?Vendor: \w+ Product: \w+\)$/, '');
|
const gamepadId = gamepad.id.replace(/ \(.*?Vendor: \w+ Product: \w+\)$/, '');
|
||||||
text += ` - ${gamepadId}`;
|
text += ` - ${gamepadId}`;
|
||||||
const status = gamepad.connected ? t('connected') : t('disconnected');
|
|
||||||
|
let status;
|
||||||
|
if (gamepad.connected) {
|
||||||
|
const supportVibration = !!gamepad.vibrationActuator;
|
||||||
|
status = (supportVibration ? '✅' : '❌') + ' ' + t('vibration-status');
|
||||||
|
} else {
|
||||||
|
status = t('disconnected');
|
||||||
|
}
|
||||||
|
|
||||||
Toast.show(text, status, {instant: false});
|
Toast.show(text, status, {instant: false});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user