Add "Xbox button > Press" shortcut

This commit is contained in:
redphx
2024-12-09 17:42:11 +07:00
parent 7206c9e8bc
commit 5381575048
6 changed files with 74 additions and 7 deletions

View File

@@ -57,3 +57,36 @@ export function hasGamepad() {
return false;
}
export function generateVirtualControllerMapping(override: {}={}) {
const mapping = {
GamepadIndex: 0,
A: 0,
B: 0,
X: 0,
Y: 0,
LeftShoulder: 0,
RightShoulder: 0,
LeftTrigger: 0,
RightTrigger: 0,
View: 0,
Menu: 0,
LeftThumb: 0,
RightThumb: 0,
DPadUp: 0,
DPadDown: 0,
DPadLeft: 0,
DPadRight: 0,
Nexus: 0,
LeftThumbXAxis: 0,
LeftThumbYAxis: 0,
RightThumbXAxis: 0,
RightThumbYAxis: 0,
PhysicalPhysicality: 0,
VirtualPhysicality: 0,
Dirty: false,
Virtual: false,
};
return Object.assign({}, mapping, override);
}

View File

@@ -10,6 +10,7 @@ import { EmulatedMkbHandler } from "@/modules/mkb/mkb-handler";
import { RendererShortcut } from "@/modules/shortcuts/renderer-shortcut";
import { TrueAchievements } from "./true-achievements";
import { NativeMkbHandler } from "@/modules/mkb/native-mkb-handler";
import { VirtualControllerShortcut } from "@/modules/shortcuts/virtual-controller-shortcut";
export class ShortcutHandler {
static runAction(action: ShortcutAction) {
@@ -69,6 +70,10 @@ export class ShortcutHandler {
case ShortcutAction.TRUE_ACHIEVEMENTS_OPEN:
TrueAchievements.getInstance().open(false);
break;
case ShortcutAction.CONTROLLER_XBOX_BUTTON_PRESS:
VirtualControllerShortcut.pressXboxButton();
break;
}
}
}

View File

@@ -27,6 +27,8 @@ export const SUPPORTED_LANGUAGES = {
};
const Texts = {
"button-xbox": "Xbox button",
"press": "Press",
"activate": "Activate",
"activated": "Activated",
"active": "Active",