mGalaxy forum
General Discussions => Need Help? => Topic started by: davhuit on August 13, 2013, 04:01:12 PM
-
Okay, so now, I'm trying to do a AutoIt script for Mame.
I know I can assign a key to quit, but if I can, I would rather use the same combo key on xpadder to close all the emulators (will be easier to remember).
Right now, I'm using the combo LB+click on the right analog stick to emulate the ESC key on xpadder, and can quit Final Burn Alpha (and others emulators which use the ESC key to quit) this way (right analog stick click, without LB, is configured to reset in those emulators).
Until now, I had mapped the right analog stick click in Mame to do the quit button, but if I can use an AutoIt script, I will then be able to use that stick to do reset, which would also be cool)
I tried Mame in command line and it only require : "Mame nameoftherom" (no .zip needed, but it also works when you put a .zip extension anyway) so I tried to use the Model 2 script one, but Mame don't start with it, which is pretty weird.
HotKeySet("{ESC}", "Terminate")
$path = "F:\Jeux PC [Downloads]\Emulation\mame0149b\"
$app = "mame.exe"
If $CmdLine[0] == 1 Then
$PID = Run( $path & $app & ' ' & $CmdLine[1], $path)
While 1
Sleep(100)
WEnd
EndIf
Func Terminate()
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
Exit 0
EndFunc
I saw this in the xml file :
<Cmd id="0" name="MAME" value="-rompath "%path" %file%ext %volume -skip_gameinfo -nowindow" />
So maybe it's what I missing?
Thanks a lot.
-
I tried another script, Project64 2.1 one (though Mame don't require any quotes) but same, Mame don't run with it, seems weird ???
-
As you can see in the "systems.xml" there's a '-rompath' which is passed to the command line.
Try to add it to your AutoIt script, like this:
$PID = Run( $path & $app & ' -rompath' & $CmdLine[1], $path)
-
Ah, as it was working in command line without it, I thought it was optional.
I tested with your line and it still don't work ???. mGalaxy say "launching game" but it stay on the games list window.
HotKeySet("{ESC}", "Terminate")
$path = "F:\Jeux PC [Downloads]\Emulation\mame0149b\"
$app = "mame.exe"
If $CmdLine[0] == 1 Then
$PID = Run( $path & $app & ' -rompath' & $CmdLine[1], $path)
While 1
Sleep(100)
WEnd
EndIf
Func Terminate()
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
Exit 0
EndFunc
-
You still have 2 errors.
$CmdLine[1] = first param, so you pass the param "-rompath" and only this one, try $CmdLineRaw (contains the entire command line)
$CmdLine[0] == 1 : in your case you have more than 1 param so better use
$CmdLine[0] <>0 or $CmdLine[0] > 0
More infos here http://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine (http://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine)
-
Like that ?
HotKeySet("{ESC}", "Terminate")
$path = "F:\Jeux PC [Downloads]\Emulation\mame0149b\"
$app = "mame.exe"
If $CmdLine[0] > 0 Then
$PID = Run( $path & $app & ' -rompath' & $CmdLineRaw, $path)
While 1
Sleep(100)
WEnd
EndIf
Func Terminate()
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
Exit 0
EndFunc
Mame give me the following error :
Error: unknow option: -rompath-rompath
-
I tested several new things and the best I could do is :
HotKeySet("{ESC}", "Terminate")
$path = "F:\Jeux PC [Downloads]\Emulation\mame0149b\"
$app = "mame.exe"
If $CmdLine[0] > 0 Then
$PID = Run( $path & $app & ' -rompath')
While 1
Sleep(100)
WEnd
EndIf
Func Terminate()
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
Exit 0
EndFunc
which now output this error :
Error: Option -rompath excepted a parameter.
No more "-rompath-rompath" (twice the same line) but it still don't work.
-
I'll help you as soon as I'm back from my holidays. I've tried to help with my first reply to your post...but it was done quickly on my phone. I'll take some times to reply you efficiently in 2-3 days!!
-
If you use in your xml part
<Cmd id="0" name="MAME" value="-rompath "%path" %file%ext %volume -skip_gameinfo -nowindow" />
try with
HotKeySet("{ESC}", "Terminate")
$path = "F:\Jeux PC [Downloads]\Emulation\mame0149b\"
$app = "mame.exe"
If $CmdLine[0] > 0 Then
$PID = Run( $path & $app & $CmdLineRaw )
While 1
Sleep(100)
WEnd
EndIf
exit 0
Func Terminate()
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
Exit 0
EndFunc
-
Yeah, I use the same xml infos.
With this version, it stay on mGalaxy main screen (no more console with the error).
@mGalaxy : There's no hurry, have a great holliday :)
-
I forget A space I think try with PID = Run( $path & $app & ' ' & $CmdLineRaw )
-
This time it's working, thanks :)
Here's the whole script, if someone else need it one day :
HotKeySet("{ESC}", "Terminate")
$path = "F:\Jeux PC [Downloads]\Emulation\mame0149b\"
$app = "mame.exe"
If $CmdLine[0] > 0 Then
$PID = Run( $path & $app & ' ' & $CmdLineRaw )
While 1
Sleep(100)
WEnd
EndIf
exit 0
Func Terminate()
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
Exit 0
EndFunc
-
I found a little problem with my script, but it's probably not coming from v5.0, it's probably just that I didn't noticed it before.
Sometimes, when I quit Mame, mGalaxy lost the focus and I have to use ALT-TAB several times to get the focus back.
Here's an example of it in a video : http://www.youtube.com/watch?v=vp1gYtm35R8&feature=youtu.be
It often happen when I reset the game, then quit. It seems that the cause would be the command-line window that appear when you start/reset a game (as it's the only emulator which have that "bug" in my list).
Is there a way to fix the focus when I quit Mame by modifying the AutoIt script?
Meanwhile, I'll try that : http://www.mgalaxy.com/forum/index.php?topic=15.msg125#msg125
Maybe it can fix the problem (if it's really related to the command-line window).
-
Why do you not use "mame64.exe" ? (no dos box with it)
-
No real reason, just took the first one I found (the official website don't seem to have true windows version : http://mamedev.org/release.html).
But yeah, as I wrote at the end of my previous message, I plan to try a Windows based version to see if the problem come from that.
If someone know whre to find the 0149b version for Windows, I'm interested.
Edit : Okay, it seems the true windows version waqs called "Mame32" (for the 32 bits version) and now renamed "MAMEUI".
-
Seems to work with "MameIU32" though it also open a dosbox at the start, will see if I get the problem again later or not.
-
You are right, I m trying the official version and the application is just called "mame.exe".
We can try with a command to active mGalaxy in autoit, if your problem is still here.
WinActivate ("mGalaxy")
-
I'll post again here later if I notice the same problem with "MameUI" :)