Mednafen Members Members   Search Search   Help Help   Register Register   Login Login   Home Home
Home » Mednafen » General » Pause on focus loss
Show: Today's Messages  :: Show Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Pause on focus loss [message #5818] Wed, 20 March 2019 07:33 Go to next message
nz0543  [PM]
In other emulators when it is inactive it will pause itself automatically. Is there a feature like this in mednafen?
Re: Pause on focus loss [message #5819 is a reply to message #5818 ] Sun, 24 March 2019 18:57 Go to previous messageGo to next message
Lint  [PM]
Hi there, even though I'm not a mednafen programmer I might help you with that. Can you manage to compile mednafen's latest release (1.22.1)?

For a quick and dirty patch you only have to add the following lines to src/drivers/main.cpp at line 1524:

PauseGameLoop(0);

And into line 1530 (or 1529 if have not patched the aforementioned) :

PauseGameLoop(1);

You can only patch the second item if you want the emulator to only pause on lost focus and have to un-pause manually when you get back, to avoid sound spouting unadvertedly after alt-tabbing back into it.

I'll try to make it into a configuration setting and if everything goes as planned I might attach a patch file (maybe even submit it) anytime soon.
Re: Pause on focus loss [message #5820 is a reply to message #5818 ] Sun, 24 March 2019 19:43 Go to previous message
Lint  [PM]
Here's the two diff files, apply those patches and get an auto-pause version of mednafen.

There are 2 new configuration settings called "focus_pause" that pauses the game when focus is lost and "focus_resume" to resume upon focus.

Beware that for some reason I just discovered that my mednafen pause-emulator button is not working, neither for pausing/resuming, I don't know why, regardless the auto-resume is working a-ok.

To patch, on Linux, you can issue "patch -t src/mednafen.cpp <path-to-mednafen.cpp.diff>" and "patch -t src/drivers/main.cpp <patch-to-main.cpp.diff>"

  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic:Debugger (Wonderswan text routine)
Next Topic:[SSaturn] Decreased Performance in Build 1.22.1 in Specific Games
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ ]

Current Time: Sat May 18 07:18:35 CDT 2024
.:: Contact :: Home ::.

Powered by FUDforum.
Copyright © FUDforum Bulletin Board Software