Visual Pinball (near run) - Helps

Get answers to questions about using mGalaxy.
Post Reply
User avatar
Stefan
Veteran
Veteran
Posts: 143
Joined: Wed Feb 20, 2013 8:47 am

Hi all,

i try to add Visual Pinball with PinMame,
edit the System.xml ok, make a VP Folder with Icon, ... and so on.

My Problem, i dont know what i must write exact in <cmd id ... at the end,
how i give a tablename.vpt to the VPinball.exe

I think the resolution is here: http://www.vpforums.org/index.php?showtopic=9649

Thanks for every help.
---------------
Greetings from Austria
User avatar
mgalaxy
Administrator
Administrator
Posts: 1189
Joined: Tue Dec 05, 2006 7:46 pm

The system block should be like that:

<System>
    <Name>Pinball</Name>
    <AppPath/>
    <RomPath/>
    <SnapPath/>
    <Emu selected="0">
      <Cmd id="0" name="Visual Pinball" value="-play -"%path\%file"" />
    </Emu>
    <Ext selected="0">
      <Suf id="0" value=".vpt" />
    </Ext>
    <Active>False</Active>
</System>


ATTENTION: the folder you created have to be named with the name you choose in  the <Name></Name> tag!! (in that example: Pinball)

PS: for what I can see, the problem won't be to launch a table in Visual Pinball...but to quit it "nicely" with the ESC key!!
Last edited by mgalaxy on Wed Feb 20, 2013 8:24 pm, edited 1 time in total.
User avatar
Stefan
Veteran
Veteran
Posts: 143
Joined: Wed Feb 20, 2013 8:47 am

I got a "Error loading file" Message...  :-[

The ESC solution was secondary... i am in heaven, if i can start a table to play ;-)

Do you have write -play - ( after play: space and - ) ?
---------------
Greetings from Austria
User avatar
Stefan
Veteran
Veteran
Posts: 143
Joined: Wed Feb 20, 2013 8:47 am

YES !

It RUN !

Your -play - ... is correct !

The ESC works too, with a following [Enter], on a Keyboard or me: on the "Enter" Button at Arcade Cabinet ...

Others:
It is better, to bring the Table fit first with the VPinball.exe only, place the DMD, F3 for Reset the Table, then you can play. Details to the Pinball Sim (for all other peoples): http://www.vpforums.org/

Any Questions to me - no Problem.

GREAT THANKS to you, Admin !  :-*

(maybe i will try this with Nebula 2 Emu too ;-)) ... tomorrow.
Last edited by Stefan on Wed Feb 20, 2013 8:42 pm, edited 1 time in total.
---------------
Greetings from Austria
User avatar
Stefan
Veteran
Veteran
Posts: 143
Joined: Wed Feb 20, 2013 8:47 am

Is there an easy way over AutoIt, so i can Exit the Visual Pinball with ESC ?

If i press ESC, sure, there come a confirm-window, with ENTER i can press "Exit" on this.

I must get with press ESC this: [ESC] and [Enter]

btw.
here is a little video from my system now  :D
http://www.digisystems.at/mGalaxy-Final.zip
Last edited by Stefan on Sat Feb 23, 2013 3:29 pm, edited 1 time in total.
---------------
Greetings from Austria
User avatar
mgalaxy
Administrator
Administrator
Posts: 1189
Joined: Tue Dec 05, 2006 7:46 pm

Can you test this and tells me if that works for you?
Just change the value of the $path and eventually $app variables at lines 2 & 3

Code: Select all

HotKeySet("{ESC}", "Terminate")
$path = "C:\Program Files (x86)\Visual Pinball\"
$app = "VPinball_9_0_2.exe"

If $CmdLine[0] == 1 Then
	Run( $path & $app & " -play -" & '"' & $CmdLine[1] & '"', $path)	
    While 1
          Sleep(100)
    WEnd
EndIf
Func Terminate()
	WinClose ( "Visual Pinball Player")
	ControlClick("[CLASS:#32770]", "Paused", 293)
	WinClose ("Visual Pinball")
	WinActivate ("mGalaxy")
    Exit 0
 EndFunc
Concerning the "Systems.xml" file:

Code: Select all

<Emu selected="0">
      <Cmd id="0" name="AutoIt" value=""%path\%file"" />
</Emu>
Last edited by mgalaxy on Sun Feb 24, 2013 11:19 am, edited 1 time in total.
User avatar
Stefan
Veteran
Veteran
Posts: 143
Joined: Wed Feb 20, 2013 8:47 am

It can't run better  :D

Sure, edit the AppPath in Runway, too (to the AutoIt.exe)

Thank you again !

Edit:
This run with Visual Pinball V8 too, i use V8 ...
---------------
Greetings from Austria
davhuit
Elite Member
Elite Member
Posts: 173
Joined: Mon Aug 12, 2013 3:06 am

Works fine with the last version (9.1.5), just tried :)

But maybe you should precise on the site that you have to use the "AutoIt" script to make it works, as mGalaxy was loading "Visual Pinball" but wasn't loading any tables when I first tried without the "AutoIt" script.

And for people who are interested about it, that last version (9.1.5) is compatible with controllers.

