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 Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles() [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 # 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)) { [Security.Principal.WindowsBuiltInRole]::Administrator)) {
[System.Windows.Forms.MessageBox]::Show("Restarting as Administrator...") [System.Windows.Forms.MessageBox]::Show("Restarting as Administrator...")
Start-Process powershell "-ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs Start-Process powershell "-ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
@@ -35,14 +41,15 @@ function Stop-Unity {
function Update-StartBat { function Update-StartBat {
param ([string]$Mode) param ([string]$Mode)
$batPath = "C:\\pilotgames\\start.bat" $batPath = "C:\pilotgames\start.bat"
if ($Mode -eq "Portrait") { if ($Mode -eq "Portrait") {
$content = @" $content = @"
cd /D C:\pilotgames\NDGDRelease cd /D C:\pilotgames\NDGDRelease
powershell -command "Start-Process cabinet.exe -Verb runas -ArgumentList '-screen-height', '1920', '-screen-width','1080', '-screen-fullscreen', '0', '-popupwindow'" powershell -command "Start-Process cabinet.exe -Verb runas -ArgumentList '-screen-height', '1920', '-screen-width','1080', '-screen-fullscreen', '0', '-popupwindow'"
"@ "@
} else { }
else {
$content = @" $content = @"
cd /D C:\pilotgames\BRGDRelease cd /D C:\pilotgames\BRGDRelease
powershell -command "Start-Process cabinet.exe -Verb runas -ArgumentList '-screen-height', '1080', '-screen-width','1920', '-screen-fullscreen', '0', '-popupwindow'" 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." 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 { function Install-Pilot {
param ([string]$Mode) param ([string]$Mode)
$outputBox.Clear() $outputBox.Clear()
Write-Log "Starting $Mode installation..." Write-Log "Starting $Mode installation..."
if ($Mode -eq "Portrait") { $version = Get-ModeVersion -Mode $Mode
$zipFile = "NDGDRelease-2026.02.11.3.zip" $orient = Get-ModeOrientation -Mode $Mode
$orient = "Portrait"
} else { Write-Log "Selected version: $version"
$zipFile = "NDGDRelease-2026.02.06.4.zip" Write-Log "Selected orientation: $orient"
$orient = "Dual"
}
Write-Log "`nRenaming PC using MAC address..." Write-Log "`nRenaming PC using MAC address..."
$mac = (Get-NetAdapter -InterfaceAlias "*Ethernet*" | Select-Object -First 1 -ExpandProperty MacAddress) -replace '-', '' $mac = (Get-NetAdapter -InterfaceAlias "*Ethernet*" | Select-Object -First 1 -ExpandProperty MacAddress) -replace '-', ''
@@ -83,36 +140,36 @@ function Install-Pilot {
Stop-Unity Stop-Unity
pushd "C:\\pilotgames" Push-Location "C:\pilotgames"
try {
Write-Log "Clearing downloads folder..." Write-Log "Clearing downloads folder..."
Remove-Item -Path "C:\\pilotgames\\downloads\\*" -Force -Recurse -ErrorAction SilentlyContinue Remove-Item -Path "C:\pilotgames\downloads\*" -Force -Recurse -ErrorAction SilentlyContinue
Write-Log "Removing backup folders..." Write-Log "Removing backup folders..."
Remove-Item -Path "C:\\pilotgames\\BRGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue Remove-Item -Path "C:\pilotgames\BRGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\\pilotgames\\NDGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue Remove-Item -Path "C:\pilotgames\NDGDRelease.bak" -Recurse -Force -ErrorAction SilentlyContinue
Write-Log "Waiting 10 seconds...." Write-Log "Waiting 10 seconds...."
Start-Sleep -Seconds 10 Start-Sleep -Seconds 10
if (Test-Path "C:\\pilotgames\\BRGDRelease") { if (Test-Path "C:\pilotgames\BRGDRelease") {
Write-Log "Backing up BRGDRelease folder..." Write-Log "Backing up BRGDRelease folder..."
Move-Item "C:\\pilotgames\\BRGDRelease" "C:\\pilotgames\\BRGDRelease.bak" -Force Move-Item "C:\pilotgames\BRGDRelease" "C:\pilotgames\BRGDRelease.bak" -Force
} }
if (Test-Path "C:\\pilotgames\\NDGDRelease") {
if (Test-Path "C:\pilotgames\NDGDRelease") {
Write-Log "Backing up NDGDRelease folder..." Write-Log "Backing up NDGDRelease folder..."
Move-Item "C:\\pilotgames\\NDGDRelease" "C:\\pilotgames\\NDGDRelease.bak" -Force Move-Item "C:\pilotgames\NDGDRelease" "C:\pilotgames\NDGDRelease.bak" -Force
} }
Write-Log "Copying release zip file..." $zipPath = Download-ReleaseZip -Version $version
$zipPath = "C:\\pilotDownloads\\$orient\\$zipFile"
Copy-Item -Path $zipPath -Destination "C:\\pilotgames\\downloads\\" -Force
Write-Log "Unzipping file into C:\\pilotgames..." Write-Log "Unzipping file into C:\pilotgames..."
Add-Type -AssemblyName System.IO.Compression.FileSystem Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, "C:\\pilotgames") [System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, "C:\pilotgames")
Update-StartBat -Mode $Mode Update-StartBat -Mode $orient
Write-Log "Waiting 20 seconds..." Write-Log "Waiting 20 seconds..."
Start-Sleep -Seconds 20 Start-Sleep -Seconds 20
@@ -122,6 +179,13 @@ function Install-Pilot {
Start-Service -Name "PilotGameAgent" Start-Service -Name "PilotGameAgent"
Write-Log "$Mode installation completed successfully." Write-Log "$Mode installation completed successfully."
}
catch {
Write-Log "Installation error: $_"
}
finally {
Pop-Location
}
} }
function Set-HighPerformancePowerPlan { function Set-HighPerformancePowerPlan {
@@ -186,12 +250,13 @@ function Disable-UACAndNotifications {
# GUI # GUI
$form = New-Object System.Windows.Forms.Form $form = New-Object System.Windows.Forms.Form
$form.Text = "Pilot Installer" $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" $form.StartPosition = "CenterScreen"
$buttons = @( $buttons = @(
@{ Text = "Install Portrait"; Action = { Install-Pilot -Mode "Portrait" } }, @{ Text = "Install Portrait"; Action = { Install-Pilot -Mode "Portrait" } },
@{ Text = "Install Dual"; Action = { Install-Pilot -Mode "Dual" } }, @{ Text = "Install Dual"; Action = { Install-Pilot -Mode "Dual" } },
@{ Text = "Install Botoneira"; Action = { Install-Pilot -Mode "Botoneira" } },
@{ Text = "Exit"; Action = { $form.Close() } } @{ Text = "Exit"; Action = { $form.Close() } }
) )
@@ -199,18 +264,18 @@ $x = 10
foreach ($btn in $buttons) { foreach ($btn in $buttons) {
$button = New-Object System.Windows.Forms.Button $button = New-Object System.Windows.Forms.Button
$button.Text = $btn.Text $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.Location = New-Object System.Drawing.Point($x,20)
$button.Add_Click($btn.Action) $button.Add_Click($btn.Action)
$form.Controls.Add($button) $form.Controls.Add($button)
$x += 150 $x += 180
} }
$outputBox = New-Object System.Windows.Forms.TextBox $outputBox = New-Object System.Windows.Forms.TextBox
$outputBox.Multiline = $true $outputBox.Multiline = $true
$outputBox.ScrollBars = "Vertical" $outputBox.ScrollBars = "Vertical"
$outputBox.ReadOnly = $true $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.Location = New-Object System.Drawing.Point(10,70)
$outputBox.Font = New-Object System.Drawing.Font("Consolas",10) $outputBox.Font = New-Object System.Drawing.Font("Consolas",10)
$outputBox.Name = "OutputTextBox" $outputBox.Name = "OutputTextBox"