t2-demo-parser 1.0.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +201 -87
- package/dist/DemoParser.d.ts.map +1 -1
- package/dist/DemoParser.js +43 -8
- package/dist/DemoParser.js.map +1 -1
- package/dist/GhostManager.d.ts.map +1 -1
- package/dist/GhostManager.js +36 -68
- package/dist/GhostManager.js.map +1 -1
- package/dist/GhostStateAccumulator.d.ts +36 -0
- package/dist/GhostStateAccumulator.d.ts.map +1 -0
- package/dist/GhostStateAccumulator.js +124 -0
- package/dist/GhostStateAccumulator.js.map +1 -0
- package/dist/GhostStateAccumulator.test.d.ts +2 -0
- package/dist/GhostStateAccumulator.test.d.ts.map +1 -0
- package/dist/GhostStateAccumulator.test.js +201 -0
- package/dist/GhostStateAccumulator.test.js.map +1 -0
- package/dist/LiveParser.d.ts +39 -1
- package/dist/LiveParser.d.ts.map +1 -1
- package/dist/LiveParser.js +43 -1
- package/dist/LiveParser.js.map +1 -1
- package/dist/PacketParser.d.ts +23 -2
- package/dist/PacketParser.d.ts.map +1 -1
- package/dist/PacketParser.js +62 -19
- package/dist/PacketParser.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,2CAA2C;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAClC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CA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B,EAAK,WAAW;IAC3C,qBAAqB,EAAW,WAAW;IAC3C,sBAAsB,EAAU,WAAW;IAC3C,iBAAiB,EAAe,WAAW;IAC3C,iBAAiB,EAAe,WAAW;IAC3C,mBAAmB,EAAa,WAAW;IAC3C,qBAAqB,EAAW,WAAW;IAC3C,qBAAqB,EAAW,WAAW;IAC3C,oBAAoB,EAAY,WAAW;IAC3C,iBAAiB,EAAe,WAAW;IAC3C,iBAAiB,EAAe,WAAW;IAC3C,eAAe,EAAiB,WAAW;CACnC,CAAC;AAEX,+DAA+D;AAC/D,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,CAAK,sCAAsC;AAC5E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,CAAC,uCAAuC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,CAAO,6BAA6B;AACnE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,CAAO,kCAAkC;AAExE,yBAAyB;AACzB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC","sourcesContent":["import type { ParsedData } from \"./ClassRegistry.js\";\n\n// Key constants from the V12 engine source\nexport const MaxGhostCount = 1024;\nexport const GhostIdBitSize = 10;\nexport const NetStringTableMaxStrings = 4096;\nexport const StringIdBitSize = 12;\nexport const NetEventClassBitSize = 6;\nexport const NetEventClassFirst = 255;\nexport const NetObjectClassBitSize = 7;\nexport const NetObjectClassFirst = 0;\nexport const MaxPacketDataSize = 1500;\nexport const MaxTriggerKeys = 6;\nexport const MoveCountBits = 5;\nexport const MaxMoveCount = 30;\n\n// GhostingMessageEvent message types (NetConnection::GhostMSG enum).\nexport const GhostMsgGhostAlwaysDone = 0;\nexport const GhostMsgGhostAlwaysAck = 1;\nexport const GhostMsgEndGhosting = 2;\nexport const GhostMsgGhostingActive = 3;\n\n// DataBlock constants.\n// For SimDataBlockEvent header (initial block + events), the binary uses:\n// readInt(11) objectId, readInt(7) classId, readInt(11) index, readInt(12) total.\n// For DataBlock references in payloads (readDataBlockRef), V12 source uses:\n// readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast).\nexport const DataBlockObjectIdFirst = 3;\nexport const DataBlockObjectIdBitSize = 10;\nexport const DataBlockObjectIdLast =\n DataBlockObjectIdFirst + (1 << DataBlockObjectIdBitSize) - 1; // 1026\nexport const DataBlockClassFirst = 128;\nexport const DataBlockClassBitSize = 7;\n\n// SimDataBlockEvent header bit sizes (from decompiled binary).\n// These are the HEADER field sizes, which differ from the payload reference sizes.\n// readClassInfo uses getNextPow2(0x800=2048) → getBitCount(2048)=11 for objectId.\n// The classId, index, and total are read with literal values 7, 11, 12 (from 0x80, 0xb, 0xc).\nexport const SimDBEventObjectIdBits = 11;\nexport const SimDBEventClassIdBits = 7; // same as DataBlockClassBitSize\nexport const SimDBEventIndexBits = 11;\nexport const SimDBEventTotalBits = 12;\n\n// Deterministic DataBlock class name mapping, derived from machine code\n// analysis of the Tribes 2 binary (build 25034). All 54 DataBlock classes\n// with mClassIdBase=0x80 are sorted by C strcmp (ASCII byte order), which\n// is how AbstractClassRep::initialize assigns sequential classIds.\n// Index N in this array corresponds to classId N (group-local) or\n// classId N+128 (V12 global format).\nexport const DataBlockClassNames: readonly string[] = [\n \"AudioDescription\", // 0 / 128\n \"AudioEnvironment\", // 1 / 129\n \"AudioProfile\", // 2 / 130\n \"AudioSampleEnvironment\", // 3 / 131\n \"BombProjectileData\", // 4 / 132\n \"CameraData\", // 5 / 133\n \"CannedChatItem\", // 6 / 134\n \"CommanderIconData\", // 7 / 135\n \"DebrisData\", // 8 / 136\n \"DecalData\", // 9 / 137\n \"ELFProjectileData\", // 10 / 138\n \"EffectProfile\", // 11 / 139\n \"EnergyProjectileData\", // 12 / 140\n \"ExplosionData\", // 13 / 141\n \"FireballAtmosphereData\", // 14 / 142\n \"FlareProjectileData\", // 15 / 143\n \"FlyingVehicleData\", // 16 / 144\n \"ForceFieldBareData\", // 17 / 145\n \"GameBaseData\", // 18 / 146\n \"GrenadeProjectileData\", // 19 / 147\n \"HoverVehicleData\", // 20 / 148\n \"ItemData\", // 21 / 149\n \"JetEffectData\", // 22 / 150\n \"LightningData\", // 23 / 151\n \"LinearFlareProjectileData\",// 24 / 152\n \"LinearProjectileData\", // 25 / 153\n \"MissionMarkerData\", // 26 / 154\n \"ParticleData\", // 27 / 155\n \"ParticleEmissionDummyData\",// 28 / 156\n \"ParticleEmitterData\", // 29 / 157\n \"PlayerData\", // 30 / 158\n \"PrecipitationData\", // 31 / 159\n \"ProjectileData\", // 32 / 160\n \"RepairProjectileData\", // 33 / 161\n \"RunningLightData\", // 34 / 162\n \"SeekerProjectileData\", // 35 / 163\n \"SensorData\", // 36 / 164\n \"ShapeBaseData\", // 37 / 165\n \"ShapeBaseImageData\", // 38 / 166\n \"ShockLanceProjectileData\", // 39 / 167\n \"ShockwaveData\", // 40 / 168\n \"SimDataBlock\", // 41 / 169\n \"SniperProjectileData\", // 42 / 170\n \"SplashData\", // 43 / 171\n \"StaticShapeData\", // 44 / 172\n \"StationFXPersonalData\", // 45 / 173\n \"StationFXVehicleData\", // 46 / 174\n \"TSShapeConstructor\", // 47 / 175\n \"TargetProjectileData\", // 48 / 176\n \"TracerProjectileData\", // 49 / 177\n \"TriggerData\", // 50 / 178\n \"TurretData\", // 51 / 179\n \"TurretImageData\", // 52 / 180\n \"WheeledVehicleData\", // 53 / 181\n] as const;\n\n// Deterministic NetObject (ghost) class name mapping, derived from machine code\n// analysis of the Tribes 2 binary (build 25034). All 53 NetObject classes\n// with mClassIdBase=0 are sorted by C strcmp (ASCII byte order), which\n// is how AbstractClassRep::initialize assigns sequential classIds.\n// Index N in this array corresponds to classId N (NetObjectClassFirst + N).\n// Verified against decompiled FUN_00423cb0 class table initialization.\n// Vehicle is NOT a ghost class (classGroup=0xFFFFFFFF in binary).\nexport const NetObjectClassNames: readonly string[] = [\n \"AIObjective\", // 0\n \"AudioEmitter\", // 1\n \"BeaconObject\", // 2\n \"BombProjectile\", // 3\n \"Camera\", // 4\n \"Debris\", // 5\n \"ELFProjectile\", // 6\n \"EnergyProjectile\", // 7\n \"FireballAtmosphere\", // 8\n \"FlareProjectile\", // 9\n \"FlyingVehicle\", // 10\n \"ForceFieldBare\", // 11\n \"GameBase\", // 12\n \"GrenadeProjectile\", // 13\n \"HoverVehicle\", // 14\n \"InteriorInstance\", // 15\n \"Item\", // 16\n \"Lightning\", // 17\n \"LinearFlareProjectile\", // 18\n \"LinearProjectile\", // 19\n \"Marker\", // 20\n \"MissionArea\", // 21\n \"MissionMarker\", // 22\n \"ParticleEmissionDummy\", // 23\n \"PhysicalZone\", // 24\n \"Player\", // 25\n \"Precipitation\", // 26\n \"Projectile\", // 27\n \"RepairProjectile\", // 28\n \"ScopeAlwaysShape\", // 29\n \"SeekerProjectile\", // 30\n \"ShapeBase\", // 31\n \"ShockLanceProjectile\", // 32\n \"Shockwave\", // 33\n \"SimpleNetObject\", // 34\n \"Sky\", // 35\n \"SniperProjectile\", // 36\n \"SpawnSphere\", // 37\n \"Splash\", // 38\n \"StaticShape\", // 39\n \"StationFXPersonal\", // 40\n \"StationFXVehicle\", // 41\n \"Sun\", // 42\n \"TSStatic\", // 43\n \"TargetProjectile\", // 44\n \"TerrainBlock\", // 45\n \"TracerProjectile\", // 46\n \"Trigger\", // 47\n \"Turret\", // 48\n \"VehicleBlocker\", // 49\n \"WaterBlock\", // 50\n \"WayPoint\", // 51\n \"WheeledVehicle\", // 52\n] as const;\n\n// Deterministic NetEvent class name mapping, derived from machine code\n// analysis of the Tribes 2 binary (build 25034). All 26 NetEvent classes\n// with mClassIdBase=0xFF are sorted by C strcmp (ASCII byte order), which\n// is how AbstractClassRep::initialize assigns sequential classIds.\n// Index N in this array corresponds to classId NetEventClassFirst + N (255 + N).\nexport const NetEventClassNames: readonly string[] = [\n \"CRCChallengeEvent\", // 0 / 255\n \"CRCChallengeResponseEvent\", // 1 / 256\n \"FogChallengeEvent\", // 2 / 257\n \"GhostAlwaysObjectEvent\", // 3 / 258\n \"GhostingMessageEvent\", // 4 / 259\n \"GravityEvent\", // 5 / 260\n \"LightningStrikeEvent\", // 6 / 261\n \"NetStringEvent\", // 7 / 262\n \"PathManagerEvent\", // 8 / 263\n \"RemoteCommandEvent\", // 9 / 264\n \"RemoveClientTargetTypeEvent\", // 10 / 265\n \"ResetClientTargetsEvent\", // 11 / 266\n \"SensorGroupColorEvent\", // 12 / 267\n \"SetMissionCRCEvent\", // 13 / 268\n \"SetObjectActiveImageEvent\", // 14 / 269\n \"SetSensorGroupEvent\", // 15 / 270\n \"SetServerTargetEvent\", // 16 / 271\n \"Sim2DAudioEvent\", // 17 / 272\n \"Sim3DAudioEvent\", // 18 / 273\n \"SimDataBlockEvent\", // 19 / 274\n \"SimTargetAudioEvent\", // 20 / 275\n \"SimVoiceStreamEvent\", // 21 / 276\n \"SimpleMessageEvent\", // 22 / 277\n \"TargetFreeEvent\", // 23 / 278\n \"TargetInfoEvent\", // 24 / 279\n \"TargetToEvent\", // 25 / 280\n] as const;\n\n// Block types in the U16 packed format (type = typeSize >> 12)\n// These are from TorqueSDK-style recordBlock/handleRecordedBlock\nexport const BlockTypePacket = 0; // Received network packet (dnet data)\nexport const BlockTypeSendPacket = 1; // SendPacket trigger (size=0, no data)\nexport const BlockTypeMove = 2; // Raw Move struct (64 bytes)\nexport const BlockTypeInfo = 3; // Info block (8 bytes: U32 + F32)\n\n// Packet types from dnet\nexport const DataPacket = 0;\nexport const PingPacket = 1;\nexport const AckPacket = 2;\n\nexport interface Move {\n px: number;\n py: number;\n pz: number;\n pyaw: number;\n ppitch: number;\n proll: number;\n x: number;\n y: number;\n z: number;\n yaw: number;\n pitch: number;\n roll: number;\n id: number;\n sendCount: number;\n freeLook: boolean;\n trigger: boolean[];\n}\n\nexport interface InfoBlock {\n value1: number; // U32\n value2: number; // F32\n}\n\nexport interface DataBlockHeader {\n objectId: number;\n classId: number;\n index: number;\n total: number;\n dataBitsStart: number;\n}\n\nexport interface DnetHeader {\n gameFlag: boolean;\n connectSeqBit: number;\n seqNumber: number;\n highestAck: number;\n packetType: number;\n ackByteCount: number;\n ackMask: number;\n}\n\nexport interface RateInfo {\n updateDelay?: number;\n packetSize?: number;\n maxUpdateDelay?: number;\n maxPacketSize?: number;\n}\n\nexport interface GhostUpdate {\n index: number;\n type: \"create\" | \"update\" | \"delete\";\n classId?: number;\n updateBitsStart: number;\n updateBitsEnd: number;\n parsedData?: ParsedData;\n}\n\nexport interface NetEventInfo {\n classId: number;\n guaranteed: boolean;\n sequenceNumber?: number;\n absoluteSequenceNumber?: number;\n dataBitsStart: number;\n dataBitsEnd: number;\n parsedData?: ParsedData;\n}\n\nexport interface PacketData {\n dnetHeader: DnetHeader;\n rateInfo: RateInfo;\n gameState: GameState;\n events: NetEventInfo[];\n ghosts: GhostUpdate[];\n /** Bit position where ghost section starts (readGhosts call). */\n ghostSectionStart?: number;\n}\n\nexport interface GameState {\n lastMoveAck: number;\n damageFlash?: number;\n whiteOut?: number;\n selfLocked?: boolean;\n selfHomed?: boolean;\n seekerTracking?: boolean;\n seekerTrackingPos?: { x: number; y: number; z: number };\n seekerMode?: number;\n seekerObjectGhostIndex?: number;\n targetPos?: { x: number; y: number; z: number };\n pinged: boolean;\n jammed: boolean;\n controlObjectGhostIndex?: number;\n controlObjectDataStart?: number;\n controlObjectDataEnd?: number;\n controlObjectData?: ParsedData;\n compressionPoint?: { x: number; y: number; z: number };\n targetVisibility?: { index: number; mask: number }[];\n cameraFov?: number;\n}\n\nexport interface DemoBlock {\n index: number;\n type: number;\n size: number;\n data: Uint8Array;\n parsed?: PacketData | Move | InfoBlock;\n}\n\nexport interface ConnectionProtocolState {\n lastSeqRecvdAtSend: number[];\n lastSeqRecvd: number;\n highestAckedSeq: number;\n lastSendSeq: number;\n ackMask: number;\n connectSequence: number;\n lastRecvAckAck: number;\n connectionEstablished: boolean;\n}\n\nexport interface StringTableEntry {\n id: number;\n value: string;\n}\n\nexport interface ParsedDataBlock {\n classId: number;\n className: string;\n objectId: number;\n data: ParsedData;\n}\n\nexport interface ScoreEntry {\n clientId: number;\n teamId: number;\n score: number;\n field0: number;\n field1: number;\n field2: number;\n isBot: boolean;\n triggerFlags: boolean[];\n}\n\n/**\n * IFF (Identification Friend or Foe) color for one sensor group pairing.\n * sensorGroupColors[myGroup][theirGroup] determines how `theirGroup` appears\n * to `myGroup` (e.g., red for enemy, green for friendly).\n */\nexport interface SensorGroupColor {\n group: number;\n targetGroup: number;\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\nexport interface TargetEntry {\n targetId: number;\n sensorData?: number;\n voiceMapData?: number;\n name?: string;\n skin?: string;\n skinPref?: string;\n voice?: string;\n typeDescription?: string;\n sensorGroup: number;\n targetData: number;\n dataBlockRef?: number;\n damageLevel: number;\n}\n\nexport interface PathManagerEntry {\n entryId: number;\n records: { field0: number; field1: number; field2: number; auxField: number }[];\n}\n\nexport interface InitialBlockData {\n taggedStrings: Map<number, string>;\n dataBlockHeaders: DataBlockHeader[];\n dataBlockCount: number;\n dataBlocks: Map<number, ParsedDataBlock>;\n /** Initial $firstPerson state from GameConnection::writeDemoStartBlock. */\n firstPerson: boolean;\n connectionFields: number[];\n stateArray: number[];\n scoreEntries: ScoreEntry[];\n demoValues: string[];\n sensorGroupColors: SensorGroupColor[];\n targetEntries: TargetEntry[];\n connectionState: ConnectionProtocolState;\n roundTripTime: number;\n packetLoss: number;\n pathManager: PathManagerEntry[];\n notifyCount: number;\n nextRecvEventSeq: number;\n ghostingSequence: number;\n initialGhosts: GhostUpdate[];\n initialEvents: NetEventInfo[];\n controlObjectGhostIndex: number;\n controlObjectData?: ParsedData;\n missionName: string;\n missionCRC: number;\n phase2TrailingBits?: number;\n phase2Valid?: boolean;\n phase2Error?: string;\n}\n\nexport interface DemoHeader {\n identString: string;\n protocolVersion: number;\n demoLengthMs: number;\n initialBlockSize: number;\n}\n\nexport interface DemoFile {\n header: DemoHeader;\n initialBlock: InitialBlockData;\n blocks: DemoBlock[];\n}\n\nexport interface LoadResult {\n header: DemoHeader;\n initialBlock: InitialBlockData;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,2CAA2C;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAClC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAC/B,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,qEAAqE;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,uBAAuB;AACvB,0EAA0E;AAC1E,oFAAoF;AACpF,4EAA4E;AAC5E,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;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AAU;IACvC,mBAAmB,EAAE,UAAU;IAC/B,wBAAwB,EAAE,UAAU;IACpC,sBAAsB,EAAE,UAAU;IAClC,cAAc,EAAE,UAAU;IAC1B,sBAAsB,EAAE,UAAU;IAClC,gBAAgB,EAAE,UAAU;IAC5B,kBAAkB,EAAE,UAAU;IAC9B,oBAAoB,EAAE,UAAU;IAChC,6BAA6B,EAAE,WAAW;IAC1C,yBAAyB,EAAE,WAAW;IACtC,uBAAuB,EAAE,WAAW;IACpC,oBAAoB,EAAE,WAAW;IACjC,2BAA2B,EAAE,WAAW;IACxC,qBAAqB,EAAE,WAAW;IAClC,sBAAsB,EAAE,WAAW;IACnC,iBAAiB,EAAE,WAAW;IAC9B,iBAAiB,EAAE,WAAW;IAC9B,mBAAmB,EAAE,WAAW;IAChC,qBAAqB,EAAE,WAAW;IAClC,qBAAqB,EAAE,WAAW;IAClC,oBAAoB,EAAE,WAAW;IACjC,iBAAiB,EAAE,WAAW;IAC9B,iBAAiB,EAAE,WAAW;IAC9B,eAAe,EAAE,WAAW;CACpB,CAAC;AAEX,+DAA+D;AAC/D,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,CAAC,sCAAsC;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,CAAC,uCAAuC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC,6BAA6B;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC,kCAAkC;AAElE,yBAAyB;AACzB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC","sourcesContent":["import type { ParsedData } from \"./ClassRegistry.js\";\n\n// Key constants from the V12 engine source\nexport const MaxGhostCount = 1024;\nexport const GhostIdBitSize = 10;\nexport const NetStringTableMaxStrings = 4096;\nexport const StringIdBitSize = 12;\nexport const NetEventClassBitSize = 6;\nexport const NetEventClassFirst = 255;\nexport const NetObjectClassBitSize = 7;\nexport const NetObjectClassFirst = 0;\nexport const MaxPacketDataSize = 1500;\nexport const MaxTriggerKeys = 6;\nexport const MoveCountBits = 5;\nexport const MaxMoveCount = 30;\n\n// GhostingMessageEvent message types (NetConnection::GhostMSG enum).\nexport const GhostMsgGhostAlwaysDone = 0;\nexport const GhostMsgGhostAlwaysAck = 1;\nexport const GhostMsgEndGhosting = 2;\nexport const GhostMsgGhostingActive = 3;\n\n// DataBlock constants.\n// For SimDataBlockEvent header (initial block + events), the binary uses:\n// readInt(11) objectId, readInt(7) classId, readInt(11) index, readInt(12) total.\n// For DataBlock references in payloads (readDataBlockRef), V12 source uses:\n// readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast).\nexport const DataBlockObjectIdFirst = 3;\nexport const DataBlockObjectIdBitSize = 10;\nexport const DataBlockObjectIdLast =\n DataBlockObjectIdFirst + (1 << DataBlockObjectIdBitSize) - 1; // 1026\nexport const DataBlockClassFirst = 128;\nexport const DataBlockClassBitSize = 7;\n\n// SimDataBlockEvent header bit sizes (from decompiled binary).\n// These are the HEADER field sizes, which differ from the payload reference sizes.\n// readClassInfo uses getNextPow2(0x800=2048) → getBitCount(2048)=11 for objectId.\n// The classId, index, and total are read with literal values 7, 11, 12 (from 0x80, 0xb, 0xc).\nexport const SimDBEventObjectIdBits = 11;\nexport const SimDBEventClassIdBits = 7; // same as DataBlockClassBitSize\nexport const SimDBEventIndexBits = 11;\nexport const SimDBEventTotalBits = 12;\n\n// Deterministic DataBlock class name mapping, derived from machine code\n// analysis of the Tribes 2 binary (build 25034). All 54 DataBlock classes\n// with mClassIdBase=0x80 are sorted by C strcmp (ASCII byte order), which\n// is how AbstractClassRep::initialize assigns sequential classIds.\n// Index N in this array corresponds to classId N (group-local) or\n// classId N+128 (V12 global format).\nexport const DataBlockClassNames: readonly string[] = [\n \"AudioDescription\", // 0 / 128\n \"AudioEnvironment\", // 1 / 129\n \"AudioProfile\", // 2 / 130\n \"AudioSampleEnvironment\", // 3 / 131\n \"BombProjectileData\", // 4 / 132\n \"CameraData\", // 5 / 133\n \"CannedChatItem\", // 6 / 134\n \"CommanderIconData\", // 7 / 135\n \"DebrisData\", // 8 / 136\n \"DecalData\", // 9 / 137\n \"ELFProjectileData\", // 10 / 138\n \"EffectProfile\", // 11 / 139\n \"EnergyProjectileData\", // 12 / 140\n \"ExplosionData\", // 13 / 141\n \"FireballAtmosphereData\", // 14 / 142\n \"FlareProjectileData\", // 15 / 143\n \"FlyingVehicleData\", // 16 / 144\n \"ForceFieldBareData\", // 17 / 145\n \"GameBaseData\", // 18 / 146\n \"GrenadeProjectileData\", // 19 / 147\n \"HoverVehicleData\", // 20 / 148\n \"ItemData\", // 21 / 149\n \"JetEffectData\", // 22 / 150\n \"LightningData\", // 23 / 151\n \"LinearFlareProjectileData\", // 24 / 152\n \"LinearProjectileData\", // 25 / 153\n \"MissionMarkerData\", // 26 / 154\n \"ParticleData\", // 27 / 155\n \"ParticleEmissionDummyData\", // 28 / 156\n \"ParticleEmitterData\", // 29 / 157\n \"PlayerData\", // 30 / 158\n \"PrecipitationData\", // 31 / 159\n \"ProjectileData\", // 32 / 160\n \"RepairProjectileData\", // 33 / 161\n \"RunningLightData\", // 34 / 162\n \"SeekerProjectileData\", // 35 / 163\n \"SensorData\", // 36 / 164\n \"ShapeBaseData\", // 37 / 165\n \"ShapeBaseImageData\", // 38 / 166\n \"ShockLanceProjectileData\", // 39 / 167\n \"ShockwaveData\", // 40 / 168\n \"SimDataBlock\", // 41 / 169\n \"SniperProjectileData\", // 42 / 170\n \"SplashData\", // 43 / 171\n \"StaticShapeData\", // 44 / 172\n \"StationFXPersonalData\", // 45 / 173\n \"StationFXVehicleData\", // 46 / 174\n \"TSShapeConstructor\", // 47 / 175\n \"TargetProjectileData\", // 48 / 176\n \"TracerProjectileData\", // 49 / 177\n \"TriggerData\", // 50 / 178\n \"TurretData\", // 51 / 179\n \"TurretImageData\", // 52 / 180\n \"WheeledVehicleData\", // 53 / 181\n] as const;\n\n// Deterministic NetObject (ghost) class name mapping, derived from machine code\n// analysis of the Tribes 2 binary (build 25034). All 53 NetObject classes\n// with mClassIdBase=0 are sorted by C strcmp (ASCII byte order), which\n// is how AbstractClassRep::initialize assigns sequential classIds.\n// Index N in this array corresponds to classId N (NetObjectClassFirst + N).\n// Verified against decompiled FUN_00423cb0 class table initialization.\n// Vehicle is NOT a ghost class (classGroup=0xFFFFFFFF in binary).\nexport const NetObjectClassNames: readonly string[] = [\n \"AIObjective\", // 0\n \"AudioEmitter\", // 1\n \"BeaconObject\", // 2\n \"BombProjectile\", // 3\n \"Camera\", // 4\n \"Debris\", // 5\n \"ELFProjectile\", // 6\n \"EnergyProjectile\", // 7\n \"FireballAtmosphere\", // 8\n \"FlareProjectile\", // 9\n \"FlyingVehicle\", // 10\n \"ForceFieldBare\", // 11\n \"GameBase\", // 12\n \"GrenadeProjectile\", // 13\n \"HoverVehicle\", // 14\n \"InteriorInstance\", // 15\n \"Item\", // 16\n \"Lightning\", // 17\n \"LinearFlareProjectile\", // 18\n \"LinearProjectile\", // 19\n \"Marker\", // 20\n \"MissionArea\", // 21\n \"MissionMarker\", // 22\n \"ParticleEmissionDummy\", // 23\n \"PhysicalZone\", // 24\n \"Player\", // 25\n \"Precipitation\", // 26\n \"Projectile\", // 27\n \"RepairProjectile\", // 28\n \"ScopeAlwaysShape\", // 29\n \"SeekerProjectile\", // 30\n \"ShapeBase\", // 31\n \"ShockLanceProjectile\", // 32\n \"Shockwave\", // 33\n \"SimpleNetObject\", // 34\n \"Sky\", // 35\n \"SniperProjectile\", // 36\n \"SpawnSphere\", // 37\n \"Splash\", // 38\n \"StaticShape\", // 39\n \"StationFXPersonal\", // 40\n \"StationFXVehicle\", // 41\n \"Sun\", // 42\n \"TSStatic\", // 43\n \"TargetProjectile\", // 44\n \"TerrainBlock\", // 45\n \"TracerProjectile\", // 46\n \"Trigger\", // 47\n \"Turret\", // 48\n \"VehicleBlocker\", // 49\n \"WaterBlock\", // 50\n \"WayPoint\", // 51\n \"WheeledVehicle\", // 52\n] as const;\n\n// Deterministic NetEvent class name mapping, derived from machine code\n// analysis of the Tribes 2 binary (build 25034). All 26 NetEvent classes\n// with mClassIdBase=0xFF are sorted by C strcmp (ASCII byte order), which\n// is how AbstractClassRep::initialize assigns sequential classIds.\n// Index N in this array corresponds to classId NetEventClassFirst + N (255 + N).\nexport const NetEventClassNames: readonly string[] = [\n \"CRCChallengeEvent\", // 0 / 255\n \"CRCChallengeResponseEvent\", // 1 / 256\n \"FogChallengeEvent\", // 2 / 257\n \"GhostAlwaysObjectEvent\", // 3 / 258\n \"GhostingMessageEvent\", // 4 / 259\n \"GravityEvent\", // 5 / 260\n \"LightningStrikeEvent\", // 6 / 261\n \"NetStringEvent\", // 7 / 262\n \"PathManagerEvent\", // 8 / 263\n \"RemoteCommandEvent\", // 9 / 264\n \"RemoveClientTargetTypeEvent\", // 10 / 265\n \"ResetClientTargetsEvent\", // 11 / 266\n \"SensorGroupColorEvent\", // 12 / 267\n \"SetMissionCRCEvent\", // 13 / 268\n \"SetObjectActiveImageEvent\", // 14 / 269\n \"SetSensorGroupEvent\", // 15 / 270\n \"SetServerTargetEvent\", // 16 / 271\n \"Sim2DAudioEvent\", // 17 / 272\n \"Sim3DAudioEvent\", // 18 / 273\n \"SimDataBlockEvent\", // 19 / 274\n \"SimTargetAudioEvent\", // 20 / 275\n \"SimVoiceStreamEvent\", // 21 / 276\n \"SimpleMessageEvent\", // 22 / 277\n \"TargetFreeEvent\", // 23 / 278\n \"TargetInfoEvent\", // 24 / 279\n \"TargetToEvent\", // 25 / 280\n] as const;\n\n// Block types in the U16 packed format (type = typeSize >> 12)\n// These are from TorqueSDK-style recordBlock/handleRecordedBlock\nexport const BlockTypePacket = 0; // Received network packet (dnet data)\nexport const BlockTypeSendPacket = 1; // SendPacket trigger (size=0, no data)\nexport const BlockTypeMove = 2; // Raw Move struct (64 bytes)\nexport const BlockTypeInfo = 3; // Info block (8 bytes: U32 + F32)\n\n// Packet types from dnet\nexport const DataPacket = 0;\nexport const PingPacket = 1;\nexport const AckPacket = 2;\n\nexport interface Move {\n px: number;\n py: number;\n pz: number;\n pyaw: number;\n ppitch: number;\n proll: number;\n x: number;\n y: number;\n z: number;\n yaw: number;\n pitch: number;\n roll: number;\n id: number;\n sendCount: number;\n freeLook: boolean;\n trigger: boolean[];\n}\n\nexport interface InfoBlock {\n value1: number; // U32\n value2: number; // F32\n}\n\nexport interface DataBlockHeader {\n objectId: number;\n classId: number;\n index: number;\n total: number;\n dataBitsStart: number;\n}\n\nexport interface DnetHeader {\n gameFlag: boolean;\n connectSeqBit: number;\n seqNumber: number;\n highestAck: number;\n packetType: number;\n ackByteCount: number;\n ackMask: number;\n}\n\nexport interface RateInfo {\n updateDelay?: number;\n packetSize?: number;\n maxUpdateDelay?: number;\n maxPacketSize?: number;\n}\n\nexport interface GhostUpdate {\n index: number;\n type: \"create\" | \"update\" | \"delete\";\n classId?: number;\n updateBitsStart: number;\n updateBitsEnd: number;\n parsedData?: ParsedData;\n}\n\nexport interface NetEventInfo {\n classId: number;\n guaranteed: boolean;\n sequenceNumber?: number;\n absoluteSequenceNumber?: number;\n dataBitsStart: number;\n dataBitsEnd: number;\n parsedData?: ParsedData;\n /** Set when the event could not be parsed (unknown class or parser\n * threw), leaving the stream position unreliable. */\n failed?: boolean;\n}\n\nexport interface PacketData {\n dnetHeader: DnetHeader;\n rateInfo: RateInfo;\n gameState: GameState;\n events: NetEventInfo[];\n ghosts: GhostUpdate[];\n /** Bit position where ghost section starts (readGhosts call). */\n ghostSectionStart?: number;\n}\n\nexport interface GameState {\n lastMoveAck: number;\n damageFlash?: number;\n whiteOut?: number;\n selfLocked?: boolean;\n selfHomed?: boolean;\n seekerTracking?: boolean;\n seekerTrackingPos?: { x: number; y: number; z: number };\n seekerMode?: number;\n seekerObjectGhostIndex?: number;\n targetPos?: { x: number; y: number; z: number };\n pinged: boolean;\n jammed: boolean;\n controlObjectGhostIndex?: number;\n controlObjectDataStart?: number;\n controlObjectDataEnd?: number;\n controlObjectData?: ParsedData;\n compressionPoint?: { x: number; y: number; z: number };\n targetVisibility?: { index: number; mask: number }[];\n cameraFov?: number;\n}\n\nexport interface DemoBlock {\n index: number;\n type: number;\n size: number;\n data: Uint8Array;\n parsed?: PacketData | Move | InfoBlock;\n}\n\nexport interface ConnectionProtocolState {\n lastSeqRecvdAtSend: number[];\n lastSeqRecvd: number;\n highestAckedSeq: number;\n lastSendSeq: number;\n ackMask: number;\n connectSequence: number;\n lastRecvAckAck: number;\n connectionEstablished: boolean;\n}\n\nexport interface StringTableEntry {\n id: number;\n value: string;\n}\n\nexport interface ParsedDataBlock {\n classId: number;\n className: string;\n objectId: number;\n data: ParsedData;\n}\n\nexport interface ScoreEntry {\n clientId: number;\n teamId: number;\n score: number;\n field0: number;\n field1: number;\n field2: number;\n isBot: boolean;\n triggerFlags: boolean[];\n}\n\n/**\n * IFF (Identification Friend or Foe) color for one sensor group pairing.\n * sensorGroupColors[myGroup][theirGroup] determines how `theirGroup` appears\n * to `myGroup` (e.g., red for enemy, green for friendly).\n */\nexport interface SensorGroupColor {\n group: number;\n targetGroup: number;\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\nexport interface TargetEntry {\n targetId: number;\n sensorData?: number;\n voiceMapData?: number;\n name?: string;\n skin?: string;\n skinPref?: string;\n voice?: string;\n typeDescription?: string;\n sensorGroup: number;\n targetData: number;\n dataBlockRef?: number;\n damageLevel: number;\n}\n\nexport interface PathManagerEntry {\n entryId: number;\n records: {\n field0: number;\n field1: number;\n field2: number;\n auxField: number;\n }[];\n}\n\nexport interface InitialBlockData {\n taggedStrings: Map<number, string>;\n dataBlockHeaders: DataBlockHeader[];\n dataBlockCount: number;\n dataBlocks: Map<number, ParsedDataBlock>;\n /** Initial $firstPerson state from GameConnection::writeDemoStartBlock. */\n firstPerson: boolean;\n connectionFields: number[];\n stateArray: number[];\n scoreEntries: ScoreEntry[];\n demoValues: string[];\n sensorGroupColors: SensorGroupColor[];\n targetEntries: TargetEntry[];\n connectionState: ConnectionProtocolState;\n roundTripTime: number;\n packetLoss: number;\n pathManager: PathManagerEntry[];\n notifyCount: number;\n nextRecvEventSeq: number;\n ghostingSequence: number;\n initialGhosts: GhostUpdate[];\n initialEvents: NetEventInfo[];\n controlObjectGhostIndex: number;\n controlObjectData?: ParsedData;\n /** Compression point established by the control object's readPacketData\n * (its position), used to decode compressed points in packets that\n * precede the first in-stream compression-point update. */\n initialCompressionPoint?: { x: number; y: number; z: number };\n missionName: string;\n missionCRC: number;\n phase2TrailingBits?: number;\n phase2Valid?: boolean;\n phase2Error?: string;\n}\n\nexport interface DemoHeader {\n identString: string;\n protocolVersion: number;\n demoLengthMs: number;\n initialBlockSize: number;\n}\n\nexport interface DemoFile {\n header: DemoHeader;\n initialBlock: InitialBlockData;\n blocks: DemoBlock[];\n}\n\nexport interface LoadResult {\n header: DemoHeader;\n initialBlock: InitialBlockData;\n}\n"]}
|