Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/launcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,9 @@ the server's `mod-state.txt` (no backup, no client), which a stopped Gateway rea
applies within a second (LocalExile since 2026-11-07; an older Gateway applies it at its next start). While Gateway runs,
Windows and Linux show a restart notice when the checkout's source does not identify the live-choice hook; release installs
also show the notice because they have no source to verify. The checkbox represents the saved choice, not proof of a live
load. A switch holds the workspace lock and is refused while another operation holds it. **Update** and
load. A switch holds the workspace lock and is refused while another operation holds it. A program that is no LocalExile
server holding one of the servers' ports (Steam's helper on 8080, say) does not block mod changes, nor Modules, Leagues
or Accounts: it blocks only a start, and the message names it. **Update** and
**Update all** appear when a repository has a newer version. The ⋮ menu holds the rarer tools: Install from folder…,
Build all mods, Check live status (Python with Frida), Gateway log, the operation log, and the backup choice.

Expand Down
3 changes: 3 additions & 0 deletions docs/runtime-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ Accept a server as owned only when:

Do not adopt unrelated absolute build folders, identical relative DLL paths in another checkout, shared terminal
sessions or orphaned relative commands. Conflicting listeners block start/play; failed inventory queries fail closed.
A conflict names the program holding the port. When that program is no LocalExile server or watcher (Steam's helper on
8080, say), the snapshot also lists it in `PortsInUse`: it still blocks start/play, but not a change of mods, modules,
leagues or accounts, since it holds none of their files. A listener whose process Waypoint cannot name blocks everything.
This is a compatibility/ownership guard, not an isolation boundary against malicious same-user code forging command lines.

