This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
mission_impossible:sool_engine [2019/06/18 17:48] shygoo more notes on method calls/returns and native calls |
mission_impossible:sool_engine [2019/07/01 18:25] (current) shygoo last minute notes on sool file structure |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== SOOL Engine ====== | ====== SOOL Engine ====== | ||
| - | Scenaric Object Oriented Language | + | SOOL (Scenaric Object Oriented Language) is a proprietary scripting language and engine used by Mission Impossible. |
| - | * [[https://hackmd.io/D7_UZ5kGSWCAZb_nM2-xHg?edit|Rough decompilation of the SOOL Engine]] | + | * [[https://hackmd.io/@shygoo/Byq2TYWkr|SOOL Interpreter partial decomp]] |
| + | |||
| + | ---- | ||
| + | ===== SOOL File structure ===== | ||
| + | |||
| + | ==== File header ==== | ||
| + | ^Offset^Type^Name^Description^ | ||
| + | |0x00|char|signature[4] |"SOOL"| | ||
| + | |0x04|u32 |fileSize |Size of the sool file.| | ||
| + | |0x08|u16 |numSections |Number of interactor sections.| | ||
| + | |0x0A|u8 |padding[2] |Alignment padding.| | ||
| + | |0x0C|u32 |sectionOffsets[]|Array of interactor section offsets. The length of this array is defined by the ''numSections'' field.| | ||
| + | |....|u32 |unknownData[] |Unknown data. Always the same size as ''sectionOffsets''.| | ||
| + | |||
| + | ==== Interactor sections ==== | ||
| + | ^Offset^Type^Name^Description^ | ||
| + | |0x00|u16 |offsVars |Offset of the interactor's variables.| | ||
| + | |0x02|u16 |offsVarsEnd |End offset of the interactor's variables.| | ||
| + | |0x04|u16 |offsElements |Offset of the interactor's elements. 0xFFFF if ''numElements'' is zero.| | ||
| + | |0x06|u16 |numElements |Number of elements.| | ||
| + | |0x08|u16 |unk08 |Unknown - always 0xFFFF?| | ||
| + | |0x0A|u16 |specialMethodIdx|An index of ''methodOffsets''. Unknown purpose.| | ||
| + | |0x0C|u16 |offsMethodsEnd |End offset of the method code.| | ||
| + | |0x0E|u16 |numMethods |Number of methods.| | ||
| + | |0x10|u16 |methodOffsets[] |Array of method offsets. The length of this array is defined by the ''numMethods'' field.| | ||
| + | |....|u16 |variables[] |Variable definitions. The position and length of this array are defined by the ''offsVars'' and ''offsVarsEnd'' fields.| | ||
| + | |....|u8 |methodCode[] |Method bytecode. See commands below.| | ||
| + | |....|u8 |garbage[] |If ''offsMethodsEnd'' is uneven, there will be one padding byte of an arbitrary value here for alignment.| | ||
| + | |....|elem|elements[] |Element lookup table. Each entry contains two u16 fields for the key and value.| | ||
| ---- | ---- | ||
| Line 96: | Line 124: | ||
| Stack: ''[...] -> [...] [immValue1] [immValue2]'' | Stack: ''[...] -> [...] [immValue1] [immValue2]'' | ||
| ---- | ---- | ||
| - | ====0B: load_ctx_var_offs ==== | + | ====0B: load_ctx_elem ==== |
| ''0B'' | ''0B'' | ||
| - | Pop variable id and context id from the stack, push offset of variable to the stack. | + | Pop element key and context id from the stack, push context's element value to the stack. |
| - | Stack: ''[...] [ctxId] [varId] -> [...] [varOffset]'' | + | Stack: ''[...] [ctxId] [elemKey] -> [...] [elemValue]'' |
| ---- | ---- | ||
| - | ====0C: load_ctx_var_offs_keep_ctx ==== | + | ====0C: load_ctx_elem_keep_ctx ==== |
| ''0C'' | ''0C'' | ||
| - | Pop variable id from the stack, load context id from top of stack (do not pop context id). Push offset of variable to the stack. | + | Pop element key from the stack, load context id from top of stack (do not pop context id). Push context's element value to the stack. |
| - | Stack: ''[...] [ctxId] [varId] -> [...] [ctxId] [varOffset]'' | + | Stack: ''[...] [ctxId] [elemKey] -> [...] [ctxId] [elemValue]'' |
| ---- | ---- | ||
| - | ====0D: load_ctx_var ==== | + | ====0D: load_ctx_elem_var ==== |
| ''0D'' | ''0D'' | ||
| - | Pop variable id and context id from the stack. Push context's variable value to the stack. | + | Pop element key and context id from the stack. Using the element's value as a variable offset, push context's variable to the stack. |
| - | Stack: ''[...] [ctxId] [varId] -> [...] [varValue]'' | + | Stack: ''[...] [ctxId] [elemKey] -> [...] [varValue]'' |
| ---- | ---- | ||
| ====0E: unk0E ==== | ====0E: unk0E ==== | ||
| Line 417: | Line 445: | ||
| The called method will pop ''returnCtxId'' and ''returnOffs'' from the stack before returning; they are not visible to the caller. | The called method will pop ''returnCtxId'' and ''returnOffs'' from the stack before returning; they are not visible to the caller. | ||
| - | Stack: ''[...] [ctxId] [methodId] -> [...] [returnCtxId] [returnOffs] -> [...]'' | + | Stack: ''[...] [methodId] [ctxId] -> [...] [returnCtxId] [returnOffs] -> [...]'' |
| ---- | ---- | ||
| ====3B: pop_nop ==== | ====3B: pop_nop ==== | ||