arianrhodsandlot / nostalgist

A JavaScript library used for running emulators of retro consoles inside browsers.
https://nostalgist.js.org
MIT License
665 stars 19 forks source link

`SELECT`(rshift on keyboard) button not work in nes. #15

Closed daGaiGuanYu closed 10 months ago

daGaiGuanYu commented 10 months ago

I tried Retroassembly, not work too.

daGaiGuanYu commented 10 months ago

Is it possible for you to give me some clues to the source code of keyboard event listener? I might be able to make a little contribution.

arianrhodsandlot commented 10 months ago

Thanks for your willingness to contribute! However, this seems to be an upstream problem that we cannot put any effort into.

The browser keyboard events are handled by RetroArch directly, without being modified by Nostalgist.js. I guess the reason you are encountering this issue is that you are using an IME, and sometimes that can lead to the event.code being modified, while the event.code is used internally by RetroArch.

You can check if you are receiving the expected event.code at keycode.info.

To work around this, you can try to turn off your IME or use another key as the key mapping for the select button. Let's say the quote key ' is being chosen:

await Nostalgist.launch({
  core: 'fceumm',
  rom: 'your-game.nes',
  retroarchConfig: {
    input_player1_select: 'quote',
  },
})
daGaiGuanYu commented 10 months ago

Ooooh, sorry. It works in my another laptop.

But my computor works on keycode.info, wield. thanks for answering.