Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. Thank you for your support. Tom Speirs

Patreon

Exit GamEx plugin help


emphatic

Recommended Posts

I'm using my EGRET II for MAME gaming and I don't have any free buttons for exiting MAME games, so I thought I'd give the Exit GameEx plugin a go. However, I can't seem to get it to work at all. My ideal function would be holding down Player 1 and Player 2 start to exit a game. Is this possible?

Emph

Link to comment
Share on other sites

No need to use advanced plugins. Just go into the MAME setup (hit 'TAB') and change the 'UI Cancel' setting. You can have multiple keys in there just by pressing them all at once. So, maybe you want to use P1B1 + P1Start + P1Coin (or maybe throw a direction in there on a joystick). Should work fine! I actually have my cab setup to use P2 left + P2 right = quit and P2 up + p2 down = pause.

Link to comment
Share on other sites

The plugin is for exiting GameEx not exiting a game. Advanced Configs can be used to exit games using joystick button combo's.

Okay, but how? The thing is I don't want just a buttom combo, since that can easily interfere with gameplay. Holding the buttons for say, 5 seconds would be optimal. Can I do this with AutoHotKey? Does it have timed key mapping like that? I know that GameEx has (had?) some remapping functionality. But perhaps most people have six buttons or more on their CP's?

I was looking in Advanced MAME configuration, AND GameEx inputs (in the wizard) but there's no mentioning of this.

Thanks guys.

Emph

Link to comment
Share on other sites

I managed to set MAME's 'GUI Cancel' to Right+1+2. But if you just run MAME from Windows, exiting it kinda impossible, since the 'Select a new game'-menu pops up and everytime you try to hit the correct key-combo, the search has a higher priority than executing the key-combo/exiting. I found that the solution was to tie 'Escape' as well as the desired combo. So if you're running games outside of GameEx (testing or whatever) you don't need to do the combo-thing.

Emph

Link to comment
Share on other sites

So what I have to change is:

WatchQuitCombo:
if GetKeyState("Joy1") AND GetKeyState("Joy1")
{
SetTimer, ComboQuitDown, 100
SetTimer, WatchQuitCombo, Off
}
return

ComboQuitDown:
if GetKeyState("Joy1") AND GetKeyState("Joy2")
{
QuitWaitTime:=QuitWaitTime + 100
if QuitWaitTime >=2000
{

Right?

If I wanna use keyboard 1+2 I just switch out Joy1 -> 1 and Joy2 -> 2, correct?

Thanks, I'll give it a go.

Emph

Link to comment
Share on other sites

It might be easier with keyboard input. I think just changing the Joy1 -> 1 should work, I've just never tried it.

It might be better to use the multiple key remapping capability of AHK instead since you aren't using a joystick. If you want to map 2 keys to do the same thing, just use:

1 & 2 :: <action>

I would suggest using a timer anyway since you probably want a delay (I think you said you did). If you just have <action> be Alt-F4, you get the same result as you currently have.

Link to comment
Share on other sites

Hi, thanks a lot for your kind effort, but the script doesn't seem to pick up when I press 1+2. I've tried holding them down and counting to 20. Perhaps it's because I use a laptop? What does {Blind} do?

Thanks

Emph

Link to comment
Share on other sites

Are you using the number keys on the top, or the keypad keys? The script looks for the standard number keys (above the letters) and if 1 and 2 are held down for 2 seconds, it sends the escape key. I don't think this will work with the current version of MAME since it requires raw input (the script is a bit old). If you want to see if it's detecting the keys, replace:

Send {Blind}{Escape}

with

msgbox booooom!

If it pops up a message box, it's working. If not, then your keys are not sending the standard 1 & 2 buttons. Not a problem, just requires an extra step. Also, it might be easiest to open notepad and save an empty text document as MAME (no extension). Keep it open while trying the script. That way, it will see "MAME" in the application name field and enter the IfWinActive section. Otherwise, you can just delete that line and the two brackets. Either way...

Link to comment
Share on other sites

Nope, that's new as of 0.107 or so. One thing you can do is either send Alt-F4 (Windows forced quit) or use the AHK WinClose statement above. Either *should* work, but it's possible MAME will steal the Alt-F4.

Link to comment
Share on other sites

Success! Winclose worked!

So for future reference is anyone is interested, here's a script that exits MAME by holding down P1 start + P2 start for a couple of seconds:

#InstallKeybdHook
#SingleInstance force

QuitWaitTime:=0

#Persistent
SetTimer, WatchQuitCombo, 250
return



WatchQuitCombo:
if GetKeyState("1") AND GetKeyState("2")
{
SetTimer, ComboQuitDown, 100
SetTimer, WatchQuitCombo, Off
}
return

ComboQuitDown:
if GetKeyState("1") AND GetKeyState("2")
{
QuitWaitTime:=QuitWaitTime + 100
if QuitWaitTime >=2000
{
IfWinActive MAME
{
WinClose, MAME
}
;IfWinActive <Another Emulator>
;{
; Send {Blind}{Escape}
;}
QuitWaitTime:=0
SetTimer, WatchQuitCombo, 250
}
}
Else
{
QuitWaitTime:=0
SetTimer, WatchQuitCombo, 250
}
return

Thank you very much, you've totally made my evening.

Emph

Link to comment
Share on other sites

Quick note. This quits when you hold keyboard 1 + keyboard 2, which is defaulted to P1 Start + P2 Start. If you remap your keys in MAME, just replace the 1 & 2 keys as appropriate. If you need a reference for what the keys are called check the AHK help file or search at www.AutoHotKey.com for "remapping". I would provide a direct link, but my stupid ISP has decided that AHK is inappropriate and/or contains malicious code... :mellow:

Link to comment
Share on other sites

All you had to do was ask... :D

#InstallKeybdHook
#SingleInstance force

QuitWaitTime:=0

#Persistent
SetTimer, WatchQuitCombo, 250
SetTimer, WatchMAME, 1000
return



WatchQuitCombo:
if GetKeyState("1") AND GetKeyState("2")
{
SetTimer, ComboQuitDown, 100
SetTimer, WatchQuitCombo, Off
}
return

ComboQuitDown:
if GetKeyState("1") AND GetKeyState("2")
{
QuitWaitTime:=QuitWaitTime + 100
if QuitWaitTime >=2000
{
WinClose, MAME
ExitApp
}
}
Else
{
QuitWaitTime:=0
SetTimer, WatchQuitCombo, 250
}
return

WatchMAME:
IfWinNotExist MAME
{
ExitApp
}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...