[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
superdimi
Apprenti
Apprenti
Messages : 27
Inscription : 17 févr. 2015 - 04:59

[RESOLU] Intégration de Visual Pinball dans HeavyBox

Message par superdimi » 21 févr. 2015 - 17:16

Salut les pros , voilà j'essaie donc d'intégrer Visual Pinball dans la HeavyBox. Etant un noob j'ai longtemps cherché dans le forum et essayé quelques astuces que j'ai pu y trouver mais sans succès. il y a pas mal de zones d'ombres pour le néophyte que je suis .

J'ai ajouté le menu visual pinball dans hyperspin j'ai modifié le module trouvé sur le forum , mis à jour de la database mais quand j'essaie de lancer une table , j'ai droit à cette erreur : Image

Voici mon module si cela peut vous aider à y voir plus clair https://mega.co.nz/#!kRhFTbBJ!8tg_9LhHf ... xIRsOQvo-w

Je m'excuse par avance si la réponse à déjà été donnée , mais je dois bien avouer que je patauge lamentablement .

Merci d'avance ;)

Avatar de l’utilisateur
BazingA
Initié
Initié
Messages : 120
Inscription : 29 sept. 2013 - 01:00
Localisation : 82000
A remercié : 16 fois
A été remercié : 6 fois

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

Message par BazingA » 21 févr. 2015 - 19:50

Perso, je trouve que future pinball est plus joli et plus stable, cherche de ce côté là peut être...
:)

Avatar de l’utilisateur
STRAPHSNIPER
Passionné
Passionné
Messages : 170
Inscription : 29 janv. 2014 - 00:00
A remercié : 13 fois
A été remercié : 4 fois

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

Message par STRAPHSNIPER » 21 févr. 2015 - 19:59

Moi perso j'ai installer future pinball et il est super sympas!

Avatar de l’utilisateur
moustic
Administrateur
Administrateur
Messages : 6940
Inscription : 23 juil. 2014 - 01:00
Localisation : Saint Jean Rohrbach
A remercié : 333 fois
A été remercié : 677 fois

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

Message par moustic » 21 févr. 2015 - 20:00

Tu as essayé ce post l'ami ?

viewtopic.php?f=32&t=2001&hilit=Visual+pinball" onclick="window.open(this.href);return false;
Image

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: [EN COURS ] Intégration de Visual Pinball dans HeavyBox

Message par LaDite » 21 févr. 2015 - 20:09

slt,

j ai integre VP dans ma config, malheureusement je ne l ai pas sous la main, je suis chez ma femme, mais quand je rentre chez moi cette semaine (mardi ou mercredi), je te fais une copie des fichiers nécessaires a son fonctionnement ;)

a bientôt

PS : envoi moi un MP pour que je n oublie pas ;)
moustic57 a écrit :Tu as essayé ce post l'ami ?

viewtopic.php?f=32&t=2001&hilit=Visual+pinball" onclick="window.open(this.href);return false;
ha, c est justement un de mes posts , de mémoire j avais du modifier le module en remplacant les lignes suivantes pour que ca marche

Code : Tout sélectionner

vp8exe = VPinball.exe
vp9exe = VPinball912.exe
vp8tag = Visual Pinball 8
en mettant a chaque version le meme .EXE

je ne me rappelle plus si j ai modifie autre chose, faudra attendre que je rentre ;)

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: [EN COURS ] Intégration de Visual Pinball dans HeavyBox

Message par tetrafred » 21 févr. 2015 - 21:02

BazingA a écrit :Perso, je trouve que future pinball est plus joli et plus stable, cherche de ce côté là peut être...
:)
Le soucis de Future Pinball c'est qu'il n'a plus aucun avenir (en plus d'être la foire au bug). C'est Unit3D Pinball qui devrait prendre la relève et qui en plus prendra Vpinmame et DOF. Tu prend les dernières tables Visual Pinball elles sont franchement magnifiques.

