Touch controls for the web player: joystick, D-pad, shortcut keys and numpad (drop-in index.html)

Inspired by the fact that I couldn’t Play Lufia V and this post

Hi all, this is my first post here.

I wanted the web player to be comfortable on a phone, so I wrote a replacement index.html that adds on-screen touch controls. It only replaces the HTML wrapper; the player files and game data are untouched.

Features

  • Virtual joystick, with an optional four-way D-pad mode
  • Shift, Escape and Enter buttons
  • Shortcut buttons for F1, F12, F and G
  • Expandable numpad
  • Fullscreen button
  • Portrait and landscape layouts
  • The controls hide when no touchscreen is detected or a gamepad is connected

Versions
There are smaller versions for people who don’t need everything: D-pad only, joystick only, and each of those without the numpad. All five are generated from one template with a small Node script.

Customizing
Each control group can be moved and scaled with CSS variables at the top of the file, with separate values for portrait and landscape.

Install
Back up your existing index.html, copy one of the versions over it (renaming it to index.html), and reload the player.

I’ve tested it in Chrome on Android, including through RomM. I haven’t tried iOS or other browsers, so feedback there would be especially useful.

Repo with the README and all versions:

Feedback and bug reports are welcome.