Route Unity Eve commands through typed runtime lowering

This commit is contained in:
Meta Vens 2026-06-21 11:20:51 +01:00
commit ae6269c497
2 changed files with 22 additions and 51 deletions

View file

@ -2418,9 +2418,9 @@ static void RequireMainMenuSettingsCommands(string root)
var requiredMainMenuAuthoritySymbols = new[]
{
"TrySendPlayerSettingsCommand(request, command.Command)",
"TrySendKnownAetheriaEveCommand(request, \"player-settings\")",
"AetheriaRuntimeMainMenuCommandKind.PlayerSettingsCommand",
"AetheriaRuntimeEveCommands.TrySendPlayerSettingsCommand(",
"AetheriaRuntimeEveCommands.TrySendKnownSurfaceCommand(",
"stateBoot.StateFilePath",
"\"unity-main-menu\""
};
@ -2436,7 +2436,8 @@ static void RequireMainMenuSettingsCommands(string root)
string.Join(", ", missingUiCalls));
}
if (source.Contains("TrySendPlayerSettingsCommand(request.Command, request.Payload)", StringComparison.Ordinal) ||
if (source.Contains("TrySendPlayerSettingsCommand(", StringComparison.Ordinal) ||
source.Contains("CommandKindForSurface(request)", StringComparison.Ordinal) ||
source.Contains("new AetheriaRuntimePlayerSettingsCommandBody", StringComparison.Ordinal))
{
throw new InvalidOperationException(
@ -2492,7 +2493,7 @@ static void RequireMainMenuSettingsCommands(string root)
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build",
"AetheriaEveUnitySurfaceHost.RenderRuntime(",
"AetheriaRuntimeMainMenuCommandKind.PlayerSettingsCommand",
"TrySendPlayerSettingsCommand(request, command.Command)"
"TrySendKnownAetheriaEveCommand(request, \"player-settings\")"
};
var missingMainMenuSymbols = requiredMainMenuSymbols
@ -2628,6 +2629,7 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
"string.Equals(request.Command, AetheriaRuntimeMainMenuCommands.BackToSettings",
"string.Equals(request.Command, AetheriaRuntimeMainMenuCommands.OpenRuntimeInputScreen",
"TrySendVerseHostCommand(request.Command)",
"CommandKindForSurface(request)",
"AetheriaRuntimeClientTargetCommands.IsKnown(request.Command",
"_nextMenu.panel.Title.text = \"settings\"",
"_nextMenu.panel.Title.text = TitleSubtitle(\"input\", \"settings\")",
@ -5550,13 +5552,11 @@ static void RequireVerseSettingsShellAndBridge(string root)
"AetheriaRuntimeMainMenuCommandKind.ClientTargetCommand",
"AetheriaRuntimeMainMenuCommandKind.VerseHostCommand",
"TryRequestClientTargetCommand(request)",
"TrySendVerseHostCommand(AetheriaRuntimeEveCommandClient.CommandKindForSurface(request))",
"TrySendVerseHostCommand(AetheriaRuntimeEveCommandKind command)",
"AetheriaRuntimeEveCommands.TrySendVerseHostCommand(",
"TrySendKnownAetheriaEveCommand(request, \"Verse-host\")",
"AetheriaRuntimeEveCommands.TrySendKnownSurfaceCommand(",
"AetheriaState.At(ActionGameManager.GameDataDirectory)",
".ClientTarget",
"AetheriaRuntimeClientTargetSurfaceCommands.TryRequest(",
"AetheriaRuntimeEveCommands.TrySendVerseHostCommand("
"AetheriaRuntimeClientTargetSurfaceCommands.TryRequest("
};
var missingMainMenuSymbols = requiredMainMenuSymbols
.Where(symbol => !mainMenu.Contains(symbol, StringComparison.Ordinal))
@ -5590,6 +5590,7 @@ static void RequireVerseSettingsShellAndBridge(string root)
"clientTarget.SyncReplica()",
"TryQueueVerseHostCommand(",
"TrySendVerseHostCommand(request.Command)",
"CommandKindForSurface(request)",
"AetheriaRuntimeClientTargetCommands.IsKnown(request.Command",
"AetheriaRuntimeVerseHostCommands.IsKnown(request.Command",
"new EveSurfaceCommandRequest(",
@ -6677,6 +6678,7 @@ static void RequireTypedEveCommandBodies(string root)
"TrySendLoadoutTemplateCommand(",
"TrySendKnownSurfaceCommand(",
"TryCreateKnownSurfaceCommand(",
"CreateVerseHostCommand(CommandKindForSurface(request), clientId)",
"CommandKindForSurface(",
"CommandText(",
"ToDocument(",
@ -6694,7 +6696,6 @@ static void RequireTypedEveCommandBodies(string root)
"command.InputSettings.ActionName",
"command.InputSettings.InputSystemPath",
"AetheriaRuntimeEveCommands.TrySendInputSettingsCommand(",
"AetheriaRuntimeEveCommands.TrySendVerseHostCommand(",
"AetheriaRuntimeEveCommands.TrySendLoadoutTemplateCommand(",
"AetheriaRuntimeEveCommands.TrySendKnownSurfaceCommand("
};

