• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Creating Save States with a Single Button Press

Scheduled Pinned Locked Moved Help and Support
nes30save stateshotkeyremapping
16 Posts 6 Posters 5.4k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K
    Katsu
    last edited by 30 Mar 2017, 19:16

    I've looked though many posts. Searched the docs. But either I can't find the information, or it's out there, and I simply can't apply it to what I want to do. (Likely the latter.)

    What I need is an easy to understand method for creating save states with a single button press for a specific single game. I want to play a PC Engine 2-button game (Lords of Thunder) and specifically have the R shoulder button on my NES30 8bitdo controller be the Create Save State shortcut. Without hitting Select. I don't mind if Select+L Shoulder button is necessary to Load a Save State, but I want to be able to just hit R shoulder button to save quickly. I'm going to try to play Lords of Thunder on Super difficulty for a recorded run through, and I need to be able to save quickly without having to hit Select (the hot key) first. Now, keep in mind that I DO want to have to hit Select+Start to exit the emulator. So, I don't want to completely disable the Select hot key. I just want to map Create Save State to a single R shoulder button and leave the rest the same.

    Any help would be appreciated.

    B 1 Reply Last reply 30 Mar 2017, 20:24 Reply Quote 0
    • B
      backstander @Katsu
      last edited by backstander 30 Mar 2017, 20:24

      @Katsu
      Someone correct me if I'm wrong but I don't think that's possible with a controller. You can do something like this with the keyboard input:
      https://retropie.org.uk/forum/topic/9229/using-a-single-button-to-exit-games/5

      You could set the Save State to the space bar on your keyboard and put your keyboard right by your feet and if you want to save, just hit it with your foot lol!

      K 1 Reply Last reply 30 Mar 2017, 20:38 Reply Quote 0
      • K
        Katsu @backstander
        last edited by 30 Mar 2017, 20:38

        @backstander That's what I've been wondering. If it's even possible to do this with a controller. In short, I want to change Create Save State from"Select+R shoulder button" to just "R shoulder button" while leaving everything else the same. Or, to put it yet another way, I want to have the R shoulder button act as if you're hitting "Select + R shoulder button" at the same time.

        B 1 Reply Last reply 30 Mar 2017, 20:54 Reply Quote 0
        • B
          backstander @Katsu
          last edited by 30 Mar 2017, 20:54

          @Katsu
          Hmmm...if you had a programmable gamepad you could program R shoulder to be both Select+R shoulder buttons at once when pressed.

          I don't know but maybe @mediamogul's Advanced Controller Mappings can accomplish this:
          https://retropie.org.uk/docs/Universal-Controller-Calibration-&-Mapping-Using-xboxdrv/

          https://retropie.org.uk/forum/topic/2861/guide-advanced-controller-mappings

          1 Reply Last reply Reply Quote 0
          • K
            Katsu
            last edited by Katsu 30 Mar 2017, 21:49

            Hmmm. Taking a look at that now... Seems like xboxdrv can emulate pressing a keyboard key on a controller, but it will still take two keyboard keys to create a save state. Alt+F2, so that still leaves me hitting two keys to create a save file.

            The reason I need a single button, R, to save is that when I'm playing a face paced shooting game like Lords of Thunder on Super hard difficulty, I want to just hit the R button and not stop what I'm doing to hit Select+R. Timing is crucial in shooters. Letting go of the fire button isn't a good option.

            1 Reply Last reply Reply Quote 0
            • D
              Danorak1981
              last edited by Danorak1981 30 Mar 2017, 21:59

              Just a thought, could you not set the left shoulder button as the hotkey and the right to save the state? I don't know about you, but my index fingers naturally 'hover' over those when playing anything, and that way you can keep your thumbs on the d-pad and buttons without having to locate the select button without looking...

              Restored SNES UK Boxart
              RPi Modified Case to fit PowerBlock

              K 1 Reply Last reply 31 Mar 2017, 19:04 Reply Quote 0
              • K
                Katsu @Danorak1981
                last edited by 31 Mar 2017, 19:04

                @Danorak1981 That's funny. I was thinking of this very same things as my backup workaround to this problem. I'll probably set it that way for the meantime (L being my hotkey instead of Select), but I'd really like to figure out a way to do this properly.

                It's strange. Retroarch is so customizable, but it won't let you just hit a button or combination of buttons that you'd like to perform actions like this. It would be nice to have it prompt you to hit the button or buttons you'd like to perform whatever action. Kind of how it does when you set up a new controller in Emulation Station.

                Anyway, if anyone has the solution or workaround to this, I'd be very happy to know it!

                1 Reply Last reply Reply Quote 0
                • E
                  etheling
                  last edited by 9 Jul 2020, 07:02

                  I was scratching my head with this same problem with RetroPie 4.6. E.g. how to trigger save state with single keypad button press (right shoulder).

                  It appears that with 4.6 you can go to 'RetroArch Settings (F1) -> Settings -> Input -> Hotkey binds -> Load|Save State' and simply press the controller button that you with to assign this functionality. Alternatively setting following settings in /opt/retroarch/config/all/retroarch.cfg will do the trick:

                  input_load_state_btn = "4"
                  input_save_state_btn = "5"

                  To find which buttons (e.g. 4,...) to assign here, use jstest /dev/input/js0 (or js1,...).

                  What is really important is that for any of this to work input_enable_hotkey = must NOT be set in retroarch.cfg or for any configured gamepad. If it is set anywhere, then RetroArch (very annoyingly if I may) will require you to also hold the hotkey in addition of gamepad button or keyboard key. E.g. make sure that retroarch.cfg has 'input_enable_hotkey ="nul"' in it. After this, also keyboard key bindings work by just pressing e.g. F2 to save state without the need to hold down another key.

                  So to sum it up - as long as 'input_enable_hotkey =" is NOT set anywhere, with RetroPie 4.6 single key/button press hotkeys work beautifully!

                  M 1 Reply Last reply 12 Jul 2020, 03:10 Reply Quote 0
                  • M
                    M0dd3r4t0R @etheling
                    last edited by 12 Jul 2020, 03:10

                    @etheling Have been waiting the longest time for this answer! I have modified the retroarch.cfg and <gamepad>.cfg to reflect 'input_enable_hotkey ="nul" like you suggested! And the one button press for save states and load states do work!!! BUT - with the hotkey now in the "nul" state, I am not able to perform the exit command through <start> + <select(hotkey)> button presses. Am I missing something? Thanks in advance!

                    E 1 Reply Last reply 13 Jul 2020, 07:12 Reply Quote 0
                    • M
                      mitu Global Moderator
                      last edited by 12 Jul 2020, 03:25

                      @M0dd3r4t0R said in Creating Save States with a Single Button Press:

                      BUT - with the hotkey now in the "nul" state, I am not able to perform the exit command through <start> + <select(hotkey)> button presses. Am I missing something?

                      Yes, you're missing the Hotkey. Once you've un-set it, no hotkey combination will work - pressing only Start should exit the game.

                      M E 2 Replies Last reply 12 Jul 2020, 05:46 Reply Quote 0
                      • M
                        M0dd3r4t0R @mitu
                        last edited by 12 Jul 2020, 05:46

                        @mitu Thanks for chipping in bro. However, with the hotkey unset, the Start button still performs as it should though, for my case at least.
                        Leaving the hotkey unset, what I did afterwards was to bind Exit, Load State and Save State to 3 separate buttons. <CFG details below>.
                        This meant that the hotkey was no longer required for these regularly used functions. But strangely enough, only exit and load state buttons work, save state does not.
                        I have double checked with jstest to make sure i got the numerals correct, but I still fail in identifying what went wrong. Just when I thought I had a solution to the earlier problem - only to hit another wall with a new one. HA!

                        input_device = "DragonRise Inc. Generic USB Joystick "
                        input_driver = "udev"
                        input_l_btn = "4"
                        input_save_state_btn = "6"
                        input_load_state_btn = "8"

                        input_start_btn = "10"
                        input_exit_emulator_btn = "9"
                        input_down_axis = "+1"
                        input_r_btn = "5"
                        input_right_axis = "+0"
                        input_state_slot_increase_axis = "nul"
                        input_select_btn = "11"
                        input_left_axis = "-0"
                        input_state_slot_decrease_axis = "nul"
                        input_l2_btn = "nul"
                        input_up_axis = "-1"
                        input_a_btn = "0"
                        input_b_btn = "1"
                        input_reset_btn = "nul"
                        input_enable_hotkey_btn = "nul"
                        input_x_btn = "2"
                        input_menu_toggle_btn = "nul"
                        input_y_btn = "3"

                        M 1 Reply Last reply 12 Jul 2020, 06:10 Reply Quote 0
                        • M
                          mitu Global Moderator @M0dd3r4t0R
                          last edited by 12 Jul 2020, 06:10

                          @M0dd3r4t0R said in Creating Save States with a Single Button Press:

                          This meant that the hotkey was no longer required for these regularly used functions. But strangely enough, only exit and load state buttons work, save state does not.

                          This contradicts what you said earlier:

                          And the one button press for save states and load states do work!!!

                          Your configuration has save/load inputs bound, but they're not the same buttons as input_l_btn or input_r_btn.

                          M 1 Reply Last reply 12 Jul 2020, 06:29 Reply Quote 0
                          • M
                            M0dd3r4t0R @mitu
                            last edited by 12 Jul 2020, 06:29

                            @mitu said in Creating Save States with a Single Button Press:

                            larly used functions. But strangely enough, only exit and load state buttons work, save state does not.

                            This contradicts what you said earlier:

                            And the one button press for save states and load states do work!!!

                            Your configuration has save/load inputs bound, but they're not the same buttons as input_l_btn or input_r_btn.

                            Apologies for the confusion. The earlier configuration I had save and load mapped to other buttons, all worked except the hotkey - thus not being able to exit the game.

                            For the latest config, I attempted to map EXIT to a single button, and have save state mapped to button "6", but the latter didnt work upon.

                            Being someone new to the scene, I have difficulty understanding " Your configuration has save/load inputs bound, but they're not the same buttons as input_l_btn or input_r_btn.". I'm embarrassed to have to request for a simpler explanation. Thanks in advance! :)

                            1 Reply Last reply Reply Quote 0
                            • M
                              mitu Global Moderator
                              last edited by 12 Jul 2020, 06:36

                              @M0dd3r4t0R said in Creating Save States with a Single Button Press:

                              For the latest config, I attempted to map EXIT to a single button, and have save state mapped to button "6", but the latter didnt work upon.

                              6 is an input code that is tied to a button, but your configuration doesn't have any other button using to this code, so it may not be a valid input code.

                              The RetroPie gamepad auto-configuration will read the input codes for the buttons you choose during the input configuration and generate a .cfg where Save/Load are bound to the L/R shoulder buttons.
                              In your configuration, input_r_btn is mapped to 5, so pressing L to load a save state will not work. The same for input_l_btn , which is mapped to 4, but your save button is mapped to 6. If you want to use the L and R shoulder buttons for Save/Load, the input codes for save/load should be identical to the ones for L/R.

                              1 Reply Last reply Reply Quote 0
                              • E
                                etheling @M0dd3r4t0R
                                last edited by etheling 13 Jul 2020, 07:12

                                @M0dd3r4t0R Right. I should have pointed out that after disabling hotkey, exit (and other) gamepad button combinations cease to work. That was a problem for me too so I ended up writing:

                                URL: https://github.com/etheling/vkbdd

                                I also wanted to exit game from the controller (which I 'solved' that originally by just ssh:ing to RetroPie and sending SIGTERM to RetroArch. ;) ). And toggle FPS, slow motion, shaders etc. via arbitrary button combinations from gamepad. Which to my knowledge is not possible with stock RetroPie (xboxdrv can be used to achieve this too, but...).

                                To achieve this I wrote a little daemon (vkbdd - GitHub link above has some documentation and install instructions) that acts as a virtual keyboard device on RetroPie. When combined with triggerhappy daemon, you can now trigger events from gamed pad that require dual keypress (or triple). As an example, here is triggerhappy config that assigns (on Xbox 360 controller) select+start to send ESC to exit emulator, and left analog stick + (X|B|Y) respectively to next/prev shader, and to FPS display toggle.

                                pi@retropie:~ $ cat /etc/triggerhappy/triggers.d/vkbdd-retropie.conf
                                ## xbox 360 wired controller
                                BTN_SELECT+BTN_START		1	/usr/bin/printf '\033' > /tmp/vkbdd.fifo # ESC / exit emulator
                                BTN_THUMBL+BTN_B		1	/usr/bin/printf m > /tmp/vkbdd.fifo # next shader
                                BTN_THUMBL+BTN_NORTH		1	/usr/bin/printf n > /tmp/vkbdd.fifo # prev shader
                                BTN_THUMBL+BTN_WEST		1	/usr/bin/printf '\214' > /tmp/vkbdd.fifo # F3 fps on/off
                                

                                As emphasized before, to be able to use these single key/button hotkeys (and /w vkbdd and triggerhappy to handle button combinations), 'input_enable_hotkey =" must NOT be set anywhere.

                                I hope this was helpful and if you try vkbdd, let me know if I should update / improve the docs. I wrote it mostly for myself to be able to solve the problem that you also bumped into (single button hotkeys work, but not combinations after 'input_enable_hotkey ="), so I didn't put a lot of emphasis on documentation. What took me down this rabbit hole was that I did a build of RetroPie inside Atari 2600 and I had to get the switches on Atari working without having to press hotkey somewhere else (https://retropie.org.uk/forum/topic/27120/atari-2600-4-switch-woodgrain-housing-for-retropie).

                                If you're not familiar with triggerhappy, it's installed and running by default on RetroPie 4.6 and here is the package documentation: https://packages.debian.org/sid/triggerhappy . After updating triggerhappy config, you should restart the daemon with 'sudo systemctl restart triggerhappy.service' (as in RetroPie 4.6) for the new config to take effect. In order to find correct BTN_ events for creating triggerhappy config for a given gamepad, use thd on gamepads event* device. For example '$ thd --dump /dev/input/event0' assuming gamepad is registered as event0.

                                edit: evtest --> thd example fix

                                1 Reply Last reply Reply Quote 0
                                • E
                                  etheling @mitu
                                  last edited by etheling 13 Jul 2020, 08:45

                                  @mitu said in Creating Save States with a Single Button Press:

                                  pressing only Start should exit the game.

                                  My experience with (retropie 4.6) is that (luckily) it doesn't. Which at least for my purposes is good. Should this change at some future version, then if 'input_enable_hotkey =" and single press hotkeys are what's desired, then one would need to change that mapping in RetroArch configurations somewhere to avoid exiting emulator when Start is pressed. (it's almost like the old joke on Windows - you press start to to stop/exit ;-) ).

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post

                                  Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                  Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.

                                    This community forum collects and processes your personal information.
                                    consent.not_received