Jump to content
LaunchBox Community Forums

Using both an Xbox 360 controller for Virtua Fighter 2 and an Aimtrak light gun for gun games for Sega Model 2 Emulator


pantonio3

Recommended Posts

Hi everyone, I am trying to set up the Sega Model 2 emulator so that I can run each game out of Launchbox without having to edit the EMULATOR.INI file every time I play a different type of game, but based on what I've tried so far, it doesn't look like you can have the XInput setting set to 1 and the UserRawInput setting also set to 1 at the same time so that the emulator will recognize buttons on 2 different Aimtrak light guns and buttons on Xbox 360 controllers at the same time. That means that if I am playing Virtua Cop and I want to use the buttons on the Aimtrak light gun to insert coins and press start in the game, I have to have the Xinput setting set to zero. If I then want to play Virtua Fighter 2, I can't play the game and use the controls on the Xbox 360 controller without going back into the ini file and setting the XInput setting back to one. Is there a way to set up custom ini files by game, or is there a setting in the EMULATOR.INI file I am missing? Could there also be a script that could help solve this issue? Any assistance anyone might be able to provide would be greatly appreciated. Thank you!

Link to comment
Share on other sites

For situations like this I create all the ini files I need and than create a simple AHK script to copy each script to the default ini location.

I compile the AHK script to an exe and than use LB's additional apps feature to run and wait for that to finish before starting the emulator.

Here's an example:

Quote

FileCopy, C:\Users\ARCADEPC\Launchbox\Emulators\m2emulator\RMULATOR_xbox.ini, C:\Users\ARCADEPC\Launchbox\Emulators\m2emulator\EMULATOR.ini, 1

ExitApp

return

 

Link to comment
Share on other sites

This is fantastic!!! Do you mind breaking this down a little bit for me? I know how to create all of the ini files, and I know how to save those all to the default ini location. I think I also know how to compile the AHK script and save those to the default ini location, and I know how to run the additional apps in Launchbox. Do I just copy the script you provided above? It looks like it is running both a custom ini file and the default ini file, so I just want to be sure I copy the script you provided above verbatim, using the names of the custom ini files I use. I will try this right now and provide an update. Thanks!

Link to comment
Share on other sites

I am in a similar situation, but with my Thrustmaster racing wheel. There are a couple of solutions:

- Like Headrush69 mentions overwrite values or swap config files with an ahk script.

- Simply have multiple installs of an emulator (and added to LaunchBox) for different use cases. (probably the easiest solution.)

- I even have 2 setups for LaunchBox/Bigbox. (Default setup = Controller / Racing setup = Wheel). I start LaunchBox or BigBox from an ahk script. First the script checks if my wheel is connected. If it isn't, it starts my default LaunchBox or Bigbox setup. If it is, it starts my racing LaunchBox or Bigbox setup.

*Edit*

I want to elaborate on my third option a bit. The neat thing is not to have 2 setups, but auto loading different configs (files) when different peripherals  are connected. (If you can detect that they are connected.)

Edited by Koroth
Link to comment
Share on other sites

3 hours ago, pantonio3 said:

 It looks like it is running both a custom ini file and the default ini file, so I just want to be sure I copy the script you provided above verbatim, using the names of the custom ini files I use. I will try this right now and provide an update. Thanks!

Not exactly. All it is doing is copying a specific ini file and over writing it to the default EMULATOR.ini That last option ,1 means to overwrite the current EMULATOR.ini file.

You may want to restore your default ini after running as well.

So you might have these inis in your emulator directory:

  • EMULATOR.ini
  • default.ini
  • lightgun.ini

So before the emulator starts you use the compiled script to over write EMULATOR.ini with the contents of lightguns.ini. After running the emulator you over write EMULATOR.ini with default.ini.

The names you use are arbitrary except for EMULATOR.ini which is what the m2emulator will read on starting.

Edit: This is just a general way to handle unique controller set ups. With the m2emulator you may want to check out Demulshooter so you don't have to use raw input directly in the EMULATOR.ini.

Edited by Headrush69
Link to comment
Share on other sites

I created the AHK scripts, and i am assuming that AHK stands for "Auto Hot Key" script. Is there anything additional I need to do or install in order for my AHK scripts to run? I created exe files in notepad to try to get the AHK scripts to run, but I don't think this is the right approach. I also had spaces in some of my folder names, so I am assuming I have to use quotation marks in order for the script to accurately pick up my folder paths. If I just create the AHK scripts in notepad with either an exe or bat extension, neither seems to be working for me right now - any additional tips as far as what I'm doing wrong or additional steps I might need to take to get the AHK scripts to run? Please let me know! Thank you!

Link to comment
Share on other sites

24 minutes ago, pantonio3 said:

I created the AHK scripts, and i am assuming that AHK stands for "Auto Hot Key" script. Is there anything additional I need to do or install in order for my AHK scripts to run? I created exe files in notepad to try to get the AHK scripts to run, but I don't think this is the right approach. I also had spaces in some of my folder names, so I am assuming I have to use quotation marks in order for the script to accurately pick up my folder paths. If I just create the AHK scripts in notepad with either an exe or bat extension, neither seems to be working for me right now - any additional tips as far as what I'm doing wrong or additional steps I might need to take to get the AHK scripts to run? Please let me know! Thank you!

AHK can handle spaces in file paths.

You need to download the full AHK (free) and it includes a small compiler application that converts your ahk script to an exe.

