MEmu = Visual Pinball
MEmuV = v8.1.1 & v9.12
MURL =
http://sourceforge.net/projects/vpinball/" onclick="window.open(this.href);return false;
MAuthor = djvj
MVersion = 2.0
MCRC = 6B81A939
iCRC = 80311E26
MID = 635038268932497719
MSystem = "Visual Pinball"
vp8exe = VPinball8.exe
vp9exe = VPinball990.exe
vppm5exe = VP_physmod5.exe
vp8tag = Visual Pinball 8
vppm5tag = Visual Pinball 9 Physmod5
;----------------------------------------------------------------------------
; Notes:
; Requires VPinMame v2.4
; Download xpath from
http://www.autohotkey.net/~Titan/dl/xpath.zip" onclick="window.open(this.href);return false; and extract the xpath.ahk into your Hyperspin directory
; xpath is needed because AutoHotKey does not natively support reading/writing of XML files
; If you want to use a picture while the table is loading, place it on the dir with this module and define the width & height and its filename in the variables below.
; You can also set the color of the background
; If you use Esc as your exit_emulator_key, set EscClose to true. The emu closes faster if you don't use Esc, and this value doesn't seem to matter if you use Win7
;
; VPinMame uses the registry to store configs @ HKEY_CURRENT_USER\Software\Freeware\Visual PinMame
; Each time a new table is ran, it pulls the default configs into a new folder in the registry
; Visual Pinball stores settings in the registry @ HKEY_USERS\S-1-5-21-440413192-1003725550-97281542-1001\Software\Visual Pinball
;
; Editing Visual Pinball.xml:
; If your database xml has exe tags to support vp8 and vp9, make sure all vp8 game's tags match the vp8tag variable set below.
; Open your database and find all exe> and replace with vpexe>
; This tag will be ignored by HS, but let the script load the appropriate emu for those tables.
; This is done so you don't need separate modules for vp8 and vp9
;----------------------------------------------------------------------------
StartModule()
FadeInStart()
settingsFile := modulePath . "\" . moduleName . ".ini"
EscClose := IniReadCheck(settingsFile, "Settings", "EscClose","false",,1) ; This fixes VP from crashing (in WinXP) on exit when using Esc as your exit key.
showDMD := IniReadCheck(settingsFile, "Settings", "showDMD","true",,1)
updateDefaultDMD := IniReadCheck(settingsFile, "Settings", "updateDefaultDMD","true",,1) ; Set this to true if you want the script to set the default position of the DMD on next run.
dmdX := IniReadCheck(settingsFile, "Settings", "dmdX","45",,1) ; Your new default X position of the DMD
dmdY := IniReadCheck(settingsFile, "Settings", "dmdY","35",,1) ; Your new default Y position of the DMD
dmdWidth := IniReadCheck(settingsFile, "Settings", "dmdWidth","300",,1) ; Your new default DMD Width
dmdHeight := IniReadCheck(settingsFile, "Settings", "dmdHeight","75",,1) ; Your new default DMD Height
7z(romPath, romName, romExtension, 7zExtractPath)
; Update default DMD position & size so when new tables are ran, they use the new defaults
If ( updateDefaultDMD = "true" ) {
dmdXcur := ReadReg("dmd_pos_x")
dmdYcur := ReadReg("dmd_pos_y")
dmdWcur := ReadReg("dmd_width")
dmdHcur := ReadReg("dmd_height")
If ( dmdXcur != dmdX or dmdYcur != dmdY or dmdWcur != dmdWidth or dmdHcur != dmdHeight ) {
WriteReg("dmd_pos_x",dmdX)
WriteReg("dmd_pos_y",dmdY)
WriteReg("dmd_width",dmdWidth)
WriteReg("dmd_height",dmdHeight)
}
}
If ( exe = vp8tag )
Run, "%vp8exe%" /exit /play -"%romPath%%romName%%romExtension%", %emuPath%, Min ; hide does not work
Else If ( exe = vppm5tag )
Run, "%vppm5exe%" /exit /play -"%romPath%%romName%%romExtension%", %emuPath%, Min ; hide does not work
Else
Run, "%vp9exe%" /exit /play -"%romPath%%romName%%romExtension%", %emuPath%, Min ; hide does not work
WinWait, Preparing Table AHK_class #32770
WinWaitClose, Preparing Table AHK_class #32770,,4
Sleep, 500
; script to look for Please answer window, selects Yes I am and hits enter to continue loading table
Loop {
Sleep 50
IfWinExist, Please ; Nag screen the first time a table is ran
{ WinActivate, Please
IfWinActive, Please
{ SetControlDelay -1
ControlClick, Button2, Please answer AHK_class #32770 ; Click Yes I am
ControlSend, Button1, {Enter}, Please answer AHK_class #32770 ; Click the OK button
}
} Else ifWinExist, Game Info ; unknown window
{ WinActivate, Game Info
IfWinActive, Game Info
{ Send {Enter}
Send {Enter}
}
} Else ifWinExist, Notice ; sound not 100% acurate
{ WinActivate, Notice
IfWinActive, Notice
{ Send {Enter}
Send {Enter}
}
} Else ifWinExist, VBScript ; all msg boxes from vp script (like vb/vpm version not high enough...)
{ WinActivate, VBScript
IfWinActive, VBScript
Send {Enter}
} ;else ifWinExist, Error ; serious errors - like z buffer too small and so on
; {
; we have some error and we want to see it so we don't send Enter
;Send {Enter}
; Gui, Destroy
; WinActivate, Error
; WinWaitActive, Error
; WinWaitClose, Error
; WinClose, ahk_class VPinball
; Process, WaitClose, %executable%
; ExitModule()
; }
IfWinExist, Visual Pinball Player,, DMD ;Check if visual pinball is Ready
IfWinActive, Visual Pinball Player,, DMD ;Check if visual pinball is Ready
Break
}
Sleep, 500
WinWait("ahk_Class VPPlayer")
Sleep, 500
Loop {
IfWinActive, ahk_class VPPlayer
Break
WinActivate, ahk_class VPPlayer
Sleep, 50
}
WinWaitActive("ahk_class VPPlayer")
Sleep, 1000
; Give focus to the dmd so it appears on top of the playfield
If showDMD = true
{ DetectHiddenWindows, off ; don't detect dmd if it is hidden
WinActivate, ahk_class MAME
WinWaitActive("ahk_class MAME",,2)
ControlClick,, ahk_class MAME ; clicking the dmd to set the WS_EX_TOPMOST parameter (AlwaysOnTop)
DetectHiddenWindows on
WinActivate, ahk_class VPPlayer
WinWaitActive("ahk_class VPPlayer")
}
FadeInExit()
Process("WaitClose",executable)
7zCleanUp()
FadeOutExit()
ExitModule()
ReadReg(var1) {
RegRead, regValue, HKEY_CURRENT_USER, Software\Freeware\Visual PinMame\default, %var1%
Return %regValue%
}
WriteReg(var1, var2) {
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Freeware\Visual PinMame\default, %var1%, %var2%
}
CloseProcess:
FadeOutStart()
If escClose = true
{ DetectHiddenWindows, On ;Or next line will not work
Sleep, 50
;ControlSend, Button1, q, ahk_class #32770
ControlSend, Button2, r, ahk_class #32770 ; in case q crashes VP, use this
}
; If ( exe = vp8tag ) {
; WinClose, ahk_class VPinball
; } Else {
Sleep, 150
WinHide, ahk_class VPinball ;This line fixes where the VP Window flashes real quick when closing the window for a cleaner exit
WinMinimize, ahk_class VPinball
WinClose("ahk_class VPinball")
; }
Return