Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit 01c491f

Browse files
committed
Vsync on and off bug fix
1 parent 8af88e5 commit 01c491f

File tree

8 files changed

+50
-25
lines changed

8 files changed

+50
-25
lines changed

Minecraft Launch Script/Views/MainPage.vb

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,22 @@ Public Class MainPage
169169
GC.WaitForPendingFinalizers()
170170
GC.Collect()
171171
switchPanel(PerformanceTweakView)
172-
Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader)
173-
If fileWrite.Contains("gfx_vsync:0") Then
174-
PerformanceTweakView.lblVsyncStatus.Text = "OFF"
175-
PerformanceTweakView.lblVsyncStatus.ForeColor = Color.Lime
176-
Directory.SetCurrentDirectory(appDefLoc)
177-
ElseIf fileWrite.Contains("gfx_vsync:1") Then
178-
PerformanceTweakView.lblVsyncStatus.Text = "ON"
172+
Try
173+
Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader)
174+
If fileWrite.Contains("gfx_vsync:0") Then
175+
PerformanceTweakView.lblVsyncStatus.Text = "OFF"
176+
PerformanceTweakView.lblVsyncStatus.ForeColor = Color.Lime
177+
Directory.SetCurrentDirectory(appDefLoc)
178+
ElseIf fileWrite.Contains("gfx_vsync:1") Then
179+
PerformanceTweakView.lblVsyncStatus.Text = "ON"
180+
PerformanceTweakView.lblVsyncStatus.ForeColor = Color.Red
181+
Directory.SetCurrentDirectory(appDefLoc)
182+
End If
183+
Catch ex As System.IO.DirectoryNotFoundException
184+
PerformanceTweakView.lblVsyncStatus.Text = "Minecraft is not installed!"
179185
PerformanceTweakView.lblVsyncStatus.ForeColor = Color.Red
180186
Directory.SetCurrentDirectory(appDefLoc)
181-
End If
187+
End Try
188+
182189
End Sub
183190
End Class

Minecraft Launch Script/Views/PerformanceTweakView.vb

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,29 @@ Public Class PerformanceTweakView
55
Dim appDefLoc = My.Application.Info.DirectoryPath
66
Dim fileReader As String = Environ$("USERPROFILE") & "\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\minecraftpe\options.txt"
77
Private Sub btnVsyncOn_Click(sender As Object, e As EventArgs) Handles btnVsyncOn.Click
8-
Directory.SetCurrentDirectory(root)
9-
Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader).Replace("gfx_vsync:0", "gfx_vsync:1")
10-
File.WriteAllText(fileReader, fileWrite)
11-
updateForm()
12-
Directory.SetCurrentDirectory(appDefLoc)
8+
'Directory.SetCurrentDirectory(root)
9+
Try
10+
Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader).Replace("gfx_vsync:0", "gfx_vsync:1")
11+
File.WriteAllText(fileReader, fileWrite)
12+
updateForm()
13+
Directory.SetCurrentDirectory(appDefLoc)
14+
Catch ex As System.IO.DirectoryNotFoundException
15+
lblVsyncStatus.Text = "Minecraft is not installed!"
16+
lblVsyncStatus.ForeColor = Color.Red
17+
Directory.SetCurrentDirectory(appDefLoc)
18+
End Try
1319
End Sub
1420
Private Sub btnVsyncOff_Click(sender As Object, e As EventArgs) Handles btnVsyncOff.Click
15-
Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader).Replace("gfx_vsync:1", "gfx_vsync:0")
16-
File.WriteAllText(fileReader, fileWrite)
17-
updateForm()
18-
Directory.SetCurrentDirectory(appDefLoc)
19-
21+
Try
22+
Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader).Replace("gfx_vsync:1", "gfx_vsync:0")
23+
File.WriteAllText(fileReader, fileWrite)
24+
updateForm()
25+
Directory.SetCurrentDirectory(appDefLoc)
26+
Catch ex As System.IO.DirectoryNotFoundException
27+
lblVsyncStatus.Text = "Minecraft is not installed!"
28+
lblVsyncStatus.ForeColor = Color.Red
29+
Directory.SetCurrentDirectory(appDefLoc)
30+
End Try
2031
End Sub
2132
Public Async Sub updateForm()
2233
Dim taskRunning = True
@@ -53,13 +64,20 @@ Public Class PerformanceTweakView
5364
End If
5465
End Sub
5566
Private Sub PerformanceTweakView_Load(sender As Object, e As EventArgs) Handles MyBase.Load
56-
Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader)
57-
If fileWrite.Contains("gfx_vsync:0") Then
58-
lblVsyncStatus.Text = "OFF"
59-
lblVsyncStatus.ForeColor = Color.Lime
60-
ElseIf fileWrite.Contains("gfx_vsync:1") Then
61-
lblVsyncStatus.Text = "ON"
67+
Try
68+
Directory.SetCurrentDirectory(root)
69+
Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader)
70+
If fileWrite.Contains("gfx_vsync:0") Then
71+
lblVsyncStatus.Text = "OFF"
72+
lblVsyncStatus.ForeColor = Color.Lime
73+
ElseIf fileWrite.Contains("gfx_vsync:1") Then
74+
lblVsyncStatus.Text = "ON"
75+
lblVsyncStatus.ForeColor = Color.Red
76+
End If
77+
Catch ex As System.IO.DirectoryNotFoundException
78+
lblVsyncStatus.Text = "Minecraft is not installed!"
6279
lblVsyncStatus.ForeColor = Color.Red
63-
End If
80+
Directory.SetCurrentDirectory(appDefLoc)
81+
End Try
6482
End Sub
6583
End Class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)