Jump to content
LaunchBox Community Forums

AHK script to close Dolphin emulator in a specific way


SiriusVI

Recommended Posts

Hey everyone,

I have a very niche issue that I'd like to resolve using a specific AHK command.

 

Short story:

I want an AHK script that first stops Dolphin's rom emulation and then waits a few seconds until the emulation is stopped before it closes the emulator entirely.

 

Long story:

I have an original Wii Bluetooth module converted to USB, so I'm able to use Dolphin's Bluetooth Passthrough feature. (more info here: https://wiki.dolphin-emu.org/index.php?title=Bluetooth_Passthrough)

 

With most games, everything works fine, but with some games (such as Wii Sports USA (Rev 1)), closing the emulator before the emulation stops, causes a weird issue with the bluetooth adapter. I am in no way capable to explain why or how this happens, but the result is that I have to uninstall the bluetooth device from my device manager and then reinstall it with the Zadig software, before Dolphin accepts the BT device again.

 

If I however stop the emulation and then afterwards exit the emulator, everything works as expected.



Hope someone able to help. 


EDIT: It should be achievable by:

1. first removing the "-b" from the default command line parameters in the emulator settings

2. somehow telling Dolphin via AHK script to send ESC and after (say 5 sec) send ESC again.

I just don't know how to do that

Edited by SiriusVI
Link to comment
Share on other sites

1 hour ago, SiriusVI said:

EDIT: It should be achievable by:

1. first removing the "-b" from the default command line parameters in the emulator settings

2. somehow telling Dolphin via AHK script to dush ESC and after (say 5 sec) press ESC again.

Test this, then confirm that's what's needed to be done.  So remove -b, launch the game and let it completely load.  Then see if [physically] pressing Escape, waiting 5 seconds, and pressing Escape actually works.

If that works, then it's simply:

$Esc::
{
   Sleep, 5000
   Send, {Esc}
   ExitApp
}

This should work if you place the above in the Running Script section of the emulator and physically press "Escape" on the keyboard.  If you're using a controller to exit the game ('stop the emulation'), that may be a different story. 

When using a controller to exit the game, LB/BB "presses Escape" (along with some other behind-the-scenes voodoo) and the Running Script (above) might catch that and do the Sleep/Escape thing.  Don't know.

Link to comment
Share on other sites

1 hour ago, JoeViking245 said:

Test this, then confirm that's what's needed to be done.  So remove -b, launch the game and let it completely load.  Then see if [physically] pressing Escape, waiting 5 seconds, and pressing Escape actually works.

If that works, then it's simply:

$Esc::
{
   Sleep, 5000
   Send, {Esc}
   ExitApp
}

This should work if you place the above in the Running Script section of the emulator and physically press "Escape" on the keyboard.  If you're using a controller to exit the game ('stop the emulation'), that may be a different story. 

When using a controller to exit the game, LB/BB "presses Escape" (along with some other behind-the-scenes voodoo) and the Running Script (above) might catch that and do the Sleep/Escape thing.  Don't know.

Hey, thx for the suggestion.

This didn't work unfortunately. This is what happens:

When pressing ESC (on my actual keyboard), nothing happens at first. If I wait a few seconds and try to press ECS again, the emulation eventually stops, but the emulator won't close.

I've tried this AHK earlier and when I have this AHK, the emulation stops immediately if I press ESC for the first time, and if I press ESC a second time, the emulator closes:
 

Quote

$Esc::
{
    WinClose, ahk_exe {{{StartupEXE}}}
}


So what I need is basically have this command executed twice when I press ESC.

Link to comment
Share on other sites

14 minutes ago, JoeViking245 said:

Without overthinking it...

$Esc::
{
   WinClose, ahk_exe {{{StartupEXE}}}
   Sleep, 5000
   WinClose, ahk_exe {{{StartupEXE}}}
}

 

That worked perfectly!

Thank you 😃

(Seriously, I have NO idea what is going on with Wii Sports and that bluetooth dongle. Every game I've tried works perfectly when just shutting down the emulator)

Edited by SiriusVI
  • Game On 1
Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...