diff --git a/emscripten-shell.html b/emscripten-shell.html
index 6722c0e..f1ea138 100644
--- a/emscripten-shell.html
+++ b/emscripten-shell.html
@@ -51,10 +51,10 @@
Experimental emscripten build of ccleste.
- - Jump with Z/C
- - Dash with X/V
- - Move with arrow keys
- - Escape to pause
+ - Jump with Z/C/Gamepad A
+ - Dash with X/V/Gamepad B
+ - Move with arrow keys/Gamepad d-pad/Gamepad left stick
+ - Escape/Gamepad start to pause
- Shift+S to save state
- Shift+D to load state
- Hold F9 to reset
diff --git a/sdl12main.c b/sdl12main.c
index 6f96b13..31a3e05 100644
--- a/sdl12main.c
+++ b/sdl12main.c
@@ -394,6 +394,7 @@ static void mainLoop(void) {
}
} else reset_input_timer = 0;
+ buttons_state = 0;
#if SDL_MAJOR_VERSION >= 2
SDL_GameControllerUpdate();
@@ -454,31 +455,18 @@ static void mainLoop(void) {
) {
enable_screenshake = !enable_screenshake;
OSDset("screenshake: %s", enable_screenshake ? "on" : "off");
- }
- //else: fallthrough
- }
- case SDL_KEYUP: {
- int down = ev.type == SDL_KEYDOWN;
- int b = -1;
- switch (ev.key.keysym.sym) {
- case SDLK_LEFT: b = 0; break;
- case SDLK_RIGHT: b = 1; break;
- case SDLK_UP: b = 2; break;
- case SDLK_DOWN: b = 3; break;
- case SDLK_z: case SDLK_c: case SDLK_n: case SDLK_a:
- b = 4; break;
- case SDLK_x: case SDLK_v: case SDLK_m: case SDLK_b:
- b = 5; break;
- default: break;
- }
- if (!TAS && b >= 0) {
- if (down) buttons_state |= (1<