Skip to content

Commit e3e08f2

Browse files
committed
Read disableController setting at boot
1 parent 25fe2ad commit e3e08f2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/helpers/gamepad.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { IpcRenderer } from 'electron'
2-
import { GamepadActionStatus } from 'src/types'
2+
import { AppSettings, GamepadActionStatus } from 'src/types'
33
import {
44
checkGameCube,
55
checkPS3,
@@ -25,6 +25,12 @@ const SCROLL_REPEAT_DELAY = 50
2525
let controllerIsDisabled = false
2626

2727
export const initGamepad = () => {
28+
ipcRenderer
29+
.invoke('requestSettings', 'default')
30+
.then(({ disableController }: AppSettings) => {
31+
controllerIsDisabled = disableController || false
32+
})
33+
2834
// store the current controllers
2935
let controllers: number[] = []
3036

@@ -272,9 +278,9 @@ export const initGamepad = () => {
272278
console.log(`button ${button} pressed ${buttons[button].value}`)
273279
}
274280
for (const axis in axes) {
275-
if (axes[axis] < -0.1 && axes[axis] >= -1)
281+
if (axes[axis] < -0.2 && axes[axis] >= -1)
276282
console.log(`axis ${axis} activated negative`)
277-
if (axes[axis] > 0.1 && axes[axis] <= 1)
283+
if (axes[axis] > 0.2 && axes[axis] <= 1)
278284
console.log(`axis ${axis} activated positive`)
279285
}
280286
}

0 commit comments

Comments
 (0)