The NEW Build Your Own Arcade Controls
Front End Support => MaLa Frontend => Topic started by: PaTrYcK on July 11, 2012, 07:11:22 am
-
Hi, i have one problem with epsxe emulator because when i press alt sx button the games is blocked...
I resolved it with my autohotkey script, but how i can configure mala to start this exe when i launch epsxe emulator?
How i can close it when i close the epsxe emulator?
Thanks
-
I like your idea, but i'm not MALA developer, in addition to your ideia it will nice to see:
On MALA start execute command
On emulator start execute command
On game start execute command
On game vertical start execute command
On game horizontal start execute command
On game horizontal end execute command
On game vertical start execute command
On game end execute command
On emulator end execute command
On MALA end execute command
Thankyou
-
@treco
All these things are possible already by using the Mala API. Granted, it's not settings and batch files, but the ability is there.
@patryck
The best way to set that up is to configure mala to run your AHK Script or a bat file, etc.
Then, in the script/bat file
1) execute whatever startup you need
2) start your emulator with the proper command line args and wait for it to close
3) when the emu closes, run any shutdown code you need and exit the script.
-
Hi drventure , thanks for your reply!
Then, in the script/bat file
1) execute whatever startup you need
2) start your emulator with the proper command line args and wait for it to close
3) when the emu closes, run any shutdown code you need and exit the script.
I have the autokey script in c:/mala/script.exe
I need your help...which is the command for start this autokey with emulator?
Thanks!
-
What I do is configure MALA to execute a BAT file instead of MAME directly, in MALA's config screen.
Then, in that BAT file, you can do whatever you need to do. Mala will pass you the mame rom name of the rom that it's trying to start. It's up to you to actually start MAME with that roms name, something like this
cd c:\mame
start "Mame" /WAIT Mame.exe %1
You'll want to use the START command so that the bat file waits till Mame exits before it continues.
For details on START see
http://www.computerhope.com/starthlp.htm (http://www.computerhope.com/starthlp.htm)
Finally, since you've now got a BAT file sitting between Mala and Mame, you can run whatever you want BEFORE and AFTER you run mame.
So an AHK script could be run like:
c:\autohotkey\AutoHotKey.exe MyScript.ahk
Here's some info on running AHK from the command line (or a BAT file)
http://www.autohotkey.com/docs/Scripts.htm#cmd (http://www.autohotkey.com/docs/Scripts.htm#cmd)
-
I'm trying to remember what I wanted to do in this vein.........I think it was only to ensure there was no flash back to the game list between the game loading screen and the game loading (for example with VP and AAE).
-
I know what you mean. I believe that flash is because Mala is throwing up the Loading screen, then launching, then taking down the loading screen after a few seconds.
If it takes longer than that timeout to load the game, you get what looks like that flash.
Really mala ought to just leave the loading screen up much longer, but, I can see the opposite problem, too.
If it's up too long, you could quit the game only to see a flash of "loading" and then back to Mala, which would likely also be objectionable.
-
I know what you mean. I believe that flash is because Mala is throwing up the Loading screen, then launching, then taking down the loading screen after a few seconds.
If it takes longer than that timeout to load the game, you get what looks like that flash.
Really mala ought to just leave the loading screen up much longer, but, I can see the opposite problem, too.
If it's up too long, you could quit the game only to see a flash of "loading" and then back to Mala, which would likely also be objectionable.
Welp....not even every quick-loading game in MAME takes the same time to load, and Mala catches it right, which suggests to me that Mala knows when the game is not only loading but also displaying. I assumed this would be the case for any game, any emulator - unless there was some thing that told Mala differently...or Mala was mis-intepreting some thing during loading sequence.
For example, AAE through the command line is almost instant. But through Mala, it's different: loading screen, then pop back to layout with an apparently minimized black screen (I'm thinking Mala is having trouble with the OpenGL transition or something), sits there for five to ten seconds, and finally the game loads.
With Visual Pinball I think it's not Mala's fault, as VP has those damn splash screen. Even Howard's wrapper can't totally negate them.
-
You could take a look to AllInOne.
Greetings!
-
@drventure
thanks for your reply...
I would like to start the autohotkey file only when I start the emulator epsxe and I would like it closed automatically when I close epsxe, i can do it directly here?
(http://i.imgur.com/inso1.jpg)
-
Haven't used those options, but that would sure seem like the appropriate way to do it.
The only thing you might run into is what is considered the "current" directory. I'm guessing the ROM folder, but it could be the MALA folder, or the EMU folder. You could test it by using
DIR
PAUSE
If you always reference full paths, though, there shouldn't be any issue.
-
Hi drventure, thanks!
The name of my autohotkey file is "script.exe" and directory of this file is: c:/script.exe.
I tryed this configuration, i see that script is started, but Mala not launch the epsxe emulator, while if i closed the script mala work perfectly and epsx started...
(http://i.imgur.com/3J6lx.jpg)
-
I haven't tested this part of Mala out a lot yet (I plan on it with Virtual Pinball etc).
One thing that might be causing issues is you need to use the backslash in your paths
c:\script.exe
Another is how script.exe works. Mala, +I THINK+ will execute each of the pre and post commands, waiting for each to finish before moving on.
In this case you don't want that.
You may need to use a command line like start or cmd
as in
cmd /k c:\script.exe
or
start "Title" c:\script.exe
Alternately, get rid of the pre and post commands, and for the emulator, instead of specifying espx directly, set a BAT file in that field, then create a BAT file that executes your pre and post commands around starting the emulator.
-
Same issue I had. It would not continue to game load.
-
Just had a sec to try this out.
If you want to use the Pre and post commands for ANYTHING that "stays loaded", you'll need to use something like this for your command line
cmd /c start "" yourapphere.exe
so, for instance, i tried notepad.exe
Using this:
notepad.exe
for a "pre command" did exactly what you guys see, it stops at notepad, as soon as I close notepad, the emulator would start up.
So,I changed the command line to
cmd /c start "" notepad.exe
and that works perfect. Notepad starts in the background and the emulator is then loaded.
Same this with post commands.
Basically, mala is waiting for your command to exit.
The only way to make that happen is to use CMD /C Start, in order to fire up the "actual" command separately, so that the cmd shell can exit and make mala happy.
-
WOW, now work fine, thanks!
I use your cmd: cmd /c start "" script.exe and i put file script.exe in to "windows" folder, my autohotkey script.exe start with emu, perfect!
So, you can help me for close it when i closed the emu?
Thanks ;)
:applaud:
-
Glad that's working.
About stopping the script. Wow, I didn't think it'd be particularly tough, but looks like I was wrong.
I don't see any obvious command line switch to do it.
I did turn up this
http://www.autohotkey.com/docs/commands/OnMessage.htm (http://www.autohotkey.com/docs/commands/OnMessage.htm)
Basically, you have your actual script, which will terminate on receipt of a specific message.
Then you write ANOTHER script to send that message.
Then, you execute the second script at the end of the run (after the emu has closed), it sends a message to the already running first script, which then shuts down, then the second script automatically closes.
Sorry, though, don't have any examples of that. The link above looks like it has some good stuff on it though.
-
Hi, i have found the way for close the script, in the post-command i have used:
taskkill /im script.exe
and when i close the emulator the script is killed ;)
-
I keep forgetting about taskkill.
Good call!
-
Thanks for your support :cheers:
-
Obviously Mala was waiting for the app to close, and I knew it would be something simple to have it run in the background. I just don't know command line beyond running an app and navigating directories. I still can't remember what I wanted this for, though, so.....
-
Oh, it was in my bookmarks:
I have gamepad controllers in one rig, and shelling to Mala means joytokey can't load.
So I thought I'd load joytokey via emulator pre-command. I assumed the pre-command syntax would be "dir>joytokey.exe, and joytokey does load. However, the game doesn't load/Mala sticks on the loading screen. Exiting/canceling joytokey allows Mala to continue and load the game.
What does the syntax need to be?....or is this avenue not viable within Mala?
http://forum.arcadecontrols.com/index.php/topic,115347.0.html (http://forum.arcadecontrols.com/index.php/topic,115347.0.html)
So similar deal as above. I don't recall whether I found a way to shell to Mala; or I hid the task bar, set a game-type image for the background, and put Mala and joytokey in the start folder. But I'll keep this in mind if I go back to it.
By the way, I'm not seeing the difference in your cmdline entries:
cmd /c start "" yourapphere.exe
so, for instance, i tried notepad.exe
Using this:
notepad.exe
for a "pre command" did exactly what you guys see, it stops at notepad, as soon as I close notepad, the emulator would start up.
So,I changed the command line to
cmd /c start "" notepad.exe
-
I know this thread is a bit old, but I have similar problem and seem to be very close to solving it given the info in this thread regarding the Pre/Post commands in Mala.
I'm running Visual Pinball with Mala. I'm using Howard_Casto's Visual Pinball wrapper to launch the tables from Mala. Everything works great except that I want to run an Auto Hot Key script ALSO so I can remap the mouse buttons and also create a two-button ESC combo. This is to make sure everything runs smoothly on my X-Arcade tankstick.
So... what I'm trying to do is run an AHK exe (VPTable-Launch.exe) in the Pre-Command that will remap the keys, then launch the VP wrapper (vp-launcher.exe) with the keys still remapped and then exit the wrapper with my chosen two-button exit mapped to ESC, close the AHK script, then jump back to Mala.
The problem is that Mala opens the AHK script but will hang. the controls for VP won't work (flippers, etc). I have to quit the script and then Visual Pinball will work. I want them both to run simultaneously. Is that possible?
My script looks like this:
______________________
LButton::D
RButton::G
~2 & ~4::
Send {ESC}
Exit APP
return
______________________
Precommand:
cmd /c start "" "C:\Arcade\Visual Pinball\VPTable-Launch.exe"
Postcommand:
tskill VPTable-Launch.exe
All other set-up coding is the same as before, pointing to Howard_Casto's "vp-launch6.exe" wrapper.
Do I need some sort of loop command?:
http://forum.arcadecontrols.com/index.php/topic,89321.msg937485.html#msg937485 (http://forum.arcadecontrols.com/index.php/topic,89321.msg937485.html#msg937485)
How can I get the AHK scripting to work alongside the vp-launch6.exe wrapper??? This is so frustrating? Any help? :badmood:
-
I would have thought that would work. I'll see if I can replicate that prob.
-
drventure,
Thanks for your help. I can sense I'm close to getting this to work, but I just can't figure out what I'm doing wrong.
It's odd. I've been able to get the AHK script to work by itself AND launch Visual Pinball, but the normal controls don't work, meaning Mala is limiting Howard's wrapper or VP from working fully because it's hung up on the AHK script. If I quit the script, then VP works normally. When I close VP (using ESC rather than my two-button combo set up by the AHK script), I get the error that it couldn't close the script. I'm sure this end error is because I had to close it in order to play VP.
-
One possibility is to not use the pre/post command, and setup a BAT file that accepts the arguments that Mala supplies, and launches AHK, then VP, waits for VP to finish, then closes out AHK.
Here's an example I use for launching DukeNukem 3D, and turning on LEDBlinky to run sound animations, then turning it off when done
REM Run Duke Nukem3d
c:
cd C:\Games\EDuke3D
REM Start Audio Animation
REM "\\arqadium\drivec\Games\FrontEnds\Mala\Plugins\LEDBlinky\LEDBlinky.exe" audio.lwax pattern01.lwax
start "" /wait eduke32.exe
REM Stop Animation
REM "\\arqadium\drivec\Games\FrontEnds\Mala\Plugins\LEDBlinky\LEDBlinky.exe" 11
note the START .... /wait
that stops the bat file from continuing till the user exits dukenukem.
Of course, you'll need to experiment with the %1 %2 %3 arguments that mala passes to the bat file to have it load up the selected table when launching VP, but that's pretty straightforward.
-
Thanks for the suggestion. You may be onto something with the BAT file idea. I can see the logic where you state "setup a BAT file that accepts the arguments that Mala supplies, and launches AHK, then VP, waits for VP to finish, then closes out AHK."
I've messed with BAT files a little bit but am no expert.
What does "REM" mean? Just a remark? Ignored line of code?
How would I allow Mala to pass the %1% variable (name of table) through the BAT file and onto the final VP wrapper (vp-launch6.exe)? I've never done that before.
-
Couldn't I simply launch a BAT file in the Pre-Command that would run an AHK script in the background to set up a few controls, then have Mala launch the wrapper (vp-launch6.exe) normally using the command line, then have a BAT file in the Post Command close the AHK script.
Couldn't that work?
Any idea what that batch file might look like?
-
You're right about the REM lines, those are just remarks or comments.
And yes, starting AHK with the precommand, then terminating it with the post command should work.
If I can get some time tomorrow, I'll see if I can put together an example for you.
-
OK, I've done some experimenting and I've had more success!
I created an AHK file called "VPControls.ahk" which ONLY sets up the controls I need:
_________________________________
Set WorkingDir, C:\Arcade\Visual Pinball\
#SingleInstanceforce
LButton:: g
RButton:: d
~2 & ~4::
Send {ESC}; Note no ExitAPP, Return after this line to keep the script running.
_________________________________
Then in Mala put the following under the Execution tab...
Precommand:
cmd /c start "" "C:\Arcade\Visual Pinball\VPControls.ahk
Command line (same as always):
"%rom%.%ext%"
Postcommand:
taskkill VPControls.ahk
Everything under the Basics tab stayed the same as always...
Executable (keeping the wrapper as the launcher):
C:\Arcade\Visual Pinball\vp-launch6.exe
Rom Path
C:\Arcade\Visual Pinball\Tables
Rom Extensions:
vpt
_________________________________
And it works for the most part!
Two minor problems:
The "taskkill" command line doesn't seem to work. It doesn't give me an error but AutoHotKey.exe is still running in the background when I go back to the Mala menu and the script controls are still running. How to end the script for good after vp-launch6.exe quits? Run the script as an .exe. Go back to the BAT file idea to open and close the AHK scripts?
The other issue is that when a VP table is open the 2+4 combo exit key sends ESC but not the way I intended. Visual Pinball picks it up and I get the close menu. What I want is the outright automatic Quit/Close I get when I manually press ESC. This is what the vp-launch6.exe does but for some reason even though it's running fine, my 2+4 key acts as if VP was running alone. Any ideas on how to trully send the escape key. Perhaps a AHK code like {Down ESC} or something?
So it looks like I'm about 90% there. Very close. Any ideas on the last two issues?
-
No reason to set working directory in the script since all it is doing is remapping buttons.
~2 & ~4::
Process, Close, vp-launch6.exe
Will kill visual pinball
You might have to swap in the actual visual pinball exe in place of the wrapper.
Like I said, I'm not running VP.
That just leaves exiting the script.
You could have it check to see if a virtual pinball windows exists. (ifwinexist)
If it does, it will return. If not, it will exit.
I don't remember the commands off the top of my head, but Nitz should be able to help you with that one.
(or find an example and copy it ;) )
-
SUCCESS!!!! :woot
I posted this same solution on this thread:
http://forum.arcadecontrols.com/index.php/topic,130016.0.html (http://forum.arcadecontrols.com/index.php/topic,130016.0.html)
Between trying to understand Pre/Post command structure here (Thank you drventure!!) and AHK scripting along with how Howard_Casto's wrapper worked in the other (Thanks to nitz, Howard_Casto and BadMouth), I finally figured out how to do it.
Perhaps there's another way to do what I was trying to do but for me it involved using the Pre/Post Commands in Mala along with a carefully crafted AHK script. All this to keep the functionality of Howard's excellent VP wrapper intact (and not loose focus) while still being able to add a bit more functionality for my X-Arcade tankstick. I also wanted to keep with my consistent 2 button exit format along with the rest of the emulators on my arcade cabinet.
Now the SOLUTION!!
First I tweaked my AHK script (VPControls.ahk) for the Pre-Command in Mala. I suppose I could have compiled it to be an .exe, but the simple .ahk format ended up working just fine:
______________________________________
SetWorkingDir, C:\Arcade\Visual Pinball\
#SingleInstance force
~LButton::g ; Nudge Right remap. The "~" is required. Otherwise focus is lost on some tables. Somehow V.P. "clicks" left on tables to begin.
~LButton::d ; Nudge Left Control remap
~2 & ~4::
Send {Esc DOWN} ; Esc key MUST be held for for a bit in order to register with the wrapper. Thanks Howard for the head up.
Sleep 1000 ; keeps the Esc key down for one second
Send {Esc UP}
Sleep 500 ; putting in this small pause seemed to help
ExitApp ; Closing AutoHotKey.exe here rather than in the Post command proved to be possible after all.
return
______________________________________
Then I set up Mala as follows so Howard's wrapper and the AHK script would play nice together. Pre/Post commands were the vital parts:
EXECUTION TAB
Pre Command:
cmd /c start "" "C:\Arcade\Visual Pinball\VPControls.ahk"
Command line (same as always):
"%rom%.%ext%"
Post Command:
(NONE/EMPTY - Not needed because I set up the closing of the ahk script within the script itself)
BASICS TAB (same as always to launch Howard's wrapper):
Executable (keeping the wrapper as the launcher):
C:\Arcade\Visual Pinball\vp-launch6.exe
Rom Path
C:\Arcade\Visual Pinball\Tables
Rom Extensions:
vpt
And that's it!! From Mala/Visual Pinball I can launch any table from the menu. The ahk script sets a few controls I couldn't remap otherwise and stays running in the background. Mala then launches Howard's excellent wrapper (vp-launch6.exe). The wrapper takes control of Visual Pinball and plays the table accordingly WITH the added controls of the ahk script. There is no conflicts or loss of focus. I can nudge using the 2nd flipper buttons now on my X-Arcade!! Then, when I'm done playing that particular table I press the 2+4 buttons together (on my X-arcade, not keyboard) and BAM! I'm back to the Mala menu and BOTH Visual Pinball AND AutoHotkey.exe have been closed!!! I tested this over and over on many different tables. Works like a champ.
I hope this thread helps someone else with a similar goal in mind.
Thanks again everyone who chimed in on this thread (drventure, BadMouth, Gray_Area, PaTrYcK). Thanks for your help and knowledge.
-
Awesome! Glad to hear you got it working.
Closing out AHK on the keypress was a nice touch. Makes it much cleaner.