From cae76430aea4cb0d25de8a8f056ff89d8c8c99e2 Mon Sep 17 00:00:00 2001 From: Belim Date: Mon, 8 Sep 2025 21:11:35 +0200 Subject: [PATCH] Add files via upload --- Flyoobe.Extensions/Gaming tweaks.ps1 | 74 ++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Flyoobe.Extensions/Gaming tweaks.ps1 diff --git a/Flyoobe.Extensions/Gaming tweaks.ps1 b/Flyoobe.Extensions/Gaming tweaks.ps1 new file mode 100644 index 0000000..70f01b0 --- /dev/null +++ b/Flyoobe.Extensions/Gaming tweaks.ps1 @@ -0,0 +1,74 @@ +# Description: Gaming Tweaks – optimize Windows 11 for games +# Host: console +# Options: Enable Game Mode; Disable Game Mode; Toggle Hardware GPU Scheduling; Switch Power Plans; Disable Game DVR; Clear Shader Cache + +param([string]$choice) + +function Is-Admin { + $id = [Security.Principal.WindowsIdentity]::GetCurrent() + $pr = New-Object Security.Principal.WindowsPrincipal($id) + return $pr.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) +} + +switch ($choice) { + + "Enable Game Mode" { + Write-Output "✔ Enabling Game Mode..." + Set-ItemProperty -Path "HKCU:\Software\Microsoft\GameBar" -Name "AllowAutoGameMode" -Value 1 + } + + "Disable Game Mode" { + Write-Output "✔ Disabling Game Mode..." + Set-ItemProperty -Path "HKCU:\Software\Microsoft\GameBar" -Name "AllowAutoGameMode" -Value 0 + } + + "Toggle Hardware GPU Scheduling" { + if (-not (Is-Admin)) { + Write-Output "✘ Requires Administrator. Please run Flyoobe as Admin." + break + } + + $path = "HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" + $val = (Get-ItemProperty -Path $path -Name HwSchMode -ErrorAction SilentlyContinue).HwSchMode + if ($val -eq 2) { + Set-ItemProperty -Path $path -Name HwSchMode -Value 1 -Type DWord + Write-Output "✔ Hardware GPU Scheduling disabled (restart required)." + } else { + Set-ItemProperty -Path $path -Name HwSchMode -Value 2 -Type DWord + Write-Output "✔ Hardware GPU Scheduling enabled (restart required)." + } + } + + "Switch Power Plans" { + Write-Output "Available power plans:" + powercfg /list + + Write-Output "" + Write-Output "Use one of these commands to switch manually:" + Write-Output " - Balanced: powercfg /setactive SCHEME_BALANCED" + Write-Output " - High Performance: powercfg /setactive SCHEME_MIN" + Write-Output " - Ultimate Performance: powercfg /setactive SCHEME_MAX" + } + + "Disable Game DVR" { + Write-Output "✔ Disabling Game DVR..." + Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Value 0 + Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Value 0 + } + + "Clear Shader Cache" { + $cache = "$env:LOCALAPPDATA\D3DSCache" + if (Test-Path $cache) { + Write-Output "✔ Clearing shader cache..." + Remove-Item "$cache\*" -Force -Recurse -ErrorAction SilentlyContinue + } else { + Write-Output "ℹ Shader cache folder not found." + } + } + + default { + Write-Output "✘ Unknown option: $choice" + } +} + +Write-Output "`nDone. Some changes may require restart to take effect."