Remove dxwrapper; test scripts focus the game window
The default render size (1835x768) is below Direct3D 7's 2048 limit, so the D3D7 -> D3D9 wrapper and its device-info workaround are no longer needed. The game pauses start-up until its window is active; game-input.ps1 now activates it reliably (Alt + SetForegroundWindow, polled), which dxwrapper had masked. borderless logs the first failed presents. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
df31c9c105
commit
f73c4154ad
9 files changed
+38
-344
No files matched your search
+18
-4
@@ -19,13 +19,27 @@ Add-Type -Namespace SacredRe -Name Input -MemberDefinition @'
|
||||
|
||||
$script:Root = Split-Path $PSScriptRoot
|
||||
|
||||
# The game pauses its start-up until its window is active, and Windows does
|
||||
# not hand the foreground to a window started from a background process; a
|
||||
# synthetic Alt press lifts that restriction for SetForegroundWindow.
|
||||
function Focus-Sacred($Game) {
|
||||
$Game.Refresh()
|
||||
if ($Game.MainWindowHandle -eq [IntPtr]::Zero) { return $false }
|
||||
[SacredRe.Input]::keybd_event(0x12, 0, 0, [UIntPtr]::Zero)
|
||||
[SacredRe.Input]::keybd_event(0x12, 0, 2, [UIntPtr]::Zero)
|
||||
[SacredRe.Input]::SetForegroundWindow($Game.MainWindowHandle)
|
||||
}
|
||||
|
||||
function Start-Sacred([string]$Arguments = "log", [int]$WaitSeconds = 18) {
|
||||
if (Get-Process sacred -ErrorAction SilentlyContinue) { throw "sacred.exe is already running" }
|
||||
$null = Start-Process (Join-Path $script:Root "build\x86-debug\sacred_re.exe") -ArgumentList $Arguments
|
||||
Start-Sleep $WaitSeconds
|
||||
$game = Get-Process sacred -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if (-not $game) { throw "sacred.exe did not start (or crashed)" }
|
||||
[SacredRe.Input]::SetForegroundWindow($game.MainWindowHandle) | Out-Null
|
||||
$game = $null
|
||||
for ($i = 0; $i -lt $WaitSeconds * 4; $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 }
|
||||
}
|
||||
if (-not $game -or $game.HasExited) { throw "sacred.exe did not start (or crashed)" }
|
||||
$game
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user