pantonio3 Posted June 5, 2021 Share Posted June 5, 2021 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! Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted June 5, 2021 Share Posted June 5, 2021 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 Quote Link to comment Share on other sites More sharing options...
pantonio3 Posted June 5, 2021 Author Share Posted June 5, 2021 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! Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted June 5, 2021 Share Posted June 5, 2021 (edited) 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 June 5, 2021 by Koroth Quote Link to comment Share on other sites More sharing options...
pantonio3 Posted June 5, 2021 Author Share Posted June 5, 2021 Thank you both so much!!! Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted June 6, 2021 Share Posted June 6, 2021 (edited) 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 June 6, 2021 by Headrush69 Quote Link to comment Share on other sites More sharing options...
pantonio3 Posted June 6, 2021 Author Share Posted June 6, 2021 Perfect! Not in front of my setup right now, but will provide an update tomorrow. It may end up being easier for me to just go with a multi-emulator setup, but I will try both options and see which one of the two I might prefer Quote Link to comment Share on other sites More sharing options...
pantonio3 Posted June 6, 2021 Author Share Posted June 6, 2021 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! Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted June 6, 2021 Share Posted June 6, 2021 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. Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted June 6, 2021 Share Posted June 6, 2021 (edited) 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 June 6, 2021 by Koroth Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted June 6, 2021 Share Posted June 6, 2021 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. Quote Link to comment Share on other sites More sharing options...
pantonio3 Posted June 6, 2021 Author Share Posted June 6, 2021 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? Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted June 6, 2021 Share Posted June 6, 2021 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. Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted June 6, 2021 Share Posted June 6, 2021 (edited) 9 minutes ago, pantonio3 said: 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 No you do not enable raw input in EMULATOR.ini (Demulshooter for m2emulator doc) Edited June 6, 2021 by Headrush69 Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted June 6, 2021 Share Posted June 6, 2021 7 minutes ago, pantonio3 said: Is there an easier way to do it using only a bat file? I do not think it would make much difference, adding a bat file or autohotkey script. You basically have to do the same. But correct me Headrush69 if I'm wrong. @pantonio3 Wouldn't be easier to use the 2x install method? Quote Link to comment Share on other sites More sharing options...
pantonio3 Posted June 6, 2021 Author Share Posted June 6, 2021 2 install method might be the easiest option. Not in front of my setup right now but I will provide an update once I'm able to spend some time making changes to the settings Quote Link to comment Share on other sites More sharing options...
pantonio3 Posted June 6, 2021 Author Share Posted June 6, 2021 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 Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted June 6, 2021 Share Posted June 6, 2021 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. Quote Link to comment Share on other sites More sharing options...
pantonio3 Posted June 6, 2021 Author Share Posted June 6, 2021 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 Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted June 6, 2021 Share Posted June 6, 2021 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. 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.