Jump to content
LaunchBox Community Forums

Auto Hotkey for loading xpadder profile


drewjbx

Recommended Posts

Anyone know how I can use a script to load a default xpadder profile for Daphne for example, then once exiting the game load a blank xpadder profile. This does work with the 'add application' feature on a per game basis like in the pic below. But obviously wanted to see if I can save some time here as there are a couple other situations like this that will take a lot of time doing per game...

 

 

example.png

Link to comment
Share on other sites

The only way I've found to do what you're asking to create a new 'emulator' based off a script.  Something like:

Run, xpadder-load-commandline
RunWait, "path_to_Daphne.exe" %1
Run, blank-load-commandline

And have that Platforms default emulator be the script.

I've only tried something to that affect with Mame and it worked great.  'Worked' (past tense)... actually it still does, but with Mame I can't seem to properly pass "-keyboardprovider" to get the LB Pause Screen to work via the scripted-emu. I think LB need to get that argument 1st hand and it (sorta) can't through a script in this manner.  I have not tested this with any other emulator.  

Link to comment
Share on other sites

1 hour ago, JoeViking245 said:

The only way I've found to do what you're asking to create a new 'emulator' based off a script.  Something like:


Run, xpadder-load-commandline
RunWait, "path_to_Daphne.exe" %1
Run, blank-load-commandline

And have that Platforms default emulator be the script.

I've only tried something to that affect with Mame and it worked great.  'Worked' (past tense)... actually it still does, but with Mame I can't seem to properly pass "-keyboardprovider" to get the LB Pause Screen to work via the scripted-emu. I think LB need to get that argument 1st hand and it (sorta) can't through a script in this manner.  I have not tested this with any other emulator.  

Not sure if I follow create new emulator based off script. Are you putting this script under the emulator auto hotkey option. So in this case wouldn't I need to point to the specific xpadder profile. Also I have profiles associated with the xpadder program (p1.xpadderprofile). So essentially I am not launching xpadder.exe directly.... I'm pointing to the profile, which obviously opens xpadder. In the emulator options there is a tab for 'Running AutoHotKey Script' and 'Exit AutoHotKey Script'

Link to comment
Share on other sites

1 hour ago, drewjbx said:

Are you putting this script under the emulator auto hotkey option.

No.  The "Exit AutoHotkey Script" is only for closing (shutting down) the emulator.  Not sure what the other one does. ?

The alternative to editing each and every game to have a 'launch before' and 'launch after' like what you show in your pict. is to write an AutoHotkey script (or a batch file) that will send the commands that will: 

  • load your xpadder profile
  • run the game (** see note)
  • (then when you exit the game) load the blank profile

Then in LaunchBox go to:

  • Tools
  • Manage Emulators
  • Add

image.thumb.png.63cf354920756f24a324afe20e16ce82.pngGive it a name (like maybe Daphne Xpadder)

Under Application Path, Browse to were you have the AHK or batch file that you created.

Put a check in "Don't use quotes.."

In Associated Platforms tab, add Daphne.

 

**note:  LaunchBox will pass the games name (rom file name) as %1 to the script or batch file.  So if you write an AHK script, this line might look like

RunWait, "D:\Emulators\Daphne\Daphne.exe" %1

Or in a batch file

start /w "" "D:\Emulators\Daphne\Daphne.exe" %1

 

Link to comment
Share on other sites

4 hours ago, JoeViking245 said:

Run, xpadder-load-commandline

RunWait, "path_to_Daphne.exe" %1

Run, blank-load-commandline

Ok so for the script is this the correct syntax for pointing to the profiles needed?

Run, D:\RocketLauncher\Profiles\Xpadder\Daphne\_Default\p1.xpadderprofile

RunWait, D:\Hyperspin\Emulators\Daphne\Daphne.exe %1

Run, D:\RocketLauncher\Profiles\Xpadder\_Default\blank.xpadderprofile

Not at my cabinet at the moment so cant test. Also I have Daphne as an emulator using a Batch file method to launch games. Not sure how this will jive with another script...

Daphne.exe %1 vldp -fullscreen -x 1920 -y 1080 -framefile "D:\Hyperspin\Emulators\Daphne\framefile\%1.txt"

 

Link to comment
Share on other sites

