Remove packaged runtime repository dependency
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\engine\Age.Engine\Age.Engine.csproj" />
|
||||
<EmbeddedResource Include="..\build\opcodes.json"
|
||||
LogicalName="Himegari.Runtime.opcodes.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
|
||||
<ProjectReference Include="..\engine\Age.Engine.Text.Windows\Age.Engine.Text.Windows.csproj" />
|
||||
@@ -21,4 +23,8 @@
|
||||
Link="FFmpeg-LICENSE.txt"
|
||||
CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
<Target Name="RequireGeneratedRuntimeMetadata" BeforeTargets="PrepareForBuild"
|
||||
Condition="!Exists('..\build\opcodes.json')">
|
||||
<Error Text="Missing generated runtime metadata '..\build\opcodes.json'. Run 'py -3.11 -X utf8 tools\opcodes_build.py --build' from age-reimpl before building Godot." />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
24
godot/HimegariRuntimeMetadata.cs
Normal file
24
godot/HimegariRuntimeMetadata.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Age.Engine.Model;
|
||||
using Age.Engine.Sys4;
|
||||
|
||||
/// <summary>
|
||||
/// Himegari profile metadata that must travel with every Godot build. Repository discovery belongs to
|
||||
/// development tooling; exported runtimes read the generator output embedded into this assembly.
|
||||
/// </summary>
|
||||
internal static class HimegariRuntimeMetadata
|
||||
{
|
||||
internal const string OpcodeTableResourceName = "Himegari.Runtime.opcodes.json";
|
||||
|
||||
internal static OpcodeTable LoadOpcodeTable()
|
||||
{
|
||||
Assembly assembly = typeof(HimegariRuntimeMetadata).Assembly;
|
||||
using Stream stream = assembly.GetManifestResourceStream(OpcodeTableResourceName)
|
||||
?? throw new InvalidDataException(
|
||||
$"Embedded runtime metadata '{OpcodeTableResourceName}' is missing from " +
|
||||
$"{assembly.GetName().Name}.");
|
||||
return OpcodeTableJson.Load(stream);
|
||||
}
|
||||
}
|
||||
@@ -275,7 +275,7 @@ public partial class Main : Godot.Control
|
||||
_clock.Speed = System.Math.Clamp(speed, 0.05, 8.0);
|
||||
GD.Print($"[renderer] retained backend={(_useGpuBackend ? "gpu" : "software")}");
|
||||
|
||||
var table = OpcodeTableJson.Load(Paths.OpcodesJson);
|
||||
var table = HimegariRuntimeMetadata.LoadOpcodeTable();
|
||||
// Persistence retains AGE's native filenames and formats, but the port owns one profile-root
|
||||
// interception point. Himegari's SYS4INI makes SAVEPATH the SAVE child of REGFILEPATH, so both
|
||||
// save payloads and SYS4REG.INI remain isolated together under Godot's user directory.
|
||||
@@ -333,7 +333,7 @@ public partial class Main : Godot.Control
|
||||
&& !scene.Equals("SYSTEM4", System.StringComparison.OrdinalIgnoreCase);
|
||||
if (_timelineLogPath != null) _timeline = new GodotTimelineLog(_timelineLogPath);
|
||||
if (!_selftest && pageMapPath == null)
|
||||
pageMapPath = System.IO.Path.Combine(Paths.Build, $"page-map-{scene.ToUpperInvariant()}.jsonl");
|
||||
pageMapPath = DefaultPageMapPath(scene);
|
||||
_locator = new PageLocatorState(scene, _selftest ? null : pageMapPath);
|
||||
_locatorHud.Visible = _locatorHudVisible;
|
||||
var resources = scripts != null
|
||||
@@ -2043,7 +2043,7 @@ public partial class Main : Godot.Control
|
||||
|
||||
private void RunSelfTest()
|
||||
{
|
||||
var table = OpcodeTableJson.Load(Paths.OpcodesJson);
|
||||
var table = HimegariRuntimeMetadata.LoadOpcodeTable();
|
||||
var (script, provider) = BuildSelfTestScene(table);
|
||||
var headless = new VirtualMachine(script, table, new CaptureHost(), null, provider);
|
||||
headless.Run();
|
||||
@@ -2381,6 +2381,20 @@ public partial class Main : Godot.Control
|
||||
GetTree().Quit(ok ? 0 : 1);
|
||||
}
|
||||
|
||||
private static string DefaultPageMapPath(string scene)
|
||||
{
|
||||
string fileName = $"page-map-{scene.ToUpperInvariant()}.jsonl";
|
||||
#if TOOLS
|
||||
// Preserve the established workspace handoff for editor/development runs.
|
||||
return System.IO.Path.Combine(Paths.Build, fileName);
|
||||
#else
|
||||
// Exports have no repository and may be installed read-only. Keep diagnostics with the
|
||||
// profile-owned Godot data instead of probing for an age-reimpl ancestor.
|
||||
return System.IO.Path.Combine(
|
||||
ProjectSettings.GlobalizePath("user://"), "diagnostics", "page-maps", fileName);
|
||||
#endif
|
||||
}
|
||||
|
||||
// A deterministic synthesized scene: show-text, wait-for-input (exercises the suspend plumbing), a
|
||||
// nested call-script into a synthetic subroutine (exercises call-script handling), shared globals.
|
||||
private static (Script, IScriptProvider) BuildSelfTestScene(OpcodeTable table)
|
||||
|
||||
Reference in New Issue
Block a user