Crush Posted January 9, 2017 Share Posted January 9, 2017 (edited) #NoEnv ; ================================================================================= ; FOR MAME TO ACCEPT AHK SCRIPTS keyboardprovider IN mame.ini MUST BE SET TO dinput! ; ================================================================================= ; Fast Forward 4Joy15:: If GetKeyState("4Joy15") { SetKeyDelay, -1, 110 MmC:=!MmC if MmC = 1 Send {Insert down} else Send {Insert up} return } Return ; Pause 4Joy20:: If GetKeyState("4Joy20") { SetKeyDelay, -1, 110 Send {p} } Return ; Exit 4Joy17:: If GetKeyState("4Joy17") { SetKeyDelay, -1, 110 Send {escape} } Return ; Load State 4Joy18:: If GetKeyState("4Joy18") { SetKeyDelay, -1, 110 Send {F7 up}{Shift up} Sleep 100 Send {F7} Sleep 100 Send {s} } Return ; Save State 4Joy19:: If GetKeyState("4Joy19") { SetKeyDelay, -1, 110 Send +{F7} Sleep 50 Send {s} } Return This is a series of small scripts mapping various MAME functions (Load State, Save State, Pause, Exit, Fast Forward) to gamepad buttons on my 4th controller. Modify the scripts to map them to your own controllers or add new ones - you may also need to modify some timings in the Sleep, SetKeyDelay commands if a script doesn't work for you. NOTE1: If you don't want to modify your mame.ini, open Launchbox, go to the Default Command-Line parameters for MAME and add: -keyboardprovider dinput This is needed so MAME can accept input from AutoHotKey. NOTE2: The Save States script, saves a state with the name "s" automatically (and the Load State script loads it back). You can change the "s" to any other number/letter on both scripts or you can remove the Sleep 50, Sleep 100 & Send {s} lines if you want to save states manually. Edited January 9, 2017 by Crush Quote Link to comment Share on other sites More sharing options...
DOS76 Posted January 9, 2017 Share Posted January 9, 2017 (edited) User could also just set these controls to two button combos sent from the 1st player controller on my arcade machine coin and start together is tab coin and one of the buttons on my front panel exit coin and 5 is save coin and 6 is load so on a controller you would just replace coin with select and do the same thing. To map combos in MAME just press both buttons simultaneously while it is waiting for you to enter input. This way you can still use XInput you don't have to mess with AHK at all and control things all from the 1st player. Edited January 9, 2017 by DOS76 Quote Link to comment Share on other sites More sharing options...
DOS76 Posted January 9, 2017 Share Posted January 9, 2017 (edited) Sorry double post Edited January 9, 2017 by DOS76 Quote Link to comment Share on other sites More sharing options...
Zero Posted July 30, 2017 Share Posted July 30, 2017 Encountered this post and wanted to ask, has anyone gotten the save state/load state script to work for MAME? Been trying various things and can't get anything to stick. Farthest is leep encountering the save state being a "joy0" entry from AHK which is unable to be loaded? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.