benilla-re systems structs docs

EvtContext

struct · core · 532 bytes

Vtable
0x801364
Meaning
Holds a scheduled context: its run state, due time, flags, handler lists, messages, held input and timers
Confidence
verified, proof one
Finding
core/loop#contexts

Finding: Contexts in core: the frame loop

A context is a 0x214-byte object: a lock at +0x10, run state +0x2c, a heap node +0x30 whose key +0x3c is the due time, the last tick time +0x40, flags +0x44, the idle time +0x48 and +0x4c, a load cost +0x50 and +0x54, 29 handler lists from +0x5c, and the message, input, timer and thread state after them. For the client's context the constructor stores: run state 0, last tick = now, flags 2 (interactive), idle time 1 ms in both fields, cost 1000 in both, and gives it a handle in the context table.

The derivation is in the doc.

Fields 25

offsetsizetypenamemeaningconfidencefinding
0x00004void **__vfptrHolds the vtable 0x801364verified, proof onecore/loop#start-and-stop
0x00048void *[2]m_tableLinkHolds the context's link in its context table bucketverified, proof onecore/loop#contexts
0x000c4uint32_tm_handleHolds the context's handle, its key in the context tableverified, proof onecore/loop#contexts
0x001024uint8_t[24]m_lockHolds the critical section guarding the run state, messages and timersverified, proof onecore/loop#one-tick
0x00284uint32_tm_reservedHolds 0 from the constructor; the event library reads it nowhereverified, proof onecore/scheduler#context-fields
0x002c4uint32_tm_runStateHolds 0 running, 1 closing, 2 torn downverified, proof twocore/loop#start-and-stop
0x003012void *[3]m_heapNodeHolds the heap node: vtable 0x801368, owning heap and indexverified, proof twocore/loop#scheduler-heap
0x003c4uint32_tm_dueTimeHolds the clock time the context is next due, the heap keyverified, proof twocore/loop#next-due-time
0x00404uint32_tm_lastFrameTimeHolds the clock time of the last frame time or start dispatchverified, proof twocore/loop#frame-time
0x00444uint32_tm_flagsHolds 1 started, 2 interactive, 4 after-frame pendingverified, proof twocore/loop#start-and-stop
0x00484uint32_tm_idleTimeHolds the idle time in milliseconds, at least 1verified, proof twocore/loop#next-due-time
0x004c4uint32_tm_idleTimeInitialHolds the idle time as constructed; a difference from +0x48 overrides the timer waitverified, proof twocore/loop#next-due-time
0x00504uint32_tm_costHolds the load the context adds to its slot: 1000 interactive, 1 otherwiseverified, proof twocore/loop#contexts
0x00544uint32_tm_costTargetHolds the cost passed to the rescheduleverified, proof twocore/loop#contexts
0x00584uint32_tm_costChangedHolds 1 when the cost moved by more than an eighthverified, proof onecore/loop#next-due-time
0x005c348uint32_t[87]m_handlerListsHolds the 29 handler list heads of 12 bytes, one per categoryverified, proof twocore/events#handler-records
0x01b812uint32_t[3]m_messagesHolds the deferred message list headverified, proof twocore/events#deferred-messages
0x01c44uint32_tm_heldButtonsHolds the held-button mask the dispatch keepsverified, proof twocore/events#held-buttons
0x01c812uint32_t[3]m_heldKeysHolds the held-key list headverified, proof twocore/events#held-keys-and-repeats
0x01d416uint32_t[4]m_timerTableHolds the array of timer records by idverified, proof twocore/events#timers
0x01e416uint32_t[4]m_freeTimerIdsHolds the array of timer ids free for reuseverified, proof twocore/events#timers
0x01f420uint32_t[5]m_timerHeapHolds the heap of timers ordered by due timeverified, proof twocore/events#timers
0x02084void *m_threadPropsHolds the property array the calling thread carries while the context runsverified, proof onecore/scheduler#context-fields
0x020c4void *m_nameObjectHolds the name object, null unless the constructor was told to build oneverified, proof onecore/scheduler#context-fields
0x02104uint32_tm_flagBitHolds bit 1 of the constructor's third argumentverified, proof onecore/scheduler#context-fields