Author Topic: Visual Pinball (near run) - Helps  (Read 13068 times)

davhuit

  • Full Member
  • ***
  • Posts: 173
Re: Visual Pinball (near run) - Helps
« Reply #13 on: August 20, 2013, 02:41:07 PM »
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 :)

Aeliss

  • Hero Member
  • *****
  • Posts: 915
Re: Visual Pinball (near run) - Helps
« Reply #12 on: August 20, 2013, 11:00:30 AM »
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

http://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm
« Last Edit: August 20, 2013, 11:09:07 AM by Aeliss »

davhuit

  • Full Member
  • ***
  • Posts: 173
Re: Visual Pinball (near run) - Helps
« Reply #11 on: August 19, 2013, 04:30:23 PM »
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/showthread.php?7716-Playfield-losing-focus-in-Visual-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).


Aeliss

  • Hero Member
  • *****
  • Posts: 915
Re: Visual Pinball (near run) - Helps
« Reply #10 on: August 19, 2013, 11:46:39 AM »
Try that

Code: [Select]
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

  • Full Member
  • ***
  • Posts: 173
Re: Visual Pinball (near run) - Helps
« Reply #9 on: August 18, 2013, 09:50:15 PM »
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: (AutoIt) [Select]
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).
« Last Edit: August 18, 2013, 09:59:18 PM by davhuit »

davhuit

  • Full Member
  • ***
  • Posts: 173
Re: Visual Pinball (near run) - Helps
« Reply #8 on: August 18, 2013, 07:05:21 PM »
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 Edit: August 18, 2013, 08:06:56 PM by davhuit »

Stefan

  • Full Member
  • ***
  • Posts: 143
  • BORN TO PLAY
Re: Visual Pinball (near run) - Helps
« Reply #7 on: February 25, 2013, 11:46:18 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

mgalaxy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1168
    • Email
Re: Visual Pinball (near run) - Helps
« Reply #6 on: February 24, 2013, 05:16:52 AM »
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]
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]
<Emu selected="0">
      <Cmd id="0" name="AutoIt" value="&quot;%path\%file&quot;" />
</Emu>

« Last Edit: February 24, 2013, 05:19:57 AM by mgalaxy »

Stefan

  • Full Member
  • ***
  • Posts: 143
  • BORN TO PLAY
Re: Visual Pinball (near run) - Helps
« Reply #5 on: February 23, 2013, 09:27:33 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 Edit: February 23, 2013, 09:29:47 AM by Stefan »
---------------
Greetings from Austria

Stefan

  • Full Member
  • ***
  • Posts: 143
  • BORN TO PLAY
Re: Visual Pinball (near run) - Helps
« Reply #4 on: February 20, 2013, 02:40:42 PM »
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 Edit: February 20, 2013, 02:42:26 PM by Stefan »
---------------
Greetings from Austria

Stefan

  • Full Member
  • ***
  • Posts: 143
  • BORN TO PLAY
Re: Visual Pinball (near run) - Helps
« Reply #3 on: February 20, 2013, 02:26:51 PM »
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

mgalaxy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1168
    • Email
Re: Visual Pinball (near run) - Helps
« Reply #2 on: February 20, 2013, 02:18:14 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 -&quot;%path\%file&quot;" />
    </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 Edit: February 20, 2013, 02:24:15 PM by mgalaxy »

Stefan

  • Full Member
  • ***
  • Posts: 143
  • BORN TO PLAY
Visual Pinball (near run) - Helps
« Reply #1 on: February 20, 2013, 01:53:29 PM »
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