libretro / mame2003-plus-libretro

Updated 2018 version of MAME (0.78) for libretro. with added game support plus many fixes and improvements
Other
192 stars 109 forks source link

Sigterm is not well supported by MAME 2003-Plus #1623

Closed schmurtzm closed 3 months ago

schmurtzm commented 1 year ago

Problem : In many cases when running mame2003-plus, SIGTERM commands sent to Retroarch doesn't work properly : Retroarch is not exited. This is a different behavior from all the other cores which allow a proper exit.

It could be nice that mame2003-plus supports properly sigterm command too. This is really useful to support this because on many devices as it allows to close Retroarch and to triggers an auto save state.

For example on the Miyoo Mini (little handheld linux device), pressing the "menu" button triggers an exit of Retroarch to the OS main menu. As the sigterm doesn't work, the only way to exit Retroarch when running Mame 2003 is to exit Retroarch from the menu instead just pressing the button provided for this purpose. This exit method works with all cores except with MAME 2003-Plus.

To reproduce : Start Retroarch with mame2003-plus with 1942, send a pkill retroarch command. Normally Retroarch should exit and make a save state (if the "Auto Save State" option is enabled).

Example of result with After Burner :

/ # pkill retroarch
/ # SDL_PrivateQuit          -> nothing happens, the game still runnning after that.

Other observations :

sigterm doesn't work with:

  • 1942,1943
  • After Burner
  • arknoid2
  • shinobi
  • superman
  • xmen

But it works with:

  • Act-Fancer: Cybernetick Hyper Weapon
  • aerofgt
  • batman
  • Elevator Action Returns
  • tmnt

So it seems that the behavior of sigterm is different depending the game (different behaviors from different game drivers ?)

mahoneyt944 commented 1 year ago

I typically use hotkeys for these functions. settings->input->hotkeys Screenshot_20230918-163151

schmurtzm commented 1 year ago

Hi, thank you for the quick answer !

It can't be a solution for us (Onion OS) because our "menu" button is our hotkey and also the way to quit RA (on handhelds we can't sacrifice a button to only one exit function) . And we have some special features (triggered by an external application named "keymon") like pressing a long time the menu button will quit RA and got to rom list and pressing a short time will quit RA and display an UI with the list of last save states made.

However it's interesting to see that by using hotkey feature RA is able to quit properly any Mame2003+ game.

It make me think that may be it's more the Retroarch SIGTERM implementation which is not good and should copy the behavior of this "quit" hotkey. Is there a way to trigger this hotkey exit function externally from Retroarch ?

mahoneyt944 commented 1 year ago

Not that I know of, You should move this issue to the retroarch GitHub page. They maybe able to assist you further.

mahoneyt944 commented 3 months ago

Seems like this should resolve the issue once merged. Safe to close this now? https://github.com/OnionUI/Onion/pull/1620

schmurtzm commented 3 months ago

Hi not really, the real problem is still here and doesn't apply only to Onion. The sigterm implementation of this core is still not working, what we have done in Onion is a workaround: we use RA network commands to quit Retroarch instead of using a sigterm. Which means that it solve the situation for Onion but the problem is still here for everyone who use a sigterm to close RetroArch (which is a normal way to do that).

So as sigterm should be implemented in this core and should work like any other core, this issue should stay opened.

mahoneyt944 commented 3 months ago

My understanding is that a sigterm would be handled by the frontend, are there other cores that have integrated a solution for this on the core side? I don't know that a core has access to an RA event.

mahoneyt944 commented 3 months ago

Should be fixed with this https://github.com/libretro/RetroArch/pull/16854