Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamepads broken in 1.38.22 #7840

Closed
dos1 opened this issue Jan 10, 2019 · 10 comments
Closed

Gamepads broken in 1.38.22 #7840

dos1 opened this issue Jan 10, 2019 · 10 comments
Labels

Comments

@dos1
Copy link

@dos1 dos1 commented Jan 10, 2019

exception thrown: TypeError: Cannot read property 'length' of undefined
    at _emscripten_get_num_gamepads (http://localhost:8000/odglos.js:1:318521)
@juj
Copy link
Collaborator

@juj juj commented Jan 10, 2019

Have you called emscripten_sample_gamepad_data() function? See #7673 and https://groups.google.com/d/msg/emscripten-discuss/khBHudPFtUA/lqHpVwvpBQAJ

@dos1
Copy link
Author

@dos1 dos1 commented Jan 10, 2019

I should have said that I got that with SDL2 from emscripten-ports ;)

@Daft-Freak
Copy link
Contributor

@Daft-Freak Daft-Freak commented Jan 10, 2019

I just hit this myself. Looks like we need to call that in here and here.

dos1 added a commit to dos1/SDL2 that referenced this issue Jan 11, 2019
@dos1
Copy link
Author

@dos1 dos1 commented Jan 11, 2019

emscripten-ports/SDL2@2092bef does help :)

@Daft-Freak
Copy link
Contributor

@Daft-Freak Daft-Freak commented Jan 14, 2019

Did you test it with a gamepad? (That's on a branch because I couldn't find one).

@Beuc
Copy link
Contributor

@Beuc Beuc commented Jan 20, 2019

With or without the patch, I now get:

TypeError: JSEvents.lastGamepadState is undefined

I don't have time to track down right now, but I guess I'll have to.

(This is a quite ugly breakage, please consider a deprecation phase to avoid busting everybody's intermediate libs/frameworks, I see Godot seems also impacted godotengine/godot#25100 :/)

Daft-Freak added a commit to Daft-Freak/emscripten that referenced this issue Jan 21, 2019
See emscripten-ports/SDL2@version_15...version_16. Just a few fixes, the most important being the one for emscripten-core#7840. (Otherwise you get an exception on `SDL_Init` with `SDL_INIT_GAMECONTROLLER`)
kripken added a commit that referenced this issue Jan 21, 2019
See emscripten-ports/SDL2@version_15...version_16. Just a few fixes, the most important being the one for #7840. (Otherwise you get an exception on SDL_Init with SDL_INIT_GAMECONTROLLER)
@Beuc
Copy link
Contributor

@Beuc Beuc commented Jan 22, 2019

Did you test it with a gamepad? (That's on a branch because I couldn't find one).

I reproduced the first error in my FreeDink port. I could test the patch with a gamepad: things work as before, that is, the joystick gets initialized only once in a while (not sure where that comes from, SDL2 just returns 0 joystick found). But when it gets detected, it works.

I was about to check this other "JSEvents.lastGamepadState is undefined" error but now the OpenGL context doesn't start anymore... Wish me luck :/

@weiyuemin
Copy link

@weiyuemin weiyuemin commented Mar 30, 2019

I encountered the same with Beuc

With or without the patch (https://github.com/emscripten-ports/SDL2/blob/master/src/joystick/emscripten/SDL_sysjoystick.c ), get:
TypeError: Cannot read property 'length' of undefined,TypeError: Cannot read property 'length' of undefined
at _emscripten_get_num_gamepads
...

and in the generated js i see:

function _emscripten_get_num_gamepads() {
return JSEvents.lastGamepadState.length
}

seems JSEvents.lastGamepadState is undefined.

I don't have gamepad connected, and I'm using Chrome 71.0.3573.0

@weiyuemin
Copy link

@weiyuemin weiyuemin commented Mar 30, 2019

well, the error is gone after rebuilding the project.

@stale
Copy link

@stale stale bot commented Mar 29, 2020

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Mar 29, 2020
@stale stale bot closed this Apr 5, 2020
haberbyte added a commit to haberbyte/emscripten that referenced this issue Jan 31, 2021
See emscripten-ports/SDL2@version_15...version_16. Just a few fixes, the most important being the one for emscripten-core#7840. (Otherwise you get an exception on SDL_Init with SDL_INIT_GAMECONTROLLER)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants