bon, pour le module visual pinball pour hyperlauch2, j'ai ça:
Spoiler: ;----------------------------------------------------------------------------
; Visual Pinball
; Visual Pinball v8.1.1 v9.12 VPinMame v2.4
; by djvj
; 1.3
;
; Notes:
; Download xpath from
http://www.autohotkey.net/~Titan/dl/xpath.zip 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
;----------------------------------------------------------------------------
LoadingScreen = true
ExitScreen = true
EscClose = true; This fixes VP from crashing (in WinXP) on exit when using Esc as your exit key.
showDMD = false
updateDefaultDMD = true ; Set this to true if you want the script to set the default position of the DMD on next run.
dmdX = 45 ; Your new default X position of the DMD
dmdY = 35 ; Your new default Y position of the DMD
dmdWidth = 300 ; Your new default DMD Width
dmdHeight = 75 ; Your new default DMD Height
vp8exe = VPinball.exe
vp9exe = VPinball912.exe
vp8tag = Visual Pinball 8
loadingPic = pinball.jpg
loadingPicW = 800
loadingPicH = 600
loadingColor = Black
;----------------------------------------------------------------------------
;#Include xpath.ahk
#Include %A_Scriptdir%\Modules\Visual Pinball\xpath.ahk
;If 0 2
;{
; MsgBox,,,Please run this through HyperSpin,2
; ExitApp
;}Else
; Goto, Start
;Start:
databaseFile = %A_Scriptdir%\Databases\%systemName%\%systemName%.xml
xpath_load(dbXML, databaseFile ) ; need to read the existing xml otherwise xpath deletes all existing nodes
exe := XPath(dbXML, "/menu/game[@name=" . romName . "]/vpexe/text()")
; 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)
}
}
FadeInStart()
7z(romPath, romName, romExtension, 7zExtractDir)
If ( exe = vp8tag )
Run, "%vp8exe%" /exit /play -"%romPath%%romName%%romExtension%", %emuPath%, Min ; hide does not work
Else
Run, "%vp8exe%" /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%
; ExitApp
; }
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()
If ( exe = vp8tag )
Process, WaitClose, %vp8exe%
Else
Process, WaitClose, %vp8exe%
7zCleanUp()
FadeOutExit()
WinActivate, Hyperspin
ExitApp
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
sinon, ba bon courage pour ton projet