[RESOLU] Intégration de Visual Pinball dans HeavyBox

Un problème que vous ne pouvez classer dans aucune des autres sections?

Modérateurs : Porko, Modérateurs

Avatar de l’utilisateur
LaDite
Virtuose
Virtuose
Messages : 1051
Inscription : 04 juil. 2013 - 01:00
Localisation : Belgique
A remercié : 198 fois
A été remercié : 110 fois

Re: [RESOLU] Intégration de Visual Pinball dans HeavyBox

Message par LaDite » 24 févr. 2015 - 09:40

slt,

essaye avec ce script, n oublie pas de changer le nom de tes exécutables, chez moi ca fonctionne :)
vp8exe = Vpinball.exe
vp9exe = VPinball.exe
vp8tag = VPinball.exe

Code : Tout sélectionner

;----------------------------------------------------------------------------
; Visual Pinball
; Visual Pinball v8.1.1 & v9.12 & VPinMame v2.4
; by djvj
; 1.4
;
; 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 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
;----------------------------------------------------------------------------
ExitScreen = true
EscClose = false ; This fixes VP from crashing (in WinXP) on exit when using Esc as your exit key.
showDMD = true
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 = VPinball.exe
vp8tag = VPinball.exe
;----------------------------------------------------------------------------

;executable = VPinball.exe
;executable = VPinball912.exe
;romPath = C:\Hyperspin\Emulators\Visual Pinball\Tables\
;vp8
;romName = Agents 777
;vp9
;romName = Alien Poker (Williams 1980)
;romExtension = .vpt
;emuPath = C:\Hyperspin\Emulators\Visual Pinball\
;Hotkey, ~Escape, CloseProcess

; #Include 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)
			}
	}

GUI_ID := FadeInStart()

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

If ( exe = vp8tag )
	Run, "%vp8exe%" /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%
;			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
}

GUI_ID2 := FadeInExit()

If ( exe = vp8tag )
	Process, WaitClose, %vp8exe%
Else
	Process, WaitClose, %vp9exe%

7z2 := 7zCleanUp()

GUI_ID4 := 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:
	GUI_ID3 := 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

tiens nous au courant

Avatar de l’utilisateur
superdimi
Apprenti
Apprenti
Messages : 27
Inscription : 17 févr. 2015 - 04:59

Re: [RESOLU] Intégration de Visual Pinball dans HeavyBox

Message par superdimi » 26 févr. 2015 - 22:20

Merci beaucoup pour votre aide à tous. J'ai finalement résolu le problème en le contournant. je lance les tables avec Pinballx qui lui se lance via hyperspin. Merci encore à tous ;)

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

Re: [RESOLU] Intégration de Visual Pinball dans HeavyBox

Message par tetrafred » 26 févr. 2015 - 22:54

La ruse absolu. Par contre tu verra PInballX au bout d'un moment de temps, même si tu est hors ligne, te dira que t'a version n'est plus à jour et ne se lancera pas. Soit tu l'update soit tu change l'année dans ton windows en mettant 2050 (astuce trouvé sur Pincab Passion). C'est ce qui est arivé dans le pack que j'avais fait qui contient Pinballx avec un best set VP et FP. Pour te donner l'eau à la bouche et t'inciter à passer super membre:
[video][/video]

Je suis en train de voir pour une éventuelle conversion du pack best set VP pour HL3

Avatar de l’utilisateur
superdimi
Apprenti
Apprenti
Messages : 27
Inscription : 17 févr. 2015 - 04:59

Re: [RESOLU] Intégration de Visual Pinball dans HeavyBox

Message par superdimi » 26 févr. 2015 - 23:32

Merci pour l'astuce de la date , la vidéo fait envie en effet :)

Avatar de l’utilisateur
peon
noob
noob
Messages : 3
Inscription : 14 nov. 2014 - 14:45

Re: [RESOLU] Intégration de Visual Pinball dans HeavyBox

Message par peon » 13 sept. 2015 - 01:25

yop,

Grâce à toutes les infos présente dans ce forum j'ai pas trop galéré,
enfin si : j'ajoute une info pour ceux qui utiliserait windob seven :

il me semble que autoHotKey ait besoin des droits admin pour faire un WinClose ou encore un Process, Close

j'ai dû indiquer a windows de lancer Hyperspin (et Hyperlaunch dans le doute) en mode administrateur, et là le ahk arrive à fermer les fenêtres

(clic droit sur l’exécutable, propriétés, compatibilité
cocher la case : exécuter ce programme en tant qu'administrateur)

Donc maintenant, ça marche, c'est pas rapide mais ça marche

J'ai passé toute l'après midi a galérer sur des tutos de ahk pour fermer cette fucking fenêtre et tout ce qu'il me fallait c'était de lancer tout ça en mode admin :)


au moins j'aurai appris à faire des .ahk dégueulasse :

une partie de mon ahk :

; la fenetre VPPlayer existe ?
IfWinExist, ahk_class VPPlayer
{
;si oui, on est ici et on attend que l'utilisateur ferme la table
WinWaitClose, ahk_class VPPlayer

;ensuite on regarde si une fenetre existe dont le titre commencerait par Visual Pinball
IfWinExist, Visual Pinball
{
;la table existe on recupere l identifiant de son processus
WinGet, variablepidwindowsvisualpinball, PID
;et on ferme le processus, c'est degeulasse, un WinClose suffit
Process, Close, %variablepidwindowsvisualpinball%
}
else
{
MsgBox, Visual Pinball existe PAS, piutain de bordel de merde
}
}

voilou, et vive la fonction recherche, il y avait presque tout ce dont j'avais besoin :)

Répondre

Revenir à « Divers »