punesemu/puNES

map shortcuts via command line

Closed this issue ยท 16 comments

hello fabio,

thanks for this great emulator.
Right now i can configure a lot via the command line, but what is missing are the input controlls and shortcuts.

Would it be possible to add them as well?

Thanks in regards
bmsuseluda

Hi bmsuseluda, thank you for your frontend ๐Ÿ‘ . Right now I'm implementing NSF2 format support and rewriting the NSF player, but when I finish I can take a look at your request. I still have no idea how I could implement it but I'm open to suggestions.

Based on your input.cfg file i would suggest --shortcut-video-fullscreen Alt+Return,NULL for video fullscreen.
I think with this it would be relatively simple to have a similar structure to your config files.

Another approach could be what other emulators are doing:

ares

https://ares-emu.net/news/ares-v133-released

--setting Hotkey/ToggleFullscreen=0x1/0/2

dolphin

https://wiki.dolphin-emu.org/index.php?title=Help:Contents#Command_Line_Options

--config Dolphin.Display.Fullscreen=True

mednafen

-ss.input.port1 3dpad

duckstation

https://github.com/stenzek/duckstation/wiki/Command-Line-Arguments

DuckStation is a bit limited, but supports a command -settings /path/to/custom/config to load a custom config.

Sadly tho there is no standard, so do what suits you best :)
I hope this helps and do not feel in a hurry. Do your things in your order and your time and it will be great ๐Ÿ‘๏ธ

OK, many thanks for the suggestions, I will keep you updated.

I implemented it (275865a), I could only do the tests with keyboard commands because my two gamepads don't work. If you can do some tests I would be grateful. For shortcuts you need to use the syntax "--shortcut.hard_reset=F11" for the NES pad "--input.p1k_left=Left". The descriptions of the shortcuts can be found in the puNES.cfg file (you must replace the spaces with the underscore) while the descriptions of the NES pad commands can be found in the input.cfg file.

of course i will do ๐Ÿ™‚

i tried to test with the appImage, but unfortunatly the app does not start. I get the following log statements:

ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pulse.so (/usr/lib/libsndfile.so.1: undefined symbol: mpg123_info2)
โ–ถ playback open : No such device or address

I do not know if the problem relates with the appImage in general, because i used the flatpak in the past only.

Is it released as a flatpak already?

ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pulse.so (/usr/lib/libsndfile.so.1: undefined symbol: mpg123_info2)
โ–ถ playback open : No such device or address

Which Linux distribution are you using?

manjaro (arch)

I want to try creating a VM with your distro but I need to know what version of Manjaro you use.

Since Manjaro is a rolling release distro, you can just grab the latest one.

Can you try with the latest appimage? I should have solved it with commit d753cbc.

now it runs. thanks for this fast fix.

I was able to set a shortcut to a gamepad key via command line. This is great.

What i could not get to work is to set a gamepad key to the nes pad. I tried "--input.p1j_start=BTN07" as an example.

Sorry there was a bug that I fixed, get the latest WIP. I have also made other changes that make management clearer, to configure keyboard shortcuts you now have to use the --shortcut.k parameter while for joystick shortcuts --shortcut.j : e.g. --shortcut.k.open=Alt+O or --shortcut.j.hard_reset=BTN05. In a similar way you can also manage the configuration of the NES gamepad : --input.p1k.up=Up or -input.p1j.up=BTN05. You can find the explanation in the -h of the emulator.

i like the new way to configure the keys. It is much simpler. Sadly i do not get the input settings for gamepads to work.

  • --shortcut.j.toggle_gui_in_window=BTN02 works
  • --shortcut.k.toggle_gui_in_window=o works
  • --input.p1k.start=s works
  • --input.p1j.start=BTN03 does not work

I should have solved it with be0c260.

it works ๐ŸŽ‰๐Ÿ‘๏ธ๐Ÿ™‚

Great, thanks so much for the tests.