22 #ifndef SCI_ENGINE_SEG_MANAGER_H 23 #define SCI_ENGINE_SEG_MANAGER_H 25 #include "common/scummsys.h" 26 #include "common/serializer.h" 27 #include "sci/engine/script.h" 28 #include "sci/engine/vm.h" 29 #include "sci/engine/vm_types.h" 30 #include "sci/engine/segment.h" 32 #include "sci/graphics/celobj32.h" 127 void uninstantiateScriptSci0(
int script_nr);
131 reg_t getClassAddress(
int classnr,
ScriptLoadType lock, uint16 callerSegment,
bool applyScriptPatches =
true);
354 void memcpy(
reg_t dest,
const byte* src,
size_t n);
377 SegmentObj *getSegmentObj(SegmentId seg)
const;
380 SegmentType getSegmentType(SegmentId seg)
const;
383 SegmentObj *getSegment(SegmentId seg, SegmentType type)
const;
400 bool isHeapObject(
reg_t pos)
const;
435 uint32 classTableSize()
const {
return _classTable.size(); }
436 Class getClass(
int index)
const {
return _classTable[index]; }
437 void setClassOffset(
int index,
reg_t offset) { _classTable[index].reg = offset; }
438 void resizeClassTable(uint32 size) { _classTable.resize(size); }
440 reg_t getSaveDirPtr()
const {
return _saveDirPtr; }
441 reg_t getParserPtr()
const {
return _parserPtr; }
444 bool isValidAddr(
reg_t reg, SegmentType expected)
const {
445 SegmentObj *mobj = getSegmentObj(reg.getSegment());
447 mobj->getType() == expected &&
451 SciArray *allocateArray(SciArrayType type, uint16 size,
reg_t *addr);
452 SciArray *lookupArray(
reg_t addr);
453 void freeArray(
reg_t addr);
454 bool isArray(
reg_t addr)
const;
456 SciBitmap *allocateBitmap(
reg_t *addr,
const int16 width,
const int16 height,
const uint8 skipColor = kDefaultSkipColor,
const int16 originX = 0,
const int16 originY = 0,
const int16 xResolution = kLowResX,
const int16 yResolution = kLowResY,
const uint32 paletteSize = 0,
const bool remap =
false,
const bool gc =
true);
457 SciBitmap *lookupBitmap(
reg_t addr);
458 void freeBitmap(
reg_t addr);
472 SegmentId _clonesSegId;
473 SegmentId _listsSegId;
474 SegmentId _nodesSegId;
475 SegmentId _hunksSegId;
482 SegmentId _arraysSegId;
483 SegmentId _bitmapSegId;
490 void deallocate(SegmentId seg);
491 void createClassTable();
493 SegmentId findFreeSegment()
const;
505 SegmentId getActualSegment(SegmentId seg)
const;
510 #endif // SCI_ENGINE_SEG_MANAGER_H Script * getScriptIfLoaded(SegmentId seg) const
List * lookupList(reg_t addr)
byte * allocDynmem(int size, const char *description, reg_t *addr)
Definition: seg_manager.h:42
Clone * allocateClone(reg_t *addr)
List * allocateList(reg_t *addr)
void reconstructStack(EngineState *s)
reg_t findObjectByName(const Common::String &name, int index=-1)
SegManager(ResourceManager *resMan, ScriptPatcher *scriptPatcher)
Definition: serializer.h:79
byte * getHunkPointer(reg_t addr)
const char * getObjectName(reg_t pos)
Definition: segment.h:202
void strncpy(reg_t dest, reg_t src, size_t n)
reg_t allocateHunkEntry(const char *hunk_type, int size)
int instantiateScript(int script_nr, bool applyScriptPatches=true)
Definition: resource.h:327
Common::Array< reg_t > findObjectsBySuperClass(const Common::String &superClassName)
Common::String getString(reg_t pointer)
void uninstantiateScript(int script_nr)
void strcpy_(reg_t dest, reg_t src)
reg_t * derefRegPtr(reg_t pointer, int entries)
SegmentId findSegmentByType(int type) const
Common::Array< reg_t > findObjectsByName(const Common::String &name)
Script * allocateScript(int script_nr, SegmentId &seg_id)
ScriptLoadType
Definition: seg_manager.h:40
byte * derefBulkPtr(reg_t pointer, int entries)
bool isObject(reg_t obj) const
Definition: seg_manager.h:397
void deallocateScript(int script_nr)
Definition: serializer.h:308
bool freeDynmem(reg_t addr)
Definition: seg_manager.h:48
Definition: script_patches.h:91
reg_t newNode(reg_t value, reg_t key)
SegmentId getScriptSegment(int script_nr) const
void memcpy(reg_t dest, reg_t src, size_t n)
SegmentRef dereference(reg_t pointer)
Node * lookupNode(reg_t addr, bool stopOnDiscarded=true)
char * derefString(reg_t pointer, int entries=0)
DataStack * allocateStack(int size)
virtual bool isValidOffset(uint32 offset) const =0
Definition: seg_manager.h:43
Object * getObject(reg_t pos) const
Definition: seg_manager.h:41
Definition: segment.h:195
Node * allocateNode(reg_t *addr)
Definition: vm_types.h:39
Script * getScript(SegmentId seg)
Definition: segment.h:165
void freeHunkEntry(reg_t addr)