fix(vfx): classify hardwareless particle emitters once

This commit is contained in:
Erik 2026-07-27 00:03:31 +02:00
parent 921712f412
commit 5b3fb17775
8 changed files with 374 additions and 18 deletions

View file

@ -11,18 +11,57 @@ using DatReaderWriter.Lib.IO;
using DatReaderWriter.Options;
using DatReaderWriter.Types;
using DatAnimation = DatReaderWriter.DBObjs.Animation;
using DatParticleEmitter = DatReaderWriter.DBObjs.ParticleEmitter;
using DatPhysicsScript = DatReaderWriter.DBObjs.PhysicsScript;
string datDir = System.Environment.GetEnvironmentVariable("ACDREAM_DAT_DIR")
?? @"C:\Turbine\Asheron's Call";
using var dats = new DatCollection(datDir, DatAccessType.Read);
var physicsScripts = new RetailPhysicsScriptLoader(dats);
var animations = new RetailAnimationLoader(dats);
using var boundedDats = new AcDream.Content.DatCollectionAdapter(dats);
var physicsScripts = new RetailPhysicsScriptLoader(boundedDats);
var animations = new RetailAnimationLoader(boundedDats);
Console.WriteLine($"DAT metadata audit: {datDir}");
var failures = new List<string>();
var representativePes = new HashSet<uint>();
if (args.Contains("--emitters", StringComparer.OrdinalIgnoreCase))
{
uint[] emitterIds =
[
0x320002D6u,
0x320003B6u,
0x320003B7u,
0x320003B8u,
0x320003B9u,
];
var registry = new EmitterDescRegistry(boundedDats);
foreach (uint emitterId in emitterIds)
{
bool hasRaw = dats.Portal.Tree.TryGetFile(emitterId, out _);
DatParticleEmitter? emitter = SafeGet<DatParticleEmitter>(emitterId);
uint softwareGfxObjId = emitter?.GfxObjId.DataId ?? 0u;
uint hardwareGfxObjId = emitter?.HwGfxObjId.DataId ?? 0u;
bool hasSoftwareGfx = softwareGfxObjId != 0u
&& SafeGet<GfxObj>(softwareGfxObjId) is not null;
bool hasHardwareGfx = hardwareGfxObjId != 0u
&& SafeGet<GfxObj>(hardwareGfxObjId) is not null;
bool resolved = registry.TryGet(
emitterId,
out EmitterDesc? descriptor,
out EmitterDescResolutionFailure failure);
Console.WriteLine(
$"0x{emitterId:X8}: raw={hasRaw}, parsed={emitter is not null}, " +
$"gfx=0x{softwareGfxObjId:X8}, gfxParsed={hasSoftwareGfx}, " +
$"hwGfx=0x{hardwareGfxObjId:X8}, hwParsed={hasHardwareGfx}, " +
$"registry={resolved}, maxDist={descriptor?.MaxDegradeDistance:R}, " +
$"failure={failure.Kind}, related=0x{failure.RelatedDatId:X8}, " +
$"type={emitter?.EmitterType}/{emitter?.ParticleType}, " +
$"initial={emitter?.InitialParticles}, max={emitter?.MaxParticles}");
}
return;
}
var expectedSetups = new Dictionary<uint, (Vector3 Origin, float Radius, int Length, string Sha256)>
{
[0x02000124u] = (Vector3.Zero, 0.1f, 812, "630D19A9C79137F7BA90D01448B03E8F44D655FF77A4725792CB5660930A079E"),