Public Member Functions | |
int | getLocalsOffset () const |
uint16 | getLocalsCount () const |
uint32 | getScriptSize () const |
uint32 | getHeapSize () const |
uint32 | getBufSize () const |
uint32 | getHeapOffset () const |
const byte * | getBuf (uint offset=0) const |
SciSpan< const byte > | getSpan (uint offset) const |
int | getScriptNumber () const |
SegmentId | getLocalsSegment () const |
reg_t * | getLocalsBegin () |
void | syncLocalsBlock (SegManager *segMan) |
ObjMap & | getObjectMap () |
const ObjMap & | getObjectMap () const |
bool | offsetIsObject (uint32 offset) const |
void | freeScript (const bool keepLocalsSegment=false) |
void | load (int script_nr, ResourceManager *resMan, ScriptPatcher *scriptPatcher, bool applyScriptPatches=true) |
bool | isValidOffset (uint32 offset) const override |
SegmentRef | dereference (reg_t pointer) override |
reg_t | findCanonicAddress (SegManager *segMan, reg_t sub_addr) const override |
void | freeAtAddress (SegManager *segMan, reg_t sub_addr) override |
Common::Array< reg_t > | listAllDeallocatable (SegmentId segId) const override |
Common::Array< reg_t > | listAllOutgoingReferences (reg_t object) const override |
Common::Array< reg_t > | listObjectReferences () const |
void | saveLoadWithSerializer (Common::Serializer &ser) override |
Object * | getObject (uint32 offset) |
const Object * | getObject (uint32 offset) const |
Object * | scriptObjInit (reg_t obj_pos, bool fullObjectInit=true) |
void | initializeLocals (SegManager *segMan) |
void | initializeClass (SegManager *segMan, uint16 species, uint32 position) |
void | initializeObjects (SegManager *segMan, SegmentId segmentId, bool applyScriptPatches) |
void | incrementLockers () |
void | decrementLockers () |
uint | getLockers () const |
void | setLockers (uint lockers) |
uint | getExportsOffset () const |
uint16 | getExportsNr () const |
const SciSpan< const byte > & | getSynonyms () const |
uint16 | getSynonymsNr () const |
uint32 | validateExportFunc (int pubfunct, bool relocSci3) |
void | markDeleted () |
bool | isMarkedAsDeleted () const |
SciSpan< const byte > | findBlockSCI0 (ScriptObjectTypes type, bool findLastBlock=false) const |
void | syncStringHeap (Common::Serializer &ser) |
int | getCodeBlockOffset () |
const offsetLookupArrayType * | getOffsetArray () |
uint16 | getOffsetObjectCount () |
uint16 | getOffsetStringCount () |
uint16 | getOffsetSaidCount () |
uint32 | getRelocationOffset (const uint32 offset) const |
Public Member Functions inherited from Sci::SegmentObj | |
SegmentObj (SegmentType type) | |
SegmentType | getType () const |
Protected Attributes | |
offsetLookupArrayType | _offsetLookupArray |
Additional Inherited Members | |
Static Public Member Functions inherited from Sci::SegmentObj | |
static SegmentObj * | createSegmentObj (SegmentType type) |
Public Attributes inherited from Sci::SegmentObj | |
SegmentType | _type |
|
overridevirtual |
Check whether the given offset into this memory object is valid, i.e., suitable for passing to dereference.
Implements Sci::SegmentObj.
|
overridevirtual |
Dereferences a raw memory pointer.
reg | reference to dereference |
Reimplemented from Sci::SegmentObj.
|
overridevirtual |
Finds the canonic address associated with sub_reg. Used by the garbage collector.
For each valid address a, there exists a canonic address c(a) such that c(a) = c(c(a)). This address "governs" a in the sense that deallocating c(a) will deallocate a.
sub_addr | base address whose canonic address is to be found |
Reimplemented from Sci::SegmentObj.
|
overridevirtual |
Deallocates all memory associated with the specified address. Used by the garbage collector.
sub_addr | address (within the given segment) to deallocate |
Reimplemented from Sci::SegmentObj.
|
overridevirtual |
Iterates over and reports all addresses within the segment. Used by the garbage collector.
Reimplemented from Sci::SegmentObj.
|
overridevirtual |
Iterates over all references reachable from the specified object. Used by the garbage collector.
object | object (within the current segment) to analyze |
Reimplemented from Sci::SegmentObj.
Common::Array<reg_t> Sci::Script::listObjectReferences | ( | ) | const |
Return a list of all references to objects in this script (and also to the locals segment, if any). Used by the garbage collector.
Initializes an object within the segment manager
obj_pos | Location (segment, offset) of the object. It must point to the beginning of the script/class block (as opposed to what the VM considers to be the object location) |
void Sci::Script::initializeLocals | ( | SegManager * | segMan | ) |
Initializes the script's local variables
segMan | A reference to the segment manager |
void Sci::Script::initializeClass | ( | SegManager * | segMan, |
uint16 | species, | ||
uint32 | position | ||
) |
Adds a script's class to the segment manager's class table
segMan | A reference to the segment manager |
species | The class number (index) |
position | The position of the class (object) in the script |
void Sci::Script::initializeObjects | ( | SegManager * | segMan, |
SegmentId | segmentId, | ||
bool | applyScriptPatches | ||
) |
Initializes the script's objects
segMan | A reference to the segment manager |
segmentId | The script's segment id |
applyScriptPatches | Apply patches for the script, if available |
void Sci::Script::incrementLockers | ( | ) |
Increments the number of lockers of this script by one.
void Sci::Script::decrementLockers | ( | ) |
Decrements the number of lockers of this script by one.
uint Sci::Script::getLockers | ( | ) | const |
Retrieves the number of locks held on this script.
void Sci::Script::setLockers | ( | uint | lockers | ) |
Sets the number of locks held on this script.
|
inline |
Retrieves the offset of the export table in the script
|
inline |
Retrieves the number of exports of script.
|
inline |
Retrieves a pointer to the synonyms associated with this script
|
inline |
Retrieves the number of synonyms associated with this script.
uint32 Sci::Script::validateExportFunc | ( | int | pubfunct, |
bool | relocSci3 | ||
) |
Validate whether the specified public function is exported by the script in the specified segment.
pubfunct | Index of the function to validate |
relocSci3 | Decide whether to relocate this SCI3 public function or not |
|
inline |
Marks the script as deleted. This will not actually delete the script. If references remain present on the heap or the stack, the script will stay in memory in a quasi-deleted state until either unreachable (resulting in its eventual deletion) or reloaded (resulting in its data being updated).
|
inline |
Determines whether the script is marked as being deleted.
SciSpan<const byte> Sci::Script::findBlockSCI0 | ( | ScriptObjectTypes | type, |
bool | findLastBlock = false |
||
) | const |
Finds the pointer where a block of a specific type starts from, in SCI0 - SCI1 games
void Sci::Script::syncStringHeap | ( | Common::Serializer & | ser | ) |
Syncs the string heap of a script. Used when saving/loading.
|
inline |
Gets an offset to the beginning of the code block in a SCI1.1 or later script
|
inline |
Get the offset array
uint32 Sci::Script::getRelocationOffset | ( | const uint32 | offset | ) | const |