I really don't know anything about the Daphne emu or xpadder.  A quick search looks like to load the profile you need:

"D:\<path_to>\xpadder.exe" "D:\RocketLauncher\Profiles\Xpadder\Daphne\_Default\p1.xpadderprofile" /M

....just reread your comment about using a batch file..... why didn't you say so.. lol

Edit your batch file to read...

start /w "" "D:\<path_to>\xpadder.exe" "D:\RocketLauncher\Profiles\Xpadder\Daphne\_Default\p1.xpadderprofile" /M
start /w "" Daphne.exe %1 vldp -fullscreen -x 1920 -y 1080 -framefile "D:\Hyperspin\Emulators\Daphne\framefile\%1.txt"
start "" "D:\<path_to>\xpadder.exe" "D:\RocketLauncher\Profiles\Xpadder\Daphne\_Default\blank.xpadderprofile" /M

This is assuming that is indeed the command line to apply a profile for xpadder (including the /M).

The "/w" after "start" just says 'wait for it to finish it's thing before going to the next line'.  We put it on the 1st line because without it, line 1 and 2 will load virtually simultaneously and Daphne might kick in before 'it was told' we're using p1'.  Line 3, load profile "blank", won't start until Daphne closes.    For the 2nd line, adding in     start /w ""    you may need to put Daphne.exe in quotes. But nothing else on that line changes.

If that all works, we (or you) can figure out how to hide xpadder command-prompt windows that'll pop up. :) 

Link to comment
Share on other sites

On 6/25/2019 at 5:34 PM, JoeViking245 said:

start /w "" "D:\<path_to>\xpadder.exe" "D:\RocketLauncher\Profiles\Xpadder\Daphne\_Default\p1.xpadderprofile" /M

start /w "" Daphne.exe %1 vldp -fullscreen -x 1920 -y 1080 -framefile "D:\Hyperspin\Emulators\Daphne\framefile\%1.txt"

start "" "D:\<path_to>\xpadder.exe" "D:\RocketLauncher\Profiles\Xpadder\Daphne\_Default\blank.xpadderprofile" /M

Ok so I did try this and at first got an error saying couldn't find Daphne, so I put the full path.

 

start /w "" "D:\RocketLauncher\Profiles\Xpadder\Daphne\_Default\p1.xpadderprofile" /M

start /w "" D:\Hyperspin\Roms\Daphne\Daphne.exe %1 vldp -fullscreen -x 1920 -y 1080 -framefile "D:\Hyperspin\Roms\Daphne\framefile\%1.txt"

start "" "D:\RocketLauncher\Profiles\Xpadder\_Default\blank.xpadderprofile" /M

 

Got an syntax error from Daphne. Want to thankyou thus far but I should have used the emulator AAE as a better example. I tried the following it looks like the games load but just loses focus to command window and when try to bring game up its blank screen. I think I am getting close. If you have suggestions for the one I'm trying below I would appreciate it. Perhaps AHK works better then batch files? or works the same?

AAE doesn't require any command lines to launch... I just need to load a controller profile as the emulator has only default keyboard inputs. 

start /w "" "D:\RocketLauncher\Profiles\Xpadder\AAE\_Default\p1.xpadderprofile" /M

start /w "" D:\Hyperspin\Emulators\AAE\aae.exe %1 "D:\Hyperspin\Roms\AAE\%1.zip"

start "" "D:\RocketLauncher\Profiles\Xpadder\_Default\blank.xpadderprofile" /M

 

Default emulator 

Untitled.png

Batch file emulator

Untitled1.thumb.png.bb9e3d35d3729ffd40532cb113bb0bd7.png

Edited by drewjbx
Link to comment
Share on other sites

Assuming "xpadder.exe" is located in "D:\RocketLauncher\Profiles\Xpadder\", to load a profile you need the run the program and tell it the profile name.  (Also the "/w" might be causing the blank screen issue. So take it out.)

start "" D:\RocketLauncher\Profiles\Xpadder\xpadder.exe "D:\RocketLauncher\Profiles\Xpadder\AAE\_Default\p1.xpadderprofile" /M

 

Did you already have a batch file to start AAE that looked like...? :
D:\Hyperspin\Emulators\AAE\aae.exe %1 "D:\Hyperspin\Roms\AAE\%1.zip"
If it works, great!  But it doesn't need the last part.  The 1st  "%1"  tells it the roms path and filename already.  (On this line, keep "/w" in.)