Je serais curieux aussi Ladite parceque j'avais tout essayé (avec mes maigres connaissances en modules Hyperlaunch) et je n'avais réussi à rien et qu'a priori faudrais refaire le module pour chaque version d'exe :(
A si VP991, VP 991 Physique mode et VP10 (qui sort dans quelques semaines) fonctionnent bien.
Si le module ne s'arrête qu'a VP912 et Vpinmame passe par la solution de lancer un launcher spécifique (HyperPin ou PinballX) via HyperSpin pour lancer te stables et gérer les medias, wheel, instruction card, mode pause, flyer etc etc....). Plus d'options qu'hyperSpin de base qui s'apparente à du HL3 (mode pause et médias) mais en largement plus accessible.
Dernière modification par tetrafred le 21 févr. 2015 - 21:18, modifié 5 fois.

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

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

Message par superdimi » 21 févr. 2015 - 21:03

LaDite a écrit :slt,

j ai integre VP dans ma config, malheureusement je ne l ai pas sous la main, je suis chez ma femme, mais quand je rentre chez moi cette semaine (mardi ou mercredi), je te fais une copie des fichiers nécessaires a son fonctionnement ;)

a bientôt

PS : envoi moi un MP pour que je n oublie pas ;)
moustic57 a écrit :Tu as essayé ce post l'ami ?

viewtopic.php?f=32&t=2001&hilit=Visual+pinball" onclick="window.open(this.href);return false;
ha, c est justement un de mes posts , de mémoire j avais du modifier le module en remplacant les lignes suivantes pour que ca marche

Code : Tout sélectionner

vp8exe = VPinball.exe
vp9exe = VPinball912.exe
vp8tag = Visual Pinball 8
en mettant a chaque version le meme .EXE

je ne me rappelle plus si j ai modifie autre chose, faudra attendre que je rentre ;)
oui j'ai essayé ce post , en mettant

Code : Tout sélectionner

vp8exe = VPinball915.exe
vp9exe = VPinball915.exe
vp8tag = VPinball915.exe
Là j'avais un message qui disait qu'il ne trouvait pas xpath.ahk je crois

j'ai vu dans le post qu'il fallait ajouter des ";" devant chaques lignes concernant xpath

et depuis j'ai le message d'erreur posté dans mon premier message.

J'ai forcément mal fait quelque chose , c'est certain , mais je suis un peu peaumé.

Merci à tous en tout cas d'avoir pris la peine de me répondre , vous êtes super ;)

Avatar de l’utilisateur
davidlinch
Connaisseur
Connaisseur
Messages : 389
Inscription : 26 sept. 2013 - 01:00
A remercié : 19 fois
A été remercié : 19 fois

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

Message par davidlinch » 21 févr. 2015 - 22:00

Bizarre, je fais tourner VP991 et VP991 Physmod sans probleme

Voir module ci-dessous:
module
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 = VPinball8.exe
vp9exe = VPinball.exe
vppm5exe = VP_physmod5.exe
vp8tag = Visual Pinball 8
vppm5tag = Visual Pinball 9 Physmod5
;----------------------------------------------------------------------------

;Settings
loadingScreen=1
fullscreenWidth = 1920
fullscreenHeight = 1200
addsounds=0
nomousy=0

if(nomousy){
Run, D:\Frontend\nomousy\nomousy.exe /hide
}

if(loadingScreen){
Gui +AlwaysOnTop -Caption +ToolWindow
Gui, Color, Black
logoXPos := A_ScreenWidth/2 - 900 /2
Gui, Add, Picture,x%logoXPos% y120, %A_ScriptDir%\Media\Fade\%systemName%\_Default\Layer 2.png
loadXPos := A_ScreenWidth/2 - 500 /2
loadYPos := A_ScreenHeight - 220
Gui, Add, Picture,x%loadXPos% y%loadYPos%, %A_ScriptDir%\Media\Fade\%systemName%\_Default\Layer 3.png
Gui Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%
}

if(addsounds)
{
;sounds specify a directory of sounds for "romname"
soundplay, %A_ScriptDir%\Media\Sounds\%systemName%\%systemName%.mp3
Sleep, 2000
}

#Include xpath.ahk

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

Start:

