andrew / node-xbox-controller

:video_game: [UNMAINTAINED] Interface for Xbox 360 game controller into Node.js
http://libraries.io/npm/xbox-controller
MIT License
270 stars 49 forks source link

requiring xbox-controller crashes electron process #88

Closed s4m2d closed 7 years ago

s4m2d commented 7 years ago

By running it in pure nodeJS environment I didn't expected any issues. But as soon as running it in an wrapper as electron it crashes the whole application. I am not sure were the issue is located, since I am not that deep into the topic.

If you require it in the first lines, electron won't start the process, if you paste it after the window-process is created it crashes.

crash:

const {app, BrowserWindow} = require('electron')
let win

function createWindow () {
  win = new BrowserWindow({fullscreen: true})
  win.loadURL(`file://${__dirname}/game.html`)
  win.webContents.openDevTools()
  win.on('closed', () => {
    win = null
  })
  const XboxController = require('xbox-controller')
}

won't run:

const {app, BrowserWindow} = require('electron')
const XboxController = require('xbox-controller')
let win

function createWindow () {
  win = new BrowserWindow({fullscreen: true})
  win.loadURL(`file://${__dirname}/game.html`)
  win.webContents.openDevTools()
  win.on('closed', () => {
    win = null
  })
}

I am aware that maintaining the electron integrity isn't the focus on this module. But any thought on this would be helpful?

Process:               Electron [4887]
Path:                  /Users/USER/*/Electron.app/Contents/MacOS/Electron
Identifier:            com.github.electron
Version:               1.8.1 (1.8.1)
Code Type:             X86-64 (Native)
Parent Process:        ??? [4886]
Responsible:           Electron [4887]
User ID:               501

Date/Time:             2017-10-03 12:59:22.348 +0200
OS Version:            Mac OS X 10.13 (17A365)
Report Version:        12
Anonymous UUID:        84B02756-DEA9-49D6-0A12-F4E7B4E54B6D

Time Awake Since Boot: 10000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  CrBrowserMain  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000008
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0x8:
andrew commented 7 years ago

I've not actively supported this project in a long time, I'm not even sure if it works at all anymore, have you looked at the web gamepad api: https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API

s4m2d commented 7 years ago

Thanks for answering, The reason to use your module relies on the rumble access which the webAPI isn't capable of. Your module still works very well with xbox360 and One controllers.

The issue is in node-hid, which runs a different node module version than electron. It always fails for electron-rebuild- don't know a solution till yet.

Just wanted to give feedback. Considering this as closed, I will have a detailed look on rebuilding node-hid. Thanks for your time!