From bddb723f36f680478abf8da7d730c7beb3b5eecc Mon Sep 17 00:00:00 2001 From: Jason Gardner Date: Sun, 1 Jun 2025 13:22:28 -0500 Subject: [PATCH 1/3] feat: Enable RTX via options.txt --- v2/installer.ps1 | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/v2/installer.ps1 b/v2/installer.ps1 index 0b42290..8da6af6 100644 --- a/v2/installer.ps1 +++ b/v2/installer.ps1 @@ -36,6 +36,8 @@ $T = Data { dlss_downloading = Downloading DLSS dlss_updating = Updating DLSS dlss_success = Successfully updated DLSS + update_options = Fix GFX Options + options_updated = Successfully updated GFX options '@ } $translationFilename = "installer.psd1" @@ -882,11 +884,65 @@ function Install-DLSS() { $StatusLabel.Text = $T.dlss_success } +# Modify the options.txt file to enable certain graphics options for best RTX performance +# This is a workaround for the fact that the game doesn't allow you to enable these options in the UI +function Update-OptionsFile { + param( + [Parameter(Mandatory = $true)] + [string]$OptionsFile + ) + + try { + if (Test-Path $OptionsFile) { + $content = Get-Content $OptionsFile -Raw + + if ($content -match "show_advanced_video_settings:0") { + $content = $content -replace "show_advanced_video_settings:0", "show_advanced_video_settings:1" + $content | Out-File $OptionsFile -Force + } + elseif ($content -notmatch "show_advanced_video_settings:1") { + # Add the setting if not found + $content += "`nshow_advanced_video_settings:1" + $content | Out-File $OptionsFile -Force + } + + Write-Host "Updated video settings in $OptionsFile" -ForegroundColor Green + } + } + catch { + Write-Error "Failed to update options file ${OptionsFile}: $_" + } +} + +function Enable-GfxOptions() { + $comMojang = [System.Environment]::GetFolderPath("LocalApplicationData") + "\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang" + $previewComMojang = [System.Environment]::GetFolderPath("LocalApplicationData") + "\Packages\Microsoft.MinecraftPreview_8wekyb3d8bbwe\LocalState\games\com.mojang" + + $optionsFile = "$comMojang\minecraftpe\options.txt"; + $previewOptionsFile = "$previewComMojang\minecraftpe\options.txt"; + + foreach ($mc in $dataSrc) { + if ($ListBox.SelectedItems -notcontains $mc.FriendlyName) { + continue + } + + if ($mc.Preview) { + Update-OptionsFile -OptionsFile $previewOptionsFile + } + else { + Update-OptionsFile -OptionsFile $optionsFile + } + } +} + # Advanced Section function Update-Advanced() { $hasSelectedItems = -not ($ListBox.SelectedItems.Count -eq 0) $dlssMenu = $advancedMenu.MenuItems | Where-Object { $_.Text -eq $T.update_dlss } $dlssMenu.Enabled = $hasSelectedItems + + $updateOptionsMenuItem = $advancedMenu.MenuItems | Where-Object { $_.Text -eq $T.update_options } + $updateOptionsMenuItem.Enabled = $hasSelectedItems } # Setup GUI @@ -1165,6 +1221,18 @@ $dlssUpdateMenuItem.Enabled = $false $dlssUpdateMenuItem.Add_Click({ Install-DLSS }) $advancedMenu.MenuItems.Add($dlssUpdateMenuItem) | Out-Null +$updateOptionsMenuItem = New-Object System.Windows.Forms.MenuItem +$updateOptionsMenuItem.Text = $T.update_options +$updateOptionsMenuItem.Enabled = $false +$updateOptionsMenuItem.Add_Click({ + Enable-GfxOptions + $StatusLabel.Text = $T.options_updated + $StatusLabel.ForeColor = 'Green' + $StatusLabel.Visible = $true + }) +$advancedMenu.MenuItems.Add($updateOptionsMenuItem) | Out-Null +$advancedMenu.Add_Click({ Update-OptionsFile }) + $helpMenu = New-Object System.Windows.Forms.MenuItem $helpMenu.Text = $T.help $mainMenu.MenuItems.Add($helpMenu) | Out-Null From a9f2b3ff0c092cfc24b7612862743f5129c5ac4b Mon Sep 17 00:00:00 2001 From: Jason Gardner Date: Sun, 1 Jun 2025 13:27:51 -0500 Subject: [PATCH 2/3] chore: Add else branch / Remove duplicate click event --- v2/installer.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/v2/installer.ps1 b/v2/installer.ps1 index 8da6af6..fc594dc 100644 --- a/v2/installer.ps1 +++ b/v2/installer.ps1 @@ -908,6 +908,9 @@ function Update-OptionsFile { Write-Host "Updated video settings in $OptionsFile" -ForegroundColor Green } + else { + Write-Host "Options file not found: $OptionsFile" -ForegroundColor Red + } } catch { Write-Error "Failed to update options file ${OptionsFile}: $_" @@ -1231,7 +1234,6 @@ $updateOptionsMenuItem.Add_Click({ $StatusLabel.Visible = $true }) $advancedMenu.MenuItems.Add($updateOptionsMenuItem) | Out-Null -$advancedMenu.Add_Click({ Update-OptionsFile }) $helpMenu = New-Object System.Windows.Forms.MenuItem $helpMenu.Text = $T.help From a3575f5fb145c7f06115d30eda8cffe52b33b58d Mon Sep 17 00:00:00 2001 From: Jason Gardner Date: Sun, 1 Jun 2025 13:41:16 -0500 Subject: [PATCH 3/3] fix: Provide encoding for options file --- v2/installer.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/installer.ps1 b/v2/installer.ps1 index fc594dc..97f1583 100644 --- a/v2/installer.ps1 +++ b/v2/installer.ps1 @@ -898,12 +898,12 @@ function Update-OptionsFile { if ($content -match "show_advanced_video_settings:0") { $content = $content -replace "show_advanced_video_settings:0", "show_advanced_video_settings:1" - $content | Out-File $OptionsFile -Force + $content | Out-File $OptionsFile -Force -Encoding UTF8 } elseif ($content -notmatch "show_advanced_video_settings:1") { # Add the setting if not found $content += "`nshow_advanced_video_settings:1" - $content | Out-File $OptionsFile -Force + $content | Out-File $OptionsFile -Force -Encoding UTF8 } Write-Host "Updated video settings in $OptionsFile" -ForegroundColor Green