Skip to content

Commit

Permalink
Read disableController setting at boot
Browse files Browse the repository at this point in the history
  • Loading branch information
arielj committed Jun 6, 2022
1 parent 25fe2ad commit e3e08f2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/helpers/gamepad.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IpcRenderer } from 'electron'
import { GamepadActionStatus } from 'src/types'
import { AppSettings, GamepadActionStatus } from 'src/types'
import {
checkGameCube,
checkPS3,
Expand All @@ -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[] = []

Expand Down Expand Up @@ -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`)
}
}
Expand Down

0 comments on commit e3e08f2

Please sign in to comment.