View file

@ -306,7 +306,7 @@ public class MainMenu : MonoBehaviour
ShowSettings();
return;
case AetheriaRuntimeMainMenuCommandKind.PlayerSettingsCommand:
if (!TrySendPlayerSettingsCommand(request, command.Command))
if (!TrySendKnownAetheriaEveCommand(request, "player-settings"))
{
Debug.LogWarning($"Unhandled player-settings command kind: {command.Kind}");
return;
@ -341,7 +341,7 @@ public class MainMenu : MonoBehaviour
return;
case AetheriaRuntimeMainMenuCommandKind.VerseHostCommand:
if (TrySendVerseHostCommand(AetheriaRuntimeEveCommandClient.CommandKindForSurface(request)))
if (TrySendKnownAetheriaEveCommand(request, "Verse-host"))
{
ShowVerseSettingsSurface();
}
@ -468,78 +468,48 @@ public class MainMenu : MonoBehaviour
}
}
private static bool TrySendVerseHostCommand(AetheriaRuntimeEveCommandKind command)
{
var stateBoot = CurrentStateBoot();
if (!CanSendLocalEveCommand(stateBoot, "Verse-host", command.ToString()))
return true;
try
{
if (!AetheriaRuntimeEveCommands.TrySendVerseHostCommand(
stateBoot.StateFilePath,
command,
"unity-main-menu",
out var submitted,
out var error))
{
Debug.LogError($"Failed to submit Aetheria Verse-host Eve command '{command}': {error}");
return true;
}
Debug.Log($"Submitted Aetheria Verse-host Eve command: {submitted!.CommandId}");
return true;
}
catch (Exception ex)
{
Debug.LogError($"Failed to send Aetheria Verse-host Eve command '{command}': {ex}");
return true;
}
}
private static bool TrySendPlayerSettingsCommand(
private static bool TrySendKnownAetheriaEveCommand(
EveSurfaceCommandRequest request,
string command)
string label)
{
if (request == null)
return false;
var stateBoot = CurrentStateBoot();
if (!CanSendLocalEveCommand(stateBoot, "player-settings", command))
if (!CanSendLocalEveCommand(stateBoot, label))
return true;
try
{
if (!AetheriaRuntimeEveCommands.TrySendPlayerSettingsCommand(
if (!AetheriaRuntimeEveCommands.TrySendKnownSurfaceCommand(
stateBoot.StateFilePath,
request,
"unity-main-menu",
out var submitted,
out var error))
{
Debug.LogError($"Failed to submit Aetheria player-settings Eve command '{command}': {error}");
Debug.LogError($"Failed to submit Aetheria {label} Eve command: {error}");
return true;
}
Debug.Log($"Submitted Aetheria player-settings Eve command: {submitted!.CommandId}");
Debug.Log($"Submitted Aetheria {label} Eve command: {submitted!.CommandId}");
return true;
}
catch (Exception ex)
{
Debug.LogError($"Failed to send Aetheria player-settings Eve command '{command}': {ex}");
Debug.LogError($"Failed to send Aetheria {label} Eve command: {ex}");
return true;
}
}
private static bool CanSendLocalEveCommand(
AetheriaRuntimeStateBootReport stateBoot,
string label,
string command)
string label)
{
if (!stateBoot.SupportsLocalStateFileRead || !stateBoot.StateFileExists)
{
Debug.LogWarning(
$"Cannot send {label} command '{command}' because the active target is not a readable local Verse state file.");
$"Cannot send {label} command because the active target is not a readable local Verse state file.");
return false;
}