How do I exit a game? Why doesn't the back button work?

I’ve been playing with classic game emulators for many years, so I’m not really a noob to emulation, but only last week decided to finally take the plunge and start playing with them on Android.

I’ve purchased a MOGA Hero Power bluetooth game controller, and installed RetroArch and the Gamesome front end. I’ve managed to get RetroArch to load and play games through Gamesome, and with the controller in HID mode it’s recognized, and the default controller mappings work fine for me. So all that is working great and I can play games.

I have two problems though:

(1) I can’t figure out how to exit a game! Yes, if I leave the default “retropad” overlay enabled, I can bring that up, hit menu, and from there eventually navigate my way to “Quit RetroArch”, which gets me back to Gamesome, but there’s got to be an easier way to exit a game than this? Also, if I disable the overlay (which I’d like to do, since I’m using a physical gamepad), then there’s NO way that I can find to exit. (Other than pulling up Android’s recent apps list and killing Retroarch, then manually switching focus back to Gamesome. Again, there’s GOT to be an easier way than that?)

I’ve figured out that I can map “Quit RetroArch” to a button on the controller, but then I lose the ability to use that button for anything else (plus I may hit it accidentally while playing.) Shouldn’t it be possible to just hit the Android “back button” or something similar to exit a game? I’ve been looking high and low for a solution to this and haven’t been able to find one. I’ve gotten so desperate that I’ve even tried creating my own custom overlay that would implement a “quit” button (and nothing else), but am running into some problems there (I can’t get RetroArch to recognize my overlay: when I try to navigate to it from within the configuration menu it falsely reports “directory not found”, even though I have the permissions and ownership of my overlay directory and files set exactly the same as the other overlay directories and files.)

(2) The Android back button doesn’t work. At all. I mean nowhere in the menus, etc. I realize there’s an on-screen “back” button in the menus, and so I’m able to navigate around using that, but this is the only app I’ve ever used in all my years with Android that doesn’t use the back button. Is this an issue with RetroArch on my particular phone (Samsung J7), or am I doing something wrong, or is it really supposed to be this way? It seems broken.

Thanks for any help or suggestions!

I forget why we stopped using the back button for navigation, but I think it was because certain devices do weird things with them… Anyway, the best options are to:

A.) map the menu to a button. If you’re running low on available buttons, you can use the “hotkey enabler” (or whatever it’s called) in settings > input > hotkey binds, which makes RetroArch only listen for its own commands (i.e., only the core listens) unless that button is held. You still lose the original button, but the rest of your buttons can have their original function and a hotkey function at the same time.

B.) use the “immerse” overlay (I think it’s in the ‘misc’ subdirectory of the overlays). It’s designed for use with physical gamepads and is invisible until you tap the screen, then it has some nice, big buttons for commonly used functions, including the menu. When you’re done with it, just tap the screen a few times and it will hide itself.

Thanks Hunter,

I actually had tried using the Immerse overlay. That was what inspired me to try creating my own overlay to do what I wanted. I found that even with Immerse it was a cumbersome process though. When I’m in Gamesome to start a Retroarch game all I have to do is select it. To exit the game though, I have to tap the screen, bringing up the Immerse overlay, then tap on those little left-right arrow things (I’m not sure what those are supposed to represent), then tap on the alien, then move down slightly (this may be a bug: if I don’t move down slightly it won’t go into the menu and just goes back to the overlay.) This gets me into the quick menu, and from there I have to tap the back arrow (again, the Android back button doesn’t work.) This finally gets me to the main menu, where I have to scroll down several screens to finally get to “Quit Retroarch” at the very bottom. Ugh.

I really like how MAME4droid does it. They display an “exit” label right on the screen, which you can just tap on to exit (or you can use the Android back button), which gets me right back to the Gamesome menu. From what you’ve said, I’m thinking that creating a custom overlay that looks like MAME4droid is probably the way I should go. Here’s a screenshot showing what I mean:

Any idea why Retroarch is telling me the directory is not found when I try to navigate to my custom overlay? The directory is there, and has the same ownership and permissions as the “Immerse” overlay, which I started with as a template. As you can see in these screenshots, I named it “basic”, and have a directory for it in the “misc” directory, right next to “immerse”, but when I tap on it, I get “directory not found”:

root@universal7870:/data/data/com.retroarch/overlays/misc # ls -l
total 8
drwx------    2 u0_a191  u0_a191       4096 Oct  9 22:58 basic
drwx------    2 u0_a191  u0_a191       4096 Oct  9 19:55 immerse
root@universal7870:/data/data/com.retroarch/overlays/misc # cd basic
root@universal7870:/data/data/com.retroarch/overlays/misc/basic # ls -l
total 12
-rw-------    1 u0_a191  u0_a191        160 Oct 10 00:39 basic.cfg
-rw-------    1 u0_a191  u0_a191       7669 Oct  9 22:58 basic.png
root@universal7870:/data/data/com.retroarch/overlays/misc/basic # cat basic.cfg
overlays = 1
overlay0_overlay = basic.png
overlay0_full_screen = true
overlay0_name = "basic0"
overlay0_descs = 1
overlay0_desc0 = "quit,0.0,0.0,rect,1.0,1.0"

