Page 1 of 2
Mame (AutoIt)
Posted: Tue Aug 13, 2013 9:01 pm
by davhuit
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.
Code: Select all
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 :
Code: Select all
<Cmd id="0" name="MAME" value="-rompath "%path" %file%ext %volume -skip_gameinfo -nowindow" />
So maybe it's what I missing?
Thanks a lot.
Re: Mame (AutoIt)
Posted: Wed Aug 14, 2013 7:31 pm
by davhuit
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
Re: Mame (AutoIt)
Posted: Wed Aug 14, 2013 8:03 pm
by mgalaxy
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:
Code: Select all
$PID = Run( $path & $app & ' -rompath' & $CmdLine[1], $path)
Re: Mame (AutoIt)
Posted: Wed Aug 14, 2013 8:17 pm
by davhuit
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.
Code: Select all
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
Re: Mame (AutoIt)
Posted: Thu Aug 15, 2013 9:49 am
by Aeliss
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
Re: Mame (AutoIt)
Posted: Thu Aug 15, 2013 10:40 am
by davhuit
Like that ?
Code: Select all
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 :
Code: Select all
Error: unknow option: -rompath-rompath
Re: Mame (AutoIt)
Posted: Fri Aug 16, 2013 7:18 am
by davhuit
I tested several new things and the best I could do is :
Code: Select all
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.
Re: Mame (AutoIt)
Posted: Fri Aug 16, 2013 2:47 pm
by mgalaxy
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!!
Re: Mame (AutoIt)
Posted: Fri Aug 16, 2013 3:50 pm
by Aeliss
If you use in your xml part
Code: Select all
<Cmd id="0" name="MAME" value="-rompath "%path" %file%ext %volume -skip_gameinfo -nowindow" />
try with
Code: Select all
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
Re: Mame (AutoIt)
Posted: Fri Aug 16, 2013 7:00 pm
by davhuit
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
Re: Mame (AutoIt)
Posted: Sat Aug 17, 2013 7:51 am
by Aeliss
I forget A space I think try with PID = Run( $path & $app & ' ' & $CmdLineRaw )
Re: Mame (AutoIt)
Posted: Sat Aug 17, 2013 11:46 am
by davhuit
This time it's working, thanks
Here's the whole script, if someone else need it one day :
Code: Select all
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
Re: Mame (AutoIt)
Posted: Sun Sep 08, 2013 12:36 pm
by davhuit
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=vp1gYtm3 ... e=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? ... 125#msg125
Maybe it can fix the problem (if it's really related to the command-line window).
Re: Mame (AutoIt)
Posted: Sun Sep 08, 2013 2:49 pm
by Aeliss
Why do you not use "mame64.exe" ? (no dos box with it)
Re: Mame (AutoIt)
Posted: Sun Sep 08, 2013 3:21 pm
by davhuit
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".