feat(content): bake and read flat collision assets
Append strict collision/topology payloads to the existing prepared package so later physics cutover can drop parsed DAT graphs without adding a second mapping or changing traversal behavior. The full 2,232,170-key catalog is deterministic across worker counts, exact-byte aliased, corruption-isolated, and cancellation-safe.
This commit is contained in:
parent
d9300c7854
commit
9cd42417a8
29 changed files with 2868 additions and 63 deletions
|
|
@ -0,0 +1,58 @@
|
|||
using AcDream.Content.Pak;
|
||||
using DatReaderWriter;
|
||||
using DatReaderWriter.Options;
|
||||
|
||||
namespace AcDream.Content.Tests;
|
||||
|
||||
public sealed class InstalledPreparedCollisionCatalogTests
|
||||
{
|
||||
[Fact]
|
||||
public void InstalledPackage_ContainsAndReadsCanonicalCollisionKeys()
|
||||
{
|
||||
string? datDir = ResolveDatDir();
|
||||
if (datDir is null)
|
||||
return;
|
||||
|
||||
string packagePath = Path.Combine(datDir, "acdream.pak");
|
||||
if (!File.Exists(packagePath))
|
||||
return;
|
||||
|
||||
using var dats = new DatCollection(datDir, DatAccessType.Read);
|
||||
using var adapter = new DatCollectionAdapter(dats);
|
||||
using var source =
|
||||
new PakPreparedAssetSource(packagePath, adapter);
|
||||
|
||||
Assert.Equal(
|
||||
PreparedAssetReadStatus.Loaded,
|
||||
source.ReadGfxObjCollision(0x0100_0A2Bu).Status);
|
||||
Assert.Equal(
|
||||
PreparedAssetReadStatus.Loaded,
|
||||
source.ReadSetupCollision(0x0200_0001u).Status);
|
||||
Assert.Equal(
|
||||
PreparedAssetReadStatus.Loaded,
|
||||
source.ReadCellStructureCollision(0xA9B4_013Fu).Status);
|
||||
Assert.Equal(
|
||||
PreparedAssetReadStatus.Loaded,
|
||||
source.ReadEnvCellTopology(0xA9B4_013Fu).Status);
|
||||
Assert.Equal(4, source.CollisionStats.Loaded);
|
||||
Assert.True(source.MappedVirtualBytes > 1L << 30);
|
||||
}
|
||||
|
||||
private static string? ResolveDatDir()
|
||||
{
|
||||
string? configured =
|
||||
Environment.GetEnvironmentVariable("ACDREAM_DAT_DIR");
|
||||
if (!string.IsNullOrWhiteSpace(configured)
|
||||
&& Directory.Exists(configured))
|
||||
{
|
||||
return configured;
|
||||
}
|
||||
|
||||
string fallback = Path.Combine(
|
||||
Environment.GetFolderPath(
|
||||
Environment.SpecialFolder.UserProfile),
|
||||
"Documents",
|
||||
"Asheron's Call");
|
||||
return Directory.Exists(fallback) ? fallback : null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue