Daijishou icon indicating copy to clipboard operation
Daijishou copied to clipboard

Daijishou can no longer kill RetoArch when launching a new game

Open mattakins opened this issue 1 year ago • 33 comments

Whenever I have a game loaded in RetroArch and I attempt to launch a different one over it through Daijisho, it takes me to a black screen and I have to force quit RetroArch then launch the game again. When I don't have a game previously loaded, Daijisho will launch the game just fine.

With previous versions of RetroArch, I was able to launch new games over previous games using Daijishou. Something changed in recent RetroArch versions that broke the Daijisho kill feature.

Back in RetroArch 1.16.0 (Oct 2 2023), I was able to launch games from Daijisho over a previously loaded game without closing it first. Daijisho effectively kills the previous game and boots the new one. I do not know which specific version broke this functionality as I only have started using newer RetroArch builds recently.

Thanks for your great work. Let me know if there is any other information I can provide.

mattakins avatar Sep 04 '24 07:09 mattakins

Would be best to submit logs because something seems to wrong with your setup. I tested with my Retroid Pocket 2S, normally I close content first with a hotkey before starting a new game. This time, I launched a game, pressed the home button launched a different game and it just worked. Did it 5 times, and no issues at all.

adriansticoid avatar Sep 04 '24 20:09 adriansticoid

Thanks for testing. I did some testing and this issue occurs on my Android 13 device but not my Android 12 device. It works fine on that one. I am using the latest versions of Daijishou and the latest nightly of RetroArch on both devices with clean installs of each. How do I export logs from Daijishou?

mattakins avatar Sep 05 '24 04:09 mattakins

Upon investigating further user reports on Reddit, I am pretty sure this is a compatibility issue with Android 13.

  • https://www.reddit.com/r/EmulationOnAndroid/comments/1bsx03l/retroarch_requiring_manual_close_to_launch/
  • https://www.reddit.com/r/RG556/comments/1d7k4f8/anyone_else_experience_this_from_retroarch_and/

Both of these examples report this same issue on Android 13 devices. The first one also reports not experiencing the issue on his Android 12 device. The Retroid Pocket 2S is Android 11, so it would make sense that this issue wouldn't occur on your device.

mattakins avatar Sep 05 '24 08:09 mattakins

I also have the AYN Odin 2, which is Android 13. I still can't reproduce the issue.

adriansticoid avatar Sep 05 '24 11:09 adriansticoid

Interesting. I don't think it's my setup since I replicated the issue with a clean install of both Daijishou and RetroArch and because of the other examples of the same issue. I am using a Ayaneo Pocket S.

mattakins avatar Sep 06 '24 02:09 mattakins

I also can't replicate this on any of my devices.

A13/Retroid Pocket 4 Pro A9/Retroid Pocket 2 Plus A12/Samsung S10e

Using RetroArch Nightly (c87a88f) Daijishou version 403 (1.4.71)

Recent commits for RetroArch doesn't show any major change on how RetroArch loads on Android. It sounds like something is either wrong in your setup or the device (similar to how the Odin 2 had major issues).

Jetup13 avatar Sep 07 '24 10:09 Jetup13

Thanks for testing. Just had another guy test this on his Pocket S and he experiences this issue as well. Sounds like it's only an issue on certain devices like the Pocket S and RG556. Maybe it's a subset of Android 13 devices as these are the only other reports I can find.

mattakins avatar Sep 09 '24 23:09 mattakins

Odin 2 Mini here. Same issue. It doesn’t matter if Retroarch is running a game or not, I have to fully close Retroarch for Daijosho to launch a game on it. Otherwise it crashes.

Steerwalt avatar Oct 05 '24 22:10 Steerwalt

Odin 2 Mini as well here, same issue. I have an original Odin 2 which does not have this issue.

judd43 avatar Oct 15 '24 06:10 judd43

Same issue on my Retroid Pocket 5 on Android 13, I am using the latest nightly Retroarch.

tailtwo avatar Dec 07 '24 11:12 tailtwo

Make sure to properly quit RetroArch beforehand. You can enable RetroArch to quit when you select close content from quick menu:

RetroArch > Settings > User Interface > Quit on Close Content > CLI > Save Configuration

There's also various Hotkeys you can enable:

RetroArch > Settings > Input > Hotkeys

Pressing Home Button or swiping into Recent Apps beforehand is not considered closing RetroArch properly.

Jetup13 avatar Dec 07 '24 11:12 Jetup13

I am pretty sure the reason Daijishou can't kill Retroarch is because it never ask for the permission to do it. I tried to add the permission manually but got :

kona:/ $ pm grant com.magneticchen.daijishou android.permission.KILL_BACKGROUND_PROCESSES