You can of course run your AHK scripts (.ahk files) manually to make sure they do what you want before compiling them. 

Link to comment
Share on other sites

If I may give some further explanation?

I used Headrush69's script. First be sure you have 2 extra copies of emulator.ini in the m2emulator folder. Headrush69 called them default.ini and lightgun.ini. (also be sure you have edited default.ini for use with a xbox controller and lightgun.ini for use with a lightgun). The script first replaces the content of emulator.ini with the content of lightgun.ini. Then It waits for the emulator to start and after that to close again. Then it replaces the content of emulator.ini with the content of default.ini again. (So when you want to play non lightgun games the xbox controller will be the default controller.)

Be sure the paths in the script match the location of your m2emulator folder.

#NoEnv
FileCopy, C:\Users\ARCADEPC\Launchbox\Emulators\m2emulator\lightgun.ini, C:\Users\ARCADEPC\Launchbox\Emulators\m2emulator\emulator.ini, 1
Process, Wait, emulator.exe
Process, WaitClose, emulator.exe
FileCopy, C:\Users\ARCADEPC\Launchbox\Emulators\m2emulator\default.ini, C:\Users\ARCADEPC\Launchbox\Emulators\m2emulator\emulator.ini, 1
ExitApp

Headrush69 would compile the script to an .exe, but for now I think the easiest approach would be the following: Copy/paste the script into a newly create text file. Save the text file and give it a name with an .ahk extension. For example model_2_lightgun.ahk. Go to the LaunchBox\ThirdParty\AutoHotkey folder. Copy AutoHotkey.exe and the ahk script you just created to a folder. Perhaps your m2emulator folder and rename AutoHotkey.exe the same as your .ahk script, so you have a model_2_lightgun.ahk and model_2_lightgun.exe.

Now go to LaunchBox and your lightgun game.  Right click your lightgun game > Edit > Additional Apps. Click "Add Application". Enter a name for the additional app. > Then browse for the application: m2emulator folder, model_2_lightgun.exe. > Tick the checkbox "Automatically Run Before Main Application" > OK.

*Note*

By keeping model_2_lightgun.ahk and model_2_lightgun.exe you can always open lightgun.ahk in a text editor and change the script.

*Note 2*

In the case you use the "emulator_multicpu" exe of m2emulator, in the script change emulator.exe with emulator_multicpu.exe.

Edited by Koroth
Link to comment
Share on other sites

23 minutes ago, Koroth said:

for now I think the easiest approach would be the following: Copy/paste the script into a newly create text file. Save the text file and give it a name with an .ahk extension. For example model_2_lightgun.ahk. Go to the LaunchBox\ThirdParty\AutoHotkey folder. Copy AutoHotkey.exe and the ahk script you just created to a folder. Perhaps your m2emulator folder and rename AutoHotkey.exe the same as your .ahk script, so you have a model_2_lightgun.ahk and model_2_lightgun.exe.

Now go to LaunchBox and your lightgun game.  Right click your lightgun game > Edit > Additional Apps. Click "Add Application". Enter a name for the additional app. > Then browse for the application: m2emulator folder, model_2_lightgun.exe. > Tick the checkbox "Automatically Run Before Main Application" > OK....

You are correct Koroth, there are several ways to do this, including directly with a bat file and avoiding AHK. (Much like how many start Daphne games)

I think the easiest approach is probably just using Demulshooter as an additional application and you can avoid needing multiple inis since raw input doesn't have to be enabled in EMULATOR.ini

I use Demulshooter. This was just adapted from scripts I use with devreorder to hide and order specific devices when needed, but the approach is workable.  

 

Link to comment
Share on other sites

I use Demulshooter but that doesn't solve what I was initially trying to accomplish. Even if you use Demulshooter, you have to set RawInputData to one if you use both light guns, and I don't think there is any way to do this using the Aimtrak gun's buttons and also use an Xbox 360 controller without either using an AHK script or using two emulators. Is there an easier way to do it using only a bat file?

Link to comment
Share on other sites

12 minutes ago, Headrush69 said:

You are correct Koroth, there are several ways to do this, including directly with a bat file and avoiding AHK. (Much like how many start Daphne games)

Hehe, you are right. I have a basic understanding of autohotkey, but for batch scripting none at all.

12 minutes ago, Headrush69 said:

I think the easiest approach is probably just using Demulshooter as an additional application and you can avoid needing multiple inis since raw input doesn't have to be enabled in EMULATOR.ini

As I don't have lightguns (yet), I don't have experience with Demulshooter.

Link to comment
Share on other sites

Just now, pantonio3 said:

Would anyone know how to do this using a bat file method? I am assuming a bat file script would have to be different than an AHK? If anyone would be able to point me in the right direction on this, it would be much appreciated 

You're essentially doing the same thing but using BAT commands rather than AHK. Short of writing it for you, I think if you have issues with the AHK, using the BAT will be the same..

If you don't want to get Demulshooter working, I think Koroth's suggestion of using two instances of m2emulator might be the easiest method for you. Also, be aware that even though m2emulator has native raw input support, there are reports of issues using it including changing devices numbers, something that isn't an issue with Demulshooter.

Link to comment
Share on other sites

Just now, pantonio3 said:

No, I use Demulshooter, and Demulshooter has been working well for me so far, so I don't think that's been the issue for me

I guess I don't understand your issue at all then.

I thought in your original post that you meant you needed to enabled rawinput in emulator.ini for model2 light gun games, and turn it off to use xinput for other model2 games.

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