Jump to content
LaunchBox Community Forums

Sinden guns switching recoil between Mame games in LaunchBox


Recommended Posts

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:

  1. Every game in LaunchBox must be edited to run these scripts individually. There is no workaround.

  2. When switching gun types, there is a 5 second delay after the previous executables are killed to allow time to fully close

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

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

  2. Every Lightgun.exe is configured to "Start Application in System Tray" (bottom-right corner of Configuration tab)

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

  1. Add Additional Apps to run for each game by selecting a game, Edit > Metadata > Additional Apps

  2. Click Add Application

    1. Application Name: Type any name, doesn't matter

    2. Application Path: Browse to the appropriate batch file to run auto or semi recoil

    3. Check "Automatically Run Before Main Application" - runs the batch file before the Mame game executes

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

 

 

Link to comment
Share on other sites

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

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