perf(content): add typed prepared asset source

Introduce explicit loaded, missing, and corrupt outcomes over typed pak keys, validate package/DAT identity at open, add zero-I/O TOC probes, preserve cancellation, and route the package path through RuntimeOptions. Production injection follows in the next checkpoint.
This commit is contained in:
Erik 2026-07-24 14:52:12 +02:00
parent 7fb7189de8
commit c42f93b323
7 changed files with 750 additions and 8 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Globalization;
using System.IO;
namespace AcDream.App;
@ -26,6 +27,7 @@ namespace AcDream.App;
/// </remarks>
public sealed record RuntimeOptions(
string DatDir,
string PreparedAssetPath,
bool LiveMode,
string LiveHost,
int LivePort,
@ -72,6 +74,8 @@ public sealed record RuntimeOptions(
return new RuntimeOptions(
DatDir: datDir,
PreparedAssetPath: NullIfEmpty(env("ACDREAM_PAK_PATH"))
?? Path.Combine(datDir, "acdream.pak"),
LiveMode: IsExactlyOne(env("ACDREAM_LIVE")),
LiveHost: env("ACDREAM_TEST_HOST") ?? "127.0.0.1",
LivePort: TryParseInt(env("ACDREAM_TEST_PORT")) ?? 9000,