This commit is contained in:
redphx 2024-05-26 10:54:32 +07:00
parent 5523be1b7f
commit 030791d9c4

View File

@ -29,9 +29,9 @@ if (btnHome) {
// First time pressing > save current timestamp // First time pressing > save current timestamp
window.BX_EXPOSED.resetControllerShortcut(currentGamepad.index); window.BX_EXPOSED.resetControllerShortcut(currentGamepad.index);
this.bxHomeStates[currentGamepad.index] = { this.bxHomeStates[currentGamepad.index] = {
shortcutPressed: 0, shortcutPressed: 0,
timestamp: currentGamepad.timestamp, timestamp: currentGamepad.timestamp,
}; };
} }
// Listen to next button press // Listen to next button press
@ -48,33 +48,33 @@ if (btnHome) {
if (info.shortcutPressed === 0) { if (info.shortcutPressed === 0) {
const fakeGamepadMappings = [{ const fakeGamepadMappings = [{
GamepadIndex: currentGamepad.index, GamepadIndex: currentGamepad.index,
A: 0, A: 0,
B: 0, B: 0,
X: 0, X: 0,
Y: 0, Y: 0,
LeftShoulder: 0, LeftShoulder: 0,
RightShoulder: 0, RightShoulder: 0,
LeftTrigger: 0, LeftTrigger: 0,
RightTrigger: 0, RightTrigger: 0,
View: 0, View: 0,
Menu: 0, Menu: 0,
LeftThumb: 0, LeftThumb: 0,
RightThumb: 0, RightThumb: 0,
DPadUp: 0, DPadUp: 0,
DPadDown: 0, DPadDown: 0,
DPadLeft: 0, DPadLeft: 0,
DPadRight: 0, DPadRight: 0,
Nexus: 1, Nexus: 1,
LeftThumbXAxis: 0, LeftThumbXAxis: 0,
LeftThumbYAxis: 0, LeftThumbYAxis: 0,
RightThumbXAxis: 0, RightThumbXAxis: 0,
RightThumbYAxis: 0, RightThumbYAxis: 0,
PhysicalPhysicality: 0, PhysicalPhysicality: 0,
VirtualPhysicality: 0, VirtualPhysicality: 0,
Dirty: true, Dirty: true,
Virtual: false, Virtual: false,
}]; }];
const isLongPress = (currentGamepad.timestamp - info.timestamp) >= 500; const isLongPress = (currentGamepad.timestamp - info.timestamp) >= 500;
const intervalMs = isLongPress ? 500 : 100; const intervalMs = isLongPress ? 500 : 100;