Jump to content
LaunchBox Community Forums
MayorQwert

Demul not saving Highscores when closing with Autohotkeys

Recommended Posts

Alright, so I am presently using a mixture of MAME and Demul for my Launchbox rig. I love that Demul has functionality for not just Dreamcast, but also for Sega Naomi/Naomi 2 and Sammy Atomiswave as well. Overall, Demul is great for all my purposes and I have it pretty seamlessly integrated with the rest of my Bigbox lineup, complete with a key bound to quit. However, it recently came to my attention that my high scores have not been saving in the various Naomi games I have. I first realized then when I inputted the code in Cannon Spike's bios to unlock hidden characters, only for them to be gone when I returned. I did some digging and realized that Demul only saves the game's nvram when you do a proper exit from the game(s) (File>Exit in the Demul window itself), which requires you to have a keyboard handy to alt-tab and completely defeats the purpose of a seamless arcade experience (I have mine in a proper multicade cabinet). Of course, I am pretty sure there's no way to get Autohotkey to tell Demul to save the nvram before closing, all I'm doing now is using the simple code below:

sleep 5000
MouseMove, 1920,1080
~5::
Process, Close, {{{StartupEXE}}}

It does the trick, but of course does not allow for Demul to write to nvram and therefore does not save any of the machine highscores or configurations.  I did find that, at the very least, if I input any machine codes or modify configurations and then "properly close" Demul, it does save it permanently, but this isn't really sustainable for the way I am using the emulator.

 

Does anybody have any suggestions for ways to force Demul to write to nvram or save high scores upon quitting that can be seamlessly integrated so the user doesn't have to do any extra steps? Any suggestions are appreciated!

Share this post


Link to post
Share on other sites

Alt and f4 exits demul right? Im sure I read that here somewhere recently. I dont use demul. You will have to see if it saves when using alt and f4 to exit.

 

If it does you could use something like:

sleep 5000
MouseMove, 1920,1080
~5::
{
Send {Alt Down}{F4 Down}{Alt Up}{F4 Up}
Exitapp
}

Other than that I cant help. Sorry.

Share this post


Link to post
Share on other sites
5 hours ago, jayjay said:

Alt and f4 exits demul right? Im sure I read that here somewhere recently. I dont use demul. You will have to see if it saves when using alt and f4 to exit.

 

If it does you could use something like:


sleep 5000
MouseMove, 1920,1080
~5::
{
Send {Alt Down}{F4 Down}{Alt Up}{F4 Up}
Exitapp
}

Other than that I cant help. Sorry.

That was actually pretty helpful. It seems that doing that does at least allow it to write the nvram, as the machine configurations (such as hidden characters in Cannon Spike) are saved when quitting with Alt+F4. However, it seems that it still does not save the high scores, which may be more an issue with the Naomi system in general, sadly.  I've been trying to, at least as a stopgap measure, implement the autohotkey to where it will do a save state when I quit and load it back when I open the game, which honestly wouldn't be much of a fix at all, but would at least maybe allow for the high scores to be retained.  I set the Save State and Load State keys to be F8 and F9, respectively, and ran a test where I manually pushed the keys and did confirm that it works across all games.  However, when I implemented it in Autohotkeys, it doesn't seem to be pressing F8 and F9 at all. Here's my script I'm trying to run:

sleep 5000
MouseMove, 1920,1080
Send {F9}
~5::
{
Send {F8}
sleep 5000
Send {Alt Down}{F4 Down}{Alt Up}{F4 Up}
Exitapp
}

I'm sleeping after sending F8 because it usually takes it a few seconds to save the state.

Share this post


Link to post
Share on other sites
sleep 5000
MouseMove, 1920,1080
Send {F9 Down}{F9 Up}
~5::
{
Send {F8 Down}{F8 Up}
sleep 5000
Send {Alt Down}{F4 Down}{Alt Up}{F4 Up}
Exitapp
}

 

Share this post


Link to post
Share on other sites
12 hours ago, jayjay said:

sleep 5000
MouseMove, 1920,1080
Send {F9 Down}{F9 Up}
~5::
{
Send {F8 Down}{F8 Up}
sleep 5000
Send {Alt Down}{F4 Down}{Alt Up}{F4 Up}
Exitapp
}

 

Tried that, for some reason I can't get the hotkeys to actually register in Demul with Autohotkeys no matter what I set for Save/Load State, even though they work fine when I manually press them... I suppose I could always go to the Dreamcast ports if all else fails, although I'd rather not since the Dreamcast images take up an ungodly amount of space compared to the Naomi roms. At least that way the high scores would be saved... :S

Share this post


Link to post
Share on other sites

So I installed demul to see what was happening. I learnt that alt and f4 is a windows shortcut to close the active window. I didnt know that.

Anyway can try this:

sleep 5000
MouseMove, 1920,1080
Send {F9 Down}
Sleep 1000
Send {F9 Up}
~5::
{
Send {F8 Down}
Sleep 1000
Send {F8 Up}
sleep 5000
Send {Alt Down}{F4 Down}{Alt Up}{F4 Up}
Exitapp
}

Apparently some games and apps etc need the button to be held down for a second (might need to change to 2 seconds or so). You might also need to play around with your first sleep 5000 command. For me demul takes some time to load and timing needs to be right. Ahk and demul is a pain in the ass.

Edited by jayjay

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...