Exception occurred while executing 'grant':
java.lang.SecurityException: Permission android.permission.KILL_BACKGROUND_PROCESSES requested by com.magneticchen.daijishou is not a changeable permission type
        at com.android.server.pm.permission.PermissionManagerServiceImpl.grantRuntimePermissionInternal(PermissionManagerServiceImpl.java:1392)
        at com.android.server.pm.permission.PermissionManagerServiceImpl.grantRuntimePermission(PermissionManagerServiceImpl.java:1319)
        at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:545)
        at android.permission.PermissionManager.grantRuntimePermission(PermissionManager.java:597)
        at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2546)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:292)
        at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
        at android.os.ShellCommand.exec(ShellCommand.java:38)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:6051)
        at android.os.Binder.shellCommand(Binder.java:1049)
        at android.os.Binder.onTransact(Binder.java:877)
        at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4313)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:6035)
        at android.os.Binder.execTransactInternal(Binder.java:1285)
        at android.os.Binder.execTransact(Binder.java:1244)

I guess it should be added in the app manifest so that it is allowed to kill arbritrary processes by using Android APIs.

tailtwo avatar Dec 07 '24 12:12 tailtwo

Disregard my previous comment, I found how to solve the issue for a Retroarch platform. You have to add the -e QUITFOCUS argument. Issue that helped me : https://github.com/libretro/RetroArch/issues/13551

EDIT : nevermind, it actually quit Retroarch when the app is put in the background. Not really ideal...

tailtwo avatar Dec 07 '24 14:12 tailtwo

Also getting this behavior on my Odin Mini.

Tried completely wiping my setup, both Retroarch and Daijisho, and even with a fresh install it still persists.

h3ckman avatar Jan 16 '25 19:01 h3ckman

I've got the same issue on my Retroid Pocket 5.

NewbulaCo avatar Jan 28 '25 10:01 NewbulaCo

I can reproduce this on Switchroot with Android 15.

korewaChino avatar Feb 18 '25 14:02 korewaChino

Same issue on both my Retroid Pocket 5 with Android 13 and Pixel 7 on Android 15. Daijisho launches the first game no issues but the next game will either be a black screen or sometimes black screen into a not responding popup for Retroarch.

Carter0108 avatar Mar 07 '25 18:03 Carter0108

I am also experiencing this on my Retroid Pocket 5.

mattakins avatar Mar 07 '25 18:03 mattakins

As I've said before, stop using the home button or app switcher and properly quit RetroArch beforehand. Using the home button or app switcher with RetroArch can possibly lead to save data or configuration loss as RetroArch might not get a chance to flush to disk. RetroArch is already a bit funky on Android. This is more of a android issue than a frontend issue.

RetroArch has many ways you can properly close it.

I'd suggest the following -

Enable Quit on Close Content:

RetroArch > User Interface > Quit on Close Content > CLI > Save Configuration

Quick Menu:

RetroArch Quick Menu > Close Content

Hotkeys:

RetroArch > Settings > Hotkeys > Quit, Quit (Controller Combo), or Close Content if (Quit on Close Content is enabled) > Save Configuration

TLDR: Use RetroArch to quit the game

Jetup13 avatar Mar 07 '25 18:03 Jetup13

Why don't I have to do this on my other devices then? What you're suggesting is not a solution to this bug.

mattakins avatar Mar 07 '25 18:03 mattakins

As I've said before, stop using the home button or app switcher and properly quit RetroArch beforehand. Using the home button or app switcher with RetroArch can possibly lead to save data or configuration loss as RetroArch might not get a chance to flush to disk. RetroArch is already a bit funky on Android. This is more of a android issue than a frontend issue.

RetroArch has many ways you can properly close it.

I'd suggest the following -

Enable Quit on Close Content:

RetroArch > User Interface > Quit on Close Content > CLI > Save Configuration

Quick Menu:

RetroArch Quick Menu > Close Content

Hotkeys:

RetroArch > Settings > Hotkeys > Quit, Quit (Controller Combo), or Close Content if (Quit on Close Content is enabled) > Save Configuration

TLDR: Use RetroArch to quit the game

Is there are workarounds but all of them are a lot less convenient. It really takes away from the handheld console experience when you have to start worrying about whether you closed your previous game a specific way.

Carter0108 avatar Mar 07 '25 18:03 Carter0108

Why don't I have to do this on my other devices then? What you're suggesting is not a solution to this bug.

Two devices with Android 13's might not work the same. Especially if the vendor fails to properly configure it. This goes with any device or any Android software. Retroid Pocket 4 Pro has Daijishou properly closes RetroArch. But the Retroid Pocket 5 does not. Both are Android 13.

Another (different) example was the Odin 2. When it came out it was a nightmare for frontends. It had various issues such failing to properly open App's via am start argument or even not loading certain file extensions. This was fixed via OTA from what I gather.

Just use RetroArch to close RetroArch. ES-DE also recommends this. This is also a reason why a lot of people lose RetroArch save data or settings. Properly close RetroArch the way RetroArch wants you to close it.

