Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Westworld

B2S Backglass Server Mod

Recommended Posts

As Herweh published the source of B2SServer and we saw several updates to improve PinMame support, I thought fixing two bugs could be useful for all.

1) exe mode does not support alternative screenres files
2) exe mode fails on some computers for some tables in exclusive mode launched via Pinballx

Forum discussion for 1):
http://www.vpforums.org/index.php?showtopic=23072&page=8

Bug fix was easy, the alternative screenres file is searched before the table name is set, that's why it fails always. Solution is to change the order, first detect table name, then check for "TableName.res" file.


Forum discussion for 2):
https://www.gameex.info/forums/topic/16462-update-visual-pinball-mini-dmdb2s-screen-for-apron-now-with-instruction-card-splash-viewer/?do=findComment&comment=161365
http://www.vpforums.org/index.php?showtopic=34672&page=10#entry356239
https://www.gameex.info/forums/topic/18489-visual-pinball-x-backglass-not-showing-when-using-true-fullscreen-mode/

2) is the most interesting one, it is really a pain, only workaround seems to have the Task Manager always opened. This worked for me for most tables, but not all.

B2SBackglassServer looks for a process named "Visual Pinball - " and takes the following part as table name.
This worked fine for years, but fails for new (large?) VPX tables, only if using exclusive mode and only if VPX is launched from PinballX. As in this case the table name is missing in the process name, B2SBackglassServer cannot detect it - and opens an error message saying "File 'C:\Games\Visual Pinball\Tables\.Direct2BS' not found. Please rename...". The table is name is empty, that's why it fails.

It seems a real fix needs to be done in VisualPinball itself, but there is a possible workaround for the backglass.
If the table name is empty, why not use the gamename (ROM name), which is always correctly set.

The modification checks if the table name is empty, then use the gamename as replacement.

Duplicate your directb2s file and rename it based on the gamename. If you don't know that, simply launch the table, if the problem happens on your computer with a table, you will get an error message showing the name, such as:
"File 'C:\Games\Visual Pinball\Tables\kpv106.direct2BS' not found. Please rename..."


This modifications target only the b2sbackglassserver.exe, other files do no need to be modified.
Replace the file with the one enclosed:
(build on b2s-backglass-code-14-trunk)

Alternatively, download the source from:
https://sourceforge.net/p/b2s-backglass/code/HEAD/tree/trunk/
Download/install MS Visual Studio 2015 Community Edition (free).

Patch:

Index: formBackglass.vb
===================================================================
--- formBackglass.vb    (revision 14)
+++ formBackglass.vb    (working copy)
@@ -10,7 +10,7 @@
 
     Private Const minSize4Image As Integer = 300000
 
-    Private B2SScreen As B2SScreen = New B2SScreen()
+    Private B2SScreen As B2SScreen = Nothing  '  was New B2SScreen(), delayed to do later  - Westworld, 2016-11-18
     Private B2SLED As B2SLED = New B2SLED()
     Private B2SAnimation As B2SAnimation = New B2SAnimation()
 
@@ -81,6 +81,12 @@
             B2SSettings.B2SName = regkey.GetValue("B2SB2SName", String.Empty)
         End Using
 
+        ' Westworld 2016-18-11 - TableFileName is empty in some cases when launched via PinballX, use GameName as alternativ
+        If String.IsNullOrEmpty(B2SData.TableFileName) Then
+            B2SData.TableFileName = B2SSettings.GameName
+        End If
+        B2SScreen = New B2SScreen() ' was started before Tablename was identified, alternativ ScreenRes was failing
+
         ' load settings
         B2SSettings.Load()


 

Build the project, done.

 
If I did something wrong with this post and are not supposed to publish/mod builds, I apologize upfront, I did not want to make anybody unhappy, I'm so glad about the work all code developers and table authors do. This was supposed just to help, not to annoy anybody. If wrong, please let me know, I'll clear the message asap.

B2SBackglassServerEXE.zip

  • Upvote 1

Share this post


Link to post
Share on other sites

sounds great, do you have djrobx adds for sam le tables for example?

Sent from tapatalk

Share this post


Link to post
Share on other sites
25 minutes ago, arngrim said:

do you have djrobx adds for sam le tables for example?
 

it is based on everything added from dirobx (or others).

Share this post


Link to post
Share on other sites

You are doing the right thing. I think toxie and DJRobX will see this thread but you may also want to PM. Both have access to make changes to the source code. You might also want to post a pull request at the code repo.


Sent from my iPad using Tapatalk

Share this post


Link to post
Share on other sites

just tried it on my cab with scared stiff that doesn't launch in exe mode with pbx, renamed the db2s to the rom name, and it does the trick :)

seems i am ready to use true fullscreen now, thanks ;)

about  It seems a real fix needs to be done in VisualPinball itself, but there is a possible workaround for the backglass.

did you suggest that to vp team? the trick is working with pbx, but without, the bg is not displayed.

also i remember long time ago b2s.server could use the description of the table rom the ini files, and suddenly it stopped working on my system, i had to rename all my 400 db2s at that time from the description to the table name, i wonder if investigating to have that properly working would be a good solution also

Share this post


Link to post
Share on other sites

did you suggest that to vp team? the trick is working with pbx, but without, the bg is not displayed.

