diff --git a/.github/workflows/b2s-backglass.yml b/.github/workflows/b2s-backglass.yml
index 93fd951..715f1a3 100644
--- a/.github/workflows/b2s-backglass.yml
+++ b/.github/workflows/b2s-backglass.yml
@@ -62,30 +62,30 @@ jobs:
- name: Build Server
run: |
msbuild b2s_screenresidentifier/B2S_ScreenResIdentifier.sln /t:Rebuild /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }}
- msbuild b2sbackglassserverexe/B2SBackglassServerEXE.sln /t:Restore,Rebuild /p:Configuration=${{ matrix.config }} /p:Platform="Any CPU"
+ msbuild b2sbackglassserver/B2SBackglassServerEXE.sln /t:Rebuild /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }}
msbuild b2sbackglassserverregisterapp/B2SBackglassServerRegisterApp.sln /t:Rebuild /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }}
msbuild b2sbackglassserver/B2SBackglassServer.sln /t:Rebuild /p:Configuration=${{ matrix.config }}
msbuild B2SWindowPunch/B2SWindowPunch.sln /t:Rebuild /p:Configuration=${{ matrix.config }}
shell: cmd
- name: Bundle
run: |
+ ls -R b2sbackglassserver/b2sbackglassserver/bin
mkdir tmp
cp b2s_screenresidentifier/b2s_screenresidentifier/bin/${{ matrix.platform }}/${{ matrix.config }}/B2S_ScreenResIdentifier.exe tmp
cp b2s_screenresidentifier/b2s_screenresidentifier/bin/${{ matrix.platform }}/${{ matrix.config }}/B2S_ScreenResIdentifier.exe.config tmp
- : # ls -R b2sbackglassserverexe
- cp b2sbackglassserverexe/bin/${{ matrix.config }}/B2SBackglassServerEXE.exe tmp
- : # cp b2sbackglassserverexe/bin/${{ matrix.config }}/B2SBackglassServerEXE.exe.config tmp
cp b2sbackglassserverregisterapp/b2sbackglassserverregisterapp/bin/${{ matrix.platform }}/${{ matrix.config }}/B2SBackglassServerRegisterApp.exe tmp
- cp b2sbackglassserver/b2sbackglassserver/bin/${{ matrix.config }}/B2SServerPluginInterface.dll tmp
+ cp B2SServerPluginInterface/B2SServerPluginInterface/bin/${{ matrix.config }}/B2SServerPluginInterface.dll tmp
cp b2sbackglassserver/b2sbackglassserver/bin/${{ matrix.config }}/B2SBackglassServer.dll tmp
+ cp b2sbackglassserver/b2sbackglassserver/bin/${{ matrix.platform }}/${{ matrix.config }}/B2SBackglassServerEXE.exe tmp
+ cp b2sbackglassserver/b2sbackglassserver/bin/${{ matrix.platform }}/${{ matrix.config }}/B2SBackglassServerEXE.exe.config tmp
cp b2sbackglassserver/b2sbackglassserver/B2SInit.cmd tmp
cp B2SWindowPunch/B2SWindowPunch/bin/${{ matrix.config }}/B2SWindowPunch.exe tmp
if [[ "${{ matrix.config }}" == "Debug" ]]; then
cp b2s_screenresidentifier/b2s_screenresidentifier/bin/${{ matrix.platform }}/${{ matrix.config }}/B2S_ScreenResIdentifier.pdb tmp
- : # cp b2sbackglassserverexe/bin/${{ matrix.config }}/*/B2SBackglassServerEXE.pdb tmp
cp b2sbackglassserverregisterapp/b2sbackglassserverregisterapp/bin/${{ matrix.platform }}/${{ matrix.config }}/B2SBackglassServerRegisterApp.pdb tmp
- cp b2sbackglassserver/b2sbackglassserver/bin/${{ matrix.config }}/B2SServerPluginInterface.pdb tmp
+ cp B2SServerPluginInterface/B2SServerPluginInterface/bin/${{ matrix.config }}/B2SServerPluginInterface.pdb tmp
cp b2sbackglassserver/b2sbackglassserver/bin/${{ matrix.config }}/B2SBackglassServer.pdb tmp
+ cp b2sbackglassserver/b2sbackglassserver/bin/${{ matrix.platform }}/${{ matrix.config }}/B2SBackglassServerEXE.pdb tmp
cp B2SWindowPunch/B2SWindowPunch/bin/${{ matrix.config }}/B2SWindowPunch.pdb tmp
fi
mkdir tmp/Plugins tmp/Plugins64
diff --git a/b2sbackglassserver/B2SBackglassServerEXE.sln b/b2sbackglassserver/B2SBackglassServerEXE.sln
new file mode 100644
index 0000000..2524e85
--- /dev/null
+++ b/b2sbackglassserver/B2SBackglassServerEXE.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33205.214
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "B2SBackglassServerEXE", "B2SBackglassServer\B2SBackglassServerEXE.vbproj", "{AC2E94BE-21CD-434A-9039-6551DF43698B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AC2E94BE-21CD-434A-9039-6551DF43698B}.Debug|x64.ActiveCfg = Debug|x64
+ {AC2E94BE-21CD-434A-9039-6551DF43698B}.Debug|x64.Build.0 = Debug|x64
+ {AC2E94BE-21CD-434A-9039-6551DF43698B}.Debug|x86.ActiveCfg = Debug|x86
+ {AC2E94BE-21CD-434A-9039-6551DF43698B}.Debug|x86.Build.0 = Debug|x86
+ {AC2E94BE-21CD-434A-9039-6551DF43698B}.Release|x64.ActiveCfg = Release|x64
+ {AC2E94BE-21CD-434A-9039-6551DF43698B}.Release|x64.Build.0 = Release|x64
+ {AC2E94BE-21CD-434A-9039-6551DF43698B}.Release|x86.ActiveCfg = Release|x86
+ {AC2E94BE-21CD-434A-9039-6551DF43698B}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {5F9BB968-681A-4FB2-8074-C179F66DB0F2}
+ EndGlobalSection
+EndGlobal
diff --git a/b2sbackglassserver/b2sbackglassserver/B2SBackglassServer.vbproj b/b2sbackglassserver/b2sbackglassserver/B2SBackglassServer.vbproj
index 4d3c2fb..949729b 100644
--- a/b2sbackglassserver/b2sbackglassserver/B2SBackglassServer.vbproj
+++ b/b2sbackglassserver/b2sbackglassserver/B2SBackglassServer.vbproj
@@ -27,6 +27,7 @@
42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
false
false
+ B2S="DLL"
AnyCPU
@@ -40,6 +41,7 @@
false
true
false
+ B2S="DLL"
On
diff --git a/b2sbackglassserver/b2sbackglassserver/B2SBackglassServerEXE.ico b/b2sbackglassserver/b2sbackglassserver/B2SBackglassServerEXE.ico
new file mode 100644
index 0000000..6cbc31c
Binary files /dev/null and b/b2sbackglassserver/b2sbackglassserver/B2SBackglassServerEXE.ico differ
diff --git a/b2sbackglassserver/b2sbackglassserver/B2SBackglassServerEXE.vbproj b/b2sbackglassserver/b2sbackglassserver/B2SBackglassServerEXE.vbproj
new file mode 100644
index 0000000..f40f2a0
--- /dev/null
+++ b/b2sbackglassserver/b2sbackglassserver/B2SBackglassServerEXE.vbproj
@@ -0,0 +1,307 @@
+
+
+
+ Debug
+ x86
+ {AC2E94BE-21CD-434A-9039-6551DF43698B}
+ WinExe
+ B2S
+ B2SBackglassServerEXE
+ 512
+ WindowsFormsWithCustomSubMain
+ v4.8
+ SAK
+ SAK
+ SAK
+ SAK
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ AnyCPU
+ true
+ full
+ true
+ true
+ bin\x86\Debug\
+ B2SBackglassServerEXE.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ false
+ false
+
+
+ AnyCPU
+ pdbonly
+ false
+ true
+ true
+ bin\x86\Release\
+ B2SBackglassServerEXE.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ false
+ true
+ false
+
+
+ x64
+ true
+ full
+ true
+ true
+ bin\x64\Debug\
+ B2SBackglassServerEXE.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ false
+ false
+ B2S="EXE"
+
+
+ x64
+ pdbonly
+ false
+ true
+ true
+ bin\x64\Release\
+ B2SBackglassServerEXE.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ false
+ true
+ false
+ B2S="EXE"
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+ Sub Main
+
+
+ B2SBackglassServerEXE.ico
+
+
+ true
+ true
+ true
+ bin\Debug\
+ B2SBackglassServerEXE.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ full
+ AnyCPU
+
+
+ true
+ bin\Release\
+ true
+ B2SBackglassServerEXE.xml
+ true
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ pdbonly
+ AnyCPU
+
+
+ My Project\app.manifest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+ Component
+
+
+
+
+ Background.vb
+
+
+ Form
+
+
+ formBackglass.vb
+
+
+ Form
+
+
+ formDMD.vb
+
+
+ Form
+
+
+ formMode.vb
+
+
+ Form
+
+
+ formSettings.vb
+
+
+ Form
+
+
+ formSettingsMore.vb
+
+
+ Form
+
+
+
+
+
+
+ True
+ Application.myapp
+ True
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ Background.vb
+ Designer
+
+
+ formBackglass.vb
+ Designer
+
+
+ formDMD.vb
+
+
+ formMode.vb
+
+
+ formSettings.vb
+
+
+ formSettingsMore.vb
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4.8 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/b2sbackglassserver/b2sbackglassserver/Classes/B2SAnimation.vb b/b2sbackglassserver/b2sbackglassserver/Classes/B2SAnimation.vb
index 42f3326..44205ae 100644
--- a/b2sbackglassserver/b2sbackglassserver/Classes/B2SAnimation.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Classes/B2SAnimation.vb
@@ -1,6 +1,7 @@
Imports System
Imports System.Windows.Forms
Imports System.Drawing
+Imports Microsoft.Win32
Public Class B2SAnimation
@@ -980,6 +981,7 @@ Public Class B2SAnimation
#Region "switch timer stuff"
+#If B2S = "DLL" Then
Private Shared switches As Generic.SortedList(Of Integer, Boolean) = New Generic.SortedList(Of Integer, Boolean)
Private Shared SwitchTimer As Timers.Timer = Nothing
@@ -1012,7 +1014,21 @@ Public Class B2SAnimation
switches.Clear()
End Sub
+#Else
+ Private Shared Sub SetSwitch(ByVal switchid As Integer)
+ For i As Integer = 1 To 2
+ Using regkey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\B2S", True)
+ If regkey.GetValue("B2SSetSwitch" & i.ToString(), "").ToString.Length = 0 Then
+ regkey.SetValue("B2SSetSwitch" & i.ToString(), switchid, RegistryValueKind.DWord)
+ Exit For
+ End If
+ End Using
+ Next
+
+ End Sub
+
+#End If
#End Region
End Class
\ No newline at end of file
diff --git a/b2sbackglassserver/b2sbackglassserver/Classes/B2SBackglassServerEXE.vb b/b2sbackglassserver/b2sbackglassserver/Classes/B2SBackglassServerEXE.vb
new file mode 100644
index 0000000..15e7afe
--- /dev/null
+++ b/b2sbackglassserver/b2sbackglassserver/Classes/B2SBackglassServerEXE.vb
@@ -0,0 +1,23 @@
+Imports System
+Imports System.Drawing
+Imports System.IO
+Imports System.Security.Principal
+Imports System.Windows.Forms
+Imports Microsoft.Win32
+
+Module B2SBackglassServerEXE
+ Sub Main()
+ 'If IsAdmin() Then
+ ' MessageBox.Show("You should not start this as Administrator!", My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
+ ' Exit Sub
+ 'End If
+ Application.EnableVisualStyles()
+ Application.SetCompatibleTextRenderingDefault(False)
+ Application.Run(New formBackglass())
+ End Sub
+ Private Function IsAdmin() As Boolean
+ Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent()
+ Dim principal As New WindowsPrincipal(identity)
+ Return principal.IsInRole(WindowsBuiltInRole.Administrator)
+ End Function
+End Module
\ No newline at end of file
diff --git a/b2sbackglassserver/b2sbackglassserver/Classes/B2SCollectData.vb b/b2sbackglassserver/b2sbackglassserver/Classes/B2SCollectData.vb
index 2ba23e0..e91f3ae 100644
--- a/b2sbackglassserver/b2sbackglassserver/Classes/B2SCollectData.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Classes/B2SCollectData.vb
@@ -14,17 +14,19 @@
Public Class CollectData
Public State As Integer = 0
Public Types As Integer = 0
+#If B2S = "DLL" Then
Public EarlyOffMode As Boolean = False
-
- Public Sub New(_state As Integer, _type As eCollectedDataType)
+ Public Sub New(_state As Integer, _type As eCollectedDataType, _earlyoffmode As Boolean)
State = _state
Types = _type
+ EarlyOffMode = _earlyoffmode
End Sub
- Public Sub New(_state As Integer, _type As eCollectedDataType, _earlyoffmode As Boolean)
+
+ Public Sub New(_state As Integer, _type As eCollectedDataType)
State = _state
Types = _type
- EarlyOffMode = _earlyoffmode
End Sub
+#End If
End Class
Public Sub New(_skipframes As Integer)
@@ -34,13 +36,17 @@
Public Shadows Function Add(key As Integer, value As CollectData) As Boolean
Dim ret As Boolean = False
If Me.ContainsKey(key) Then
- If value.EarlyOffMode AndAlso Me(key).State = 0 AndAlso value.State = 0 Then
+#If B2S = "DLL" Then
+ If value.EarlyOffMode AndAlso Me(key).State = 0 AndAlso value.State = 0 Then
Me(key).State = 2
Else
Me(key).State = value.State
End If
- Me(key).Types = Me(key).Types Or value.Types
- ret = True
+#Else
+ Me(key).State = value.State
+#End If
+ Me(key).Types = Me(key).Types Or value.Types
+ ret = True
Else
MyBase.Add(key, value)
End If
diff --git a/b2sbackglassserver/b2sbackglassserver/Classes/B2SData.vb b/b2sbackglassserver/b2sbackglassserver/Classes/B2SData.vb
index 1d976a5..8a76cbd 100644
--- a/b2sbackglassserver/b2sbackglassserver/Classes/B2SData.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Classes/B2SData.vb
@@ -4,7 +4,19 @@ Imports System.Drawing
Public Class B2SData
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal LongName As String, ShortName As String, ByVal bufsize As Integer) As Long
-
+ Public Enum eDMDType
+ NotDefined = 0
+ NoB2SDMD = 1
+ B2SAlwaysOnSecondMonitor = 2
+ B2SAlwaysOnThirdMonitor = 3
+ B2SOnSecondOrThirdMonitor = 4
+ End Enum
+ Public Enum eDualMode
+ Both = 0
+ Authentic = 1
+ Fantasy = 2
+ End Enum
+#If B2S = "DLL" Then
Private Shared _vpinmame As Object = Nothing
Public Shared ReadOnly Property VPinMAME() As Object
Get
@@ -30,18 +42,6 @@ Public Class B2SData
IsStopped = True
End Sub
- Public Enum eDMDType
- NotDefined = 0
- NoB2SDMD = 1
- B2SAlwaysOnSecondMonitor = 2
- B2SAlwaysOnThirdMonitor = 3
- B2SOnSecondOrThirdMonitor = 4
- End Enum
- Public Enum eDualMode
- Both = 0
- Authentic = 1
- Fantasy = 2
- End Enum
Private Shared IsLampsInfoDirty As Boolean = True
Private Shared IsSolenoidsInfoDirty As Boolean = True
@@ -95,6 +95,7 @@ Public Class B2SData
IsInfoDirty = True
End Set
End Property
+#End If
Public Shared Property OnAndOffImage() As Boolean = False
Public Shared Property IsOffImageVisible() As Boolean = False
@@ -161,7 +162,7 @@ Public Class B2SData
Public Shared Property SmallGrillHeight() As Integer = 0
Public Shared Property DMDDefaultLocation() As Point = New Point(0, 0)
Public Shared Property DualBackglass() As Boolean = False
-
+#If B2S = "DLL" Then
Private Shared Property _TestMode() As Boolean = False
Public Shared Property TestMode() As Boolean
Get
@@ -172,7 +173,7 @@ Public Class B2SData
IsInfoDirty = True
End Set
End Property
-
+#End If
Public Class PictureBoxCollection
Inherits Generic.SortedList(Of String, B2SPictureBox)
@@ -183,7 +184,9 @@ Public Class B2SData
Public Shadows Sub Add(ByVal value As B2SPictureBox, Optional ByVal dualmode As B2SData.eDualMode = eDualMode.Both)
If Not MyBase.ContainsKey(value.Name) Then MyBase.Add(value.Name, value)
If value.RomID > 0 Then
+#If B2S = "DLL" Then
IsInfoDirty = True
+#End If
Dim UsedRomIDs4Authentic As Generic.SortedList(Of Integer, B2SBaseBox()) = Nothing
Dim UsedRomIDs4Fantasy As Generic.SortedList(Of Integer, B2SBaseBox()) = Nothing
If value.RomIDType = B2SBaseBox.eRomIDType.Lamp Then
@@ -285,7 +288,9 @@ Public Class B2SData
Inherits Generic.Dictionary(Of Integer, AnimationInfo())
Public Shadows Sub Add(key As Integer, value As AnimationInfo)
+#If B2S = "DLL" Then
IsInfoDirty = True
+#End If
If Not Me.ContainsKey(key) Then
MyBase.Add(key, New AnimationInfo() {value})
Else
@@ -317,7 +322,7 @@ Public Class B2SData
End If
End Sub
End Class
-
+#If B2S = "DLL" Then
Public Shared ReadOnly Property GetLampsData() As Boolean
Get
Static ret As Boolean = False
@@ -366,7 +371,7 @@ Public Class B2SData
Return ret
End Get
End Property
-
+#End If
Public Shared ReadOnly Property UseRomLamps() As Boolean
Get
If B2SSettings.CurrentDualMode = B2SSettings.eDualMode.Fantasy Then
@@ -519,15 +524,19 @@ Public Class B2SData
Public Shared Property ledCoordMax() As Integer
Public Shared Sub ClearAll(Optional ByVal donotclearnames As Boolean = False)
+#If B2S = "DLL" Then
IsInfoDirty = True
+#End If
If Not donotclearnames Then
TableName = String.Empty
TableFileName = String.Empty
BackglassFileName = String.Empty
+#If B2S = "DLL" Then
Else
LaunchBackglass = True
IsBackglassVisible = False
IsBackglassStartedAsEXE = False
+#End If
End If
TableType = 0
DMDType = 0
diff --git a/b2sbackglassserver/b2sbackglassserver/Classes/B2SScreen.vb b/b2sbackglassserver/b2sbackglassserver/Classes/B2SScreen.vb
index 0c5d61a..fa5ac2b 100644
--- a/b2sbackglassserver/b2sbackglassserver/Classes/B2SScreen.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Classes/B2SScreen.vb
@@ -27,6 +27,7 @@ Public Class B2SScreen
Public Property PlayfieldSize() As Size = New Size(0, 0)
Public Property BackglassMonitor() As String = String.Empty
Public Property BackglassScreen() As Screen = Nothing
+ Public Property StartBackground() As Boolean = False
Public Property BackglassSize() As Size = New Size(0, 0)
Public Property BackglassLocation() As Point = New Point(0, 0)
Public Property BackglassGrillHeight() As Integer = 0
@@ -44,10 +45,9 @@ Public Class B2SScreen
Public Property BackglassCutOff() As Rectangle = Nothing
Public Property IsDMDToBeShown() As Boolean = False
- Public Property StartBackground() As Boolean = False
Public Property rescaleBackglass As SizeF = New SizeF(1, 1)
-
+
#Region "constructor and startup"
Public Sub New()
@@ -59,8 +59,7 @@ Public Class B2SScreen
' read settings file
ReadB2SSettingsFromFile()
- Server.errorlog.WriteLogEntry("B2SScreen.New DONE")
-
+ debugLog.WriteLogEntry("B2SScreen.New DONE")
End Sub
Public Sub Start(ByVal _formBackglass As Form)
@@ -105,33 +104,31 @@ Public Class B2SScreen
Private Sub ReadB2SSettingsFromFile()
Dim loadFileName As String = String.Empty
- 'Dim searchPathLog As Log = New Log("BackglassSearchPath")
- 'searchPathLog.IsLogOn = B2SSettings.IsBackglassSearchLogOn
+ debugLog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile Start Search ScreenRes")
- 'searchPathLog.WriteLogEntry("Start Search ScreenRes")
- Server.errorlog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile Start Search ScreenRes")
Try
Dim loadFileNames() As String = {IO.Path.Combine(B2SData.TableFileName & ".res"), ' .\TableName.res
IO.Path.Combine(B2SData.TableFileName, B2SSettings.B2SScreenResFileName), ' .\TableName\ScreenRes.txt
B2SSettings.B2SScreenResFileName, ' .\ScreenRes.txt
IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), B2SSettings.B2SScreenResFileName)' B2SFolder\ScreenRes.txt
}
- ' TODO IO.Path.Combine(Application.StartupPath(), B2SSettings.B2SScreenResFileName)' B2SFolder\ScreenRes.txt
+ ' TODO IO.Path.Combine(Application.StartupPath(), B2SSettings.B2SScreenResFileName)' B2SFolder\ScreenRes.txt
For Each testFileName As String In loadFileNames
- Server.errorlog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile Test " & testFileName)
- 'searchPathLog.WriteLogEntry(" Test " & testFileName)
+
+ debugLog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile Test " & testFileName)
+
If IO.File.Exists(testFileName) Then
loadFileName = testFileName
B2SSettings.LoadedResFilePath = Path.GetFullPath(loadFileName)
- Server.errorlog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile Found ScreenRes " & loadFileName)
- 'searchPathLog.WriteLogEntry("Found ScreenRes " & loadFileName)
+ debugLog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile Found ScreenRes " & loadFileName)
+
Exit For
End If
Next
Catch
End Try
- Server.errorlog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile Stop Search ScreenRes")
- 'searchPathLog.WriteLogEntry("Stop Search ScreenRes")
+ debugLog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile Stop Search ScreenRes")
+
If Not loadFileName = String.Empty Then
@@ -151,7 +148,8 @@ Public Class B2SScreen
Loop
' close file handle
FileClose(1)
- Server.errorlog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile A version #2 file " & Me.BackgroundPath)
+ debugLog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile A version #2 file " & Me.BackgroundPath)
+
line(i) = 0
line(i + 1) = 0
Me.PlayfieldSize = New Size(CInt(line(0)), CInt(line(1)))
@@ -178,13 +176,17 @@ Public Class B2SScreen
End If
Else
- Server.errorlog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile no B2S screen resolution file found")
+
+ debugLog.WriteLogEntry("B2SScreen.ReadB2SSettingsFromFile no B2S screen resolution file found")
MessageBox.Show("There is no B2S screen resolution file '" & B2SSettings.B2SScreenResFileName & "' in the current folder '" & IO.Directory.GetCurrentDirectory() & "'." & vbCrLf & vbCrLf &
"Please create this file with the tool 'B2S_ScreenResIdentifier.exe'.",
"B2S backglass error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+#If B2S = "DLL" Then
Stop
-
+#Else
+ End
+#End If
End If
End Sub
Private Function GetBackgroundPath(BackgroundPath As String, ByVal TableFileName As String, ByVal GameName As String) As String
@@ -366,9 +368,9 @@ Public Class B2SScreen
((Me.DMDViewMode = eDMDViewMode.ShowDMD) OrElse
(Me.DMDViewMode = eDMDViewMode.ShowDMDOnlyAtDefaultLocation AndAlso Me.DMDAtDefaultLocation) OrElse
(Me.DMDViewMode = eDMDViewMode.DoNotShowDMDAtDefaultLocation AndAlso Not Me.DMDAtDefaultLocation)))
-
+#If B2S = "DLL" Then
On Error Resume Next
-
+#End If
' get the correct screen
Me.BackglassScreen = ScreensOrdered(0)
Dim s As Screen
@@ -510,10 +512,14 @@ Public Class B2SScreen
formBackglass.Show(Me.formbackground)
Else
' Without background picture the backglass is the main form
- formBackglass.Text = "B2S Backglass Server"
- formBackglass.Show()
+ formBackglass.Text = "B2S Backglass Server"
+ formBackglass.Show()
End If
-
+#If B2S = "DLL" Then
+ ' bring backglass screen to the front
+ If B2SSettings.FormToFront Then formBackglass.TopMost = True
+ formBackglass.BringToFront()
+#End If
' maybe show DMD form
If IsDMDToBeShown Then
' set DMD location relative to the backglass location
@@ -523,7 +529,11 @@ Public Class B2SScreen
Me.formDMD.ControlBox = False
Me.formDMD.MaximizeBox = False
Me.formDMD.MinimizeBox = False
+#If B2S = "DLL" Then
Me.formDMD.Location = formBackglass.Location + Me.DMDLocation
+#Else
+ Me.formDMD.Location = Me.BackglassScreen.Bounds.Location + DMDKeepBackglassLocation + Me.DMDLocation
+#End If
Me.formDMD.Size = Me.DMDSize
Me.formDMD.Text = "B2S DMD"
@@ -538,7 +548,7 @@ Public Class B2SScreen
Me.formDMD.Show(formBackglass)
Else
' DMD and Back Glass separate and accessed separately
- Me.formDMD.Show()
+ Me.formDMD.Show()
End If
ElseIf B2SSettings.FormToBack Then
' DMD and Back Glass one unit, make sure they are together and also make sure it is impossible to activate
@@ -547,7 +557,7 @@ Public Class B2SScreen
Me.formDMD.Show(formBackglass)
Else
' show the DMD form without grill
- Me.formDMD.BringToFront()
+ Me.formDMD.BringToFront()
Me.formDMD.Show()
End If
End If
diff --git a/b2sbackglassserver/b2sbackglassserver/Classes/B2SSettings.vb b/b2sbackglassserver/b2sbackglassserver/Classes/B2SSettings.vb
index 7415a61..db5ff13 100644
--- a/b2sbackglassserver/b2sbackglassserver/Classes/B2SSettings.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Classes/B2SSettings.vb
@@ -59,7 +59,9 @@ Public Class B2SSettings
End Get
Set(ByVal value As Boolean)
_IsLampsStateLogOn = value
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
End Set
End Property
Private Shared Property _IsSolenoidsStateLogOn() As Boolean = False
@@ -69,7 +71,10 @@ Public Class B2SSettings
End Get
Set(ByVal value As Boolean)
_IsSolenoidsStateLogOn = value
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
+
End Set
End Property
Private Shared Property _IsGIStringsStateLogOn() As Boolean = False
@@ -79,7 +84,10 @@ Public Class B2SSettings
End Get
Set(ByVal value As Boolean)
_IsGIStringsStateLogOn = value
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
+
End Set
End Property
Private Shared Property _IsLEDsStateLogOn() As Boolean = False
@@ -89,7 +97,10 @@ Public Class B2SSettings
End Get
Set(ByVal value As Boolean)
_IsLEDsStateLogOn = value
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
+
End Set
End Property
Public Shared Property IsPaintingLogOn() As Boolean = True
@@ -101,9 +112,9 @@ Public Class B2SSettings
Public Shared Property ArePluginsOn() As Boolean = False
Public Shared Property CPUAffinityMask() As Integer = 0
-
+#If B2S = "DLL" Then
Public Shared Property PluginHost() As PluginHost = Nothing
-
+#End If
Public Shared Property ScreenshotPath() As String = String.Empty
Public Shared Property ScreenshotFileType() As eImageFileType = eImageFileType.PNG
@@ -117,7 +128,10 @@ Public Class B2SSettings
End Get
Set(ByVal value As Boolean)
_AllOff = value
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
+
End Set
End Property
Private Shared Property _LampsOff() As Boolean = False
@@ -127,7 +141,10 @@ Public Class B2SSettings
End Get
Set(ByVal value As Boolean)
_LampsOff = value
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
+
End Set
End Property
Private Shared Property _SolenoidsOff() As Boolean = False
@@ -137,7 +154,10 @@ Public Class B2SSettings
End Get
Set(ByVal value As Boolean)
_SolenoidsOff = value
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
+
End Set
End Property
Private Shared Property _GIStringsOff() As Boolean = False
@@ -147,7 +167,10 @@ Public Class B2SSettings
End Get
Set(ByVal value As Boolean)
_GIStringsOff = value
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
+
End Set
End Property
Public Shared Property LEDsOff() As Boolean = False
@@ -171,6 +194,7 @@ Public Class B2SSettings
Public Shared Property FormToBack() As Boolean = False
Public Shared Property FormNoFocus() As Boolean = False
Public Shared Property HideGrill() As System.Windows.Forms.CheckState = Windows.Forms.CheckState.Indeterminate
+ Public Shared Property HideB2SBackglass() As Boolean = False
Public Shared Property HideB2SDMD() As Boolean = False
Public Shared Property HideDMD() As System.Windows.Forms.CheckState = Windows.Forms.CheckState.Indeterminate
@@ -233,8 +257,13 @@ Public Class B2SSettings
Public Shared Function GetSettingFilename() As String
If IO.File.Exists(filename) Then
Return filename
+#If B2S = "DLL" Then
ElseIf StartAsEXE And B2STableSettingsExtendedPath And IO.File.Exists(IO.Path.Combine(Application.StartupPath(), filename)) Then
Return IO.Path.Combine(Application.StartupPath(), filename)
+#Else
+ ElseIf B2STableSettingsExtendedPath And IO.File.Exists(IO.Path.Combine(Application.StartupPath(), filename)) Then
+ Return IO.Path.Combine(Application.StartupPath(), filename)
+#End If
ElseIf B2STableSettingsExtendedPath And IO.File.Exists(IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), filename)) Then
Return IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), filename)
End If
@@ -289,74 +318,80 @@ Public Class B2SSettings
If XML IsNot Nothing AndAlso XML.SelectSingleNode("B2STableSettings") IsNot Nothing Then
Dim nodeHeader As Xml.XmlNode = XML.SelectSingleNode("B2STableSettings")
+#If B2S = "DLL" Then
If justLoadPluginSetting Then
' get plugin status
If nodeHeader.SelectSingleNode("ArePluginsOn") IsNot Nothing Then ArePluginsOn = (nodeHeader.SelectSingleNode("ArePluginsOn").InnerText = "1")
Else
- ' get default start mode
- If nodeHeader.SelectSingleNode("DefaultStartMode") IsNot Nothing Then DefaultStartMode = CInt(nodeHeader.SelectSingleNode("DefaultStartMode").InnerText)
- If DefaultStartMode <> eDefaultStartMode.Standard Then DefaultStartMode = eDefaultStartMode.EXE
- If DefaultStartMode = eDefaultStartMode.Standard Then StartAsEXE = False
- If nodeHeader.SelectSingleNode("DisableFuzzyMatching") IsNot Nothing Then DisableFuzzyMatching = (nodeHeader.SelectSingleNode("DisableFuzzyMatching").InnerText = "1")
-
- ' get overall settings
- If nodeHeader.SelectSingleNode("CPUAffinityMask") IsNot Nothing Then CPUAffinityMask = CInt(nodeHeader.SelectSingleNode("CPUAffinityMask").InnerText)
- If nodeHeader.SelectSingleNode("LogPath") IsNot Nothing Then LogPath = nodeHeader.SelectSingleNode("LogPath").InnerText
- If nodeHeader.SelectSingleNode("IsLampsStateLogOn") IsNot Nothing Then IsLampsStateLogOn = (nodeHeader.SelectSingleNode("IsLampsStateLogOn").InnerText = "1")
- If nodeHeader.SelectSingleNode("IsSolenoidsStateLogOn") IsNot Nothing Then IsSolenoidsStateLogOn = (nodeHeader.SelectSingleNode("IsSolenoidsStateLogOn").InnerText = "1")
- If nodeHeader.SelectSingleNode("IsGIStringsStateLogOn") IsNot Nothing Then IsGIStringsStateLogOn = (nodeHeader.SelectSingleNode("IsGIStringsStateLogOn").InnerText = "1")
- If nodeHeader.SelectSingleNode("IsLEDsStateLogOn") IsNot Nothing Then IsLEDsStateLogOn = (nodeHeader.SelectSingleNode("IsLEDsStateLogOn").InnerText = "1")
- If nodeHeader.SelectSingleNode("IsPaintingLogOn") IsNot Nothing Then IsPaintingLogOn = (nodeHeader.SelectSingleNode("IsPaintingLogOn").InnerText = "1")
- If nodeHeader.SelectSingleNode("IsStatisticsBackglassOn") IsNot Nothing Then IsStatisticsBackglassOn = (nodeHeader.SelectSingleNode("IsStatisticsBackglassOn").InnerText = "1")
- If nodeHeader.SelectSingleNode("IsBackglassSearchLogOn") IsNot Nothing Then IsBackglassSearchLogOn = (nodeHeader.SelectSingleNode("IsBackglassSearchLogOn").InnerText = "1")
- If nodeHeader.SelectSingleNode("ShowStartupError") IsNot Nothing Then ShowStartupError = (nodeHeader.SelectSingleNode("ShowStartupError").InnerText = "1")
- LoadGlobalAndTableSettings(nodeHeader)
- If StartBackground.HasValue Then GlobalStartBackground = StartBackground
- StartBackground = Nothing
-
- If nodeHeader.SelectSingleNode("ScreenshotPath") IsNot Nothing Then
- ScreenshotPath = nodeHeader.SelectSingleNode("ScreenshotPath").InnerText
- ScreenshotFileType = CInt(nodeHeader.SelectSingleNode("ScreenshotFileType").InnerText)
- End If
- If nodeHeader.SelectSingleNode("HyperpinXMLFile") IsNot Nothing Then
- HyperpinXMLFile = nodeHeader.SelectSingleNode("HyperpinXMLFile").InnerText
- End If
- If resetLogs AndAlso (IsLampsStateLogOn OrElse IsSolenoidsStateLogOn OrElse IsGIStringsStateLogOn OrElse IsLEDsStateLogOn OrElse IsPaintingLogOn) Then
- AddNode(XML, nodeHeader, "IsLampsStateLogOn", "0")
- AddNode(XML, nodeHeader, "IsSolenoidsStateLogOn", "0")
- AddNode(XML, nodeHeader, "IsGIStringsStateLogOn", "0")
- AddNode(XML, nodeHeader, "IsLEDsStateLogOn", "0")
- AddNode(XML, nodeHeader, "IsPaintingLogOn", "0")
- XML.Save(SettingFilePath)
- End If
- ' set default dual mode
- 'If B2SData.DualBackglass Then
- CurrentDualMode = eDualMode.Authentic
- 'End If
- ' maybe get table specific settings
- If Not String.IsNullOrEmpty(GameName) OrElse Not String.IsNullOrEmpty(B2SName) Then
- Dim nodeTable As Xml.XmlElement = nodeHeader.SelectSingleNode(If(Not String.IsNullOrEmpty(GameName), GameName, B2SName))
- If nodeTable IsNot Nothing Then
- _IsGameNameFound = True
- LoadGlobalAndTableSettings(nodeTable)
- If nodeTable.SelectSingleNode("DualMode") IsNot Nothing Then CurrentDualMode = CInt(nodeTable.SelectSingleNode("DualMode").InnerText)
- If nodeTable.SelectSingleNode("MatchingFileName") IsNot Nothing Then MatchingFileName = nodeTable.SelectSingleNode("MatchingFileName").InnerText
-
- Dim nodeAnimations As Xml.XmlElement = nodeTable.SelectSingleNode("Animations")
- If nodeAnimations IsNot Nothing Then
- For Each nodeAnimation As Xml.XmlElement In nodeAnimations.ChildNodes
- If nodeAnimation.Name.Equals("Animation") Then
- AnimationSlowDowns.Add(nodeAnimation.Attributes("Name").InnerText, CInt(nodeAnimation.Attributes("SlowDown").InnerText))
- ElseIf nodeAnimation.Name.Equals("AllAnimations") Then
- AllAnimationSlowDown = CInt(nodeAnimation.Attributes("SlowDown").InnerText)
- End If
- Next
- End If
+#Else
+ If nodeHeader.SelectSingleNode("ArePluginsOn") IsNot Nothing Then ArePluginsOn = (nodeHeader.SelectSingleNode("ArePluginsOn").InnerText = "1")
+#End If
+ ' get default start mode
+ If nodeHeader.SelectSingleNode("DefaultStartMode") IsNot Nothing Then DefaultStartMode = CInt(nodeHeader.SelectSingleNode("DefaultStartMode").InnerText)
+ If DefaultStartMode <> eDefaultStartMode.Standard Then DefaultStartMode = eDefaultStartMode.EXE
+ If DefaultStartMode = eDefaultStartMode.Standard Then StartAsEXE = False
+ If nodeHeader.SelectSingleNode("DisableFuzzyMatching") IsNot Nothing Then DisableFuzzyMatching = (nodeHeader.SelectSingleNode("DisableFuzzyMatching").InnerText = "1")
+
+ ' get overall settings
+ If nodeHeader.SelectSingleNode("CPUAffinityMask") IsNot Nothing Then CPUAffinityMask = CInt(nodeHeader.SelectSingleNode("CPUAffinityMask").InnerText)
+ If nodeHeader.SelectSingleNode("LogPath") IsNot Nothing Then LogPath = nodeHeader.SelectSingleNode("LogPath").InnerText
+ If nodeHeader.SelectSingleNode("IsLampsStateLogOn") IsNot Nothing Then IsLampsStateLogOn = (nodeHeader.SelectSingleNode("IsLampsStateLogOn").InnerText = "1")
+ If nodeHeader.SelectSingleNode("IsSolenoidsStateLogOn") IsNot Nothing Then IsSolenoidsStateLogOn = (nodeHeader.SelectSingleNode("IsSolenoidsStateLogOn").InnerText = "1")
+ If nodeHeader.SelectSingleNode("IsGIStringsStateLogOn") IsNot Nothing Then IsGIStringsStateLogOn = (nodeHeader.SelectSingleNode("IsGIStringsStateLogOn").InnerText = "1")
+ If nodeHeader.SelectSingleNode("IsLEDsStateLogOn") IsNot Nothing Then IsLEDsStateLogOn = (nodeHeader.SelectSingleNode("IsLEDsStateLogOn").InnerText = "1")
+ If nodeHeader.SelectSingleNode("IsPaintingLogOn") IsNot Nothing Then IsPaintingLogOn = (nodeHeader.SelectSingleNode("IsPaintingLogOn").InnerText = "1")
+ If nodeHeader.SelectSingleNode("IsStatisticsBackglassOn") IsNot Nothing Then IsStatisticsBackglassOn = (nodeHeader.SelectSingleNode("IsStatisticsBackglassOn").InnerText = "1")
+ If nodeHeader.SelectSingleNode("IsBackglassSearchLogOn") IsNot Nothing Then IsBackglassSearchLogOn = (nodeHeader.SelectSingleNode("IsBackglassSearchLogOn").InnerText = "1")
+ If nodeHeader.SelectSingleNode("ShowStartupError") IsNot Nothing Then ShowStartupError = (nodeHeader.SelectSingleNode("ShowStartupError").InnerText = "1")
+ LoadGlobalAndTableSettings(nodeHeader)
+ If StartBackground.HasValue Then GlobalStartBackground = StartBackground
+ StartBackground = Nothing
+
+ If nodeHeader.SelectSingleNode("ScreenshotPath") IsNot Nothing Then
+ ScreenshotPath = nodeHeader.SelectSingleNode("ScreenshotPath").InnerText
+ ScreenshotFileType = CInt(nodeHeader.SelectSingleNode("ScreenshotFileType").InnerText)
+ End If
+ If nodeHeader.SelectSingleNode("HyperpinXMLFile") IsNot Nothing Then
+ HyperpinXMLFile = nodeHeader.SelectSingleNode("HyperpinXMLFile").InnerText
+ End If
+ If resetLogs AndAlso (IsLampsStateLogOn OrElse IsSolenoidsStateLogOn OrElse IsGIStringsStateLogOn OrElse IsLEDsStateLogOn OrElse IsPaintingLogOn) Then
+ AddNode(XML, nodeHeader, "IsLampsStateLogOn", "0")
+ AddNode(XML, nodeHeader, "IsSolenoidsStateLogOn", "0")
+ AddNode(XML, nodeHeader, "IsGIStringsStateLogOn", "0")
+ AddNode(XML, nodeHeader, "IsLEDsStateLogOn", "0")
+ AddNode(XML, nodeHeader, "IsPaintingLogOn", "0")
+ XML.Save(SettingFilePath)
+ End If
+ ' set default dual mode
+ 'If B2SData.DualBackglass Then
+ CurrentDualMode = eDualMode.Authentic
+ 'End If
+ ' maybe get table specific settings
+ If Not String.IsNullOrEmpty(GameName) OrElse Not String.IsNullOrEmpty(B2SName) Then
+ Dim nodeTable As Xml.XmlElement = nodeHeader.SelectSingleNode(If(Not String.IsNullOrEmpty(GameName), GameName, B2SName))
+ If nodeTable IsNot Nothing Then
+ _IsGameNameFound = True
+ LoadGlobalAndTableSettings(nodeTable)
+ If nodeTable.SelectSingleNode("DualMode") IsNot Nothing Then CurrentDualMode = CInt(nodeTable.SelectSingleNode("DualMode").InnerText)
+ If nodeTable.SelectSingleNode("MatchingFileName") IsNot Nothing Then MatchingFileName = nodeTable.SelectSingleNode("MatchingFileName").InnerText
+
+ Dim nodeAnimations As Xml.XmlElement = nodeTable.SelectSingleNode("Animations")
+ If nodeAnimations IsNot Nothing Then
+ For Each nodeAnimation As Xml.XmlElement In nodeAnimations.ChildNodes
+ If nodeAnimation.Name.Equals("Animation") Then
+ AnimationSlowDowns.Add(nodeAnimation.Attributes("Name").InnerText, CInt(nodeAnimation.Attributes("SlowDown").InnerText))
+ ElseIf nodeAnimation.Name.Equals("AllAnimations") Then
+ AllAnimationSlowDown = CInt(nodeAnimation.Attributes("SlowDown").InnerText)
+ End If
+ Next
End If
End If
End If
End If
End If
+#If B2S = "DLL" Then
+ End If
+#End If
End Sub
Public Shared Sub Save(Optional ByVal b2sanimation As B2SAnimation = Nothing,
Optional ByVal justSaveSnifferCheck As Boolean = False,
@@ -366,9 +401,13 @@ Public Class B2SSettings
Dim XML As Xml.XmlDocument = New Xml.XmlDocument
If IO.File.Exists(SettingFilePath) Then XML.Load(SettingFilePath)
Dim nodeHeader As Xml.XmlElement = AddHeader(XML, XML, "B2STableSettings")
+#If B2S = "DLL" Then
If justSaveSnifferCheck Then
AddNode(XML, nodeHeader, "IsStatisticsBackglassOn", If(IsStatisticsBackglassOn, "1", "0"))
ElseIf justSaveDualMode Then
+#Else
+ If justSaveDualMode Then
+#End If
If B2SData.DualBackglass AndAlso (Not String.IsNullOrEmpty(GameName) OrElse Not String.IsNullOrEmpty(B2SName)) Then
Dim nodeTable As Xml.XmlElement = AddHeader(XML, nodeHeader, If(Not String.IsNullOrEmpty(GameName), GameName, B2SName))
AddNode(XML, nodeTable, "DualMode", CInt(CurrentDualMode).ToString())
@@ -540,7 +579,12 @@ Public Class B2SSettings
' not found
HyperpinXMLFile = "Unknown"
End If
+#If B2S = "DLL" Then
Save(, , , True)
+#Else
+ Save(, , True)
+#End If
+
End If
Return (HyperpinXMLFile <> "Unknown")
End Function
diff --git a/b2sbackglassserver/b2sbackglassserver/Classes/B2SStatistics.vb b/b2sbackglassserver/b2sbackglassserver/Classes/B2SStatistics.vb
index 86c944a..bcf5ee9 100644
--- a/b2sbackglassserver/b2sbackglassserver/Classes/B2SStatistics.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Classes/B2SStatistics.vb
@@ -9,7 +9,9 @@ Public Class B2SStatistics
End Get
Set(ByVal value As Boolean)
_LogStatistics = value
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
End Set
End Property
diff --git a/b2sbackglassserver/b2sbackglassserver/Classes/Processes.vb b/b2sbackglassserver/b2sbackglassserver/Classes/Processes.vb
index c351796..7dd0638 100644
--- a/b2sbackglassserver/b2sbackglassserver/Classes/Processes.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Classes/Processes.vb
@@ -70,7 +70,7 @@ Public Class Processes
End If
Next
End Sub
-
+#If B2S = "DLL" Then
Public Sub KillProcess(ByVal processname As String)
Dim proc As Process() = Process.GetProcesses
@@ -82,7 +82,7 @@ Public Class Processes
Next
End Sub
-
+#End If
Public ReadOnly Property TableName() As String
Get
Return _tablename
diff --git a/b2sbackglassserver/b2sbackglassserver/Controls/B2SLEDBox.vb b/b2sbackglassserver/b2sbackglassserver/Controls/B2SLEDBox.vb
index 1d66edc..2170d91 100644
--- a/b2sbackglassserver/b2sbackglassserver/Controls/B2SLEDBox.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Controls/B2SLEDBox.vb
@@ -79,7 +79,6 @@ Public Class B2SLEDBox
' show control
Me.Visible = True
- Me.BringToFront()
End Sub
diff --git a/b2sbackglassserver/b2sbackglassserver/Controls/B2SPictureBox.vb b/b2sbackglassserver/b2sbackglassserver/Controls/B2SPictureBox.vb
index cfe762d..09efd9b 100644
--- a/b2sbackglassserver/b2sbackglassserver/Controls/B2SPictureBox.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Controls/B2SPictureBox.vb
@@ -51,7 +51,6 @@ Public Class B2SPictureBox
' do not show the control
MyBase.Visible = False
- Me.BringToFront()
End Sub
Public Property PictureBoxType() As ePictureBoxType = ePictureBoxType.StandardImage
diff --git a/b2sbackglassserver/b2sbackglassserver/Controls/B2SReelBox.vb b/b2sbackglassserver/b2sbackglassserver/Controls/B2SReelBox.vb
index 8940ed6..ad0bc2d 100644
--- a/b2sbackglassserver/b2sbackglassserver/Controls/B2SReelBox.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Controls/B2SReelBox.vb
@@ -89,7 +89,6 @@ Public Class B2SReelBox
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
'Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.DoubleBuffered = True
- Me.BringToFront()
' back color
'Me.BackColor = Color.Transparent
diff --git a/b2sbackglassserver/b2sbackglassserver/Forms/formBackglass.vb b/b2sbackglassserver/b2sbackglassserver/Forms/formBackglass.vb
index a829733..f74acce 100644
--- a/b2sbackglassserver/b2sbackglassserver/Forms/formBackglass.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Forms/formBackglass.vb
@@ -51,8 +51,10 @@ Public Class formBackglass
MyBase.WndProc(m)
End Sub
#End Region 'Properties
+
#Region "constructor and closing"
+#If B2S = "DLL" Then
Public Sub New()
InitializeComponent()
@@ -166,16 +168,16 @@ Public Class formBackglass
snifferTimer.Start()
End Sub
+#Else
+ Public Sub New()
- Public Sub New(tableName As String, TopMost As Boolean)
- ' This is the constructor for the server when run from the wrapper
InitializeComponent()
' set some styles
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer, True)
Me.DoubleBuffered = True
- ' set key preview to allow some key action
+ ' set key peview to allow some key action
Me.KeyPreview = True
' mabye create the base registry key
@@ -190,13 +192,24 @@ Public Class formBackglass
'B2SData.TableFileName = "Close_Encounters_FS"
'B2SData.TableFileName = "Pinbot.uw.V1.02.1_JF_91x_BMPR_MOD_FS"
'B2SData.TableFileName = "ScaredStiff_FS_B2S"
+ If My.Application.CommandLineArgs.Count > 0 Then
+ B2SData.TableFileName = My.Application.CommandLineArgs(0).ToString
+
+ If B2SData.TableFileName.EndsWith(".directb2s") Then
+ B2SData.TableFileName = Path.GetFileNameWithoutExtension(B2SData.TableFileName)
+ B2SSettings.PureEXE = True
+ End If
- If tableName.EndsWith(".directb2s") Then
- tableName = System.IO.Path.GetFileNameWithoutExtension(tableName)
- B2SSettings.PureEXE = True
+ If My.Application.CommandLineArgs.Count > 1 Then
+ If My.Application.CommandLineArgs(1).ToString = "1" Then
+ Me.TopMost = True
+ End If
+ End If
+ Else
+ MessageBox.Show("Please do not start the EXE this way.", My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Error)
+ End
End If
- B2SData.TableFileName = tableName
- Me.TopMost = TopMost
+
' get the game name
'B2SSettings.GameName = "bguns_l8"
@@ -234,7 +247,7 @@ Public Class formBackglass
If B2SSettings.ShowStartupError Then
MessageBox.Show(ex.Message, My.Resources.AppTitle, Windows.Forms.MessageBoxButtons.OK, Windows.Forms.MessageBoxIcon.Error)
End If
- Stop
+ End
End Try
' initialize screen settings
@@ -271,6 +284,7 @@ Public Class formBackglass
End Sub
+#End If
Private Sub formBackglass_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
If Not B2SSettings.FormToFront Then
@@ -385,7 +399,7 @@ Public Class formBackglass
B2SStatistics.ClearAll()
End Sub
-
+#If B2S = "DLL" Then
Private Sub formBackglass_Disposed(sender As Object, e As System.EventArgs) Handles Me.Disposed
On Error Resume Next
@@ -401,76 +415,77 @@ Public Class formBackglass
'If rotateTimer IsNot Nothing Then RemoveHandler rotateTimer.Tick, AddressOf RotateTimer_Tick
End Sub
-
+#End If
#End Region
-
#Region "painting"
Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
+ 'If B2sSettings.HideBackglass Then hide this form
+ If B2SSettings.HideB2SBackglass Then
+ Me.Hide()
+ Return
+ End If
- If Not B2SStatistics.LogStatistics Then
+ If B2SStatistics.LogStatistics Then
+ ' invalidate the statistics controls
+ DrawSniffer()
- ' some rendering hints
- e.Graphics.PageUnit = GraphicsUnit.Pixel
- e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
+ Return
+ End If
- ' draw background and illumination images
- If Me.BackgroundImage IsNot Nothing Then
+ ' some rendering hints
+ e.Graphics.PageUnit = GraphicsUnit.Pixel
+ e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
- On Error Resume Next
+ ' draw background and illumination images
+ If Me.BackgroundImage IsNot Nothing Then
- ' generate new clipping region
- Dim clip As Region = New Region(e.ClipRectangle)
- For Each ledarea As KeyValuePair(Of String, B2SData.LEDAreaInfo) In B2SData.LEDAreas
- If Not ledarea.Value.IsOnDMD Then
- clip.Exclude(ledarea.Value.Rect)
- End If
- Next
- e.Graphics.SetClip(clip, Drawing2D.CombineMode.Replace)
+ On Error Resume Next
- ' draw background image
- e.Graphics.DrawImage(Me.BackgroundImage, 0, 0)
+ ' generate new clipping region
+ Dim clip As Region = New Region(e.ClipRectangle)
+ For Each ledarea As KeyValuePair(Of String, B2SData.LEDAreaInfo) In B2SData.LEDAreas
+ If Not ledarea.Value.IsOnDMD Then
+ clip.Exclude(ledarea.Value.Rect)
+ End If
+ Next
+ e.Graphics.SetClip(clip, Drawing2D.CombineMode.Replace)
- ' draw all visible and necessary images
- If B2SData.Illuminations.Count > 0 Then
+ ' draw background image
+ e.Graphics.DrawImage(Me.BackgroundImage, 0, 0)
- If Not B2SData.UseZOrder Then
+ ' draw all visible and necessary images
+ If B2SData.Illuminations.Count > 0 Then
- ' draw all standard images
- For Each illu As KeyValuePair(Of String, B2SPictureBox) In B2SData.Illuminations
- DrawImage(e, illu.Value)
- Next
+ If Not B2SData.UseZOrder Then
- Else
+ ' draw all standard images
+ For Each illu As KeyValuePair(Of String, B2SPictureBox) In B2SData.Illuminations
+ DrawImage(e, illu.Value)
+ Next
- ' first of all draw all standard images
- For Each illu As KeyValuePair(Of String, B2SPictureBox) In B2SData.Illuminations
- If illu.Value.ZOrder = 0 Then DrawImage(e, illu.Value)
- Next
- ' now draw zorderd images
- For Each illus As KeyValuePair(Of Integer, B2SPictureBox()) In B2SData.ZOrderImages
- 'For Each illu As B2SPictureBox In illus.Value
- ' DrawImage(e, illu)
- 'Next
- For i As Integer = 0 To illus.Value.Length - 1
- DrawImage(e, illus.Value(i))
- Next
- Next
+ Else
- End If
+ ' first of all draw all standard images
+ For Each illu As KeyValuePair(Of String, B2SPictureBox) In B2SData.Illuminations
+ If illu.Value.ZOrder = 0 Then DrawImage(e, illu.Value)
+ Next
+ ' now draw zorderd images
+ For Each illus As KeyValuePair(Of Integer, B2SPictureBox()) In B2SData.ZOrderImages
+ 'For Each illu As B2SPictureBox In illus.Value
+ ' DrawImage(e, illu)
+ 'Next
+ For i As Integer = 0 To illus.Value.Length - 1
+ DrawImage(e, illus.Value(i))
+ Next
+ Next
End If
End If
- Else
-
- ' invalidate the statistics controls
- DrawSniffer()
-
End If
-
End Sub
Protected Overrides Sub OnPaintBackground(e As System.Windows.Forms.PaintEventArgs)
@@ -514,7 +529,7 @@ Public Class formBackglass
e.Graphics.DrawImage(picbox.BackgroundImage, picbox.RectangleF.Location)
End If
Else
- e.Graphics.DrawImage(picbox.BackgroundImage, picbox.RectangleF.Location.X, picbox.RectangleF.Location.Y)
+ e.Graphics.DrawImage(picbox.BackgroundImage, picbox.RectangleF.Location)
End If
End If
@@ -532,9 +547,8 @@ Public Class formBackglass
#End Region
-
#Region "some timer events"
- Private Sub Timer_Tick()
+ Private Sub Timer_Tick(ByVal sender As Object, ByVal e As EventArgs)
timer.Stop()
@@ -555,7 +569,7 @@ Public Class formBackglass
End Sub
- Private Sub TableTimer_Tick()
+ Private Sub TableTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
If tableHandle <> 0 AndAlso Not IsWindow(tableHandle) Then
' get out here
@@ -565,7 +579,8 @@ Public Class formBackglass
End If
End Sub
-
+#If B2S = "DLL" Then
+#Else
Private Sub B2STimer_Tick()
' poll registry data
@@ -575,19 +590,7 @@ Public Class formBackglass
ShowStartupImages()
End Sub
-
- Private Sub StartupTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
-
- startupTimer.Stop()
-
- ' maybe show some 'startup on' images
- ShowStartupImages()
-
- ' start autostarted animations
- B2SAnimation.AutoStart()
-
- End Sub
-
+#End If
Private Sub RotateTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
Static currentAngleS As Single = 0
@@ -640,6 +643,19 @@ Public Class formBackglass
End Sub
+
+ Private Sub StartupTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
+
+ startupTimer.Stop()
+
+ ' maybe show some 'startup on' images
+ ShowStartupImages()
+
+ ' start autostarted animations
+ B2SAnimation.AutoStart()
+
+ End Sub
+
Private Sub SnifferTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
If B2SStatistics.LogStatistics Then
@@ -651,7 +667,8 @@ Public Class formBackglass
#End Region
#Region "polling action B2SBackglassServerEXE"
-
+#If B2S = "DLL" Then
+#Else
Private isVisibleStateSet As Boolean = False
Private lastTopVisible As Boolean = False
Private lastSecondVisible As Boolean = False
@@ -1637,9 +1654,9 @@ Public Class formBackglass
End Function
+#End If
#End Region
-
#Region "settings action"
Public Sub formBackglass_MouseClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
@@ -1652,90 +1669,100 @@ Public Class formBackglass
Private Sub formBackglass_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
- If Not B2SStatistics.LogStatistics Then
+ If B2SStatistics.LogStatistics Then Return
+
- If e.KeyCode = Keys.S Then
+ If e.KeyCode = Keys.S Then
- If formSettings IsNot Nothing Then
+ If formSettings IsNot Nothing Then
+ Try
+ formSettings.Dispose()
+ formSettings = Nothing
+ Catch
+ End Try
+ End If
+ formSettings = New formSettings()
+ formSettings.B2SScreen = B2SScreen
+ formSettings.B2SAnimation = B2SAnimation
+ formSettings.formBackglass = Me
+ formSettings.Show(Me)
+
+ ElseIf e.KeyCode = Keys.D1 Then
+ StartAnimation("Ball1")
+ ElseIf e.KeyCode = Keys.D2 Then
+ StartAnimation("Ball2")
+ ElseIf e.KeyCode = Keys.D3 Then
+ StartAnimation("Ball3")
+ ElseIf e.KeyCode = Keys.D4 Then
+ StartAnimation("Ball4")
+ ElseIf e.KeyCode = Keys.D5 Then
+ StartAnimation("Ball5")
+
+ ElseIf e.KeyCode = Keys.M OrElse e.KeyCode = Keys.A OrElse e.KeyCode = Keys.F Then
+
+ If B2SData.DualBackglass Then
+ If e.KeyCode = Keys.M Then
+ B2SSettings.CurrentDualMode = If(B2SSettings.CurrentDualMode = B2SSettings.eDualMode.Fantasy, B2SSettings.eDualMode.Authentic, B2SSettings.eDualMode.Fantasy)
+ ElseIf e.KeyCode = Keys.A Then
+ B2SSettings.CurrentDualMode = B2SSettings.eDualMode.Authentic
+ ElseIf e.KeyCode = Keys.F Then
+ B2SSettings.CurrentDualMode = B2SSettings.eDualMode.Fantasy
+ End If
+#If B2S = "DLL" Then
+ B2SSettings.Save(, , True)
+#Else
+ B2SSettings.Save(, True)
+#End If
+ Me.BackgroundImage = DarkImage
+ Me.Refresh()
+ ShowStartupImages()
+ B2SAnimation.RestartAnimations()
+ If formMode IsNot Nothing Then
Try
- formSettings.Dispose()
- formSettings = Nothing
+ formMode.Dispose()
+ formMode = Nothing
Catch
End Try
End If
- formSettings = New formSettings()
- formSettings.B2SScreen = B2SScreen
- formSettings.B2SAnimation = B2SAnimation
- formSettings.formBackglass = Me
- formSettings.Show(Me)
-
- ElseIf e.KeyCode = Keys.D1 Then
- StartAnimation("Ball1")
- ElseIf e.KeyCode = Keys.D2 Then
- StartAnimation("Ball2")
- ElseIf e.KeyCode = Keys.D3 Then
- StartAnimation("Ball3")
- ElseIf e.KeyCode = Keys.D4 Then
- StartAnimation("Ball4")
- ElseIf e.KeyCode = Keys.D5 Then
- StartAnimation("Ball5")
-
- ElseIf e.KeyCode = Keys.M OrElse e.KeyCode = Keys.A OrElse e.KeyCode = Keys.F Then
-
- If B2SData.DualBackglass Then
- If e.KeyCode = Keys.M Then
- B2SSettings.CurrentDualMode = If(B2SSettings.CurrentDualMode = B2SSettings.eDualMode.Fantasy, B2SSettings.eDualMode.Authentic, B2SSettings.eDualMode.Fantasy)
- ElseIf e.KeyCode = Keys.A Then
- B2SSettings.CurrentDualMode = B2SSettings.eDualMode.Authentic
- ElseIf e.KeyCode = Keys.F Then
- B2SSettings.CurrentDualMode = B2SSettings.eDualMode.Fantasy
- End If
- B2SSettings.Save(, , True)
- Me.BackgroundImage = DarkImage
- Me.Refresh()
- ShowStartupImages()
- B2SAnimation.RestartAnimations()
- If formMode IsNot Nothing Then
- Try
- formMode.Dispose()
- formMode = Nothing
- Catch
- End Try
- End If
- formMode = New formMode()
- formMode.Show(Me)
- Me.Focus()
- End If
-
- ElseIf e.KeyCode = Keys.I OrElse e.KeyCode = Keys.Print OrElse e.KeyCode = Keys.PrintScreen Then
+ formMode = New formMode()
+ formMode.Show(Me)
+ Me.Focus()
+ End If
- ' do a screenshot and save it
- If String.IsNullOrEmpty(B2SSettings.ScreenshotPath) Then
- MessageBox.Show("Please enter a valid screenshot path here at the settings.", My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
- Else
- Dim imageformat As Imaging.ImageFormat = Imaging.ImageFormat.Png
- Dim extension As String = ".png"
- Select Case B2SSettings.ScreenshotFileType
- Case B2SSettings.eImageFileType.JPG : imageformat = Imaging.ImageFormat.Jpeg : extension = ".jpg"
- Case B2SSettings.eImageFileType.GIF : imageformat = Imaging.ImageFormat.Gif : extension = ".gif"
- Case B2SSettings.eImageFileType.BMP : imageformat = Imaging.ImageFormat.Bmp : extension = ".bmp"
- End Select
- Dim filename As String = IO.Path.Combine(B2SSettings.ScreenshotPath, IO.Path.GetFileNameWithoutExtension(B2SData.BackglassFileName) & extension)
- B2SScreen.MakeScreenShot(filename, imageformat)
- My.Computer.Audio.Play(My.Resources.camera1, AudioPlayMode.Background)
- End If
+ ElseIf e.KeyCode = Keys.I OrElse e.KeyCode = Keys.Print OrElse e.KeyCode = Keys.PrintScreen Then
+ ' do a screenshot and save it
+ If String.IsNullOrEmpty(B2SSettings.ScreenshotPath) Then
+ MessageBox.Show("Please enter a valid screenshot path here at the settings.", My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
+ Else
+ Dim imageformat As Imaging.ImageFormat = Imaging.ImageFormat.Png
+ Dim extension As String = ".png"
+ Select Case B2SSettings.ScreenshotFileType
+ Case B2SSettings.eImageFileType.JPG : imageformat = Imaging.ImageFormat.Jpeg : extension = ".jpg"
+ Case B2SSettings.eImageFileType.GIF : imageformat = Imaging.ImageFormat.Gif : extension = ".gif"
+ Case B2SSettings.eImageFileType.BMP : imageformat = Imaging.ImageFormat.Bmp : extension = ".bmp"
+ End Select
+ Dim filename As String = IO.Path.Combine(B2SSettings.ScreenshotPath, IO.Path.GetFileNameWithoutExtension(B2SData.BackglassFileName) & extension)
+ B2SScreen.MakeScreenShot(filename, imageformat)
+ My.Computer.Audio.Play(My.Resources.camera1, AudioPlayMode.Background)
End If
+#If B2S = "DLL" Then
+#Else
+ ElseIf e.KeyCode = Keys.Escape Then
+ ' stop the app
+ End
+#End If
End If
- End Sub
+ End Sub
+#If B2S = "DLL" Then
Private Sub chkSniffer_CheckedChanged(sender As System.Object, e As System.EventArgs)
B2SSettings.IsStatisticsBackglassOn = chkSniffer.Checked
B2SSettings.Save(, True)
End Sub
-
+#End If
#End Region
@@ -1952,7 +1979,7 @@ Public Class formBackglass
Try
XML.Load(B2SData.BackglassFileName)
Catch ex As Exception
- MessageBox.Show("The following error occurred opening the file '" & IO.Path.GetFileName(B2SData.BackglassFileName) & "':" & vbCrLf & vbCrLf & ex.Message, My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
+ MessageBox.Show("The following error occurred opening the file '" & Path.GetFileName(B2SData.BackglassFileName) & "':" & vbCrLf & vbCrLf & ex.Message, My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
End If
@@ -1964,7 +1991,12 @@ Public Class formBackglass
Else
B2SSettings.BackglassFileVersion = XML.SelectSingleNode("DirectB2SData").Attributes("Version").InnerText
-
+#If B2S = "DLL" Then
+ ' write backglass file version to registry
+ Using regkey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\B2S", True)
+ regkey.SetValue("B2SBackglassFileVersion", B2SSettings.BackglassFileVersion, RegistryValueKind.String)
+ End Using
+#End If
' current backglass version is not allowed to be larger than server version and to be smaller minimum B2S version
If B2SSettings.BackglassFileVersion > B2SSettings.DirectB2SVersion Then
@@ -2101,6 +2133,7 @@ Public Class formBackglass
If innerNode.Attributes("OffImage") IsNot Nothing Then
offimage = Base64ToImage(innerNode.Attributes("OffImage").InnerText)
End If
+ image = CropImageToTransparency(image, offimage, loc, size)
' create new picturebox control
Dim picbox As B2SPictureBox = New B2SPictureBox()
Dim IsOnBackglass As Boolean = (parent = "Backglass")
@@ -2421,6 +2454,11 @@ Public Class formBackglass
'B2SData.LEDAreas.Add("LEDArea" & id.ToString(), New B2SData.LEDAreaInfo(New Rectangle(loc, size), Not isOnBackglass))
' add or update player info collection
' no need to do this here since it's done at the dream7 LEDs
+ ' write reel info into registry
+ Using regkey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\B2S", True)
+ regkey.SetValue("B2SScoreDigit" & led.ID.ToString(), If(isDream7LEDs, "2", "1") & "," & CInt(led.LEDType).ToString() & "," & led.StartDigit.ToString() & "," & led.Digits, RegistryValueKind.String)
+ regkey.SetValue("B2SScoreDisplay" & id.ToString(), startdigit.ToString(), RegistryValueKind.String)
+ End Using
ElseIf isReels Then
' look for matching reel sound
soundName = String.Empty
@@ -2483,6 +2521,11 @@ Public Class formBackglass
End If
B2SData.Players(b2splayerno).Add(New B2SPlayer.ControlInfo(startdigit, digits, B2SPlayer.eControlType.ReelDisplay, B2SData.ReelDisplays(id)))
End If
+ ' write reel info into registry
+ Using regkey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\B2S", True)
+ regkey.SetValue("B2SScoreDigit" & reel.ID.ToString(), "3,0," & reel.StartDigit.ToString() & "," & reel.Digits, RegistryValueKind.String)
+ regkey.SetValue("B2SScoreDisplay" & id.ToString(), startdigit.ToString(), RegistryValueKind.String)
+ End Using
End If
renderedandreelindex += 1
@@ -2493,7 +2536,31 @@ Public Class formBackglass
dream7index = renderedandreelindex
Next
-
+#If TARGET = "" Then
+#Else
+ ' write player info into registry
+ For Each controls As KeyValuePair(Of Integer, B2SPlayer.ControlCollection) In B2SData.Players
+ Dim player As String = String.Empty
+ For Each controlinfo As B2SPlayer.ControlInfo In controls.Value
+ With controlinfo
+ Dim type As String = "0"
+ If .LEDBox IsNot Nothing Then
+ type = CInt(.LEDBox.LEDType).ToString()
+ ElseIf .LEDDisplay IsNot Nothing Then
+ type = If(.LEDDisplay.Type = SegmentNumberType.TenSegment, "2", If(.LEDDisplay.Type = SegmentNumberType.FourteenSegment, "3", "1"))
+ End If
+ player &= ";" & If(.Type = B2SPlayer.eControlType.ReelDisplay OrElse .Type = B2SPlayer.eControlType.ReelBox, "3", "1") & "," &
+ type & "," &
+ controlinfo.StartDigit & "," &
+ controlinfo.Digits
+ End With
+ Next
+ If Not String.IsNullOrEmpty(player) Then player = player.Substring(1)
+ Using regkey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\B2S", True)
+ regkey.SetValue("B2SScorePlayer" & controls.Key.ToString(), player, RegistryValueKind.String)
+ End Using
+ Next
+#End If
End If
' maybe get all reel images
@@ -2848,10 +2915,10 @@ Public Class formBackglass
Select Case idJoin.Substring(0, 1).ToUpper
Case "L"
Dim animations As B2SData.AnimationCollection = If(randomstart, B2SData.UsedRandomAnimationLampIDs, B2SData.UsedAnimationLampIDs)
- If id1 > 0 Then For i As Integer = 1 To randomquality : animations.Add(id1, New B2SData.AnimationInfo(name, False)) : Next
+ If id1 > 0 Then animations.Add(id1, New B2SData.AnimationInfo(name, False))
Case "S"
Dim animations As B2SData.AnimationCollection = If(randomstart, B2SData.UsedRandomAnimationSolenoidIDs, B2SData.UsedAnimationSolenoidIDs)
- If id1 > 0 Then For i As Integer = 1 To randomquality : animations.Add(id1, New B2SData.AnimationInfo(name, False)) : Next
+ If id1 > 0 Then animations.Add(id1, New B2SData.AnimationInfo(name, False))
Case "G"
Dim animations As B2SData.AnimationCollection = If(randomstart, B2SData.UsedRandomAnimationGIStringIDs, B2SData.UsedAnimationGIStringIDs)
If idJoin.Substring(1, 1).ToUpper = "I" Then
@@ -2890,10 +2957,23 @@ Public Class formBackglass
End If
Next
End If
+#If B2S = "DLL" Then
+ Me.TopMost = True
+ Me.BringToFront()
+ Me.TopMost = False
+#Else
+ Using regkey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\B2S", True)
+ regkey.SetValue("B2SSetSwitch", If(animationpulseswitch, 1, 0), RegistryValueKind.DWord)
+ End Using
+#End If
End If
+
' set info flags to dirty to load them
+#If B2S = "DLL" Then
B2SData.IsInfoDirty = True
+#End If
+
End If
@@ -3013,15 +3093,17 @@ Public Class formBackglass
End Sub
Private Sub ShowStartupSnippits()
-
- ' maybe show some 'startup on' snippits
- Dim topIsOn As Boolean = False
- For Each picbox As KeyValuePair(Of String, B2SPictureBox) In B2SData.Illuminations
- If picbox.Value.InitialState = 1 AndAlso picbox.Value.IsImageSnippit Then
- picbox.Value.Visible = True
- End If
- Next
-
+ Static isdone As Boolean = False
+ If Not isdone Then
+ isdone = True
+ ' maybe show some 'startup on' snippits
+ Dim topIsOn As Boolean = False
+ For Each picbox As KeyValuePair(Of String, B2SPictureBox) In B2SData.Illuminations
+ If picbox.Value.InitialState = 1 AndAlso picbox.Value.IsImageSnippit Then
+ picbox.Value.Visible = True
+ End If
+ Next
+ End If
End Sub
Private Sub ShowStartupImages()
@@ -3212,7 +3294,16 @@ Public Class formBackglass
Public Property SecondRomInverted4Fantasy() As Boolean = False
#End Region
+#Region "event handling for the created backglass controls"
+#If B2S = "DLL" Then
+ Private Sub Reels_ReelRollOver(ByVal sender As Object, ByVal e As B2SReelBox.ReelRollOverEventArgs)
+ ' nothing to do for the moment so I removed the AddHandler at the reels
+
+ End Sub
+#End If
+
+#End Region
#Region "more private methods"
@@ -3302,6 +3393,85 @@ Public Class formBackglass
End If
End If
End Sub
+ Public Function GetBoundingRectangle(image As Bitmap) As Rectangle
+ Dim rect As New Rectangle(0, 0, image.Width, image.Height)
+ Dim bmpData As Imaging.BitmapData = image.LockBits(rect, Imaging.ImageLockMode.ReadOnly, Imaging.PixelFormat.Format32bppArgb)
+
+ Dim stride As Integer = bmpData.Stride
+ Dim scan0 As IntPtr = bmpData.Scan0
+
+ Dim minX As Integer = image.Width
+ Dim minY As Integer = image.Height
+ Dim maxX As Integer = 0
+ Dim maxY As Integer = 0
+
+ Dim foundNonTransparent As Boolean = False
+
+ Dim pixels(image.Height * stride - 1) As Byte
+ System.Runtime.InteropServices.Marshal.Copy(scan0, pixels, 0, pixels.Length)
+
+ For y As Integer = 0 To image.Height - 1
+ For x As Integer = 0 To image.Width - 1
+ Dim index As Integer = (y * stride) + (x * 4) ' 4 bytes per pixel (32bpp)
+ Dim alpha As Byte = pixels(index + 3)
+
+ If alpha <> 0 Then
+ foundNonTransparent = True
+ If x < minX Then minX = x
+ If y < minY Then minY = y
+ If x > maxX Then maxX = x
+ If y > maxY Then maxY = y
+ End If
+ Next
+ Next
+
+ image.UnlockBits(bmpData)
+
+ If Not foundNonTransparent Then
+ ' No non-transparent pixels found
+ Return Rectangle.Empty
+ End If
+
+ Return New Rectangle(minX, minY, maxX - minX + 1, maxY - minY + 1)
+ End Function
+
+ Public Function CropImageToTransparency(image As Image, offimage As Image, ByRef loc As Point, ByRef size As Size) As Image
+ Dim bitmap As Bitmap = CType(image, Bitmap)
+ Dim boundingRect As Rectangle = GetBoundingRectangle(bitmap)
+
+ If boundingRect = Rectangle.Empty Then
+ ' Return an empty image or the original image as needed
+ Return image
+ End If
+
+ Dim croppedImage As New Bitmap(boundingRect.Width, boundingRect.Height)
+
+ If offimage IsNot Nothing Then
+ Dim offbitmap As Bitmap = CType(offimage, Bitmap)
+ Dim offboundingRect As Rectangle = GetBoundingRectangle(offbitmap)
+ If offboundingRect = Rectangle.Empty Then
+ ' Return an empty image or the original image as needed
+ Return image
+ End If
+ ' Crop the image
+ boundingRect = Rectangle.Union(boundingRect, offboundingRect)
+ Using g As Graphics = Graphics.FromImage(croppedImage)
+ g.DrawImage(offbitmap, New Rectangle(0, 0, boundingRect.Width, boundingRect.Height), boundingRect, GraphicsUnit.Pixel)
+ End Using
+ offimage = offbitmap
+ End If
+
+ Using g As Graphics = Graphics.FromImage(croppedImage)
+ g.DrawImage(bitmap, New Rectangle(0, 0, boundingRect.Width, boundingRect.Height), boundingRect, GraphicsUnit.Pixel)
+ End Using
+
+ ' Update loc and size based on the new dimensions
+ Dim sizeOrg As Size = size
+ size = New Size(CInt(size.Width * (boundingRect.Width / image.Width)), CInt(size.Height * (boundingRect.Height / image.Height)))
+ loc = New Point(loc.X + boundingRect.X, loc.Y + boundingRect.Y)
+
+ Return croppedImage
+ End Function
Private Function ImageToBase64(image As Image) As String
If image IsNot Nothing Then
diff --git a/b2sbackglassserver/b2sbackglassserver/Forms/formDMD.vb b/b2sbackglassserver/b2sbackglassserver/Forms/formDMD.vb
index 179c24e..11e8a41 100644
--- a/b2sbackglassserver/b2sbackglassserver/Forms/formDMD.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Forms/formDMD.vb
@@ -72,6 +72,7 @@ Public Class formDMD
Private Sub formDMD_MouseClick(sender As Object, e As MouseEventArgs) Handles MyBase.MouseClick
If e.Button = Windows.Forms.MouseButtons.Right Then
B2SScreen.formBackglass.formBackglass_MouseClick(sender, e)
+ 'formBackglass.formBackglass_MouseClick(sender, e)
End If
End Sub
diff --git a/b2sbackglassserver/b2sbackglassserver/Forms/formSettings.vb b/b2sbackglassserver/b2sbackglassserver/Forms/formSettings.vb
index 2e0764e..4b150c9 100644
--- a/b2sbackglassserver/b2sbackglassserver/Forms/formSettings.vb
+++ b/b2sbackglassserver/b2sbackglassserver/Forms/formSettings.vb
@@ -37,26 +37,36 @@ Public Class formSettings
Return Name + If(SlowDown = 1, "", " (" & If(SlowDown = 0, "Off", SlowDown.ToString & "x") & ")")
End Function
End Class
-
+#If B2S = "DLL" Then
Private Sub formSettings_Load(sender As System.Object, e As System.EventArgs) Handles Me.Load
-
+#Else
+ Private Sub formSettings_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
+#End If
formSettingsMore = New formSettingsMore(Me, formBackglass)
' load data
Dim _isdirty As Boolean = isSettingsScreenDirty
Me.Text = "Settings... [" & B2SData.TableFileName & "] " & " (" & If(Not String.IsNullOrEmpty(B2SSettings.GameName), B2SSettings.GameName, B2SSettings.B2SName) & ")" & If(IsAdmin(), " (Administrator)", "")
+
If B2SSettings.PureEXE Then btnSaveSettings.Enabled = False
' set version info
- lblCopyright.Text = String.Format(lblCopyright.Text, If(B2SData.IsBackglassStartedAsEXE, "B2S.Server.EXE", "B2S.Server.DLL"), My.Application.Info.Copyright.ToString)
+#If B2S = "DLL" Then
+ lblCopyright.Text = String.Format(lblCopyright.Text, "B2S.Server.DLL", My.Application.Info.Copyright.ToString)
Dim Assembly As Assembly = Assembly.GetExecutingAssembly()
Dim FileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.Location)
-
lblVersion.Text = String.Format("Server version {0} {1}, backglass file version {2}", FileVersionInfo.ProductVersion, If(Environment.Is64BitProcess, "x64", "x86"), B2SSettings.BackglassFileVersion)
+#Else
+ lblCopyright.Text = String.Format(lblCopyright.Text, "B2S.Server.EXE", My.Application.Info.Copyright.ToString)
+ lblVersion.Text = String.Format("Server version {0} {1}, backglass file version {2}", Application.ProductVersion, If(Environment.Is64BitProcess, "x64", "x86"), B2SSettings.BackglassFileVersion)
+#End If
+
+
+
' get more data
- formSettingsMore.btnLogPath.Text = "Log path: " & B2SSettings.LogPath
+ formSettingsMore.btnLogPath.Text = "Log path: " & B2SSettings.LogPath
formSettingsMore.chkLogLamps.Checked = B2SSettings.IsLampsStateLogOn
formSettingsMore.chkLogSolenoids.Checked = B2SSettings.IsSolenoidsStateLogOn
formSettingsMore.chkLogGIStrings.Checked = B2SSettings.IsGIStringsStateLogOn
@@ -133,9 +143,15 @@ Public Class formSettings
' plugin stuff
chkActivatePlugins.Checked = B2SSettings.ArePluginsOn
chkShowStartupError.Checked = B2SSettings.ShowStartupError
+#If B2S = "DLL" Then
If B2SSettings.ArePluginsOn AndAlso B2SSettings.PluginHost IsNot Nothing AndAlso B2SSettings.PluginHost.Plugins.Count > 0 Then
btnPluginSettings.Enabled = True
End If
+#Else
+ If B2SSettings.ArePluginsOn AndAlso Registry.CurrentUser.OpenSubKey("Software\B2S").GetValue("Plugins", 0) > 0 Then
+ btnPluginSettings.Enabled = True
+ End If
+#End If
' size panel
PanelSettings.Location = New Point((Me.Size.Width - PanelSettings.Width) / 2, (Me.Size.Height - PanelSettings.Height) / 2)
' reset dirty flag to previous state
@@ -146,8 +162,11 @@ Public Class formSettings
TimerOpacity.Start()
End Sub
-
+#If B2S = "DLL" Then
Private Sub formSettings_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
+#Else
+ Private Sub formSettings_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
+#End If
If e.KeyCode = Keys.Escape OrElse e.KeyCode = Keys.S Then
btnCloseSettings.PerformClick()
End If
@@ -183,7 +202,11 @@ Public Class formSettings
Private Sub btnSaveSettings_Click(sender As System.Object, e As System.EventArgs) Handles btnSaveSettings.Click
B2SSettings.Save(B2SAnimation)
+#If B2S = "DLL" Then
B2SSettings.Save(, , True)
+#Else
+ B2SSettings.Save(, True)
+#End If
isSettingsScreenDirty = False
If activateMsgBoxAtSaving Then
MessageBox.Show(My.Resources.MSG_ChangesNeedARestart, My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
@@ -234,7 +257,11 @@ Public Class formSettings
MessageBox.Show("The following error occurred opening the file '" & name & "':" & vbCrLf & vbCrLf & ex.Message, My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
B2SSettings.HyperpinXMLFile = name
- B2SSettings.Save(, , , True)
+#If B2S = "DLL" Then
+ B2SSettings.Save(, , , True)
+#Else
+ B2SSettings.Save(, , True)
+#End If
MessageBox.Show("Your 'Visual Pinball.xml' file could be located correctly.", My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("'Visual Pinball.xml' could not be found.", My.Resources.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
@@ -416,8 +443,10 @@ Public Class formSettings
B2SSettings.ShowStartupError = chkShowStartupError.Checked
End Sub
Private Sub btnPluginSettings_Click(sender As Object, e As EventArgs) Handles btnPluginSettings.Click
+#If B2S = "DLL" Then
B2SSettings.PluginHost.ShowPluginWindow(Me)
- If B2SSettings.StartAsEXE And B2SData.IsBackglassStartedAsEXE Then
+#End If
+ If B2SSettings.StartAsEXE Then
Using regkey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\B2S", True)
With Me 'B2SScreen.BackglassScreen.Bounds
regkey.SetValue("PluginsScreen", .Location.X & "," & .Location.Y & "," & .Size.Width & "," & .Size.Height)
@@ -462,8 +491,11 @@ Public Class formSettings
Private Sub btnEditScreenRes_Click(sender As Object, e As EventArgs) Handles btnEditScreenRes.Click
Dim p As Process = New Process()
Dim pi As ProcessStartInfo = New ProcessStartInfo()
+#If B2S = "DLL" Then
Dim B2S_Identifier As String = IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "B2S_ScreenResIdentifier.exe")
-
+#Else
+ Dim B2S_Identifier As String = IO.Path.Combine(Application.StartupPath, "B2S_ScreenResIdentifier.exe")
+#End If
If IO.File.Exists(B2S_Identifier) Then
pi.Arguments = """" & B2SData.TableFileName & ".res" & """"
pi.FileName = B2S_Identifier
diff --git a/b2sbackglassserver/b2sbackglassserver/My Project/AssemblyInfo.vb b/b2sbackglassserver/b2sbackglassserver/My Project/AssemblyInfo.vb
index 8493b9b..32073fd 100644
--- a/b2sbackglassserver/b2sbackglassserver/My Project/AssemblyInfo.vb
+++ b/b2sbackglassserver/b2sbackglassserver/My Project/AssemblyInfo.vb
@@ -7,15 +7,18 @@ Imports System.Runtime.InteropServices
' associated with an assembly.
' Review the values of the assembly attributes
-
+#If B2S = "DLL" Then
-
-
-
-
-
-
+#Else
+
+
+#End If
+
+
+
+
+
'The following GUID is for the ID of the typelib if this project is exposed to COM
diff --git a/b2sbackglassserver/b2sbackglassserver/My Project/app.manifest b/b2sbackglassserver/b2sbackglassserver/My Project/app.manifest
new file mode 100644
index 0000000..9ce67d2
--- /dev/null
+++ b/b2sbackglassserver/b2sbackglassserver/My Project/app.manifest
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/b2sbackglassserver/b2sbackglassserver/app.config b/b2sbackglassserver/b2sbackglassserver/app.config
new file mode 100644
index 0000000..8e9dd2a
--- /dev/null
+++ b/b2sbackglassserver/b2sbackglassserver/app.config
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/b2sbackglassserverexe_tmp/b2sbackglassserverexe/Server.vb b/b2sbackglassserverexe_tmp/b2sbackglassserverexe/Server.vb
index 87710e6..1dda31b 100644
--- a/b2sbackglassserverexe_tmp/b2sbackglassserverexe/Server.vb
+++ b/b2sbackglassserverexe_tmp/b2sbackglassserverexe/Server.vb
@@ -736,7 +736,7 @@ Public Class Server
ElseIf secondvisible Then
formBackglass.BackgroundImage = formBackglass.SecondLightImage
Else
- formBackglass.BackgroundImage = formBackglass.DarkImage
+ formBackglass.BackgroundImage = formBackglass.LightImage
B2SData.IsOffImageVisible = True
End If
End If