start /w "" D:\Hyperspin\Emulators\AAE\aae.exe %1

The 'Batch file emulator' pict you show looks fine.  So "AAE Batch.bat" would look like

start "" D:\RocketLauncher\Profiles\Xpadder\xpadder.exe "D:\RocketLauncher\Profiles\Xpadder\AAE\_Default\p1.xpadderprofile" /M
start /w "" D:\Hyperspin\Emulators\AAE\aae.exe %1
start "" D:\RocketLauncher\Profiles\Xpadder\xpadder.exe "D:\RocketLauncher\Profiles\Xpadder\AAE\_Default\blank.xpadderprofile" /M

 

For Daphne, you said you already use a batch file to load/run the games that looked like:
Daphne.exe %1 vldp -fullscreen -x 1920 -y 1080 -framefile "D:\Hyperspin\Emulators\Daphne\framefile\%1.txt"
Adding       start /w ""      in front of it shouldn't (wouldn't?) cause a syntax error.

 

Link to comment
Share on other sites

  • 3 years later...

An old post but new helpful info for new Daphne setups. I like easy - this is easier than configuring each Daphne game. :)
Specifically for xpadder users, I modified the beautifully crafted and easier supplied BAT from another user to ensure xpadder loads my Daphne specific xpadder profile and unloads the profile when I close the game. For lazy persons like myself, no longer a need to edit each game. 

I added auto loading of specified xpadder profile. 
I added a loop check for daphne.exe running and when that closes only then will xpadder unload. 

Once you install and create an xpadder profile for your controller:
Change  the (2) sections marked as : USER SPECIFIC SECTION

Save below info as a bat file and configure Daphne emulator application path to the new bat. 

@echo off

:: USER SPECIFIC SECTION (set path to xpadder.exe and profile to be used)
:start xpadder profile
start "" D:\tools\Xpadder\xpadder.exe "D:\tools\Xpadder\Daphne.xpadderprofile" 

if "%1"=="ace" set bank= -bank 0 00000010 -bank 1 00000001& goto :start
if "%1"=="astron" set bank= -bank 0 00000000 -bank 1 00000000& goto :start
if "%1"=="badlands" set bank= -bank 0 00000010 -bank 1 10000011& goto :start
if "%1"=="bega" set bank= -bank 0 00000000 -bank 1 00000111& goto :start
if "%1"=="cliff" set bank= -bank 0 00000000 -bank 1 01000000 -bank 2 00000000 -bank 3 01111011& goto :start
if "%1"=="cobraab" set bank= -bank 0 00000000 -bank 1 01001000& goto :start
if "%1"=="esh" set bank=& goto :start
if "%1"=="galaxy" set bank= -bank 0 00000000 -bank 1 00000000& goto :start
if "%1"=="gpworld" set bank=& goto :start
if "%1"=="interstellar" set bank= -bank 0 00110001 -bank 1 00000000& goto :start
if "%1"=="lair" set bank= -bank 0 11011001 -bank 1 00100111& goto :start
if "%1"=="lair2" set bank=& goto :start
if "%1"=="mach3" set bank= -bank 0 01000100& goto :start
if "%1"=="roadblaster" set bank= -bank 0 00000000 -bank 1 00000001& goto :start
if "%1"=="sdq" set bank= -bank 0 00100001 -bank 1 00000000& goto :start
if "%1"=="tq" set bank=& goto :start
if "%1"=="uvt" set bank= -bank 0 00000000& goto :start

set bank= -bank 0 11011001 -bank 1 00100111

:: USER SPECIFIC SECTION (set daphne.exe path and preferred resolution)
:start
start "daphne" /wait "d:\game roms\daphne\daphne.exe" %1 vldp -x 2560 -y 1600 -fullscreen -framefile framefile\%1.txt -blend -ignore_aspect_ratio -blank_searches -min_seek_delay 1000 -seek_frames_per_ms 20 -homedir . -fastboot%bank% -nocrc -noissues -noserversend -sound_buffer 2048

Goto End

:end
taskkill /im "Xpadder.exe" /f

