@@ -35,6 +35,8 @@ Public Class Form1
3535 Private Const SWP_NOZORDER As UInteger = &H4
3636 Private Const SWP_NOSIZE As UInteger = &H1
3737 Private Const SW_MAXIMIZE As Integer = 3
38+ Private Const SW_MINIMIZE As Integer = 6
39+ Private Const SW_SHOWMINNOACTIVE As Integer = 7
3840
3941 Dim Game As String = My.Settings.SelectedGame
4042 Dim GPU As String = My.Settings.MainGPU
@@ -75,11 +77,6 @@ Public Class Form1
7577 Me .StartPosition = FormStartPosition.WindowsDefaultLocation
7678 End If
7779
78- ' Check For First Run
79- If My.Settings.FirstRun = True Then
80- FirstRun.Show()
81- End If
82-
8380 'Check If It's A Dev Build
8481 If DevBuild = True Then
8582 DevMenu.Show()
@@ -175,6 +172,36 @@ Public Class Form1
175172
176173 End Sub
177174
175+ Private Sub Form1_Shown(sender As Object , e As EventArgs) Handles Me .Shown ' Code to run after Form1 has loaded fully
176+
177+ ' Check For First Run
178+ If My.Settings.FirstRun = True Then
179+
180+ ' Save Form1 Location Before Showing First Run
181+ My.Settings.LastLocation = Me .Location
182+ My.Settings.Save()
183+
184+ ' Show First Run Dialog
185+ FirstRun.Show()
186+ End If
187+
188+ ' Auto Disable True Stretched if command line argument exists
189+ If AutoDisable = True AndAlso StretchedEnabled = True Then
190+ Button1.PerformClick()
191+ End If
192+
193+ End Sub
194+
195+ Private Sub Form1_Resize(sender As Object , e As EventArgs) Handles MyBase .Resize
196+
197+ ' Check if the form is being minimized
198+ If Me .WindowState = FormWindowState.Minimized Then
199+ ' Use ShowWindow to minimize without focus
200+ ShowWindow( Me .Handle, SW_SHOWMINNOACTIVE)
201+ End If
202+
203+ End Sub
204+
178205 Private Sub Form1_FormClosing(sender As Object , e As FormClosingEventArgs) Handles MyBase .FormClosing
179206
180207 ' Check if the Form1 Location is fully visible on any screen
@@ -198,24 +225,13 @@ Public Class Form1
198225 If isFormFullyVisible Then
199226 My.Settings.LastLocation = Me .Location
200227 My.Settings.Save()
201- Else
202- 'If Form1 isn't fully visible don't save location
203228 End If
204229
205230 ' Send Closing Log Message
206231 TrueLog( "Close" , "--True Stretched Closing--" )
207232
208233 End Sub
209234
210- Private Sub Form1_Shown(sender As Object , e As EventArgs) Handles Me .Shown ' Code to run after Form1 has loaded fully
211-
212- ' Auto Disable True Stretched if command line argument exists
213- If AutoDisable = True AndAlso StretchedEnabled = True Then
214- Button1.PerformClick()
215- End If
216-
217- End Sub
218-
219235 Private Async Sub CheckForUpdates()
220236 Dim httpClient As New HttpClient()
221237 Dim json As String = Await httpClient.GetStringAsync( "https://download.truestretched.com/latestversion.json" )
@@ -1142,23 +1158,31 @@ Public Class Form1
11421158 Else
11431159 ' Valorant Last User Riot ID Config File Found
11441160 ' Set the desired screen resolution
1145- Dim width As Integer = 1920
1146- Dim height As Integer = 1080
1161+ Dim width As String = " 1920"
1162+ Dim height As String = " 1080"
11471163 Dim UseLetterbox As String = "False"
1148- Dim FullscreenMode As Integer = 2
1164+ Dim FullscreenMode As String = "2"
1165+ Dim LastRecommendedScreenWidthHeight As String = "-1.000000"
1166+ Dim UseDesiredScreenHeight As String = "False"
11491167
11501168 If File.Exists(filePath) Then
11511169 ' Create a FileInfo object
11521170 Dim fileInfo As New FileInfo(filePath)
11531171
11541172 Dim lines As List( Of String ) = File.ReadAllLines(filePath).ToList()
11551173
1174+ ' Track if fullscreen line exists
1175+ Dim fullscreenModeExists As Boolean = False
1176+
11561177 For i As Integer = 0 To lines.Count - 1
11571178
11581179 If lines(i).StartsWith( "FullscreenMode=" ) Then
11591180 lines(i) = "FullscreenMode=" & FullscreenMode
1181+ fullscreenModeExists = True
11601182 ElseIf lines(i).StartsWith( "LastConfirmedFullscreenMode=" ) Then
11611183 lines(i) = "LastConfirmedFullscreenMode=" & FullscreenMode
1184+ ElseIf lines(i).StartsWith( "PreferredFullscreenMode=" ) Then
1185+ lines(i) = "PreferredFullscreenMode=" & FullscreenMode
11621186 ElseIf lines(i).StartsWith( "bShouldLetterbox=" ) Then
11631187 lines(i) = "bShouldLetterbox=" & UseLetterbox
11641188 ElseIf lines(i).StartsWith( "bLastConfirmedShouldLetterbox=" ) Then
@@ -1171,9 +1195,28 @@ Public Class Form1
11711195 lines(i) = "LastUserConfirmedResolutionSizeX=" & width
11721196 ElseIf lines(i).StartsWith( "LastUserConfirmedResolutionSizeY=" ) Then
11731197 lines(i) = "LastUserConfirmedResolutionSizeY=" & height
1198+ ElseIf lines(i).StartsWith( "DesiredScreenWidth=" ) Then
1199+ lines(i) = "DesiredScreenWidth=" & width
1200+ ElseIf lines(i).StartsWith( "DesiredScreenHeight=" ) Then
1201+ lines(i) = "DesiredScreenHeight=" & height
1202+ ElseIf lines(i).StartsWith( "LastUserConfirmedDesiredScreenWidth=" ) Then
1203+ lines(i) = "LastUserConfirmedDesiredScreenWidth=" & width
1204+ ElseIf lines(i).StartsWith( "LastUserConfirmedDesiredScreenHeight=" ) Then
1205+ lines(i) = "LastUserConfirmedDesiredScreenHeight=" & height
1206+ ElseIf lines(i).StartsWith( "LastRecommendedScreenWidth=" ) Then
1207+ lines(i) = "LastRecommendedScreenWidth=" & LastRecommendedScreenWidthHeight
1208+ ElseIf lines(i).StartsWith( "LastRecommendedScreenHeight=" ) Then
1209+ lines(i) = "LastRecommendedScreenHeight=" & LastRecommendedScreenWidthHeight
1210+ ElseIf lines(i).StartsWith( "bUseDesiredScreenHeight=" ) Then
1211+ lines(i) = "bUseDesiredScreenHeight=" & UseDesiredScreenHeight
11741212 End If
11751213 Next
11761214
1215+ ' If "FullscreenMode=" line does not exist, insert it at the 6th position
1216+ If Not fullscreenModeExists Then
1217+ lines.Insert( 5 , "FullscreenMode=" & FullscreenMode)
1218+ End If
1219+
11771220 File.WriteAllLines(filePath, lines.ToArray())
11781221 ' Log Valorant Config Update Success to File
11791222 TrueLog( "Info" , "Valorant Config Update File Successfully!" )
0 commit comments