MAME must be compiled to force Direct Input and the coin keys are set to the program defaults (5-8).
Just run the program with MAME to start it and run it again with the parameter q in order to close. The generated INI file can be used to set the number of starting coins and the interval between the addition of new coins.
The compiled program and source can be downloaded here: http://www.chinagreenelvis.com/gaming/tools/coincontrol
Code: Select all
; MAME Coin Control
; by chinagreenelvis
; Version 0.01
#NoEnv
#SingleInstance force
#Persistent
SetWorkingDir %A_ScriptDir%
AppName=MAMECC
IfNotExist, %AppName%.ini
{
IniWrite, 0, %AppName%.ini, Settings, HideIcon
IniWrite, 300000, %AppName%.ini, Settings, CoinTime
IniWrite, 4, %AppName%.ini, Settings, StartingCoins
IniWrite, 0, %AppName%.ini, Program, Running
}
IniRead, HideIcon, %AppName%.ini, Settings, HideIcon
IniRead, CoinTime, %AppName%.ini, Settings, CoinTime
IniRead, StartingCoins, %AppName%.ini, Settings, StartingCoins
IniRead, Running, %AppName%.ini, Program, Running
If (HideIcon)
{
Menu, Tray, NoIcon
}
Else
{
Menu, Tray, Icon
}
If (Running)
{
IniWrite, 0, %AppName%.ini, Program, Running
ExitApp
}
Else
{
IniWrite, 1, %AppName%.ini, Program, Running
}
P1 = %1%
IfEqual, P1, q
{
ExitApp
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CODE
SetKeyDelay 50
Joy1Pressed := 0
Joy2Pressed := 0
Joy3Pressed := 0
Joy4Pressed := 0
#IfWinActive ahk_class MAME
~1joy10::
If (!Joy1Pressed)
{
Joy1Pressed:= 1
KeyWait 1joy10
Loop, %StartingCoins%
{
Send {5 down}
Send {5 up}
Sleep, 50
}
SetTimer, Timer1, %CoinTime%
Return
}
Else
{
Return
}
Return
Timer1:
IfWinActive ahk_class MAME
{
Send {5 down}
Send {5 up}
}
Return
~2joy10::
If (!Joy2Pressed)
{
Joy2Pressed:= 1
KeyWait 1joy10
Loop, %StartingCoins%
{
Send {6 down}
Send {6 up}
Sleep, 50
}
SetTimer, Timer2, %CoinTime%
Return
}
Else
{
Return
}
Return
Timer2:
IfWinActive ahk_class MAME
{
Send {6 down}
Send {6 up}
}
Return
~3joy10::
If (!Joy3Pressed)
{
Joy3Pressed:= 1
KeyWait 1joy10
Loop, %StartingCoins%
{
Send {7 down}
Send {7 up}
Sleep, 50
}
SetTimer, Timer3, %CoinTime%
Return
}
Else
{
Return
}
Return
Timer3:
IfWinActive ahk_class MAME
{
Send {7 down}
Send {7 up}
}
Return
~4joy10::
If (!Joy4Pressed)
{
Joy4Pressed:= 1
KeyWait 1joy10
Loop, %StartingCoins%
{
Send {8 down}
Send {8 up}
Sleep, 50
}
SetTimer, Timer4, %CoinTime%
Return
}
Else
{
Return
}
Return
Timer4:
IfWinActive ahk_class MAME
{
Send {8 down}
Send {8 up}
}
Return
#IfWinActive