Open Xpadder from the systray, click settings and disable "show controller and button animations". If you don't xpadder will not close when you exit Daphne. 
Side note: If you at any point leave the active game window, you'll see it either affect current game exit or cause a second game launch to lose focus and show a blank CMD window to be primary focus.  You'll be required to end the CMD windows and Daphne.exe manually.  The "fix" is to not leave the active window :)

Edited by CLE
  • Like 1
Link to comment
Share on other sites

  • 6 months later...
On 4/1/2023 at 7:32 PM, CLE said:

An old post but new helpful info for new Daphne setups. I like easy - this is easier than configuring each Daphne game. :)
Specifically for xpadder users, I modified the beautifully crafted and easier supplied BAT from another user to ensure xpadder loads my Daphne specific xpadder profile and unloads the profile when I close the game. For lazy persons like myself, no longer a need to edit each game. 

I added auto loading of specified xpadder profile. 
I added a loop check for daphne.exe running and when that closes only then will xpadder unload. 

Once you install and create an xpadder profile for your controller:
Change  the (2) sections marked as : USER SPECIFIC SECTION

Save below info as a bat file and configure Daphne emulator application path to the new bat. 

@echo off

:: USER SPECIFIC SECTION (set path to xpadder.exe and profile to be used)
:start xpadder profile
start "" D:\tools\Xpadder\xpadder.exe "D:\tools\Xpadder\Daphne.xpadderprofile" 

if "%1"=="ace" set bank= -bank 0 00000010 -bank 1 00000001& goto :start
if "%1"=="astron" set bank= -bank 0 00000000 -bank 1 00000000& goto :start
if "%1"=="badlands" set bank= -bank 0 00000010 -bank 1 10000011& goto :start
if "%1"=="bega" set bank= -bank 0 00000000 -bank 1 00000111& goto :start
if "%1"=="cliff" set bank= -bank 0 00000000 -bank 1 01000000 -bank 2 00000000 -bank 3 01111011& goto :start
if "%1"=="cobraab" set bank= -bank 0 00000000 -bank 1 01001000& goto :start
if "%1"=="esh" set bank=& goto :start
if "%1"=="galaxy" set bank= -bank 0 00000000 -bank 1 00000000& goto :start
if "%1"=="gpworld" set bank=& goto :start
if "%1"=="interstellar" set bank= -bank 0 00110001 -bank 1 00000000& goto :start
if "%1"=="lair" set bank= -bank 0 11011001 -bank 1 00100111& goto :start
if "%1"=="lair2" set bank=& goto :start
if "%1"=="mach3" set bank= -bank 0 01000100& goto :start
if "%1"=="roadblaster" set bank= -bank 0 00000000 -bank 1 00000001& goto :start
if "%1"=="sdq" set bank= -bank 0 00100001 -bank 1 00000000& goto :start
if "%1"=="tq" set bank=& goto :start
if "%1"=="uvt" set bank= -bank 0 00000000& goto :start

set bank= -bank 0 11011001 -bank 1 00100111

:: USER SPECIFIC SECTION (set daphne.exe path and preferred resolution)
:start
start "daphne" /wait "d:\game roms\daphne\daphne.exe" %1 vldp -x 2560 -y 1600 -fullscreen -framefile framefile\%1.txt -blend -ignore_aspect_ratio -blank_searches -min_seek_delay 1000 -seek_frames_per_ms 20 -homedir . -fastboot%bank% -nocrc -noissues -noserversend -sound_buffer 2048

Goto End

:end
taskkill /im "Xpadder.exe" /f

Open Xpadder from the systray, click settings and disable "show controller and button animations". If you don't xpadder will not close when you exit Daphne. 
Side note: If you at any point leave the active game window, you'll see it either affect current game exit or cause a second game launch to lose focus and show a blank CMD window to be primary focus.  You'll be required to end the CMD windows and Daphne.exe manually.  The "fix" is to not leave the active window :)

Thanks for sharing, I am re-visiting xpadder for something a little different. I have a 4 player control panel and a ultimarc flight stick that comes in as controller/joystick number 5. I created a controller profile for the flightstick and a game profile for daphne flying games like Astron's Belt, Cobra Command etc...

 If I try to autoload that controller profile before launching the game xpadder loads it in controller number 1 slot rather than number 5. Is there a way to load the Ultimarc profile then the game profile (Daphne Flight Games) in the correct Player slot #5? 

 

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