benilla-re systems structs docs

system collision · source

collision: replay

Each mover's queue of pending movement events and its replay, in Movement.cpp.

Every CMovement keeps the events it has yet to apply in a time-ordered list; spent event nodes go to one free list the whole client shares. The per-mover step (mover) calls 0x615c30 at the end of each step with the step's end time, and 0x615c30 applies, in order, every event due by then: a jump table on the event's type runs the matching setter of the shared movement code and passes the type's opcode, with the event's values, to the unit's move-event handler. The doc also covers the list helpers the queue and status code share, and the destructor half that releases a mover's queue.

Roots: 0x617060

Event queue and free list

Each mover keeps its pending events at +0x150: a list with link offset 0 and the terminator at +0x154, ordered by each event's time at +0x8. 0x615820 inserts an event before the first one whose time is later by signed difference, so equal times keep arrival order. 0x6158e0 returns the first event or null; 0x6158f0 returns whether there is one. Spent events go to the free list 0xc4db88: 0x615910 moves the first event there; 0x6159c0 splices a whole queue onto its end, with error 0x57 for a null queue, the free list or another link offset. 0x615a50 empties a queue, spliced when the manager exists, else freed node by node. 0x617060, the destructor, runs 0x7c5950 and then 0x615a50 on +0x150.

Addresses: 0x615820, 0x6158e0, 0x6158f0, 0x615910, 0x6159c0, 0x615a50, 0x617060, 0x7c5950, 0xc4db88 Confidence: verified Proof: one Test: none

0x61584c sub eax,[ebx+0x8]; js picks the slot; past the last node 0x615894 links before the terminator. The head is [queue+0x8], null when odd or zero. 0x615910 unlinks the head and links it before the free list's terminator (0x615997 to 0x6159a9). 0x6159c0 tests ecx against 0 and 0xc4db88 and compares link offsets (0x6159c4 to 0x6159d8). 0x615a50 tail-jumps to 0x6159c0 when 0x630a40 is nonzero (0x615a61).

Event replay loop

0x615c30(t) applies, in queue order, every event with t − time ≥ 0, each in these steps:

stepaction
1move the event to the free list
2under flag 0x1000, drop it when 0x618030(type) is 0 (types 0 to 7, 18, 19 and 28)
3without byte +0x4d, 0x7c6310()
4F = the flags; V = (F & 0x2000) and +0xa0 ≠ 0.0, NaN counting as unequal
5with byte +0x4c, flag 0x2000 and the event's flags +0x30 lacking 0x2000: 0x7c6290(), a landing
6the case for the type at +0xc
7with +0x4d, no message passed on, flags & 0x200f and F & 0x200f clear: 0x615b80(t)
8with +0x4c, 0x61a770(event) nonzero and a landing: 0x602d00(t, F, V)
90x619030(t), then 0x619090(t)

It returns 1 when events remain or flags & 0x20ff, else 0.

Addresses: 0x615c30, 0x615c71, 0x618030, 0x7c6310, 0x61a770, 0x602d00, 0x619030, 0x619090 Confidence: verified Proof: one Test: none

0x615c63 js stops at the first event in the future. 0x615c71 test ah,0x10 is the 0x1000 test; a refusal jumps to 0x616539, skipping the rest. The table of 0x618030 maps types 8 to 17 and 20 to 27 to 1, and types above 28 return 1. V is fcomp 0.0; test ah,0x44; jp (0x615cb1). Step 7 is 0x615e51 to 0x615e73, where "passed on" is the case's ebx; type 6 without +0x4d enters at 0x615e78, after it, and type 38 jumps to 0x616539, past steps 7 to 9. The return is 0x61654c to 0x61657a.

Replay cases 0 to 19

The jump table at 0x616580 holds 39 cases. A setter runs, and, where stated, its nonzero result gates the message: 0x60e0a0(t, opcode, +0x4d, a, b) with a = b = 0 unless stated. Its result is "passed on".

typesetteropcode
0, 10x7c6ae0(1), 0x7c6ae0(0)0xb5, 0xb6, gated
20x7c6ba0()0xb7, gated
3, 4, 50x7c6c50(1), 0x7c6c50(0), 0x7c6d30()0xb8, 0xb9, 0xba, gated
60x7c61c0(); on nonzero, 0x602c40on nonzero with +0x4d, heartbeat 0x600a30(t, 0xee, 0, 0), passed on
70x7c6230(1)0xbb, gated
8, 9, 100x617c80(1), 0x617c80(0), 0x7c6dd0()0xbc, 0xbd, 0xbe
11, 12, 130x7c6df0(1), 0x7c6df0(0), 0x7c6e30()0xbf, 0xc0, 0xc1
14, 150x7c71c0(1), 0x7c71c0(0)0xc2, 0xc3
160x7c6f30(+0x1c)0xda
170x615bc0(t, event)below
18, 190x61a230(), 0x7c6e80()0xca, 0xcb

