From 8bbc0d6ecd6ae3b5fe6dce356eacace2b6d619dc Mon Sep 17 00:00:00 2001 From: Daniel Martin Date: Tue, 20 Oct 2026 20:23:52 +1000 Subject: [PATCH] hotkeygen: coin on 5 for retroarch, add coin to demul, flycast and cannonball --- .../batocera_launch_flycast/emulator.py | 1 + .../batocera_launch_libretro_mame/controllers.py | 2 +- .../batocera_launch_libretro/cores/dice.py | 5 +++++ .../batocera_launch_libretro/cores/fbneo.py | 2 +- .../batocera_launch_libretro/cores/flycast.py | 2 +- .../batocera_launch_libretro/cores/mame078plus.py | 5 +++++ .../batocera_launch_libretro/emulator.py | 3 +-- .../batocera-launch/batocera_launch/emulators/cannonball.py | 2 +- .../batocera-launch/batocera_launch/emulators/demul.py | 2 +- 9 files changed, 17 insertions(+), 7 deletions(-) diff --git a/python-src/batocera-launch-flycast/batocera_launch_flycast/emulator.py b/python-src/batocera-launch-flycast/batocera_launch_flycast/emulator.py index b89bb759f0a..dfc997815d1 100644 --- a/python-src/batocera-launch-flycast/batocera_launch_flycast/emulator.py +++ b/python-src/batocera-launch-flycast/batocera_launch_flycast/emulator.py @@ -53,6 +53,7 @@ def hotkeygen_context(self) -> HotkeysContext: 'keys': { 'exit': 'KEY_F7', 'menu': 'KEY_TAB', + 'coin': 'KEY_A', 'save_state': 'KEY_F9', 'restore_state': 'KEY_F8', 'fastforward': 'KEY_SPACE', diff --git a/python-src/batocera-launch-libretro-mame/batocera_launch_libretro_mame/controllers.py b/python-src/batocera-launch-libretro-mame/batocera_launch_libretro_mame/controllers.py index f3a0312a3a9..f16c33ce327 100644 --- a/python-src/batocera-launch-libretro-mame/batocera_launch_libretro_mame/controllers.py +++ b/python-src/batocera-launch-libretro-mame/batocera_launch_libretro_mame/controllers.py @@ -157,7 +157,7 @@ def _generate_special_port_element( # Special button input (ie mouse button to gamepad) sequence = _get_input_definition(controller, key, input, controller.index + 1, reversed, 0) if mapping == f'COIN{nplayer}' and nplayer == 1: - sequence = sequence + f' OR KEYCODE_{nplayer}_F{nplayer + 11}' # f12 for player 1 + sequence = sequence + f' OR KEYCODE_{nplayer}_5' config.add_sequence_port( mapping, diff --git a/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/dice.py b/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/dice.py index b1f53dc4ae8..de49e000ffd 100644 --- a/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/dice.py +++ b/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/dice.py @@ -31,6 +31,11 @@ @cached_dataclass class Dice(Core): + def set_config(self, custom_config: LibretroConfig, /) -> None: + super().set_config(custom_config) + + custom_config.set('input_player1_select', 'num5') + def set_core_options(self, core_options: LibretroConfig, /) -> None: # Pointer-as-paddle, simplest mouse setup core_options.set_from_config( diff --git a/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/fbneo.py b/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/fbneo.py index c8bd5a410b7..e90734b9de9 100644 --- a/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/fbneo.py +++ b/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/fbneo.py @@ -44,7 +44,7 @@ def get_command_arguments(self) -> list[str | Path] | None: def set_config(self, custom_config: LibretroConfig, /) -> None: super().set_config(custom_config) - custom_config.set('input_player1_select', 'f12') + custom_config.set('input_player1_select', 'num5') def set_core_options(self, core_options: LibretroConfig, /) -> None: # Diagnostic input diff --git a/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/flycast.py b/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/flycast.py index f412d3dab15..fba94797e8f 100644 --- a/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/flycast.py +++ b/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/flycast.py @@ -43,7 +43,7 @@ def set_config(self, custom_config: LibretroConfig, /) -> None: super().set_config(custom_config) if self.system != 'dreamcast': - custom_config.set('input_player1_select', 'f12') + custom_config.set('input_player1_select', 'num5') @cached_dataclass diff --git a/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/mame078plus.py b/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/mame078plus.py index 5c0930d9ee3..52bee4d559c 100644 --- a/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/mame078plus.py +++ b/python-src/batocera-launch-libretro/batocera_launch_libretro/cores/mame078plus.py @@ -49,6 +49,11 @@ def precalibrate_guns(self) -> None: def map_lightguns(self) -> bool: return self.config.get_bool('lightgun_map') + def set_config(self, custom_config: LibretroConfig, /) -> None: + super().set_config(custom_config) + + custom_config.set('input_player1_select', 'num5') + def set_core_options(self, core_options: LibretroConfig, /) -> None: # Skip Disclaimer and Warnings core_options.set('mame2003-plus_skip_disclaimer', 'enabled') diff --git a/python-src/batocera-launch-libretro/batocera_launch_libretro/emulator.py b/python-src/batocera-launch-libretro/batocera_launch_libretro/emulator.py index a7b590c7cad..2890c3bbb8d 100644 --- a/python-src/batocera-launch-libretro/batocera_launch_libretro/emulator.py +++ b/python-src/batocera-launch-libretro/batocera_launch_libretro/emulator.py @@ -163,14 +163,13 @@ def __post_init__(self) -> None: @cached_property def hotkeygen_context(self) -> HotkeysContext: - # f12 for coin : set in libretroMameConfig.py, others in libretroControllers.py return { 'name': 'retroarch', 'keys': { 'exit': ['KEY_LEFTSHIFT', 'KEY_ESC'], 'menu': ['KEY_LEFTSHIFT', 'KEY_F1'], 'pause': ['KEY_LEFTSHIFT', 'KEY_P'], - 'coin': 'KEY_F12', + 'coin': 'KEY_5', 'save_state': ['KEY_LEFTSHIFT', 'KEY_F3'], 'restore_state': ['KEY_LEFTSHIFT', 'KEY_F4'], 'previous_slot': ['KEY_LEFTSHIFT', 'KEY_F5'], diff --git a/python-src/batocera-launch/batocera_launch/emulators/cannonball.py b/python-src/batocera-launch/batocera_launch/emulators/cannonball.py index 5719d716c93..dcd7799b390 100644 --- a/python-src/batocera-launch/batocera_launch/emulators/cannonball.py +++ b/python-src/batocera-launch/batocera_launch/emulators/cannonball.py @@ -57,7 +57,7 @@ def sdl_controller_db_path(self) -> Path: def hotkeygen_context(self) -> HotkeysContext: return { 'name': 'cannonball', - 'keys': {'exit': ['KEY_LEFTALT', 'KEY_F4']}, + 'keys': {'exit': ['KEY_LEFTALT', 'KEY_F4'], 'coin': 'KEY_5'}, } async def configure(self) -> Command: diff --git a/python-src/batocera-launch/batocera_launch/emulators/demul.py b/python-src/batocera-launch/batocera_launch/emulators/demul.py index fbfbfb70d98..f8177d4cc69 100644 --- a/python-src/batocera-launch/batocera_launch/emulators/demul.py +++ b/python-src/batocera-launch/batocera_launch/emulators/demul.py @@ -75,7 +75,7 @@ class Demul(Emulator): def hotkeygen_context(self) -> HotkeysContext: return { 'name': 'demul', - 'keys': {'exit': ['KEY_LEFTALT', 'KEY_F4']}, + 'keys': {'exit': ['KEY_LEFTALT', 'KEY_F4'], 'coin': 'KEY_MINUS'}, } @cached_property