The overlays are, by default, put into the app’s directory in /data/data/com.retroarch, which isn’t user-accessible. If you want to edit your own overlay, create a new directory in user-writeable storage/RetroArch and then go to settings > directory and point your overlay directory to it. Then, go to the online updater and re-fetch the overlays. That will put them all in that user-writeable directory where you can access them.

Awesome, thanks again. I had thought that since the phone was rooted and I could write files to /data/data/com.retroarch and set their ownership and permission that it wouldn’t matter, but you’re right, by moving the directory to the emulated storage directory, I’m now able to get it to load.

So I now have my custom overlay loaded, and it looks like I’m almost there. It won’t actually exit though. No doubt this is because I’m using the wrong button name. In the overlay docs at https://buildbot.libretro.com/docs/specs/overlay/ it says:

button corresponds to the input event being generated. The names are the same as in the general input config, e.g. input_player1_start would translate to start here. overlay_next is a special bind designed to swap to the next overlay, or wrap around to the first one. Button nul means no input.

For an up-to-date view of what buttons are called, check the input_config_key_map variable in: https://github.com/libretro/RetroArch/blob/master/input/input_keymaps.c.

That doesn’t make sense to me though. The referenced source file seems to just list actual keyboard key names (i.e. escape, f1, a, b, c, etc.) while the overlay file seems to be looking for the input event name, i.e. “load”, “save”, “start”, etc. I took a wild guess and used “quit” but that’s obviously not right. I’ve done some searching but can’t find anything that lists the input event names. Any pointers?

Hmm, maybe try one of these:

I made a super minimal overlay for exactly this purpose. It just opens or closes the menu when you tap anywhere on the screen.

Thanks Miles. I’d love to try it, but Mega says that the link is invalid. :frowning:

It sounds like exactly what I’m looking for.

Thanks Hunter. Unfortunately, I still can’t get it to work. :frowning:

It’s not clear to me whether the left-hand or right-hand label from that file is the one I should use, but I tried both, and can’t get either to work. Can you see anything wrong with the following three .cfg files I’ve tried to use? For testing, I’m just trying to create a rectangle mapped to cover the entire screen, mapped to exit the emulator. When I use this overlay, my png is displayed properly, but touching the screen does nothing. Thanks again:

overlays = 1 overlay0_overlay = basic.png overlay0_full_screen = true overlay0_name = “basic0” overlay0_descs = 1 overlay0_desc0 = “exit_emulator,0.0,0.0,rect,1.0,1.0”

overlays = 1 overlay0_overlay = basic.png overlay0_full_screen = true overlay0_name = “basic0” overlay0_descs = 1 overlay0_desc0 = “QUIT_KEY,0.0,0.0,rect,1.0,1.0”

overlays = 1 overlay0_overlay = basic.png overlay0_full_screen = true overlay0_name = “basic0” overlay0_descs = 1 overlay0_desc0 = “RARCH_QUIT_KEY,0.0,0.0,rect,1.0,1.0”

My guess would have been ‘exit_emulator’, but the coordinates are also the centerpoint of the virtual button, so change the 0.0,0.0 to 0.5,0.5 to move it to the true center. The sizes are also expressed in radii rather than absolute size, so change the size to 0.5,0.5, as well.

This stuff may not make any difference, but just to make sure.

Sorry about that. The file inexplicably recieved a copyright violation notice and was taken down. Just copy the following text and save it as a .cfg file.

overlays = 1

overlay0_full_screen = true

overlay0_normalized = true

overlay0_descs = 1

overlay0_desc0 = “menu_toggle,0.5,0.5,rect,1,1”

Thanks again Hunter. Well, as it turned out there were several things wrong with my cfg file. I went back and read the overlay documentation page more carefully. To use normalized coordinates the line “overlay0_normalized = true” is needed. I didn’t have that, so I was defaulting to pixel coordinates, basically limiting my touch area to a single pixel. As you mentioned, I also wasn’t specifying the centerpoint, I was specifying the top-left, and I was using absolute sizes, rather than the radii. Now that I’ve got all that fixed, it’s working with “exit_emulator”. Perfect! (Although in the end I went back to pixel coordinates, as it was easier to line up with the image I had created in Photoshop.)

Here’s my complete file now, for reference:

overlays = 1

overlay0_overlay = basic.png

overlay0_full_screen = true

overlay0_name = “basic0”

overlay0_descs = 1

overlay0_desc0 = “exit_emulator,85,95,rect,65,30”

Game on! :grin:

1 Like

Thanks! I ended up basically doing that, but using “exit_emulator” instead of “menu_toggle”, and I decided to just make a button rather than the full screen, so I wouldn’t accidentally hit the screen and exit in the middle of a game. It’s working perfectly now, so I can enter and exit games from Gamesome easily.

Thanks!