latin625 Posted March 21, 2023 Share Posted March 21, 2023 I am trying to make sure that when a 2 way, 4 way or 8 way game in mame loads, it also loads the .ugc file with it. If there is none available, it will load a default map. Added a soundbeep to know if the file loaded, but I keep getting the 8 way default for everything regardless. Thanks in advance for the help!!!!! Maybe this can help out others who may be in need of a script. I run this as an application "before main application" on all the MAME games only. My issues: 1. how can I confirm that Im a loading the right .ugc? I see a "showfeedback" argument, but did it really load the correct file? 2. How do you get it to load up the 8way on exiting the game so it can be defaulted back to 8 way? Here is my hacked up script from what I could find on the net. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ;This script loads game & emulator specific configurations into ;UltraSticks. If a game (ROM) specific profile ;exists it will be loaded. If not, the emulator (EMU) specific profile ;will be loaded. If neither a game specific nor emulator specific ;profile exists, a default (DEF) profile will be loaded. ;Parameters are the emulator and ROM name. ROM name is optional. ;Emulator names should match the assets folder name. EMU = %1% ROM = %2% ;-------------------------------------------- ;Process UltraStick Profiles ROM_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\" . EMU . "\" . ROM . ".ugc /showfeedback" EMU_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\" . EMU . "\" . EMU . ".ugc /showfeedback" DEF_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\default.ugc /showfeedback" ULTRAMAP := "D:\LaunchBox\ThirdParty\UltraMap.exe" SoundBeep, 750, 500 ;SoundPlay, %A_WinDir%\Media\ding.wav ;Load the joystick profile if FileExist(ROM_STK_PROF) RunWait %ULTRAMAP% %ROM_STK_PROF% else if FileExist(EMU_STK_PROF) RunWait %ULTRAMAP% %EMU_STK_PROF% else RunWait %ULTRAMAP% %DEF_STK_PROF% Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted March 21, 2023 Share Posted March 21, 2023 8 hours ago, latin625 said: I run this as an application "before main application" on all the MAME games only. This won't work when running as an Additional App because you can't send parameters to them. (EMU = %1% ROM = %2%) To have the parameters sent to the script, you'd need to have it as-the-emulator.** In your script "EMU" is always going to be "MAME" since you're only using this for MAME. Correct? If so, replace that variable. i.e. (replace the 1st line with the 2nd line) This assumes your asset folder is called "MAME". ;ROM_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\" . EMU . "\" . ROM . ".ugc /showfeedback" ROM_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\MAME\" . ROM . ".ugc /showfeedback" **To set the script up as the emulator, you'd need to add a new emulator in LaunchBox that points to this script. Give it a name Point the App Path to ..\LaunchBox\ThirdParty\AutoHotkey\AutoHotkey.exe In quotes, set the parameters to point to your .ahk script add a [space] and then %romlocation% Check 2 boxes Then at the bottom of your script, you'd have it launch MAME with the ROM file. Something (but not necessarily exactly) like this. (added some beeps when it loads a specific config) romlocation = %2% ROM = %3% ;Process UltraStick Profiles ROM_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\MAME\" . ROM . ".ugc /showfeedback" EMU_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\MAME\MAME.ugc /showfeedback" DEF_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\default.ugc /showfeedback" ULTRAMAP := "D:\LaunchBox\ThirdParty\UltraMap.exe" ;Load the joystick profile if FileExist(ROM_STK_PROF) { SoundBeep, 750, 500 RunWait %ULTRAMAP% %ROM_STK_PROF% } else if FileExist(EMU_STK_PROF) { SoundBeep, 750, 200 SoundBeep, 1350, 200 RunWait %ULTRAMAP% %EMU_STK_PROF% } else { SoundBeep, 750, 200 SoundBeep, 1350, 200 SoundBeep, 750, 200 RunWait %ULTRAMAP% %DEF_STK_PROF% } RunWait, "D:\LaunchBox\Emulators\MAME\mame.exe" -keyboardprovider dinput -rompath %romlocation% %ROM% Not tested, but looks really good 'on paper'. Depending on how your MAME is setup and where it's located, you may need to change something on the last line. 1 Quote Link to comment Share on other sites More sharing options...
Drybonz Posted March 21, 2023 Share Posted March 21, 2023 (edited) I posted a mini-tutorial about this yesterday. Edited March 21, 2023 by Drybonz 1 Quote Link to comment Share on other sites More sharing options...
latin625 Posted March 21, 2023 Author Share Posted March 21, 2023 (edited) JoeVikin@g@245 2 hours ago, JoeViking245 said: This won't work when running as an Additional App because you can't send parameters to them. (EMU = %1% ROM = %2%) To have the parameters sent to the script, you'd need to have it as-the-emulator.** In your script "EMU" is always going to be "MAME" since you're only using this for MAME. Correct? If so, replace that variable. i.e. (replace the 1st line with the 2nd line) This assumes your asset folder is called "MAME". ;ROM_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\" . EMU . "\" . ROM . ".ugc /showfeedback" ROM_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\MAME\" . ROM . ".ugc /showfeedback" **To set the script up as the emulator, you'd need to add a new emulator in LaunchBox that points to this script. Give it a name Point the App Path to ..\LaunchBox\ThirdParty\AutoHotkey\AutoHotkey.exe In quotes, set the parameters to point to your .ahk script add a [space] and then %romlocation% Check 2 boxes Then at the bottom of your script, you'd have it launch MAME with the ROM file. Something (but not necessarily exactly) like this. (added some beeps when it loads a specific config) romlocation = %2% ROM = %3% ;Process UltraStick Profiles ROM_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\MAME\" . ROM . ".ugc /showfeedback" EMU_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\MAME\MAME.ugc /showfeedback" DEF_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\default.ugc /showfeedback" ULTRAMAP := "D:\LaunchBox\ThirdParty\UltraMap.exe" ;Load the joystick profile if FileExist(ROM_STK_PROF) { SoundBeep, 750, 500 RunWait %ULTRAMAP% %ROM_STK_PROF% } else if FileExist(EMU_STK_PROF) { SoundBeep, 750, 200 SoundBeep, 1350, 200 RunWait %ULTRAMAP% %EMU_STK_PROF% } else { SoundBeep, 750, 200 SoundBeep, 1350, 200 SoundBeep, 750, 200 RunWait %ULTRAMAP% %DEF_STK_PROF% } RunWait, "D:\LaunchBox\Emulators\MAME\mame.exe" -keyboardprovider dinput -rompath %romlocation% %ROM% Not tested, but looks really good 'on paper'. Depending on how your MAME is setup and where it's located, you may need to change something on the last line. Many thanks! This is awesome and it will help with my 8 way 360 handling 4 way games. LedBlinky is great, but I am not convinced it was loading my profiles. I modified the code to work for me, but I only get the MAME gui when I launch the game and not the game running. Am i missing something? Here is mine below: #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ;This script loads game & emulator specific configurations into ;UltraSticks. If a game (ROM) specific profile ;exists it will be loaded. If not, the emulator (EMU) specific profile ;will be loaded. If neither a game specific nor emulator specific ;profile exists, a default (DEF) profile will be loaded. ;Parameters are the emulator and ROM name. ROM name is optional. ;Emulator names should match the assets folder name. romlocation = %2% ROM = %3% ;Process UltraStick Profiles ROM_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\MAME\" . ROM . ".ugc /showfeedback" EMU_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\MAME\MAME.ugc /showfeedback" DEF_STK_PROF := "D:\LaunchBox\ThirdParty\UltraStick\default.ugc /showfeedback" ULTRAMAP := "D:\LaunchBox\ThirdParty\UltraMap.exe" ;Load the joystick profile if FileExist(ROM_STK_PROF) { SoundBeep, 750, 500 RunWait %ULTRAMAP% %ROM_STK_PROF% } else if FileExist(EMU_STK_PROF) { SoundBeep, 750, 200 SoundBeep, 1350, 200 RunWait %ULTRAMAP% %EMU_STK_PROF% } else { SoundBeep, 750, 200 SoundBeep, 1350, 200 SoundBeep, 750, 200 RunWait %ULTRAMAP% %DEF_STK_PROF% } RunWait, "D:\LaunchBox\Emulators\MAME 0.243\mame.exe" -keyboardprovider dinput -rompath %romlocation% %ROM% Edited March 21, 2023 by latin625 Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted March 21, 2023 Share Posted March 21, 2023 13 minutes ago, latin625 said: Am i missing something? No. 😊 Try changing these 2 lines to: romlocation = %1% ROM = %2% 1 1 Quote Link to comment Share on other sites More sharing options...
latin625 Posted March 21, 2023 Author Share Posted March 21, 2023 Worked! Only thing now is that the bezels are gone. On regular MAME they are there, but when I use the "new emulator" the bezels are gone. Odd! Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted March 21, 2023 Share Posted March 21, 2023 6 minutes ago, latin625 said: Worked! Only thing now is that the bezels are gone. On regular MAME they are there, but when I use the "new emulator" the bezels are gone. Odd! What does your existing MAME emulator (in LB) Default Command-Line Parameters look like? Quote Link to comment Share on other sites More sharing options...
latin625 Posted March 21, 2023 Author Share Posted March 21, 2023 Strange. There is no Bezel option now, but the old one (regular mame emulator) has it when I click the tab button to check the game settings. Quote Link to comment Share on other sites More sharing options...
latin625 Posted March 21, 2023 Author Share Posted March 21, 2023 The mame emulator settings are these: Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted March 21, 2023 Share Posted March 21, 2023 7 minutes ago, latin625 said: The mame emulator settings are these: Change the last line to RunWait, "D:\LaunchBox\Emulators\MAME 0.243\mame.exe" -skip_gameinfo -waitvsync -keyboardprovider dinput -rompath %romlocation% %ROM%, D:\LaunchBox\Emulators\MAME 0.243 1 Quote Link to comment Share on other sites More sharing options...
latin625 Posted March 21, 2023 Author Share Posted March 21, 2023 My Man! Super Thanks @JoeViking245 Owe you a beer for sure!!! Game on! 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.