Fix Soul Pass #1: single mouse-capture authority, raw OS argv window check, and release script hardening

This commit is contained in:
Meta Vens 2026-12-05 20:31:30 +01:00
commit 8710bed79d
2 changed files with 37 additions and 18 deletions

View file

@ -312,7 +312,7 @@ public partial class Main : Node3D
_menuPreviewOut = System.Environment.GetEnvironmentVariable("RTD_MENU_PREVIEW_OUT");
bool hasWindowOverride = GetCliArg("--windowed", allowBareFlag: true) is not null
|| GetCliArg("--resolution") is not null
|| GetCliArg("--resolution", allowBareFlag: true) is not null
|| GetCliArg("-w", allowBareFlag: true) is not null;
if (!IsAutomatedRun && !hasWindowOverride)
{
@ -899,6 +899,9 @@ public partial class Main : Node3D
private bool IsAutomatedRun =>
DisplayServer.GetName() == "headless"
|| InitialMapKindOverride.HasValue
|| InitialSkipDropOverride
|| InitialSkipMenuOverride
|| _perfTargetFrames > 0
|| _menuPreviewTargetFrames > 0
|| !string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("RTD_PERF_FRAMES"))
@ -960,10 +963,10 @@ public partial class Main : Node3D
private static string? GetCliArg(string flag, bool allowBareFlag = false)
{
static string? SearchArgs(string[] args, string flagName, bool bare)
static string? SearchArgs(string[] args, string flagName, bool bare, int startIndex = 0)
{
string prefix = flagName + "=";
for (int i = 0; i < args.Length; i++)
for (int i = startIndex; i < args.Length; i++)
{
string a = args[i];
if (a.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
@ -986,7 +989,8 @@ public partial class Main : Node3D
}
return SearchArgs(OS.GetCmdlineUserArgs(), flag, allowBareFlag)
?? SearchArgs(OS.GetCmdlineArgs(), flag, allowBareFlag);
?? SearchArgs(OS.GetCmdlineArgs(), flag, allowBareFlag)
?? SearchArgs(System.Environment.GetCommandLineArgs(), flag, allowBareFlag, startIndex: 1);
}
private static void ParseBindAndPort(string? raw, IPAddress defaultIp, int defaultPort, out IPAddress bindIp, out int port)
@ -1068,7 +1072,7 @@ public partial class Main : Node3D
public void SetScriptedInput(PlayerInput? input) => _scriptedInput = input;
public override void _UnhandledInput(InputEvent @event)
public override void _Input(InputEvent @event)
{
if (@event is InputEventKey key && key.Pressed && !key.Echo)
{
@ -1079,9 +1083,14 @@ public partial class Main : Node3D
{
ToggleBorderlessFullscreen();
GetViewport().SetInputAsHandled();
return;
}
}
}
public override void _UnhandledInput(InputEvent @event)
{
if (@event is InputEventKey key && key.Pressed && !key.Echo)
{
if (_screenMode == ClientScreenMode.MainMenu)
{
if (key.Keycode == Key.Escape && _mainMenu.IsHostPanelOpen)
@ -1190,10 +1199,9 @@ public partial class Main : Node3D
Input.MouseMode == Input.MouseModeEnum.Visible &&
!_hud.GarageExpanded &&
!_hud.NetworkPanelOpen &&
!_hud.IsPointerOverInteractiveHud(mb.Position) &&
DisplayServer.GetName() != "headless")
!_hud.IsPointerOverInteractiveHud(mb.Position))
{
Input.MouseMode = Input.MouseModeEnum.Captured;
SyncMouseMode();
}
}
}

View file

@ -197,6 +197,11 @@ $RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
$ClientDir = Join-Path $RepoRoot "client"
$AssetsSrcDir = Join-Path $RepoRoot "assets"
$fullSha = (& git -C $RepoRoot rev-parse HEAD).Trim()
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($fullSha)) {
throw "Failed to resolve git HEAD SHA."
}
if ([string]::IsNullOrWhiteSpace($Tag)) {
$shortSha = (& git -C $RepoRoot rev-parse --short HEAD).Trim()
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($shortSha)) {
@ -225,6 +230,7 @@ $env:YMIR_ROOT = $YmirRoot
$env:CULTLIB_ROOT = $CultLibRoot
$env:MSBUILDDISABLENODEREUSE = "1"
$env:DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER = "1"
$env:UseSharedCompilation = "false"
Write-Host "=== Rust to Dust win64 Release Build ==="
Write-Host "RepoRoot : $RepoRoot"
@ -354,8 +360,12 @@ if ($Publish) {
}
catch {
$statusCode = $null
if ($_.Exception.Response -and $_.Exception.Response.StatusCode) {
$statusCode = [int]$_.Exception.Response.StatusCode
$ex = $_.Exception
if ($ex -is [System.Net.WebException] -and $ex.Response) {
$statusCode = [int]$ex.Response.StatusCode
}
elseif ($ex.PSObject.Properties['Response'] -and $ex.Response -and $ex.Response.PSObject.Properties['StatusCode']) {
$statusCode = [int]$ex.Response.StatusCode
}
if ($statusCode -ne 404) {
throw
@ -365,13 +375,14 @@ if ($Publish) {
$releaseNotes = "Standalone Windows x64 build ($Tag). Unzip and run RustToDust.exe."
if ($null -eq $release) {
$release = Invoke-ForgeApiJson -Method "POST" -Url "$apiBase/releases" -Token $resolvedToken -Body @{
tag_name = $Tag
name = $Tag
body = $releaseNotes
draft = $false
prerelease = $false
tag_name = $Tag
target_commitish = $fullSha
name = $Tag
body = $releaseNotes
draft = $false
prerelease = $false
}
Write-Host "Created release id=$($release.id) for tag '$Tag'."
Write-Host "Created release id=$($release.id) for tag '$Tag' ($fullSha)."
}
else {
$release = Invoke-ForgeApiJson -Method "PATCH" -Url "$apiBase/releases/$($release.id)" -Token $resolvedToken -Body @{
@ -394,7 +405,7 @@ if ($Publish) {
}
Write-Host "Uploading '$assetName'..."
$uploadUrl = "$apiBase/releases/$($release.id)/assets?name=$([Uri]::EscapeDataString($assetName))"
& curl.exe -fS -X POST -H "Authorization: token $resolvedToken" -F "attachment=@$assetPath" $uploadUrl | Out-Null
& curl.exe -fsS -X POST -H "Authorization: token $resolvedToken" -F "attachment=@$assetPath" $uploadUrl | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "curl.exe failed uploading '$assetName' (exit $LASTEXITCODE)."
}