Maps in widened views: TAB overlay in place, M map across the full width
- hud: shift SetViewport/Clear with moved windows (TAB overview map) - megamap: view constants patched to the render width (clip, scroll limit, edge scrolling, centre, dark band, zoomed view and its markers); frame stretched to the screen edges, zoom controls and their click area centred - hud: Anchor::Screen windows are drawn and clicked unshifted but still own the event scope - autotest waits for log markers instead of fixed delays (~18 s per run) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a7f8496b2b
commit
c6c5530709
9 files changed
+327
-18
No files matched your search
+27
-5
@@ -31,16 +31,38 @@ function Focus-Sacred($Game) {
|
||||
[SacredRe.Input]::SetForegroundWindow($Game.MainWindowHandle)
|
||||
}
|
||||
|
||||
function Start-Sacred([string]$Arguments = "log", [int]$WaitSeconds = 18) {
|
||||
$script:LogPath = Join-Path $script:Root "build\x86-debug\sacred_re.log"
|
||||
|
||||
# Waits until sacred_re.log (written anew at every start) has at least $Count
|
||||
# lines containing $Pattern, focusing the game meanwhile; then waits $AfterMs.
|
||||
function Wait-Log([string]$Pattern, [int]$Count = 1, [int]$TimeoutSeconds = 60, [int]$AfterMs = 500, $Game = $null) {
|
||||
$deadline = (Get-Date).AddSeconds($TimeoutSeconds)
|
||||
while ((Get-Date) -lt $deadline) {
|
||||
if ($Game) { Focus-Sacred $Game | Out-Null }
|
||||
$found = 0
|
||||
if (Test-Path $script:LogPath) {
|
||||
$found = @(Select-String -Path $script:LogPath -Pattern $Pattern -SimpleMatch).Count
|
||||
}
|
||||
if ($found -ge $Count) { Start-Sleep -Milliseconds $AfterMs; return }
|
||||
Start-Sleep -Milliseconds 200
|
||||
}
|
||||
throw "timeout waiting for '$Pattern' in sacred_re.log"
|
||||
}
|
||||
|
||||
# Starts the game and returns once its main menu is up (the UI manager
|
||||
# starts its menu thread a second time when the menu appears).
|
||||
function Start-Sacred([string]$Arguments = "log") {
|
||||
if (Get-Process sacred -ErrorAction SilentlyContinue) { throw "sacred.exe is already running" }
|
||||
if (Test-Path $script:LogPath) { Remove-Item $script:LogPath -ErrorAction SilentlyContinue }
|
||||
$null = Start-Process (Join-Path $script:Root "build\x86-debug\sacred_re.exe") -ArgumentList $Arguments
|
||||
$game = $null
|
||||
for ($i = 0; $i -lt $WaitSeconds * 4; $i++) {
|
||||
for ($i = 0; $i -lt 80 -and -not $game; $i++) {
|
||||
Start-Sleep -Milliseconds 250
|
||||
if (-not $game) { $game = Get-Process sacred -ErrorAction SilentlyContinue | Select-Object -First 1 }
|
||||
if ($game) { Focus-Sacred $game | Out-Null }
|
||||
$game = Get-Process sacred -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
}
|
||||
if (-not $game -or $game.HasExited) { throw "sacred.exe did not start (or crashed)" }
|
||||
if (-not $game) { throw "sacred.exe did not start" }
|
||||
Wait-Log "starting menu thread!" -Count 2 -AfterMs 1500 -Game $game
|
||||
if ($game.HasExited) { throw "sacred.exe crashed" }
|
||||
$game
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user