Gateway may instead be a verified `dotnet watch run --project src\GameServer.Gateway --non-interactive --` root,
Expand Down
4 changes: 3 additions & 1 deletion scripts/AccountBridge.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Offline account operations. RuntimeBridge owns the global writer lock and runtime/profile inventory.
function Assert-AccountsStopped($snapshot) {
Require (-not $snapshot.Conflicts.Count) ($snapshot.Conflicts -join "`n")
# A port held by a program that is no LocalExile server (PortsInUse) blocks a start, not this change of files.
$blocking = @($snapshot.Conflicts | Where-Object { $_ -notin @($snapshot.PortsInUse) })
Require (-not $blocking.Count) ($blocking -join "`n")
Require (-not @($snapshot.Services | Where-Object { $_.ProcessId -or $_.WatchProcessId }).Count) 'Close the game and stop LocalExile services before changing player accounts.'
Require (-not @($script:listeners | Where-Object LocalPort -eq 7000).Count) 'Stop the local account service before changing player accounts.'
$writers = @($script:processes | Where-Object {
Expand Down
4 changes: 3 additions & 1 deletion scripts/ContentBridge.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ function Save-ContentFile($snapshot) {
# A release older than 0.2.0-beta does not read these files (Get-ContentEnvironment); what a newer one takes is checked
# below, by what the environment allows.
Require (-not (Test-LegacyReleaseMods)) 'This release is older than module and league editing. Update LocalExile to edit them.'
Require (-not $snapshot.Conflicts.Count) ($snapshot.Conflicts -join "`n")
# A port held by a program that is no LocalExile server (PortsInUse) blocks a start, not this change of files.
$blocking = @($snapshot.Conflicts | Where-Object { $_ -notin @($snapshot.PortsInUse) })
Require (-not $blocking.Count) ($blocking -join "`n")
$environment = Get-ContentEnvironment
$staged = Get-StagedModPath $ModStaged -File
Require ((Get-Item -LiteralPath $staged).Length -le 262144) 'Settings exceed 256 KB.'
Expand Down
4 changes: 3 additions & 1 deletion scripts/ModBridge.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ function Invoke-ModOperation($snapshot) {
if ($Action -in @('InstallMod','SaveModSettings','UninstallMod')) {
Require (-not (Test-LegacyReleaseMods)) 'This release does not declare compatibility with downloadable mods. Use a current source checkout to install or update mods.'
}
Require (-not $snapshot.Conflicts.Count) ($snapshot.Conflicts -join "`n")
# A port held by a program that is no LocalExile server (PortsInUse) blocks a start, not this change of files.
$blocking = @($snapshot.Conflicts | Where-Object { $_ -notin @($snapshot.PortsInUse) })
Require (-not $blocking.Count) ($blocking -join "`n")
$environment = Get-ModEnvironment $snapshot.Services
Require $environment.Supported 'This LocalExile revision has no supported mod host.'
$gateway = $snapshot.Services | Where-Object Name -eq 'Gateway'
Expand Down
27 changes: 22 additions & 5 deletions scripts/RuntimeBridge.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,25 @@ function Descends-From($process, $ancestor) {
function Owned-WatchedGateway($process, $watcher) {
return $process -and (Same-Path $process.ExecutablePath (At 'src\GameServer.Gateway\bin\Debug\net10.0\GameServer.Gateway.exe')) -and (Descends-From $process $watcher)
}
# A LocalExile server or watcher, of this checkout or any other: what live.ps1 stops by name.
function Test-ServerProcess($process) {
if ($process.Name -notin @('dotnet.exe','cmd.exe','GameServer.Gateway.exe','GameServer.Auth.exe','GameServer.Patch.exe')) { return $false }
return $process.CommandLine -match 'GameServer\.(Gateway|Auth|Patch)(\.dll|\.exe|[\\\s"]|$)' -and $process.CommandLine -notmatch '\s(build|test)\s|GameServer\.(Gateway|Auth|Patch)\.Tests'
}
# A server's port held by a process this checkout does not own: the message names the program. OtherProgram is a program
# that is no LocalExile server (Steam's helper on 8080, say): it blocks a start, but not a change of mods, modules, leagues
# or accounts, since it holds none of their files. A process Waypoint cannot name is never one.
function Get-PortConflict([int]$port, [string]$name, [int]$owner) {
$holder = $script:byId[$owner]
$named = $holder -and $holder.Name
$message = if ($named) { "Port $port is used by $($holder.Name) (PID $owner). $name needs this port." }
else { "Port $port is used by another program (PID $owner). $name needs this port." }
return [pscustomobject]@{ Message=$message; OtherProgram=($named -and -not (Test-ServerProcess $holder)) }
}
function Get-Snapshot {
Get-Inventory
$conflicts = [Collections.Generic.List[string]]::new()
$portsInUse = [Collections.Generic.List[string]]::new()
$services = @()
$watchers = @($script:processes | Where-Object { Owned-Watcher $_ })
if ($watchers.Count -gt 1) { $conflicts.Add('Multiple Gateway watchers belong to this checkout.') }
Expand All @@ -242,7 +258,9 @@ function Get-Snapshot {
if (-not $onPort.Count) { $ready = $false }
foreach ($connection in $onPort) {
if (-not $process -or $connection.OwningProcess -ne $process.ProcessId) {
$conflicts.Add("Port $port is occupied by another process (PID $($connection.OwningProcess)); $name is not owned by this checkout.")
$held = Get-PortConflict $port $name ([int]$connection.OwningProcess)
$conflicts.Add($held.Message)
if ($held.OtherProgram) { $portsInUse.Add($held.Message) }
$ready = $false
}
}
Expand All @@ -257,8 +275,7 @@ function Get-Snapshot {
# Upstream live.ps1 stops processes by name before launch, even before they hold a port.
# Block foreign server/watch processes as well as foreign listeners so upstream cannot kill them.
foreach ($p in $script:processes) {
if ($p.Name -notin @('dotnet.exe','cmd.exe','GameServer.Gateway.exe','GameServer.Auth.exe','GameServer.Patch.exe')) { continue }
if ($p.CommandLine -notmatch 'GameServer\.(Gateway|Auth|Patch)(\.dll|\.exe|[\\\s"]|$)' -or $p.CommandLine -match '\s(build|test)\s|GameServer\.(Gateway|Auth|Patch)\.Tests') { continue }
if (-not (Test-ServerProcess $p)) { continue }
$ownedProcess = $false
foreach ($s in $services) {
if ($p.ProcessId -eq $s.ProcessId) { $ownedProcess = $true }
Expand Down Expand Up @@ -309,10 +326,10 @@ function Get-Snapshot {
} catch { $sourceLabel = '' }
}
$accountBlock = ''
try { Assert-AccountsStopped ([pscustomobject]@{ Conflicts=$conflicts.ToArray(); Services=$services }) }
try { Assert-AccountsStopped ([pscustomobject]@{ Conflicts=$conflicts.ToArray(); PortsInUse=$portsInUse.ToArray(); Services=$services }) }
catch { $accountBlock = $_.Exception.Message }
@{ Root=$script:root; Profile=$script:profile; SaveDatabase=$script:savePath; AuthDatabase=$script:authPath; EarlierSaveDatabase=$script:earlierSavePath; SourceCommit=$commit; SourceBranch=$branch; AccountWriteBlockedReason=$accountBlock;
SourceLabel=$sourceLabel; BuildCommit=($builds -join '; '); Requirements=@($requirements); Services=@($services); Conflicts=@($conflicts.ToArray()); ModEnvironment=(Get-ModEnvironment $services); Capture=(Get-CaptureSnapshot $services); Content=(Get-ContentEnvironment) }
SourceLabel=$sourceLabel; BuildCommit=($builds -join '; '); Requirements=@($requirements); Services=@($services); Conflicts=@($conflicts.ToArray()); PortsInUse=@($portsInUse.ToArray()); ModEnvironment=(Get-ModEnvironment $services); Capture=(Get-CaptureSnapshot $services); Content=(Get-ContentEnvironment) }
}
function Get-SourceSelectionPath {
$sha = [Security.Cryptography.SHA256]::Create()
Expand Down
3 changes: 2 additions & 1 deletion src/Launcher.Core/Localization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ static readonly (string Pattern, string Format)[] Descriptions =
(@"\A(.+) \| hot reload watcher PID (\d+)\z", "{0} | hot reload watcher PID {1}"),
(@"\A(.+) · Checked (.+)\z", "{0} · Checked {1}"),
(@"\AMultiple (Patch|Gateway|Auth) processes belong to this checkout\.\z", "Multiple {0} processes belong to this checkout."),
(@"\APort (\d+) is occupied by another process \(PID (\d+)\); (Patch|Gateway|Auth) is not owned by this checkout\.\z", "Port {0} is occupied by another process (PID {1}); {2} is not owned by this checkout."),
(@"\APort (\d+) is used by another program \(PID (\d+)\)\. (Patch|Gateway|Auth) needs this port\.\z", "Port {0} is used by another program (PID {1}). {2} needs this port."),
(@"\APort (\d+) is used by (.+) \(PID (\d+)\)\. (Patch|Gateway|Auth) needs this port\.\z", "Port {0} is used by {1} (PID {2}). {3} needs this port."),
(@"\AAnother server or watcher is running \(PID (\d+)\)\. Stop it from its own installation before launching here\.\z", "Another server or watcher is running (PID {0}). Stop it from its own installation before launching here.")
];
public static string Describe(string source)
Expand Down
5 changes: 4 additions & 1 deletion src/Launcher.Core/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ public sealed record ServiceStatus(string Name, string Status, int ProcessId, st
}
public sealed record RuntimeSnapshot(string Root, string Profile, string SaveDatabase, string SourceCommit,
string SourceBranch, string BuildCommit, Requirement[] Requirements, ServiceStatus[] Services, string[] Conflicts, string SourceLabel = "", ModEnvironment? ModEnvironment = null, string AccountWriteBlockedReason = "", CaptureSnapshot? Capture = null,
ContentEnvironment? Content = null, string AuthDatabase = "", string EarlierSaveDatabase = "")
ContentEnvironment? Content = null, string AuthDatabase = "", string EarlierSaveDatabase = "", string[]? PortsInUse = null)
{
public bool SetupReady => Requirements.All(r => r.Ready);
public bool ServersReady => Services.Where(s => s.Name != "Game").All(s => s.Status == "Ready");
public bool HasServers => Services.Any(s => s.Name != "Game" && s.IsRunning);
public bool GameRunning => Services.Any(s => s.Name == "Game" && s.ProcessId != 0);
public bool SafeToLaunch => SetupReady && Conflicts.Length == 0;
/// <summary>The conflicts that block a change of mods, modules, leagues or accounts: all but a port held by a program
/// that is no LocalExile server (<see cref="PortsInUse"/>), which blocks only a start.</summary>
public string[] EditConflicts => [.. Conflicts.Where(c => PortsInUse?.Contains(c) != true)];
}

public sealed record BridgeResult(bool Ok, string Message, RuntimeSnapshot? Snapshot, string? FailedStage = null, AccountInventory? AccountData = null,
Expand Down
9 changes: 6 additions & 3 deletions src/Launcher.Core/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,9 @@ This checkout has modified tracked files.</value>
<data name="Text_431027eb3edb" xml:space="preserve">
<value>Open Waypoint</value>
</data>
<data name="Text_4322f210b141" xml:space="preserve">
<value>Port {0} is used by another program (PID {1}). {2} needs this port.</value>
</data>
<data name="Text_433e00b3f109" xml:space="preserve">
<value>Clears the view; the file is not changed</value>
</data>
Expand Down Expand Up @@ -2563,9 +2566,6 @@ This checkout has modified tracked files.</value>
<data name="Text_46538b55589e" xml:space="preserve">
<value>Level up</value>
</data>
<data xml:space="preserve" name="Text_4660c28f96b5">
<value>Port {0} is occupied by another process (PID {1}); {2} is not owned by this checkout.</value>
</data>
<data name="Text_468422a52e4d" xml:space="preserve">
<value>LocalExile names no Steam download for this version.</value>
</data>
Expand Down Expand Up @@ -2764,6 +2764,9 @@ This checkout has modified tracked files.</value>
<data name="Text_4b3207d58add" xml:space="preserve">
<value>Waypoint downloads {0:0} MB, checks it, and puts it over this install. Your characters, keys and game client are kept, and your saves are copied first when Automatic backups is on. The next Play may extract game data again.</value>
</data>
<data name="Text_4b6c92ba89e3" xml:space="preserve">
<value>Port {0} is used by {1} (PID {2}). {3} needs this port.</value>
</data>
<data name="Text_4b72b1793476" xml:space="preserve">
<value>{0} already has files in it, so Waypoint will not replace it with a link.</value>
</data>
Expand Down
9 changes: 6 additions & 3 deletions src/Launcher.Core/Resources/Strings.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,9 @@
<data name="Text_431027eb3edb" xml:space="preserve">
<value>Открыть Waypoint</value>
</data>
<data name="Text_4322f210b141" xml:space="preserve">
<value>Порт {0} занят другой программой (PID {1}). Этот порт нужен {2}.</value>
</data>
<data name="Text_433e00b3f109" xml:space="preserve">
<value>Очищает окно; файл не меняется</value>
</data>
Expand Down Expand Up @@ -2563,9 +2566,6 @@
<data name="Text_46538b55589e" xml:space="preserve">
<value>Новый уровень</value>
</data>
<data xml:space="preserve" name="Text_4660c28f96b5">
<value>Порт {0} занят другим процессом (PID {1}); {2} не принадлежит этой установке.</value>
</data>
<data name="Text_468422a52e4d" xml:space="preserve">
<value>LocalExile не указывает загрузку из Steam для этой версии.</value>
</data>
Expand Down Expand Up @@ -2764,6 +2764,9 @@
<data name="Text_4b3207d58add" xml:space="preserve">
<value>Waypoint скачает {0:0} МБ, проверит их и установит поверх текущей версии. Персонажи, ключи и клиент игры сохранятся, а если включено автоматическое резервное копирование, сначала будет сделана копия сохранений. При следующем запуске данные игры могут извлекаться заново.</value>
</data>
<data name="Text_4b6c92ba89e3" xml:space="preserve">
<value>Порт {0} занят программой {1} (PID {2}). Этот порт нужен {3}.</value>
</data>
<data name="Text_4b72b1793476" xml:space="preserve">
<value>В {0} уже есть файлы, поэтому Waypoint не будет заменять эту папку ссылкой.</value>
</data>
Expand Down
9 changes: 6 additions & 3 deletions src/Launcher.Core/Resources/Strings.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,9 @@
<data name="Text_431027eb3edb" xml:space="preserve">
<value>打开 Waypoint</value>
</data>
<data name="Text_4322f210b141" xml:space="preserve">
<value>端口 {0} 已被另一个程序(PID {1})占用。{2} 需要此端口。</value>
</data>
<data name="Text_433e00b3f109" xml:space="preserve">
<value>清空视图;文件不会被更改</value>
</data>
Expand Down Expand Up @@ -2563,9 +2566,6 @@
<data name="Text_46538b55589e" xml:space="preserve">
<value>升级</value>
</data>
<data name="Text_4660c28f96b5" xml:space="preserve">
<value>端口 {0} 已被另一个进程(PID {1})占用;{2} 不属于此源码副本。</value>
</data>
<data name="Text_468422a52e4d" xml:space="preserve">
<value>LocalExile 没有为此版本提供 Steam 下载信息。</value>
</data>
Expand Down Expand Up @@ -2764,6 +2764,9 @@
<data name="Text_4b3207d58add" xml:space="preserve">
<value>Waypoint 会下载 {0:0} MB,校验后覆盖到当前安装上。你的角色、密钥和游戏客户端都会保留;如果开启了“自动备份”,还会先复制你的存档。下次“开始游戏”时可能会重新提取游戏数据。</value>
</data>
<data name="Text_4b6c92ba89e3" xml:space="preserve">
<value>端口 {0} 已被 {1}(PID {2})占用。{3} 需要此端口。</value>
</data>
<data name="Text_4b72b1793476" xml:space="preserve">
<value>{0} 中已有文件,因此 Waypoint 不会将其替换为链接。</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion src/Waypoint.Linux/Views/AccountsTab.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void AccountSelected(object? sender, SelectionChangedEventArgs e)
void ShowAccess()
{
var state = _shared.Workspace.Latest;
bool stopped = state is { HasServers: false, GameRunning: false, Conflicts.Length: 0, AccountWriteBlockedReason.Length: 0 };
bool stopped = state is { HasServers: false, GameRunning: false, EditConflicts.Length: 0, AccountWriteBlockedReason.Length: 0 };
bool available = stopped && !_shared.IsLiveRunning;
foreach (var button in AccountActions.Children.OfType<Button>())
button.IsEnabled = button == CreateButton ? available && _inventory?.CanRegister == true : available && _inventory?.Writable == true && Selected is not null;
Expand Down
2 changes: 1 addition & 1 deletion src/Waypoint.Linux/Views/ModsTab.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void Render()
}

/// <summary>Whether a mod operation can start: a checkout with a mod host, nothing else running, no conflicts.</summary>
bool CanUse => State is { ModEnvironment.Supported: true, Conflicts.Length: 0 } && !_busy && !Repo.LegacyReleaseMods;
bool CanUse => State is { ModEnvironment.Supported: true, EditConflicts.Length: 0 } && !_busy && !Repo.LegacyReleaseMods;

void Filter()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Waypoint/AccountsTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void AccountSelected(object sender, SelectionChangedEventArgs e)
void ShowAccess()
{
var state = _shared.Workspace.Latest;
bool stopped = state is { HasServers: false, GameRunning: false, Conflicts.Length: 0, AccountWriteBlockedReason.Length: 0 };
bool stopped = state is { HasServers: false, GameRunning: false, EditConflicts.Length: 0, AccountWriteBlockedReason.Length: 0 };
bool available = stopped && !_shared.IsLiveRunning;
foreach (var button in AccountActions.Children.OfType<Button>())
button.IsEnabled = button == CreateButton ? available && _inventory?.CanRegister == true : available && _inventory?.Writable == true && Selected is not null;
Expand Down
2 changes: 1 addition & 1 deletion src/Waypoint/ModBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public async Task<string> ReadmeAsync(BrowseItem? item, ModEntry? installed)
/// <summary>Turns an installed mod on or off: its line in the server's mod-state.txt, at once (no backup, no client).</summary>
public Task<bool> SetEnabledAsync(ModEntry mod, bool enabled) => shared.RunExclusiveAsync(L.Text("Save mod choice"), () =>
{
if (shared.Workspace.Latest is { Conflicts.Length: > 0 } state) throw new InvalidOperationException(string.Join("\n", state.Conflicts));
if (shared.Workspace.Latest is { EditConflicts.Length: > 0 } state) throw new InvalidOperationException(string.Join("\n", state.EditConflicts));
if (shared.Workspace.Latest?.ModEnvironment is not { Supported: true } environment) throw new InvalidOperationException(L.Text("This revision does not have a supported mod host."));
ModCatalog.WriteChoice(environment.Folder, mod.Id, enabled);
return Task.CompletedTask;
Expand Down
Loading
Loading