From e3e08f2ec22af7486e7d2dcc501ff9340fca4e80 Mon Sep 17 00:00:00 2001 From: Ariel Juodziukynas Date: Sun, 5 Jun 2022 16:31:41 -0300 Subject: [PATCH] Read disableController setting at boot --- src/helpers/gamepad.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/helpers/gamepad.ts b/src/helpers/gamepad.ts index 9ffbe88e10..62407ef16e 100644 --- a/src/helpers/gamepad.ts +++ b/src/helpers/gamepad.ts @@ -1,5 +1,5 @@ import { IpcRenderer } from 'electron' -import { GamepadActionStatus } from 'src/types' +import { AppSettings, GamepadActionStatus } from 'src/types' import { checkGameCube, checkPS3, @@ -25,6 +25,12 @@ const SCROLL_REPEAT_DELAY = 50 let controllerIsDisabled = false export const initGamepad = () => { + ipcRenderer + .invoke('requestSettings', 'default') + .then(({ disableController }: AppSettings) => { + controllerIsDisabled = disableController || false + }) + // store the current controllers let controllers: number[] = [] @@ -272,9 +278,9 @@ export const initGamepad = () => { console.log(`button ${button} pressed ${buttons[button].value}`) } for (const axis in axes) { - if (axes[axis] < -0.1 && axes[axis] >= -1) + if (axes[axis] < -0.2 && axes[axis] >= -1) console.log(`axis ${axis} activated negative`) - if (axes[axis] > 0.1 && axes[axis] <= 1) + if (axes[axis] > 0.2 && axes[axis] <= 1) console.log(`axis ${axis} activated positive`) } }