feat(net): port retail physics spawn and event timestamps
Parse the complete PhysicsDesc plus F754/F755 packets, correct every PhysicsState bit, and gate all nine retail update channels with generation-safe immutable snapshots. Preserve ForcePosition, teleport, placement, velocity, parent, pickup, delete, and same-generation CreateObject ordering from the named client. Separate accepted logical lifecycle notifications from retained UI qualities, make GUID replacement and session reset clear every projection exactly once, and add packet, wraparound, malformed-input, parent FIFO, canonical-position, reconnect, and GUID-reuse conformance coverage. Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
parent
d53fe30ffe
commit
8a5d77f7f4
50 changed files with 3809 additions and 649 deletions
|
|
@ -61,14 +61,16 @@ public sealed class ObjDescEventTests
|
|||
// 4-byte align after AnimPartChanges (none here, so just align).
|
||||
while (bytes.Count % 4 != 0) bytes.Add(0);
|
||||
|
||||
// Trailing instance + visual-desc sequences (consumed but ignored).
|
||||
AppendU32(bytes, 0x12345678u);
|
||||
AppendU32(bytes, 0x9ABCDEF0u);
|
||||
// Trailing PhysicsTimestampPack: two u16 values.
|
||||
AppendU16(bytes, 0x5678);
|
||||
AppendU16(bytes, 0xDEF0);
|
||||
|
||||
var parsed = ObjDescEvent.TryParse(bytes.ToArray());
|
||||
|
||||
Assert.NotNull(parsed);
|
||||
Assert.Equal(0x50000001u, parsed!.Value.Guid);
|
||||
Assert.Equal((ushort)0x5678, parsed.Value.InstanceSequence);
|
||||
Assert.Equal((ushort)0xDEF0, parsed.Value.ObjDescSequence);
|
||||
|
||||
var md = parsed.Value.ModelData;
|
||||
Assert.Equal(0x0400007Eu, md.BasePaletteId);
|
||||
|
|
@ -87,6 +89,9 @@ public sealed class ObjDescEventTests
|
|||
Assert.Equal(3, md.TextureChanges[3].PartIndex);
|
||||
|
||||
Assert.Empty(md.AnimPartChanges);
|
||||
|
||||
Assert.Null(ObjDescEvent.TryParse(bytes.ToArray()[..^1]));
|
||||
Assert.Null(ObjDescEvent.TryParse([.. bytes, 0]));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -126,6 +131,13 @@ public sealed class ObjDescEventTests
|
|||
dest.AddRange(tmp.ToArray());
|
||||
}
|
||||
|
||||
private static void AppendU16(List<byte> dest, ushort value)
|
||||
{
|
||||
Span<byte> tmp = stackalloc byte[2];
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(tmp, value);
|
||||
dest.AddRange(tmp.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mirror of ACE's WritePackedDwordOfKnownType: strip the type prefix
|
||||
/// if it matches <paramref name="knownType"/>, then write as a 16- or
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue