[EN COURS] Module AHK - Multi exe Visual Pinball

Ici se règle les problèmes concernant une configuration Hyperspin tournant sous HyperLaunch 3.

Modérateurs : Porko, Modérateurs

Avatar de l’utilisateur
tetrafred
Gourou
Gourou
Messages : 930
Inscription : 10 oct. 2013 - 01:00
Localisation : La Mothe Achard
A remercié : 71 fois
A été remercié : 64 fois

[EN COURS] Module AHK - Multi exe Visual Pinball

Message par tetrafred » 27 févr. 2015 - 22:31

Coucou,

Alors voilà, je suis en pleine conversion de la borne de HL2 à HL3 (ou seulement de test à voir) grâce au super Tuto de Silmeria et d'autres sujets qui m'on permis d'avancé mais actuellement je butte sur l'integration de Visual Pinball pour le faire fonctionner avec plusieurs .exe . à savoir lancer des tables en VP990/991 et VP990/991 Physique mod 5.

En gros j'ai des tables qui se lance avec un exe et d'autres avec un autre mais je voudrais que tout soit sous la même wheel
Si je reste avec un seul exe tout fonctionne nickel avec le module de base bien entendu (sauf certaines tables qui se lancent avec l'exe par defaut et qui ne sont donc pas jouables).

Bref, l'aide de davidlinch sur ce ce topic m'avais permis, sous HL2 (Heavybox LCD), à faire tourner Visual PInball grâce à une partie du module qui indentifiais quel exe de VP prendre en fonction du tag exe de chaque table de la database:
[b]Parties du module HL2[/b]
vp8exe = VPinball8.exe
vp9exe = VPinball.exe
vppm5exe = VP_physmod5.exe
vp8tag = Visual Pinball 8
vppm5tag = Visual Pinball 9 Physmod5
.........
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
[b]Extrait de database[/b]
<game name="Elvis NightMod (Stern 2004) DT PhysMod 1.0" index="" image="">
<description>Elvis - NightMod</description>
<cloneof></cloneof>
<crc></crc>
<manufacturer>Stern</manufacturer>
<year>2004</year>
<genre></genre>
<vpexe>Visual Pinball 9 Physmod5</vpexe>
</game>
Pour tenter le même résultat sous HL3 je me suis attelé à tenté de modif le ahk de base par cette version:
modif ahk
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
Avec ces modifs me lance bien Visual Pinball mais ce dernier me met un message d'erreur lorsqu'il doit charger une table. Est ce que ce message d'erreur est lié au fait que dans HyperlaunchHQ on indique un emulateur par defaut? Si oui, comment changer ça svp?
Est ce que le module vous parait completement foireux?

Pourquoi est ce que je suis partie sur cette modif?
Parce que dans le descriptif du module et ce passage:
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>
je n'ai pas trouver ou renvoyais le VP8tag et comment ce dernier était traité sion j'aurais remplacé par l'exe de mon choix et c’était réglé.

Une idée svp?
Merci beaucoup ;)

Edit:J'ai dans l'idée de vouloir intégré les merveilleuse dernière tables STERN converties en desktop et Physique mod 5 pour infos. Sachant que la Metallica et la Star Trek sont prête aussi j'ai bien envie de les mettre dans la Mamecab (en plus du Pincab :p) et de vous en faire profiter.

edit by moustic: j'ai remanié un peu ça et pas de flood l'ami merci ;)

Répondre

Revenir à « Aide sur RocketLauncher »