Save Selector Selection State

save-selector script selection buffer and branch-state handlers

Selection buffer: context field 0x000000a8; values select one of 12 branch-state slots.

Pointer to a per-script selection buffer addressed by byte offsets from stream+2. Opcodes 0x11, 0x12, and 0x13 use stream+2 as an offset into this buffer; the resulting byte selects one of 12 branch-state table slots.

opcodehandlernamesummarysignatures
0x100x0040b49ebuild branch-state tableChooses primary/secondary branch-state table from stream+1, passes stream+2 to helper 0x00410c90, then advances the script stream by 4 bytes.ok
0x110x0040b4e6branch on selected stateReads index (context+0xa8)[stream+2], then tests stateTable[index]. State value 1 falls through by 8 bytes; any other value jumps to dword [stream+4].ok
0x120x0040b55fselect previous/next active state slotScans the 12-slot branch-state table for a nonzero entry, starting from (context+0xa8)[stream+2] when runtime flag 0x00457744 is set, stores the selected slot back into (context+0xa8)[stream+2], then advances by 4 bytes.ok
0x130x0040b696select matching runtime state slotComputes the active slot base from 0x004576e9/0x00457750, clears (context+0xa8)[stream+2], scans 12 runtime slots, compares per-slot bytes from 0x0059e344 with slot fields +0x4a/+0x48, stores the matching slot index back into (context+0xa8)[stream+2], then advances by 4 bytes.ok
helper0x00410c90fill branch-state tableDispatches by stream+2 value and fills a 12-byte state table. The simplest helper path writes 1 before the requested slot and 0 after it; later paths write 0/1/2 from party, menu, item, or progress-related runtime tables.ok

State Values

Helper Cases

Helper jump table 0x00410db0 accepts cases 0x00..0x0b.

caseentrytargetcalleeargumentstate valuespatternpersistence/reset noteverified
0x000x00410db00x00410ca60x00410de5constant 21/0prefix fill: slots before N become 1, remaining slots become 0supports predecessor fill 0x00000210; produces slots 0..1 as 1True
0x010x00410db40x00410cb90x00410de5constant 41/0prefix fill: slots before N become 1, remaining slots become 0would overwrite table with slots 0..3 as 1True
0x020x00410db80x00410ccc0x00410de5constant 51/0prefix fill: slots before N become 1, remaining slots become 0would overwrite table with slots 0..4 as 1True
0x030x00410dbc0x00410cdf0x00410de5constant 61/0prefix fill: slots before N become 1, remaining slots become 0would overwrite table with slots 0..5 as 1True
0x040x00410dc00x00410cf20x00410de5byte 0x004576e81/0runtime prefix fillruntime value can overwrite the prefix widthTrue
0x050x00410dc40x00410d090x00410e40constant 60/1/2party/item threshold table; missing entries 0, insufficient entries 2, pass entries 1runtime party/item state can rewrite the first six slotsTrue
0x060x00410dc80x00410d1c0x00410f23constant 60/1/2paired runtime flags at 0x004576ec/0x004576ed; writes 0/2/1runtime flags can rewrite the first six slotsTrue
0x070x00410dcc0x00410d2f0x00410fc4constant 60/1indexed table using 0x0059e33e, 0x0059e344, and 0x0045779aruntime table can rewrite the first six slotsTrue
0x080x00410dd00x00410d420x00411068constant 51/0counts nonzero flags at 0x004576f8 and fills a derived prefix widthruntime count can rewrite the first five slotsTrue
0x090x00410dd40x00410d550x00411138constant 60/1/2runtime group from 0x0059e345 plus paired flags at 0x004576f8/0x004576f9runtime flags can rewrite the first six slotsTrue
0x0a0x00410dd80x00410d680x004111e5byte 0x004576e81/0compares object pointers from 0x0059db30 via helper 0x00433a30object comparison can rewrite a runtime-sized prefixTrue
0x0b0x00410ddc0x00410d7f0x0041127dword 0x0059db280/1checks object table 0x0059db3c field +0x62 bit 0x80object flags can rewrite a runtime-sized prefixTrue