You can't directly click on a key then map it to a button of your controller by pressing a button, but you can choose each key/button mapping from a menu.
Last edited by davhuit on Mon Aug 19, 2013 1:06 am, edited 1 time in total.
davhuit
Elite Member
Elite Member
Posts: 173
Joined: Mon Aug 12, 2013 3:06 am

Okay, I found a problem after a lot of testing.

It works fine when you use standard tables (the ones which don't require roms to work, and so which don't rely on Vpinmame to work).

When you use tables which requires roms (near all old commercial ones), the table is sometimes in the background when you load it, so you have to use ALT-TAB several tab to get the focus on the right window (ALT + press TAB four times on my PC).

It don't happen everytime and it seems random, as I managed to get the right focus without needing to use ALT+TAB on a table, then a few tests later, with the same table, I had to use the trick to get the right focus.

The name of the windows where the focus have to be put on is "Visual Pinball Player".

So if someone have the skills to do an AutoIt script to fix that, I think it would be interesting for Visual Pinball users.

There is a script for PCSX2 which already do that (same problem of focus) but dunno if it (or parts of it) can be reused :

Code: Select all

If NOT $CmdLine[0] = 1 Then Exit

HotKeySet("{ESC}", "Terminate")

$PID = Run ( "pcsx2-r5350.exe " & $CmdLineRaw )

while _WinWaitActivePID($PID)
   sleep(500)
wend

While 1
  Sleep(500)
WEnd
exit 0

Func Terminate()
    While ProcessExists ( $PID )
	  ProcessClose ( $PID )
    WEnd
    Exit 0
 EndFunc
 
 Func _WinWaitActivePID($iPid)
    While 1
        Local $list = WinList()
        For $i = 1 To $list[0][0]
            If $list[$i][0] <> "" And IsVisible($list[$i][1]) Then
                If WinGetProcess($list[$i][1]) = $iPid AND WinActive($list[$i][1]) Then Return $list[$i][0]
            EndIf
        Next
    WEnd
EndFunc

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf

EndFunc
vp-01.jpg : After those tables are loaded with mGalaxy (most of the time)
vp-02.jpg : Focus on the right window (what you get once you've done ALT+TAB four times).
Attachments
vp-02.jpg
vp-01.jpg
Last edited by davhuit on Mon Aug 19, 2013 2:59 am, edited 1 time in total.
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

Try that

Code: Select all

HotKeySet("{ESC}", "Terminate")
$path = "C:\Program Files (x86)\Visual Pinball\"
$app = "VPinball_9_0_2.exe"

If $CmdLine[0] == 1 Then
	$PID=Run( $path & $app & " -play -" & '"' & $CmdLine[1] & '"', $path)

while _WinWaitActivePID($PID)
   sleep(500)
wend

    While 1
          Sleep(100)
    WEnd
EndIf

exit 0


Func Terminate()
	WinClose ( "Visual Pinball Player")
	ControlClick("[CLASS:#32770]", "Paused", 293)
	WinClose ("Visual Pinball")
	WinActivate ("mGalaxy")
    Exit 0
 EndFunc

 Func _WinWaitActivePID($iPid)
    While 1
        Local $list = WinList()
        For $i = 1 To $list[0][0]
            If $list[$i][0] <> "" And IsVisible($list[$i][1]) Then
                If WinGetProcess($list[$i][1]) = $iPid AND WinActive($list[$i][1]) Then Return $list[$i][0]
            EndIf
        Next
    WEnd
EndFunc
 
Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf
 
EndFunc
davhuit
Elite Member
Elite Member
Posts: 173
Joined: Mon Aug 12, 2013 3:06 am

Still some focus problems with some tables.

I searched a bit more and seems to have found the problem and it's solution here : http://www.hyperspin-fe.com/forum/showt ... al-Pinball

It seems to works fine if "Visual Pinball" main window is not maximized by default (like on my screenshot).

I tested a dozen of tables with this trick and all of them loaded with the right focus.

I dunno if the "AutoIt" script is also helping (didn't tried without) but I'll keep using it, just to be sure (I needed one for the "ESC" key anyway, so it's the same ^^).

Thanks a lot, again :)

Note : It might be a good thing to put that script with the others, and to precise in the "emulator settings" page of the website that the best is to leave "Visual Pinball" main window unmaximized to avoid window's focus problem with some tables (especially ones which use vpinmame for the roms).

Attachments
vp.jpg
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

I don't have this emulator, so I can't make try but you can use the WinSetState function

http://www.autoitscript.com/autoit3/docs/functions/WinSetState.htm

To minimise/maximize that you want, eg WinSetState("Visual Pinball", "", @SW_MINIMIZE)

And

Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

To help you to find the good window

[email]http://www.autoitscript.com/autoit3/doc ... vanced.htm[/email]
Last edited by Aeliss on Tue Aug 20, 2013 4:09 pm, edited 1 time in total.
davhuit
Elite Member
Elite Member
Posts: 173
Joined: Mon Aug 12, 2013 3:06 am

Oh, it's already looking okay.

This simulator save the state of the window so if you leave it windowed at start, it'll always be windowed at start so it's okay :)
Post Reply