0x615bc0 calls 0x7c6f70(+0x20): on 0 it passes 0xdb on; else with +0x4d it sends the heartbeat and returns 1, without it returns 0.

Addresses: 0x616580, 0x60e0a0, 0x615bc0, 0x7c6ae0, 0x7c6ba0, 0x7c6c50, 0x7c6d30, 0x7c61c0, 0x602c40, 0x7c6230, 0x615eba, 0x615ec5, 0x615ed1, 0x617c80, 0x7c6dd0, 0x7c6df0, 0x7c6e30, 0x7c71c0, 0x7c6f30, 0x615fc6, 0x7c6f70, 0x61a230, 0x7c6e80 Confidence: verified Proof: one Test: none

0x615cf4 cmp eax,0x26; ja 0x615e51 sends other types to no case; 0x615cfd jumps through 0x616580, read as raw dwords: 0x615d04, 0x615d3a, 0x615d70, 0x615d93, 0x615dc9, 0x615df8, 0x615e17, 0x615eba, 0x615edb, 0x615f09, 0x615f37, 0x616038, 0x616066, 0x616094, 0x615f52, 0x615f80, 0x615fae, 0x615fde, 0x615ff1, 0x61601d for types 0 to 19. Type 7: 0x615eba push 1, the gate 0x615ec5 je, 0x615ed1 push 0xbb. Type 16 pushes 0xda at 0x615fc6. The gated cases test eax and jump to 0x615e51 on 0. The heartbeat of type 6 is the call at 0x615e47; 0x615e4c sets ebx to 1.

Replay cases 20 to 38

The table continues: 0x616129, 0x61614c, 0x616180, 0x6161b4, 0x6161d7, 0x61620b, 0x6160af, 0x6160ec, 0x61623f, 0x616279, 0x61628d, 0x6162cf, 0x616320, 0x61636b, 0x61637f, 0x6163db, 0x61643f, 0x615e51, 0x6164db. x is 1 without +0x4d, else whether the unit is the active mover.

typeactionopcode, a, b
20 to 250x7c7030, 0x7c7080, 0x7c70d0, 0x7c7120, 0x7c7170, 0x7c6ff0 with +0x380xe3, 0xe5, 0x2db, 0xe7, 0x2dd, 0x2df; +0x38, +0x48
26, 270x7c7240(1), 0x7c7240(0); on nonzero 0x619aa0()0x2ad, gated
280x6179c0(&+0x38, +0x40, +0x44)0xf0; 0, +0x48
29, 300x7c72e0(1), 0x7c72e0(0); after the message 0x7c72b0(), 0x602c400x2cf; 1.0 or 0.0, +0x48
31, 320x61a580(1, x), 0x61a580(0, x)0xf6; 1.0 or 0.0, +0x48
33, 340x7c7280(1), 0x7c7280(0); 34 then 0x7c61c0() when x0x2d0; 1.0 or 0.0, +0x48
350x616d30() for a live spline with +0x4d; then 0x619a00()0xe9; 0, +0x48; then 0x61a820(t, 0, F, V, 0)
360x7c7370(x)0xeb; 0, +0x48; then 0x61a820(t, 0, F, V, 0)
37nonenone
380x617e90(T, &+0x10, +0x1c, 1, +0x4d), T = +0x28 and +0x2c with +0x4c, else 00xc7; 0, +0x48

In 35 and 36, F and V are taken again before the setter.

Addresses: 0x7c7030, 0x616142, 0x7c7080, 0x7c70d0, 0x7c7120, 0x7c7170, 0x7c6ff0, 0x7c7240, 0x619aa0, 0x6179c0, 0x61624d, 0x616261, 0x7c72e0, 0x7c72b0, 0x61a580, 0x7c7280, 0x616d30, 0x619a00, 0x61a820, 0x7c7370, 0x617e90 Confidence: verified Proof: one Test: none

Type 20 pushes 0xe3 at 0x616142. Type 28 calls 0x6179c0 at 0x61624d before pushing 0xf0 at 0x616261, so the message carries the applied state. 1.0 is pushed as 0x3f800000. x is built at 0x6162cf to 0x6162fd and its copies. Types 35 and 36 retake F and V at 0x6163f9 and 0x61643f; 36's V takes 0 from ecx, cleared at 0x615cf0. Type 38 jumps to 0x616539 after its message.