276 lines
11 KiB
PowerShell
276 lines
11 KiB
PowerShell
|
|
# Lanceur graphique des options de mesure (Docs/Migration/18_Build_Debug.md).
|
||
|
|
# Double-clic : LifePlay_debug_ui.bat. Ne propose jamais -csvCaptureFrames.
|
||
|
|
|
||
|
|
Add-Type -AssemblyName System.Windows.Forms
|
||
|
|
Add-Type -AssemblyName System.Drawing
|
||
|
|
|
||
|
|
$ErrorActionPreference = 'Stop'
|
||
|
|
|
||
|
|
function Find-GameExes {
|
||
|
|
$here = Split-Path -Parent $PSCommandPath
|
||
|
|
$list = New-Object System.Collections.Generic.List[string]
|
||
|
|
$local = Join-Path $here 'LifePlay.exe'
|
||
|
|
if (Test-Path -LiteralPath $local) { $list.Add($local) }
|
||
|
|
foreach ($p in @(
|
||
|
|
'D:\Game\LifePlay_Build_5.5_Development\Windows\LifePlay.exe',
|
||
|
|
'D:\Game\LifePlay_Build_5.5_DebugGame\Windows\LifePlay.exe')) {
|
||
|
|
if ((Test-Path -LiteralPath $p) -and -not $list.Contains($p)) { $list.Add($p) }
|
||
|
|
}
|
||
|
|
return $list
|
||
|
|
}
|
||
|
|
|
||
|
|
$script:Applying = $false
|
||
|
|
|
||
|
|
$form = New-Object System.Windows.Forms.Form
|
||
|
|
$form.Text = 'LifePlay - options de mesure'
|
||
|
|
$form.StartPosition = 'CenterScreen'
|
||
|
|
$form.FormBorderStyle = 'FixedDialog'
|
||
|
|
$form.MaximizeBox = $false
|
||
|
|
$form.ClientSize = New-Object System.Drawing.Size(560, 640)
|
||
|
|
$form.Font = New-Object System.Drawing.Font('Segoe UI', 9)
|
||
|
|
|
||
|
|
$y = 12
|
||
|
|
$lblGame = New-Object System.Windows.Forms.Label
|
||
|
|
$lblGame.Text = 'Jeu'
|
||
|
|
$lblGame.Location = New-Object System.Drawing.Point(16, $y)
|
||
|
|
$lblGame.AutoSize = $true
|
||
|
|
$form.Controls.Add($lblGame)
|
||
|
|
|
||
|
|
$cmbExe = New-Object System.Windows.Forms.ComboBox
|
||
|
|
$cmbExe.DropDownStyle = 'DropDownList'
|
||
|
|
$cmbExe.Location = New-Object System.Drawing.Point(16, 32)
|
||
|
|
$cmbExe.Width = 420
|
||
|
|
$form.Controls.Add($cmbExe)
|
||
|
|
|
||
|
|
$btnBrowse = New-Object System.Windows.Forms.Button
|
||
|
|
$btnBrowse.Text = 'Parcourir'
|
||
|
|
$btnBrowse.Location = New-Object System.Drawing.Point(444, 30)
|
||
|
|
$btnBrowse.Width = 100
|
||
|
|
$form.Controls.Add($btnBrowse)
|
||
|
|
|
||
|
|
$lblPreset = New-Object System.Windows.Forms.Label
|
||
|
|
$lblPreset.Text = 'Reglage'
|
||
|
|
$lblPreset.Location = New-Object System.Drawing.Point(16, 68)
|
||
|
|
$lblPreset.AutoSize = $true
|
||
|
|
$form.Controls.Add($lblPreset)
|
||
|
|
|
||
|
|
$cmbPreset = New-Object System.Windows.Forms.ComboBox
|
||
|
|
$cmbPreset.DropDownStyle = 'DropDownList'
|
||
|
|
$cmbPreset.Location = New-Object System.Drawing.Point(16, 88)
|
||
|
|
$cmbPreset.Width = 528
|
||
|
|
[void]$cmbPreset.Items.AddRange(@(
|
||
|
|
'Personnalise',
|
||
|
|
'Collisions',
|
||
|
|
'Memoire et physique (session B)',
|
||
|
|
'CSV 9000 images (session C)',
|
||
|
|
'Insights court, sans memory',
|
||
|
|
'Journal d''a-coups'
|
||
|
|
))
|
||
|
|
$cmbPreset.SelectedIndex = 1
|
||
|
|
$form.Controls.Add($cmbPreset)
|
||
|
|
|
||
|
|
function New-Check([string]$Text, [int]$Top) {
|
||
|
|
$c = New-Object System.Windows.Forms.CheckBox
|
||
|
|
$c.Text = $Text
|
||
|
|
$c.Location = New-Object System.Drawing.Point(16, $Top)
|
||
|
|
$c.AutoSize = $true
|
||
|
|
$c.Width = 520
|
||
|
|
return $c
|
||
|
|
}
|
||
|
|
|
||
|
|
$chkHitch = New-Check 'Journal d''a-coups (-LPHitchLog)' 128
|
||
|
|
$chkCol = New-Check 'Suivi des collisions (-LPCollisionLog), apres le chargement' 156
|
||
|
|
$chkCvd = New-Check 'Enregistrement ChaosVD (p.Chaos.StartVDRecording)' 184
|
||
|
|
$chkShow = New-Check 'Afficher les collisions (show collision)' 212
|
||
|
|
$chkSnap = New-Check 'Instantane memoire au demarrage (LifePlay.MemSnapshot)' 240
|
||
|
|
$chkLlm = New-Check 'Memoire LLM (-llm -llmcsv)' 268
|
||
|
|
$chkCsv = New-Check 'CSV 9000 images, demarre apres le rendu (pas -csvCaptureFrames)' 296
|
||
|
|
$chkTrace = New-Check 'Trace Insights : cpu, frame, bookmark, loadtime' 324
|
||
|
|
$chkMemCh = New-Check 'Canal memory (plusieurs Go, Insights sature au-dela)' 352
|
||
|
|
$chkVerbose = New-Check 'Journal des mods verbeux (LogModdingExtra)' 380
|
||
|
|
$chkPix = New-Check 'PIX / D3D12 (-d3d12). Ne pas attacher RGP en meme temps.' 408
|
||
|
|
foreach ($c in @($chkHitch, $chkCol, $chkCvd, $chkShow, $chkSnap, $chkLlm, $chkCsv, $chkTrace, $chkMemCh, $chkVerbose, $chkPix)) {
|
||
|
|
$form.Controls.Add($c)
|
||
|
|
}
|
||
|
|
|
||
|
|
$lblMs = New-Object System.Windows.Forms.Label
|
||
|
|
$lblMs.Text = 'Seuil (ms)'
|
||
|
|
$lblMs.Location = New-Object System.Drawing.Point(300, 130)
|
||
|
|
$lblMs.AutoSize = $true
|
||
|
|
$form.Controls.Add($lblMs)
|
||
|
|
$txtMs = New-Object System.Windows.Forms.TextBox
|
||
|
|
$txtMs.Text = '50'
|
||
|
|
$txtMs.Location = New-Object System.Drawing.Point(370, 126)
|
||
|
|
$txtMs.Width = 48
|
||
|
|
$form.Controls.Add($txtMs)
|
||
|
|
|
||
|
|
$txtCmd = New-Object System.Windows.Forms.TextBox
|
||
|
|
$txtCmd.Location = New-Object System.Drawing.Point(16, 448)
|
||
|
|
$txtCmd.Size = New-Object System.Drawing.Size(528, 110)
|
||
|
|
$txtCmd.Multiline = $true
|
||
|
|
$txtCmd.ReadOnly = $true
|
||
|
|
$txtCmd.ScrollBars = 'Vertical'
|
||
|
|
$txtCmd.Font = New-Object System.Drawing.Font('Consolas', 8)
|
||
|
|
$form.Controls.Add($txtCmd)
|
||
|
|
|
||
|
|
$lblWarn = New-Object System.Windows.Forms.Label
|
||
|
|
$lblWarn.AutoSize = $false
|
||
|
|
$lblWarn.Location = New-Object System.Drawing.Point(16, 564)
|
||
|
|
$lblWarn.Size = New-Object System.Drawing.Size(360, 36)
|
||
|
|
$form.Controls.Add($lblWarn)
|
||
|
|
|
||
|
|
$btnLaunch = New-Object System.Windows.Forms.Button
|
||
|
|
$btnLaunch.Text = 'Lancer'
|
||
|
|
$btnLaunch.Location = New-Object System.Drawing.Point(388, 592)
|
||
|
|
$btnLaunch.Width = 156
|
||
|
|
$btnLaunch.Height = 32
|
||
|
|
$form.Controls.Add($btnLaunch)
|
||
|
|
$form.AcceptButton = $btnLaunch
|
||
|
|
|
||
|
|
function Get-SelectedExe {
|
||
|
|
if ($cmbExe.SelectedItem) { return [string]$cmbExe.SelectedItem }
|
||
|
|
return ''
|
||
|
|
}
|
||
|
|
|
||
|
|
function Build-Args {
|
||
|
|
$exe = Get-SelectedExe
|
||
|
|
$parts = New-Object System.Collections.Generic.List[string]
|
||
|
|
if ($chkHitch.Checked) {
|
||
|
|
$parts.Add('-LPHitchLog')
|
||
|
|
$ms = 50
|
||
|
|
[void][int]::TryParse($txtMs.Text.Trim(), [ref]$ms)
|
||
|
|
if ($ms -gt 0 -and $ms -ne 50) { $parts.Add("-LPHitchMs=$ms") }
|
||
|
|
}
|
||
|
|
if ($chkCol.Checked) { $parts.Add('-LPCollisionLog') }
|
||
|
|
if ($chkLlm.Checked) { $parts.Add('-llm'); $parts.Add('-llmcsv') }
|
||
|
|
if ($chkCsv.Checked) { $parts.Add('-csvGpuStats') }
|
||
|
|
if ($chkTrace.Checked -and $exe) {
|
||
|
|
$channels = 'cpu,frame,bookmark,loadtime'
|
||
|
|
if ($chkMemCh.Checked) { $channels += ',memory' }
|
||
|
|
$parts.Add("-trace=$channels")
|
||
|
|
$parts.Add('-statnamedevents')
|
||
|
|
$saved = Join-Path (Split-Path -Parent $exe) 'LifePlay\Saved\Profiling'
|
||
|
|
$file = Join-Path $saved ('UI_{0:yyyyMMdd_HHmmss}.utrace' -f (Get-Date))
|
||
|
|
$parts.Add("-tracefile=`"$file`"")
|
||
|
|
}
|
||
|
|
if ($chkPix.Checked) { $parts.Add('-d3d12') }
|
||
|
|
if ($chkVerbose.Checked) { $parts.Add('-LogCmds="LogModdingExtra Verbose"') }
|
||
|
|
|
||
|
|
$exec = New-Object System.Collections.Generic.List[string]
|
||
|
|
if ($chkCsv.Checked) {
|
||
|
|
$exec.Add('csvprofile repeat=20')
|
||
|
|
$exec.Add('csvprofile frames=9000')
|
||
|
|
}
|
||
|
|
if ($chkSnap.Checked) { $exec.Add('LifePlay.MemSnapshot') }
|
||
|
|
if ($chkCvd.Checked) { $exec.Add('p.Chaos.StartVDRecording') }
|
||
|
|
if ($chkShow.Checked) { $exec.Add('show collision') }
|
||
|
|
if ($exec.Count -gt 0) { $parts.Add('-ExecCmds="' + ($exec -join ', ') + '"') }
|
||
|
|
return $parts
|
||
|
|
}
|
||
|
|
|
||
|
|
function Update-Preview {
|
||
|
|
$chkMemCh.Enabled = $chkTrace.Checked
|
||
|
|
$txtMs.Enabled = $chkHitch.Checked
|
||
|
|
if (-not $chkTrace.Checked) { $chkMemCh.Checked = $false }
|
||
|
|
$exe = Get-SelectedExe
|
||
|
|
$parts = Build-Args
|
||
|
|
if (-not $exe) {
|
||
|
|
$txtCmd.Text = 'LifePlay.exe introuvable.'
|
||
|
|
$btnLaunch.Enabled = $false
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
$txtCmd.Text = "`"$exe`"`r`n" + ($parts -join "`r`n")
|
||
|
|
$btnLaunch.Enabled = $true
|
||
|
|
}
|
||
|
|
$notes = New-Object System.Collections.Generic.List[string]
|
||
|
|
if ($chkCsv.Checked -and $chkHitch.Checked) {
|
||
|
|
$notes.Add('La session CSV de non-regression se joue sans journal d''a-coups.')
|
||
|
|
}
|
||
|
|
if ($chkMemCh.Checked) {
|
||
|
|
$notes.Add('Le canal memory a deja produit une trace de 6,4 Go.')
|
||
|
|
}
|
||
|
|
if ($exe -match 'DebugGame' -and $chkCsv.Checked) {
|
||
|
|
$notes.Add('Les ms DebugGame ne se comparent pas a Development.')
|
||
|
|
}
|
||
|
|
$lblWarn.Text = ($notes -join ' ')
|
||
|
|
}
|
||
|
|
|
||
|
|
function Apply-Preset([string]$Name) {
|
||
|
|
$map = @{
|
||
|
|
'Collisions' = @{ H = $false; C = $true; V = $true; S = $true; M = $false; L = $false; P = $false; T = $false; Mem = $false; Verb = $false; Pix = $false }
|
||
|
|
'Memoire et physique (session B)' = @{ H = $false; C = $true; V = $true; S = $false; M = $true; L = $true; P = $false; T = $false; Mem = $false; Verb = $false; Pix = $false }
|
||
|
|
'CSV 9000 images (session C)' = @{ H = $false; C = $false; V = $false; S = $false; M = $false; L = $true; P = $true; T = $false; Mem = $false; Verb = $false; Pix = $false }
|
||
|
|
'Insights court, sans memory' = @{ H = $true; C = $false; V = $false; S = $false; M = $false; L = $false; P = $false; T = $true; Mem = $false; Verb = $false; Pix = $false }
|
||
|
|
'Journal d''a-coups' = @{ H = $true; C = $false; V = $false; S = $false; M = $false; L = $false; P = $false; T = $false; Mem = $false; Verb = $false; Pix = $false }
|
||
|
|
}
|
||
|
|
if (-not $map.ContainsKey($Name)) { return }
|
||
|
|
$p = $map[$Name]
|
||
|
|
$script:Applying = $true
|
||
|
|
$chkHitch.Checked = $p.H
|
||
|
|
$chkCol.Checked = $p.C
|
||
|
|
$chkCvd.Checked = $p.V
|
||
|
|
$chkShow.Checked = $p.S
|
||
|
|
$chkSnap.Checked = $p.M
|
||
|
|
$chkLlm.Checked = $p.L
|
||
|
|
$chkCsv.Checked = $p.P
|
||
|
|
$chkTrace.Checked = $p.T
|
||
|
|
$chkMemCh.Checked = $p.Mem
|
||
|
|
$chkVerbose.Checked = $p.Verb
|
||
|
|
$chkPix.Checked = $p.Pix
|
||
|
|
$script:Applying = $false
|
||
|
|
Update-Preview
|
||
|
|
}
|
||
|
|
|
||
|
|
function Mark-Custom {
|
||
|
|
if ($script:Applying) { return }
|
||
|
|
$script:Applying = $true
|
||
|
|
$cmbPreset.SelectedItem = 'Personnalise'
|
||
|
|
$script:Applying = $false
|
||
|
|
Update-Preview
|
||
|
|
}
|
||
|
|
|
||
|
|
foreach ($exe in (Find-GameExes)) { [void]$cmbExe.Items.Add($exe) }
|
||
|
|
if ($cmbExe.Items.Count -gt 0) { $cmbExe.SelectedIndex = 0 }
|
||
|
|
|
||
|
|
$cmbExe.Add_SelectedIndexChanged({ Update-Preview })
|
||
|
|
$cmbPreset.Add_SelectedIndexChanged({
|
||
|
|
if ($script:Applying) { return }
|
||
|
|
Apply-Preset ([string]$cmbPreset.SelectedItem)
|
||
|
|
})
|
||
|
|
foreach ($c in @($chkHitch, $chkCol, $chkCvd, $chkShow, $chkSnap, $chkLlm, $chkCsv, $chkTrace, $chkMemCh, $chkVerbose, $chkPix)) {
|
||
|
|
$c.Add_CheckedChanged({ Mark-Custom })
|
||
|
|
}
|
||
|
|
$txtMs.Add_TextChanged({ Update-Preview })
|
||
|
|
|
||
|
|
$btnBrowse.Add_Click({
|
||
|
|
$dlg = New-Object System.Windows.Forms.OpenFileDialog
|
||
|
|
$dlg.Filter = 'LifePlay.exe|LifePlay.exe'
|
||
|
|
$dlg.Title = 'Choisir LifePlay.exe'
|
||
|
|
if ($dlg.ShowDialog() -eq 'OK') {
|
||
|
|
if (-not $cmbExe.Items.Contains($dlg.FileName)) { [void]$cmbExe.Items.Add($dlg.FileName) }
|
||
|
|
$cmbExe.SelectedItem = $dlg.FileName
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
$btnLaunch.Add_Click({
|
||
|
|
$exe = Get-SelectedExe
|
||
|
|
if (-not $exe -or -not (Test-Path -LiteralPath $exe)) {
|
||
|
|
[System.Windows.Forms.MessageBox]::Show('LifePlay.exe introuvable.', 'LifePlay')
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if ($chkTrace.Checked) {
|
||
|
|
$saved = Join-Path (Split-Path -Parent $exe) 'LifePlay\Saved\Profiling'
|
||
|
|
New-Item -ItemType Directory -Force -Path $saved | Out-Null
|
||
|
|
}
|
||
|
|
$psi = New-Object System.Diagnostics.ProcessStartInfo
|
||
|
|
$psi.FileName = $exe
|
||
|
|
$psi.WorkingDirectory = Split-Path -Parent $exe
|
||
|
|
$psi.UseShellExecute = $true
|
||
|
|
$psi.Arguments = (Build-Args) -join ' '
|
||
|
|
[void][System.Diagnostics.Process]::Start($psi)
|
||
|
|
$form.Close()
|
||
|
|
})
|
||
|
|
|
||
|
|
Apply-Preset 'Collisions'
|
||
|
|
[void]$form.ShowDialog()
|