feat(vfx): decode retail hooks and typed tables

Replace the incomplete package path with one DatCollection-backed compatibility seam for PhysicsScripts and Animations. Preserve CreateBlockingParticle's inherited payload and following cursor, route every production and audit consumer through the corrected loaders, and apply retail's post-UnPack StartTime ordering.

Add exact stored-order PhysicsScriptTable upper-threshold resolution, high-byte DID and embedded-ID validation, plus live effect profiles with Setup-to-PhysicsDesc precedence across top-level and attached entity lifetimes. Keep blocking execution deferred and narrow TS-11 accordingly.

Pin synthetic malformed/cursor/order fixtures, installed-DAT blocking and recall audits, high-index IDs, IEEE boundaries, profile teardown, and ordinary decoder parity; synchronize architecture, inventory, milestones, roadmap, research, and memory.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-14 08:17:44 +02:00
parent 8dd996053d
commit 363e046112
31 changed files with 1102 additions and 73 deletions

View file

@ -0,0 +1,73 @@
using AcDream.App.World;
using AcDream.Core.Net.Messages;
using AcDream.Core.Vfx;
using DatReaderWriter.DBObjs;
namespace AcDream.App.Rendering.Vfx;
/// <summary>
/// DAT defaults and the currently installed network effect description for
/// one logical entity incarnation.
/// </summary>
/// <remarks>
/// Retail precedence comes from <c>CPhysicsObj::InitDefaults</c>
/// (<c>0x005139D0</c>) followed by <c>CPhysicsObj::set_description</c>
/// (<c>0x00514F40</c>). Setup's direct default PES runs during initialization;
/// a network PhysicsDesc then unconditionally replaces the typed table, even
/// when PeTable was absent or zero.
/// </remarks>
public sealed class EntityEffectProfile : ILiveEntityEffectProfile
{
private EntityEffectProfile(Setup setup)
{
SetupDefaultScriptDid = NormalizePhysicsScriptDid(setup.DefaultScript.DataId);
CurrentPhysicsScriptTableDid = NormalizeTableDid((uint)setup.DefaultScriptTable);
}
public uint? SetupDefaultScriptDid { get; }
public uint? CurrentPhysicsScriptTableDid { get; private set; }
public uint RawDefaultScriptType { get; private set; }
public float DefaultScriptIntensity { get; private set; }
public bool HasNetworkDescription { get; private set; }
/// <summary>Setup defaults remain active for a DAT/static object.</summary>
public static EntityEffectProfile CreateDatStatic(Setup setup)
{
ArgumentNullException.ThrowIfNull(setup);
return new EntityEffectProfile(setup);
}
/// <summary>
/// Applies Setup initialization followed by the live PhysicsDesc, matching
/// retail construction order.
/// </summary>
public static EntityEffectProfile CreateLive(
Setup setup,
PhysicsSpawnData physics)
{
ArgumentNullException.ThrowIfNull(setup);
var profile = new EntityEffectProfile(setup);
profile.ApplyNetworkDescription(physics);
return profile;
}
/// <summary>
/// Replaces all network-owned effect defaults. Nullable wire fields use
/// PhysicsDesc's initialized zero values; they never resurrect Setup's
/// typed table.
/// </summary>
public void ApplyNetworkDescription(PhysicsSpawnData physics)
{
CurrentPhysicsScriptTableDid = NormalizeTableDid(
physics.PhysicsScriptTableId.GetValueOrDefault());
RawDefaultScriptType = physics.DefaultScriptType.GetValueOrDefault();
DefaultScriptIntensity = physics.DefaultScriptIntensity.GetValueOrDefault();
HasNetworkDescription = true;
}
private static uint? NormalizePhysicsScriptDid(uint did) =>
PhysicsScriptTableResolver.IsPhysicsScriptDid(did) ? did : null;
private static uint? NormalizeTableDid(uint did) =>
PhysicsScriptTableResolver.IsPhysicsScriptTableDid(did) ? did : null;
}