Jump to content
LaunchBox Community Forums

Enabling Dolphin Bar when launching Wii bar, disabling when not using Wii


AceEsCloud

Recommended Posts

I have been having issues with Retro arch picking up the wrong controls because the Mayflash Dolpin bar is always active as a game controller.  I only need this device active when I play Wii games though.  I created a .bat file that enables the Mayflash Dolphin bar and I want to launch this when I launch any Wii title.  Also, when I exit the Wii title I want to launch another .bat file that disables the Mayflash Dolphin bar.   

 

I have done this before with a pinball device (pinscape controller) and use a script when launching pinball tables that enables / disables my pinscape controller so I believe I would modify this script to work for this new purpose.  I linked this script below.  If anyone has any insight on how I would implement something similar for my new purpose please let me know.  This is the script I used for visual pinball;

 

 

*****VP script below*****

Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat - Shortcut.lnk"
Sleep, 2000

Run, "C:\Visual Pinball\VPinballX.exe" -minimized -exit -play "%1%"
Sleep, 10000

While WinExist("ahk_exe VPinballX.exe")
  sleep 700

Process, WaitClose, VPinballX.exe
Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_disable.bat - Shortcut.lnk"
WinActivate, ahk_exe LaunchBox.exe
WinActivate, ahk_exe BigBox.exe
ExitApp

*****End script****

 

 

If anyone is curious here are the two .bat files I am planning to launch when I launch Wii Games.  I created .bat files of these, then created shortcuts of the .bat files and in the shortcut properties I checked "run as administrator".  These work GREAT every time, just need to figure out the best way to run when I run Wii titles.... 

*****Disable Mayflash*****

PNPUTIL /disable-device /deviceid "HID\VID_057E&PID_0306&REV_0100&MI_00"
PNPUTIL /disable-device /deviceid "HID\VID_057E&PID_0306&REV_0100&MI_01"
PNPUTIL /disable-device /deviceid "HID\VID_057E&PID_0306&REV_0100&MI_02"
PNPUTIL /disable-device /deviceid "HID\VID_057E&PID_0306&REV_0100&MI_03

*****End .bat file*****

 

*****Enable Mayflash*****

PNPUTIL /enable-device /deviceid "HID\VID_057E&PID_0306&REV_0100&MI_00"
PNPUTIL /enable-device /deviceid "HID\VID_057E&PID_0306&REV_0100&MI_01"
PNPUTIL /enable-device /deviceid "HID\VID_057E&PID_0306&REV_0100&MI_02"
PNPUTIL /enable-device /deviceid "HID\VID_057E&PID_0306&REV_0100&MI_03

*****End .bat file*****

 

Link to comment
Share on other sites

2 hours ago, AceEsCloud said:

These work GREAT every time, just need to figure out the best way to run when I run Wii titles.... 

From what I can see, your VPX 'emulator' is your above AutoHotkey script.  So the Emulators Application Path is "path\to\your\VPXscript.ahk".

Why not use a modified version of that script to Run Dolphin.exe with its respective parameters and set that as your Nintendo Wii emulator? 

Though I'm not sure how you're running that elevated.  I believe the AHK script needs to be started elevated to Run the batch files shortcut, elevated.  I could be wrong. 

If it doesn't need to be elevated, that makes things a lot easier.

Run, "C:\Users\Arcade\LaunchBox\Tools\Mayflash disabler\Mayflash_enable.bat - Shortcut.lnk"
Sleep, 2000

RunWait, "C:\Users\Arcade\LaunchBox\Emulators\Dolphin\Dolphin.exe" -b -e "%1%"

Run, "C:\Users\Arcade\LaunchBox\Tools\Mayflash disabler\Mayflash_disable.bat - Shortcut.lnk"
WinActivate, ahk_exe LaunchBox.exe
WinActivate, ahk_exe BigBox.exe
ExitApp

I removed the Sleep, While WinExist and Process, WaitClose lines and used "RunWait" instead.  Less lines. Same outcome. :) 

Just change your paths and batch file names, accordingly.

  • Like 1
Link to comment
Share on other sites

This works but I need to add an exit command to the script.  I used almost exactly what JoeViking245 suggested (with some minor path edits).  I compiled the .ahk script to an .exe using the AutoHotkey script compiler.   When I compiled I used "v1.1.36.02 U64 Unicode 64-bit.bin" as the base file (in the hotkey script compiler tool).  This specific version gives me the elevated permissions and therefore allows the .bat files to run on my system.  I figured this out via trial and error working on the Visual Pinball stuff a couple months back.  I believe JoeViking helped me with this before as well!

Anyways, after compiling I went into launchbox and added a new emulator.  Named the new emulator "dolphin with mayflash".  I set the application path to be the script file that I compiled (in my case;  "C:\Users\Arcade\LaunchBox\Tools\Wii Mayflash Loader\Wii Games Load Script.exe).  I also checked  the box for "attempt to hide console window on startup/shutdown".   I then went to one of my Wii games and changed the emulator to be the new emulator "dolphin with mayflash".  Later I will bulk edit all of the Wii games to use this emulator once I get it 100% working.  This properly launches the game and enables the Mayflash controller!!!  The only issue I now have is that when I hit press escape it does not exit the game so I have to add something to close the game.  On a good note when I force close the Wii game it does run the other .bat file and disables the mayflash as it should.  

What would be the best way to edit this script to allow ESC to exit whatever Wii game I launched?

Link to comment
Share on other sites

I believe I got it working by changing it to this;

 

Run, "C:\Users\Arcade\LaunchBox\Tools\Mayflash disabler\Mayflash enabler.bat - Shortcut"
Sleep, 2000

RunWait, "C:\Users\Arcade\LaunchBox\Emulators\Dolphin-x64\Dolphin.exe" -b -e "%1%"

$Esc::
$vk07::
  Send, !{F4}
  Process, Close, dolphin.exe
  Run, "C:\Users\Arcade\LaunchBox\Tools\Mayflash disabler\Mayflash disabler.bat - Shortcut"
  ExitApp

 

Thank JoeViking245 for the help!!

  • Game On 1
Link to comment
Share on other sites

46 minutes ago, AceEsCloud said:

The only issue I now have is that when I hit press escape it does not exit the game

Just a guess, maybe Exit is not mapped to Escape in Dolphin.

image.thumb.png.fa599a2ab03c45f7d18b116bab88f7a3.png

 

Regardless, your script looks great.  And it lets you use the 'Xbox' button (or whatever it's called) to exit as well.

To 'play nice' with the emulator, I suggest changing "Process, Close," to "WinClose, ahk_exe dolphin.exe".  It's less of an unnecessary brute-force method.  But either way will "work".

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...