Fix Soul Pass #1: single mouse-capture authority, raw OS argv window check, and release script hardening
This commit is contained in:
parent
385275f130
commit
8710bed79d
2 changed files with 37 additions and 18 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue