Atualização script para baixar versões do server via HTTPS.

Remoção de Dual e Portrait
This commit is contained in:
2026-03-20 11:01:53 -03:00
parent 1099a5c301
commit e314afbdbb
3 changed files with 116 additions and 51 deletions

Binary file not shown.

View File

@@ -1,8 +1,14 @@
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
# ===== Configurações de versão =====
$VersionPortrait = "2026.03.06.3"
$VersionDual = "2026.03.05.2"
$VersionBotoneira = "2025.01.13.1"
$ReleaseBaseUrl = "https://ndlabversions.pilotgamingsys.com/devel"
# Verify Admin Rights
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator)) {
[System.Windows.Forms.MessageBox]::Show("Restarting as Administrator...")
Start-Process powershell "-ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
@@ -35,14 +41,15 @@ function Stop-Unity {
function Update-StartBat {
param ([string]$Mode)
$batPath = "C:\\pilotgames\\start.bat"
$batPath = "C:\pilotgames\start.bat"
if ($Mode -eq "Portrait") {
$content = @"
cd /D C:\pilotgames\NDGDRelease
powershell -command "Start-Process cabinet.exe -Verb runas -ArgumentList '-screen-height', '1920', '-screen-width','1080', '-screen-fullscreen', '0', '-popupwindow'"
"@
} else {
}
else {
$content = @"
cd /D C:\pilotgames\BRGDRelease
powershell -command "Start-Process cabinet.exe -Verb runas -ArgumentList '-screen-height', '1080', '-screen-width','1920', '-screen-fullscreen', '0', '-popupwindow'"
@@ -54,19 +61,69 @@ powershell -command "Start-Process cabinet.exe -Verb runas -ArgumentList '-scree
Write-Log "start.bat updated."
}
function Get-ModeVersion {
param (
[string]$Mode
)
switch ($Mode) {
"Portrait" { return $VersionPortrait }
"Dual" { return $VersionDual }
"Botoneira" { return $VersionBotoneira }
default { throw "Unknown mode: $Mode" }
}
}
function Get-ModeOrientation {
param (
[string]$Mode
)
switch ($Mode) {
"Portrait" { return "Portrait" }
"Dual" { return "Dual" }
"Botoneira" { return "Portrait" }
default { throw "Unknown mode: $Mode" }
}
}
function Download-ReleaseZip {
param (
[string]$Version
)
$zipFileName = "NDGDRelease-$Version.zip"
$zipUrl = "$ReleaseBaseUrl/$zipFileName"
$zipDest = "C:\pilotgames\downloads\$zipFileName"
Write-Log "Downloading release package..."
Write-Log "URL: $zipUrl"
try {
if (Test-Path $zipDest) {
Remove-Item -Path $zipDest -Force -ErrorAction SilentlyContinue
}
Invoke-WebRequest -Uri $zipUrl -OutFile $zipDest -UseBasicParsing
Write-Log "Download completed: $zipDest"
return $zipDest
}
catch {
throw "Failed to download file from $zipUrl. $_"
}
}
function Install-Pilot {
param ([string]$Mode)
$outputBox.Clear()
Write-Log "Starting $Mode installation..."
if ($Mode -eq "Portrait") {
$zipFile = "NDGDRelease-2026.02.11.3.zip"
$orient = "Portrait"
} else {
$zipFile = "NDGDRelease-2026.02.06.4.zip"
$orient = "Dual"
}
$version = Get-ModeVersion -Mode $Mode
$orient = Get-ModeOrientation -Mode $Mode
Write-Log "Selected version: $version"
Write-Log "Selected orientation: $orient"
Write-Log "`nRenaming PC using MAC address..."
$mac = (Get-NetAdapter -InterfaceAlias "*Ethernet*" | Select-Object -First 1 -ExpandProperty MacAddress) -replace '-', ''
@@ -83,45 +140,52 @@ function Install-Pilot {
Stop-Unity
pushd "C:\\pilotgames"
Push-Location "C:\pilotgames"
Write-Log "Clearing downloads folder..."
Remove-Item -Path "C:\\pilotgames\\downloads\\*" -Force -Recurse -ErrorAction SilentlyContinue
try {
Write-Log "Clearing downloads folder..."
Remove-Item -Path "C:\pilotgames\downloads\*" -Force -Recurse -ErrorAction SilentlyContinue
Write-Log "Removing backup folders..."
Remove-Item -Path "C:\\pilotgames\\BRGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\\pilotgames\\NDGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
Write-Log "Removing backup folders..."
Remove-Item -Path "C:\pilotgames\BRGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\pilotgames\NDGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
Write-Log "Waiting 10 seconds...."
Start-Sleep -Seconds 10
Write-Log "Waiting 10 seconds...."
Start-Sleep -Seconds 10
if (Test-Path "C:\\pilotgames\\BRGDRelease") {
Write-Log "Backing up BRGDRelease folder..."
Move-Item "C:\\pilotgames\\BRGDRelease" "C:\\pilotgames\\BRGDRelease.bak" -Force
if (Test-Path "C:\pilotgames\BRGDRelease") {
Write-Log "Backing up BRGDRelease folder..."
Move-Item "C:\pilotgames\BRGDRelease" "C:\pilotgames\BRGDRelease.bak" -Force
}
if (Test-Path "C:\pilotgames\NDGDRelease") {
Write-Log "Backing up NDGDRelease folder..."
Move-Item "C:\pilotgames\NDGDRelease" "C:\pilotgames\NDGDRelease.bak" -Force
}
$zipPath = Download-ReleaseZip -Version $version
Write-Log "Unzipping file into C:\pilotgames..."
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, "C:\pilotgames")
Update-StartBat -Mode $orient
Write-Log "Waiting 20 seconds..."
Start-Sleep -Seconds 20
Write-Log "Starting PilotGameAgent service..."
Set-Service -Name "PilotGameAgent" -StartupType Automatic -PassThru
Start-Service -Name "PilotGameAgent"
Write-Log "$Mode installation completed successfully."
}
if (Test-Path "C:\\pilotgames\\NDGDRelease") {
Write-Log "Backing up NDGDRelease folder..."
Move-Item "C:\\pilotgames\\NDGDRelease" "C:\\pilotgames\\NDGDRelease.bak" -Force
catch {
Write-Log "Installation error: $_"
}
finally {
Pop-Location
}
Write-Log "Copying release zip file..."
$zipPath = "C:\\pilotDownloads\\$orient\\$zipFile"
Copy-Item -Path $zipPath -Destination "C:\\pilotgames\\downloads\\" -Force
Write-Log "Unzipping file into C:\\pilotgames..."
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, "C:\\pilotgames")
Update-StartBat -Mode $Mode
Write-Log "Waiting 20 seconds..."
Start-Sleep -Seconds 20
Write-Log "Starting PilotGameAgent service..."
Set-Service -Name "PilotGameAgent" -StartupType Automatic -PassThru
Start-Service -Name "PilotGameAgent"
Write-Log "$Mode installation completed successfully."
}
function Set-HighPerformancePowerPlan {
@@ -186,35 +250,36 @@ function Disable-UACAndNotifications {
# GUI
$form = New-Object System.Windows.Forms.Form
$form.Text = "Pilot Installer"
$form.Size = New-Object System.Drawing.Size(600,500)
$form.Size = New-Object System.Drawing.Size(760,500)
$form.StartPosition = "CenterScreen"
$buttons = @(
@{ Text = "Install Portrait"; Action = { Install-Pilot -Mode "Portrait" } },
@{ Text = "Install Dual"; Action = { Install-Pilot -Mode "Dual" } },
@{ Text = "Exit"; Action = { $form.Close() } }
@{ Text = "Install Portrait"; Action = { Install-Pilot -Mode "Portrait" } },
@{ Text = "Install Dual"; Action = { Install-Pilot -Mode "Dual" } },
@{ Text = "Install Botoneira"; Action = { Install-Pilot -Mode "Botoneira" } },
@{ Text = "Exit"; Action = { $form.Close() } }
)
$x = 10
foreach ($btn in $buttons) {
$button = New-Object System.Windows.Forms.Button
$button.Text = $btn.Text
$button.Size = New-Object System.Drawing.Size(140,30)
$button.Size = New-Object System.Drawing.Size(170,30)
$button.Location = New-Object System.Drawing.Point($x,20)
$button.Add_Click($btn.Action)
$form.Controls.Add($button)
$x += 150
$x += 180
}
$outputBox = New-Object System.Windows.Forms.TextBox
$outputBox.Multiline = $true
$outputBox.ScrollBars = "Vertical"
$outputBox.ReadOnly = $true
$outputBox.Size = New-Object System.Drawing.Size(560,370)
$outputBox.Size = New-Object System.Drawing.Size(720,370)
$outputBox.Location = New-Object System.Drawing.Point(10,70)
$outputBox.Font = New-Object System.Drawing.Font("Consolas",10)
$outputBox.Name = "OutputTextBox"
$form.Controls.Add($outputBox)
$form.Topmost = $true
$form.ShowDialog()
$form.ShowDialog()