WinMinimize, HyperSpin ; afin de ne pas faire bouger la wheele pendant le chargement

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 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%
; 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()

Sleep, 1000
Gui Destroy ;kills optional blackscreen

If ( exe = vp8tag )
Process, WaitClose, %vp8exe%
Else If ( exe = vppm5tag )
Process, WaitClose, %vppm5exe%
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()
Process, Close, nomousy.exe
sleep, 50
hideDesktop()
WinActivate, HyperSpin
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
Extrait de la database xml:
<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>
<game name="The Addams Family Gold (Williams 1994) DT VP99x SPv1.1" index="" image="">
<description>The Addams Family Gold</description>
<cloneof></cloneof>
<crc></crc>
<manufacturer>Williams</manufacturer>
<year>1994</year>
<genre></genre>
</game>
edit moustic57: merci david de partager tes données mais essaye le spoiler stp sinon c'est le bor*** ;)

Merci moustic, j'avais mis le spoiler mais j'ai zappé les guillemets ... du coup ça marqué
j'ai honte
alors je l'ai viré ... :P

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: [EN COURS ] Intégration de Visual Pinball dans HeavyBox

Message par tetrafred » 21 févr. 2015 - 22:43

Merci Davidlinch :)

Faut que j'essaye dans mon PIncab et le database de PinballX si ton astuce "<vpexe>Visual Pinball 9 Physmod5</vpexe>" peut fonctionner. J'avais vaguement vu ce genre de manip sur le forum de Spesoft mais j'avais retenu l'option de la liste database parallèle (par système).

Tu ouvre un boulevard à une pack là :)

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

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

Message par superdimi » 22 févr. 2015 - 10:24

Avez vous un fichier nommé xpath.ahk dans votre dossier Hyperspin par hasard ?

Avatar de l’utilisateur
davidlinch
Connaisseur
Connaisseur
Messages : 389
Inscription : 26 sept. 2013 - 01:00
A remercié : 19 fois
A été remercié : 19 fois

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

Message par davidlinch » 22 févr. 2015 - 11:10

superdimi a écrit :Avez vous un fichier nommé xpath.ahk dans votre dossier Hyperspin par hasard ?
Oui

Avatar de l’utilisateur
soft-bug
Connaisseur
Connaisseur
Messages : 478
Inscription : 10 févr. 2013 - 00:00
A été remercié : 1 fois

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

Message par soft-bug » 22 févr. 2015 - 11:48

davidlinch a écrit :
superdimi a écrit :Avez vous un fichier nommé xpath.ahk dans votre dossier Hyperspin par hasard ?
Oui


Hello,

J'y connais rien à vos jeux de "boules qui tournent" :lol: , mais suite à ton erreur dans ton premier message, il y a en fait un manque d'utilisation des fonctions xpath.

xpath.ahk est une sous programme appelé par le module (voir le module de DavidLinch) pour lire le fichier database.xml et en sortir les éléments qui vont bien.

