latin625 Posted August 24 Share Posted August 24 All credit to isometrixk I updated my code from another post and now all my Mame games launch the correct recoil (semi vs automatic) type of gun that I want to fire during gameplay. A couple of things: Every game in LaunchBox must be edited to run these scripts individually. There is no workaround. When switching gun types, there is a 5 second delay after the previous executables are killed to allow time to fully close One time, only one of my Sinden guns switched. This makes me think the 5 second delay wasn't long enough. Besides that, it works great with LaunchBox with Mame and I'm going to try a few more emulators later. Prerequisites You created separate folders for each of your guns containing the Lightgun.exe. The folder path to your automatic Lightgun.exe setup must contain "auto". It doesn't matter where, it just matters "auto" is in the file path. C:\LightGuns\auto\..\Lightgun.exe Every Lightgun.exe is configured to "Start Application in System Tray" (bottom-right corner of Configuration tab) Save the two configurations below as Batch (.bat) files - edit each file to CD into your correct Lightgun.exe folder paths, I left my paths as examples. Obviously save them so you remember which is for automatic recoil and semi recoil. LaunchBox Add Additional Apps to run for each game by selecting a game, Edit > Metadata > Additional Apps Click Add Application Application Name: Type any name, doesn't matter Application Path: Browse to the appropriate batch file to run auto or semi recoil Check "Automatically Run Before Main Application" - runs the batch file before the Mame game executes Check "Wait for Exit" - waits for the batch file to complete before launching the Mame game That's it! Do this for each of your games, there is no easy way around this in LaunchBox. Batch Scripts Automatic --- IMPORTANT --- notice the "auto" keyword in my filepaths for this! @echo off setlocal enableextensions enabledelayedexpansion set "process=Lightgun.exe" for /f "usebackq skip=1 delims=" %%p in (`wmic process where "name='%process%'" get executablepath 2^>nul`) do ( if not defined exePath ( set "exePath=%%p" ) ) if not "%exePath%" == "" ( if not x%exePath:auto=%==x%exePath% ( REM do nothing... ) ELSE ( TASKKILL /F /IM Lightgun.exe TIMEOUT 5 /NOBREAK CD "C:\LightGuns\sindengun1auto\SindenLightgunWindowsSoftwareV1.08\SindenLightgun\" START Lightgun.exe CD "C:\LightGuns\sindengun2auto\SindenLightgunWindowsSoftwareV1.08\SindenLightgun\" START Lightgun.exe ) )^ else ( CD "C:\LightGuns\sindengun1auto\SindenLightgunWindowsSoftwareV1.08\SindenLightgun\" START Lightgun.exe CD "C:\LightGuns\sindengun2auto\SindenLightgunWindowsSoftwareV1.08\SindenLightgun\" START Lightgun.exe ) endlocal For Semi Auto setup @echo off setlocal enableextensions enabledelayedexpansion set "process=Lightgun.exe" for /f "usebackq skip=1 delims=" %%p in (`wmic process where "name='%process%'" get executablepath 2^>nul`) do ( if not defined exePath ( set "exePath=%%p" ) ) if not "%exePath%" == "" ( if not x%exePath:auto=%==x%exePath% ( TASKKILL /F /IM Lightgun.exe TIMEOUT 5 /NOBREAK CD "C:\LightGuns\sindengun1\SindenLightgunWindowsSoftwareV1.08\SindenLightgun\" START Lightgun.exe CD "C:\LightGuns\sindengun2\SindenLightgunWindowsSoftwareV1.08\SindenLightgun\" START Lightgun.exe ) ELSE ( REM do thing... ) )^ else ( CD "C:\LightGuns\sindengun1\SindenLightgunWindowsSoftwareV1.08\SindenLightgun\" START Lightgun.exe CD "C:\LightGuns\sindengun2\SindenLightgunWindowsSoftwareV1.08\SindenLightgun\" START Lightgun.exe ) Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted August 24 Share Posted August 24 13 minutes ago, latin625 said: Do this for each of your games, there is no easy way around this in LaunchBox. To help with the 'no easy way around this in LaunchBox', there is a way to add an Additional App to all the games all-at-once. Will need to be done twice. Once for "auto" and once for "semi recoil" (assuming you want both available for all [selected] games). 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.