no. Simply because I could not file a real bug report. It happens for some users, others don't see it - how to debug?
I'm not 100% sure it is PinballX, VP or B2sServer. I never used Visual Basic in my life, this is my first coding in Visual Basic ether, so not really qualified...

also i remember long time ago b2s.server could use the description of the table rom the ini files

Ini file? The table name is used to read the Hyperpin/PinballX XML file to get the official name. 

Or did I misunderstood you? Description means something like "Sorcerer (Williams 1985)", right? It uses the PinballX XML file (you need to use Settings to tell the server where it is), searches for the table name (this means it needs to have a table name) and if found, uses that as alternative name, if there is no file using the table name. This works fine for me - if - and only if - all tables are in the same XML. It does not support to have different XML files, as one for VB9, one for VB 9Mod, one for VBX. All needs to be merged (using the AlternateEXE tag). Was this your probelm?

Share this post


Link to post
Share on other sites

ah yes, so i forgot in b2s server settings we can specify the location of the ini file, then we could name the db2s like the description of the table that we want to run and it works

maybe because we have more than one ini file based on different systems that was my issue, anyway i already renamed all my db2s like the table name, and rename the ones that had problem with exe mode and pbx, i already renamed like the rom, solution is great like this :) 

so far i have 3 tables that i knew by heart that has the problem, demolition man, scared stiff, monster bash

Share this post


Link to post
Share on other sites

First definitely no problem sharing your mods.    That's the great thing about open source.  

Unfortunately this issue does not reproduce on my cab at all, every B2S works perfect in true fullscreen mode, as-is on my cab, so I can't debug.   I'd like to find a solution that doesn't involve needing two copies of every DirectB2S though.   

B2s EXE does all of its communication via registry keys.   Odd, but it works I guess.   Maybe a fix for the tablename problem could be for the B2S DLL to locate and put the table name in the registry and have the B2S EXE pick that up and use that.    I believe people have said that it works in non-EXE mode with true fullscreen, just with a performance hit.     Can someone confirm that?   If so I can try that method and we can see if it works. 

I will definitely pick up your alternative screenres fix and commit that though.  

 

 

 

Share this post


Link to post
Share on other sites

thanks for taking a look!

Maybe a fix for the tablename problem could be for the B2SDLL to locate and put the table name in the registry and have the B2S EXE pick that up and use that. 

I thought so as well and already tried that. Added in the DLL the tablename to registry and read that from the EXE.

But strange - even in the DLL the tablename appeared empty.

Trying to dig deaper, I saw that both DLL and EXE uses the same code from Processes.vb:

        RefreshWindowList()
        For Each proc As ProcInfo In windowlist
            If Not String.IsNullOrEmpty(proc.Name) Then
                If proc.Name.StartsWith("Visual Pinball - ", StringComparison.CurrentCultureIgnoreCase) Then

As both uses the same code, no wonder that both acts similar. I do not have VB experiences, but for me it looked as if the server is launched as EXE, for any reason, the VPX window is missing the title - sometimes...

At that moment I gave up and thought easiest way (with minimum code change) is to duplicate the backglass file.

Another idea I had was to modify the VXP table script itself, and directly manipulate the Registry to pass a tablename before starting the controller. Inside B2SServer reading this value and use it. But that would require to modify every table - and again after each update, so I thought duplicating is easier. Another idea was to try to pass another value to the controller, something like controller.tablename='tablename', but again, this would require to modify the table after each update. Or to create a new B2Sfunction, to set the table name, same problem as above. And all these needs a change in b2sserver as well.

I'm happy for any better idea...

At least, I had about 10 tables failing. 9 of them worked when TaskManager was running reduced in background (great but weird tip), one (Monster Bash) always failing. Now all my tables works fine, feels good.

Share this post


Link to post
Share on other sites

Dumb question but I just setup full screen and have a few back glasses getting the db2s not found error through pinballx. It's fine straight from vpx. Do I need to download above b2s server and rename the troubled back glasses to the rom name?

Sent from my SAMSUNG-SM-G935A using Tapatalk

Share this post


Link to post
Share on other sites
8 hours ago, umpa said:

and have a few back glasses getting the db2s not found error through pinballx. It's fine straight from vpx.

yes, seems thats exactly the problem solved here.

But a better way would be to use directly the follow up one:

http://vpuniverse.com/forums/forums/topic/2869-b2s-server-new-feature-aspect-ratio/

That one - beside adding another new feature  about aspect ratio - enhances the search path. You still can rename the db2s, but it also uses the rom name from PinballX to identify the backglass, which will avoid renaming it, if you care for the usual naming convention.

 

Share this post


Link to post
Share on other sites
yes, seems thats exactly the problem solved here.

But a better way would be to use directly the follow up one:

http://vpuniverse.com/forums/forums/topic/2869-b2s-server-new-feature-aspect-ratio/

That one - beside adding another new feature  about aspect ratio - enhances the search path. You still can rename the db2s, but it also uses the rom name from PinballX to identify the backglass, which will avoid renaming it, if you care for the usual naming convention.

 


Great thank you. I will give it a shot!

Sent from my SAMSUNG-SM-G935A using Tapatalk

Share this post


Link to post
Share on other sites

This mod. saved me for getting bold. I was really pulling my hear out to get rid of my last backglass loading error. Your mod did the final trick for me. Thank you very much for sharing this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...