Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: Haloman800 on October 06, 2012, 03:52:30 am

Title: Remap future pinball exit key
Post by: Haloman800 on October 06, 2012, 03:52:30 am
I want to change the exit key in FP from "Esc" to "3". If it needs to be with an AutoHotKey script that's fine, I'm already using one with HyperSpin's Hyperlaunch for booting, here is that script:


;----------------------------------------------------------------------------
; Future Pinball
; Future Pinball 1.9.1.20101231
; by djvj
; 1.3
;
; Notes:
; Thanks to the FPLaunch author for some of the code
; To set fullscreen, open the emu and goto Preferences->Video / Rendering Options and set your resolution and check fullscreen.
; AHK is not 100% reliable with its focusing. If coin/start/flipper buttons don't function when you start a table, try clicking your left mouse button.
; The script will fail if you have any errors or missing files for your tables. Make sure every table is working before you turn on the LoadingScreen.
; If you use Esc as your exit_emulator_key, you may see the table editor flash in when you exit a game. This is because Esc is the default fixed key for FP so it's closing the game before ahk does.
; If you need to run FP as admin, you can try this trick http://www.zdnet.com/blog/bott/fixing-windows-vista-part-2-taming-uac/436?pg=4 (http://www.zdnet.com/blog/bott/fixing-windows-vista-part-2-taming-uac/436?pg=4) and use the other Run command commented below
; Future Pinball stores its config in the registry @ HKEY_USERS\S-1-5-21-440413192-1003725550-97281542-1001\Software\Future Pinball\GamePlayer
;----------------------------------------------------------------------------

If 0 < 2
{   MsgBox,,,Please run this through HyperSpin,2
   ExitApp
}Else
   Goto, Start

Start:

GUI_ID := FadeInStart()

7z1 := 7z(romPath, romName, romExtension, 7zExtractDir)

Run, "%executable%" /open "%romPath%\%romName%%romExtension%" /play /exit /arcaderender, %emupath%, Hide
;Run, "schtasks /run /tn “Future Pinball“", C:\Windows\system32 ; this runs FP via Task Scheduler if you need to run as admin and don't want to see a UAC popup

WinWait, ahk_class FuturePinball
WinWait, ahk_class FuturePinballOpenGL
WinActivate, ahk_class FuturePinballOpenGL
WinWaitActive, ahk_class FuturePinballOpenGL
Gui, destroy   
WinWait, ahk_class FuturePinballOpenGLSecondary,,1
WinActivate, ahk_class FuturePinballOpenGLSecondary
WinWaitActive, ahk_class FuturePinballOpenGLSecondary,,1
WinWaitClose, ahk_class Ghost
Loop {
      IfWinActive, Future Pinball ahk_class FuturePinballOpenGL
         Break
      WinActivate, Future Pinball ahk_class FuturePinballOpenGL
      Sleep, 50
   }
WinWaitActive, Future Pinball ahk_class FuturePinballOpenGL

GUI_ID2 := FadeInExit()

Process, WaitClose, %executable%

7z2 := 7zCleanUp()

GUI_ID4 := FadeOutExit()

WinActivate, Hyperspin

ExitApp

CloseProcess:
   GUI_ID3 := FadeOutStart()
   WinHide, ahk_class FuturePinball ; need these 2 lines otherwise the table editor flashes over the GUI
   WinMinimize, ahk_class FuturePinball
   WinClose, ahk_class FuturePinball
   WinWaitClose, ahk_class FuturePinball ; this helps eliminate the slight flicker when you exit the table
Return


So if it does need a script, if you could add it to the above, that'd be excellent. Thanks