As I've said before, stop using the home button or app switcher and properly quit RetroArch beforehand. Using the home button or app switcher with RetroArch can possibly lead to save data or configuration loss as RetroArch might not get a chance to flush to disk. RetroArch is already a bit funky on Android. This is more of a android issue than a frontend issue. RetroArch has many ways you can properly close it. I'd suggest the following - Enable Quit on Close Content:

RetroArch > User Interface > Quit on Close Content > CLI > Save Configuration

Quick Menu:

RetroArch Quick Menu > Close Content

Hotkeys:

RetroArch > Settings > Hotkeys > Quit, Quit (Controller Combo), or Close Content if (Quit on Close Content is enabled) > Save Configuration

TLDR: Use RetroArch to quit the game

Is there are workarounds but all of them are a lot less convenient. It really takes away from the handheld console experience when you have to start worrying about whether you closed your previous game a specific way.

Using hotkeys might be the most convenient suggestion I listed.

Unless someone is able to provide exact versions to where Daijishou is closing RetroArch or another frontend closing RetroArch then this is most likely a device vendor issue. This might be why not every device is experiencing this symptom.

Jetup13 avatar Mar 07 '25 20:03 Jetup13

So I can confirm that this same issue happens on the Logitech G Cloud. Ive recently ran into the issue. What's odd is it didn't do it at first. But then I uninstalled Daijisho and RetroArch and started over again and did run into the issue.

AgentSmith2518 avatar May 04 '25 14:05 AgentSmith2518

It's almost august and this is still a concern. Not only that, I can't set a hotkey to my home button, as retro arch seems to recognize the back button (which I have set to the quick menu) but not the home button.

DrWafflePhD avatar Jul 26 '25 16:07 DrWafflePhD

Just got a Retroid Pocket Flip 2, set it up, and I'm suffering from this.

It's annoying because when I'm playing arcade stuff I often really don't care about the sanctity of my save state or data. I just want to forcefully kill whatever I was doing and start a new game.

Pluckerpluck avatar Aug 11 '25 20:08 Pluckerpluck

This same issue occurs with Beacon and Console Launcher, but RetroidLauncher is able to kill existing instances of RetroArch and launch new games without first closing the previous one - just like how Daijishou used to work. Based on RetroidLauncher's GitHub, it uses the exact same launch arguments as Daijishou, so the issue isn't the launch arguments. It has to be with how the process killing is handled.

mattakins avatar Aug 18 '25 20:08 mattakins

My last comment was incorrect. I figured out how to fix this issue by editing the launch parameters for each player in Daijishou.

  1. Go to Settings → Library → Scroll down to 'Inspect players'
  2. Select a core you are using (double check if you're using RetroArch, RetroArch 32, or RetroArch 64)
  3. Tap the 'Player am start arguments' box.
  4. Scroll to the bottom and delete --activity-clear-task and --activity-clear-top.
  5. Add --activity-single-top
  6. Tap 'Next', then tap 'Done' in the next text box that pops up, then tap 'Save' in the bottom-right corner.
  7. You can now launch games from Daijishou when RetroArch is already open without it crashing! 🎉

@TapiocaFox Would it make sense to make this the default launch parameter for all players?

mattakins avatar Aug 23 '25 20:08 mattakins

My last comment was incorrect. I figured out how to fix this issue by editing the launch parameters for each player in Daijishou.

  1. Go to Settings → Library → Scroll down to 'Inspect players'
  2. Select a core you are using (double check if you're using RetroArch, RetroArch 32, or RetroArch 64)
  3. Tap the 'Player am start arguments' box.
  4. Scroll to the bottom and delete --activity-clear-task and --activity-clear-top.
  5. Add --activity-single-top
  6. Tap 'Next', then tap 'Done' in the next text box that pops up, then tap 'Save' in the bottom-right corner.
  7. You can now launch games from Daijishou when RetroArch is already open without it crashing! 🎉

@TapiocaFox Would it make sense to make this the default launch parameter for all players?

I did this, it allows Retro Arch to open again without crashing, but the game it opens is always the first game you opened until you close it manually. I would like if it could go back to killing the old game and opening the new game when hit from the launcher.

DrWafflePhD avatar Aug 23 '25 21:08 DrWafflePhD

Ahh ok - just tested this on the latest stable build and got the same result. I did some changes to how RetroArch handles Android launch intents in a test build. I guess it requires those fixes in RetroArch and not just the launch arguments. I'll attempt merge those changes into RetroArch. That paired with these new launch arguments will fix this issue.

mattakins avatar Aug 23 '25 21:08 mattakins

@mattakins This sounds promising so I gave it a shot. Unfortunately it does not appear to be working as described. I installed the 2025-10-13 nightly of RetroArch on my A13 Retroid Mini, and adjusted the player arguments to include —activity-single-top.

Now when I launch RA, then hit Menu to return to Daijishou, and try to launch another game on the same core, I no longer get a black screen. Instead RetroArch exits entirely and dumps me back to Daijishou.

mspielberg avatar Oct 13 '25 23:10 mspielberg