Il faut mettre xpath.ahk directement dans le même répertoire que le module (si j'en crois celui mis ici).

Voilà ! sinon la fonction appelée est xpath_load et suivantes dans le module (en gros il charge les données de database.xml) puis il agit !

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

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

Message par superdimi » 22 févr. 2015 - 13:43

Pourriez vous me donner un lien pour télécharger xpath.ahk ? Car le lien fourni dans le module : http://www.autohotkey.net/~Titan/dl/xpath.zip" onclick="window.open(this.href);return false; n'est plus valable.

Avatar de l’utilisateur
davidlinch
Connaisseur
Connaisseur
Messages : 389
Inscription : 26 sept. 2013 - 01:00
A remercié : 19 fois
A été remercié : 19 fois

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

Message par davidlinch » 22 févr. 2015 - 13:57

Ce n'est pas le mien mais en cherchant via mon ami google je suis tombé ici
xpath.ahk
/*
Title: XPath Quick Reference
License:
- Version 3.14 <http://www.autohotkey.net/~polyethene/#xpath>
- Dedicated to the public domain (CC0 1.0) <http://creativecommons.org/publicdomain/zero/1.0/>
*/

/*
Function: xpath
Selects nodes and attributes from a standard xpath expression.
Parameters:
doc - an xml object returned by xpath_load()
step - a valid XPath 2.0 expression
set - (optional) text content to replace the current selection
Returns:
The XML source of the selection.
If the content was set to be modified the previous value will be returned.
Remarks:
Since multiple return values are seperated with a comma,
any found within the text content will be entity escaped as &#44;.
To get or set the text content of a node use the text function,
e.g. /root/node/text(); this behaviour is always assumed within predicates.
For performance reasons count() and last() do not update with the creation of new nodes
so you may need to alter the results accordingly.
*/
xpath(ByRef doc, step, set = "") {
static sc, scb = "" ; use EOT (\x04) as delimiter

If step contains %scb% ; i.e. illegal character
Return
sid := scb . &doc . ":" ; should be unique identifier for current XML object
If (InStr(step, "select:") == 1) { ; for quick selection
stsl = 1
StringTrimLeft, step, step, 7
}
If (InStr(step, "/") == 1)
str = 1 ; root selected
Else {
StringGetPos, p, sc, %sid% ; retrieve previous path
If ErrorLevel = 1
t = /
Else StringMid, t, sc, p += StrLen(sid) + 1, InStr(sc, scb, "", p + 2) - p
step = %t%/%step%
}

; normalize path e.g. /root/node/../child/. becomes /root/child:
step := RegExReplace(step, "(?<=^|/)(?:[^\[/@]+/\.{2}|\.)(?:/|$)|^.+(?=//)")

If (str == 1 or stsl == 1) { ; if not relative path and no select:
; remove last node and trailing attributes and functions:
xpr := RegExReplace(step, (str == 1 and stsl != 1 ? "/(?:\w+:)?\w+(?:\[[^\]]*])?" : "")
. "(?:/@.*?|/\w+\(\))*$")
StringReplace, xpr, xpr, [-1], [1], All ; -1 become just 1
StringReplace, xpr, xpr, [+1], [last()], All ; +1 becomes last()
StringGetPos, p, sc, %sid%
If ErrorLevel = 1
sc = %sc%%sid%%xpr%%scb% ; add record or update as necessary:
Else sc := SubStr(sc, 1, p += StrLen(sid)) . xpr . SubStr(sc, InStr(sc, scb, "", p))
}

; for unions call each operand seperately and join results:
If (InStr(step, "|")) {
StringSplit, s, step, |, `n`t `r
Loop, %s0%
res .= xpath(doc, s%A_Index%, set) . ","
Return, SubStr(res, 1, -1)
}
Else If (InStr(step, "//") == 1) { ; for wildcard selectors use regex searching mode:
StringTrimLeft, step, step, 2
re = 1
rew = 1
xp = /(?:(?:\w+:)?\w+)*/
}

NumPut(160, doc, 0, "UChar") ; unmask variable

; resolve xpath components to: absolute node path, attributes and predicates (if any)
Loop, Parse, step, /
{
s = %A_LoopField%
If (InStr(s, "*") == 1) ; regex mode for wildcards
{
re = 1
s := "(?:\w+:)?\w+" . SubStr(s, 2)
}
Else If (InStr(s, "@") == 1) { ; if current step is attribute:
StringTrimLeft, atr, s, 1
Continue
}
StringGetPos, p, s, [ ; look for predicate opening [...]
If ErrorLevel = 0
{
If s contains [+1],[-1] ; for child nodes record creation instructions in a list
{
If A_Index = 2 ; root node creation
{
StringLeft, t, s, p
t = <%t%/:: ></%t%/>
If (InStr(s, "+1")) {
If doc =
doc = .
doc = %doc%%t%
}
Else doc = .%t%%doc%
StringLeft, s, s, InStr(s, "[") - 1
}
Else {
nw = %nw%%s%
Continue
}
}
Else { ; i.e. for conditional predicates

If (InStr(s, "last()")) { ; finding last node
StringLeft, t, s, p
t := "<" . SubStr(xp, 2) . t . "/:: "
If re ; with regex:
{
os = 0
Loop
If (!os := RegExMatch(doc, t, "", 1 + os)) {
t = %A_Index%
Break
}
t--
}
Else { ; otherwise using StringReplace
StringReplace, doc, doc, %t%, %t%, UseErrorLevel
t = %ErrorLevel%
}
If (RegExMatch(s, "i)last\(\)\s*\-\s*(\d+)", a)) ; i.e. [last() - 2]
StringReplace, s, s, %a%, % t - a1
Else StringReplace, s, s, last(), %t%
}

; concat. the predicate to the list against the current absolute path:
ax = %ax%%xp%%s%
StringLeft, s, s, p
}
}
Else If (InStr(s, "()")) { ; if step is function, add to list
fn = %fn%+%s% ; use + prefix to prevent overlapping naming conflicts
Continue
}
; finally, if step is not any of the above, assume it's the name of a child node
xp = %xp%%s%/ ; ... and add to list, forming the absolute path
}

If (xp == "" or xp == "/") ; i.e. error cases
Return

; remove initial root selector (/) as this is how the parser works by default:
StringTrimLeft, xp, xp, 1
StringTrimRight, ax, ax, 1

StringTrimRight, nw, nw, 1

ct = 0 ; counter
os = 0 ; offset for main loop starts at zero
Loop {
; find offset of next element, and its closing tag offset:
If re
os := RegExMatch(doc, "<" . xp . ":: ", "", 1 + os)
, osx := RegExMatch(doc, "</" . xp . ">", rem, os) + StrLen(rem)
Else {
StringGetPos, osx, doc, </%xp%>, , os := InStr(doc, "<" . xp . ":: ", true, 1 + os)
osx += 4 + StrLen(xp)
}
If os = 0 ; stop looping when no more tags are found
Break

; predicate parser:
If ax !=
{
sk = 0
Loop, Parse, ax, ] ; for each predicate
{
; split components to: (1) path, (2) selector, (3) operator, (4) quotation char, (5) operand
If (!RegExMatch(A_LoopField, "/?(.*?)\[(.+?)(?:\s*([<>!=]{1,2})\s*(['""])?(.+)(?(4)\4))?\s*$", a))
Continue
a1 = %a1%/
If re
RegExMatch(rem, "(?<=^</)" . a1, a1)

If a2 is integer ; i.e. match only certain index
{
StringGetPos, t, a1, /, R2
StringMid, t, a1, 1, t + 1
t := InStr(SubStr(doc, 1, os), "<" . t . ":: ", true, 0)
; extract parent node:
StringMid, sub, doc, t, InStr(doc, ">", "", os) - t
xpf := "<" . a1 . ":: "
; get index of current element within parent node:
StringReplace, sub, sub, %xpf%, %xpf%, UseErrorLevel
If a2 != %ErrorLevel%
sk = 1
Continue
}

StringReplace, xp, xp, /, /, UseErrorLevel
t = %ErrorLevel%
StringReplace, a1, a1, /, /, UseErrorLevel

; extract result for deep analysis
If t = %ErrorLevel% ; i.e. /root/node[child='test']
StringMid, sub, doc, os, osx - os
Else StringMid, sub, doc
, t := InStr(SubStr(doc, 1, os), "<" . a1 . ":: ", true, 0)
, InStr(doc, "</" . a1 . ">", true, t) + 1

If a2 = position()
sub = %i%
Else If (InStr(a2, "@") == 1) ; when selector is an attribute:
RegExMatch(SubStr(sub, 1, InStr(sub, ">"))
, a3 == "" ? "\b" . SubStr(a2, 2) . "=([""'])[^\1]*?\1"
: "\b(?<=" . SubStr(a2, 2) . "=([""']))[^\1]+?(?=\1)", sub)
Else ; otherwise child node:
{
If a2 = . ; if selector is current node don't append to path:
a2 = /
Else a2 = %a2%/
StringMid, sub, sub
, t := InStr(sub, ">", "", InStr(sub, "<" . a1 . a2 . ":: ", true) + 1) + 1
, InStr(sub, "</" . a1 . a2 . ">", true) - t
}

; dynamic mini expression evaluator:
sk += !(a3 == "" ? (sub != "")
: a3 == "=" ? sub == a5
: a3 == "!=" ? sub != a5
: a3 == ">" ? sub > a5
: a3 == ">=" ? sub >= a5
: a3 == "<" ? sub < a5
: a3 == "<=" ? sub <= a5)
}
If sk != 0 ; if conditions were not met for this result, skip it
Continue
}

If nw != ; for node creation
{
If re
nwp := SubStr(rem, 3, -1)
Else nwp = %xp%
Loop, Parse, nw, ]
{
StringLeft, nwn, A_LoopField, InStr(A_LoopField, "[") - 1
nwn = %nwn%/
nwt = <%nwp%%nwn%:: ></%nwp%%nwn%>
If (t := InStr(A_LoopField, "-1")
? InStr(doc, ">", "", InStr(doc, "<" . nwp . ":: ", true, os) + 1) + 1
: InStr(doc, "</" . nwp . ">", true, os))
os := t
StringLen, osx, nwt
osx += os
doc := SubStr(doc, 1, os - 1) . nwt . SubStr(doc, os)
nwp = %nwp%%nwn%
}
StringLen, t, nwp
If (InStr(fn, "+text()") and atr == "")
os += t + 5, osx -= t + 3
}

If atr !=
{
; extract attribute offsets, with surrounding declaration if text() is not used:
If (t := RegExMatch(SubStr(doc, os, InStr(doc, ">", "", os) - os), InStr(fn, "+text()")
? "(?<=\b" . atr . "=([""']))[^\1]*?(?=\1)"
: "\b" . atr . "=([""'])[^\1]*?\1", rem))
os += t - 1, osx := os + StrLen(rem)
Else { ; create attribute
os := InStr(doc, ">", "", os + 1)
, doc := SubStr(doc, 1, os - 1) . " " . atr . "=""""" . SubStr(doc, os)
, osx := ++os + StrLen(atr) + 3
If (InStr(fn, "+text()"))
osx := os += StrLen(atr) + 2
}
}
Else If (InStr(fn, "+text()") and nw == "") ; for text content:
os := InStr(doc, ">", "", os) + 1, osx := InStr(doc, re ? rem : "</" . xp . ">", true, os)

If InStr(fn, "+index-of()") ; get index rather than content
sub = %A_Index%
Else StringMid, sub, doc, os, osx - os ; extract result

If (InStr(fn, "+count()")) ; increment counter if count() function is used
ct++
Else res = %res%%sub%, ; ... and concat to list

If (set != "" or InStr(fn, "+remove()")) ; modify or remove...
setb = %setb%%os%.%osx%| ; mark for modification
}

If setb !=
{
If (InStr(set, "node:") == 1) {
set := SubStr(xpath(doc, SubStr(set, 6) . "/rawsrc()"), 2)
StringReplace, set, set, <, <%xp%, All
StringReplace, set, set, <%xp%/, </%xp%, All
NumPut(160, doc, 0, "UChar")
}
StringTrimRight, setb, setb, 1
Loop, Parse, setb, |
{
StringSplit, setp, A_LoopField, .
StringLen, t, xp
If (InStr(fn, "+append()"))
setp2 := setp1 := setp2 - t - 3
Else If (InStr(fn, "+prepend()"))
setp2 := setp1 := InStr(doc, ">", "", setp1) + 2
doc := SubStr(doc, 1, setp1 - 1) . set . SubStr(doc, setp2) ; dissect then insert new value
}
}

If (InStr(fn, "+count()"))
res = %ct%, ; trailing char since SubStr is used below

nsid := scb . &doc . ":" ; update sid as necessary
If nsid != %sid%
StringReplace, sc, sc, %sid%, %nsid%

NumPut(0, doc, 0, "UChar") ; remask variable to prevent external editing
StringTrimRight, res, res, 1
If (InStr(fn, "+rawsrc()")) {
StringTrimLeft, t, xpr, 1
StringReplace, res, res, <%t%/, <, All
StringReplace, res, res, </%t%, <, All
StringReplace, res, res, `,, `,%scb%, All
Return, scb . res
}
; remove trailing comma and absolute paths from result before returning:
Return, RegExReplace(res, "S)(?<=<)(\/)?(?:(\w+)\/)+(?(1)|:: )", "$1$2")
}

/*
Function: xpath_save
Saves an XML document to file or returns the source.
Parameters:
doc - an xml object returned by xpath_load()
src - (optional) a path to a file where the XML document should be saved;
if the file already exists it will be replaced
Returns:
False if there was an error in saving the document, true otherwise.
If the src parameter is left blank the source code of the document is returned instead.
*/
xpath_save(ByRef doc, src = "") {
xml := RegExReplace(SubStr(doc, 2), "S)(?<=<)(\/)?(?:(\w+)\/)+(?(1)|:: )", "$1$2") ; remove metadata
xml := RegExReplace(xml, "<([\w:]+)([^>]*)><\/\1>", "<$1$2 />") ; fuse empty nodes
;xml := RegExReplace(xml, " (?=(?:\w+:)?\w+=['""])") ; remove prepending whitespace on attributes
xml := RegExReplace(xml, "^\s+|\s+$") ; remove start and leading whitespace
StringReplace, xml, xml, `r, , All ; normalize linefeeds:
StringReplace, xml, xml, `n, `r`n, All
sp := " "
StringLen, sl, sp
s =
VarSetCapacity(sxml, StrLen(xml) * 1.1)
Loop, Parse, xml, <, `n`t `r
{
If A_LoopField =
Continue
If (sb := InStr(A_LoopField, "/") == 1)
StringTrimRight, s, s, sl
sxml = %sxml%`n%s%<%A_LoopField%
If sb
StringTrimRight, s, s, sl
If (InStr(A_LoopField, "?") != 1 and InStr(A_LoopField, "!") != 1
and !InStr(A_LoopField, "/>"))
s .= sp
}
StringTrimLeft, sxml, sxml, 1
sxml := RegExReplace(sxml, "(\n(?:" . sp . ")*<((?:\w+:)?\w+\b)[^<]+?)\n(?:"
. sp . ")*</\2>", "$1</$2>")
If InStr(xml, "<?xml") != 1 ; add processor instruction if there isn't any:
xml = <?xml version="1.0" encoding="iso-8859-1"?>`r`n%xml%
If src = ; if save path not specified return the XML document:
Return, sxml
FileDelete, %src% ; delete existing file
FileAppend, %sxml%, %src% ; create new one
Return, ErrorLevel ; return errors, if any
}

/*
Function: xpath_load
Loads an XML document.
Parameters:
doc - a reference to the loaded XML file as a variable, to be used in other functions
src - (optional) the document to load, this can be a file name or a string,
if omitted the first paramter is used as the source
Returns:
False if there was an error in loading the document, true otherwise.
*/
xpath_load(ByRef doc, src = "") {
If src = ; if source is empty assume the out variable is the one to be loaded
src = %doc%
Else If FileExist(src) ; otherwise read from file (if it exists)
FileRead, src, %src%
If src not contains <,>
Return, false
; combined expressions slightly improve performance:
src := RegExReplace(src, "<((?:\w+:)?\w+\b)([^>]*)\/\s*>", "<$1$2></$1>") ; defuse nodes
, VarSetCapacity(doc, VarSetCapacity(xml, StrLen(src) * 1.5) * 1.1) ; pre-allocate enough space
Loop, Parse, src, < ; for each opening tag:
{
If (A_Index == 2 and InStr(A_LoopField, "?xml") == 1)
Continue
Else If (InStr(A_LoopField, "?") == 1) ; ignore all other processor instructions
xml = %xml%<%A_LoopField%
Else If (InStr(A_LoopField, "![CDATA[") == 1) { ; escape entities in CDATA sections
cdata := SubStr(A_LoopField, 9, -3)
StringReplace, cdata, cdata, ", ", All
StringReplace, cdata, cdata, &, &, All
StringReplace, cdata, cdata, ', &apos;, All
StringReplace, cdata, cdata, <, <, All
StringReplace, cdata, cdata, >, >, All
xml = %xml%%cdata%
}
Else If (!pos := RegExMatch(A_LoopField, "^\/?(?:\w+:)?\w+", tag)) ; if this isn't a valid tag:
{
If A_LoopField is not space
xml = %xml%<%A_LoopField% ; convert to escaped entity value
}
Else {
StringMid, ex, A_LoopField, pos + StrLen(tag) ; get tag name
If InStr(tag, "/") = 1 { ; if this is a closing tag:
xml = %xml%</%pre%%ex% ; close tag
StringGetPos, pos, pre, /, R2
StringLeft, pre, pre, pos + 1
}
Else {
pre = %pre%%tag%/
xml = %xml%<%pre%:: %ex%
}
}
}
StringReplace, doc, xml, `,, &#44;, All ; entity escape commas (which are used as array delimiters)
NumPut(0, doc := " " . doc, 0, "UChar") ; mask variable from text display with nullbyte
Return, true ; assume sucessful load by this point
}

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

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

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

Merci beaucoup pour le fichier , malheureusement , j'ai toujours le même message d'erreur.

Avatar de l’utilisateur
davidlinch
Connaisseur
Connaisseur
Messages : 389
Inscription : 26 sept. 2013 - 01:00
A remercié : 19 fois
A été remercié : 19 fois

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

Message par davidlinch » 22 févr. 2015 - 14:32

tu l'as mis où le fichier xpath.ahk ?

tu as bien une database visual pinball.xml ?

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

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

Message par superdimi » 22 févr. 2015 - 14:38

J'ai essayé à la racine d'hyperspin et dans le dossier module de visual pinball. Oui j'ai bien une database Visual Pinball.

Avatar de l’utilisateur
soft-bug
Connaisseur
Connaisseur
Messages : 478
Inscription : 10 févr. 2013 - 00:00
A été remercié : 1 fois

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

Message par soft-bug » 22 févr. 2015 - 16:31

superdimi a écrit :J'ai essayé à la racine d'hyperspin et dans le dossier module de visual pinball. Oui j'ai bien une database Visual Pinball.
Hello ,

Je pense qu'il faudrait vous parler ! Et attendre la mise à disposition

viewtopic.php?f=33&t=5041&start=0#p84985

superdimi, tu t'attaques à un truc qui est plus fort que toi ... c'est mon humble avis :cry:

Attend le retour de Ladite ou de DavidLinch.

Mais de manière générale, fait des réponses précises avec du concret. Sur le nom de tes fichiers, les répertoires utilisés, même une capture peut être utile. A titre de comparaison, si j'avais une installation qui serait la copie de la tienne, il me faudrait bien 1/2 journée pour comprendre comment cela marche ...
Bref, on n'est pas le nez dessus ton ordinateur ! :twisted:

De toute manière tes recherches ne sont pas vaines car c'est de l'apprentissage, mais saches que ce sujet est ardu pour un novice ... malgré ta bonne volonté !

Avatar de l’utilisateur
davidlinch
Connaisseur
Connaisseur
Messages : 389
Inscription : 26 sept. 2013 - 01:00
A remercié : 19 fois
A été remercié : 19 fois

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

Message par davidlinch » 22 févr. 2015 - 23:47

Soft n'a pas tord :mrgreen:

C'est clair qu'il faut un peu plus d'info, histoire d'y voir plus clair.

Par le plus grand des hasards aurais-tu oublier d'installer autohotkey :?:

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

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

Message par superdimi » 23 févr. 2015 - 02:48

Il est vrai que je m'attaque à un trop gros morceau pour mes maigres connaissances
En ce qui concerne autohotkey , je ne l'avais pas installé en effet.

Tout ce que j'ai fait jusqu'à présent , c'est ajouter des roms dans la HeavyBox et tout fonctionne à merveille.
Ajouter des tables de flipper , c'est un peu "la cerise sur le gateau" .
Je vais continuer à bidouiller un peu , en tout cas , je vous remercie tous d'avoir pris la peine de vous pencher sur mon problème .

Répondre

Revenir à « Divers »