aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kernel.cpp5
-rw-r--r--engines/sci/engine/kmisc.cpp4
-rw-r--r--engines/sci/engine/seg_manager.h11
3 files changed, 11 insertions, 9 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 3bec6359d1..3cdeec1866 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -632,11 +632,10 @@ int determine_reg_type(SegManager *segMan, reg_t reg, bool allow_invalid) {
return type;
}
- if ((reg.segment >= segMan->_heap.size()) || !segMan->_heap[reg.segment])
+ mobj = segMan->getMemObject(reg.segment);
+ if (!mobj)
return 0; // Invalid
- mobj = segMan->_heap[reg.segment];
-
SciVersion version = segMan->sciVersion(); // for the offset defines
switch (mobj->getType()) {
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index e35bf79fe5..7f16e7196d 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -204,7 +204,7 @@ reg_t kMemory(EngineState *s, int, int argc, reg_t *argv) {
warning("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1]));
return s->r_acc;
}
- if (s->segMan->_heap[argv[1].segment]->getType() == MEM_OBJ_LOCALS)
+ if (s->segMan->getMemObjectType(argv[1].segment) == MEM_OBJ_LOCALS)
return *((reg_t *) ref);
else
return make_reg(0, (int16)READ_LE_UINT16(ref));
@@ -218,7 +218,7 @@ reg_t kMemory(EngineState *s, int, int argc, reg_t *argv) {
return s->r_acc;
}
- if (s->segMan->_heap[argv[1].segment]->getType() == MEM_OBJ_LOCALS)
+ if (s->segMan->getMemObjectType(argv[1].segment) == MEM_OBJ_LOCALS)
*((reg_t *) ref) = argv[2];
else {
if (argv[2].segment) {
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index a4a7851fac..f44616406d 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -46,6 +46,7 @@ enum ScriptLoadType {
class SegManager : public Common::Serializable {
+ friend class Console;
public:
/**
* Initialize the segment manager.
@@ -366,16 +367,18 @@ public:
SciVersion sciVersion() { return _resMan->sciVersion(); }
+public: // TODO: make private
+ Common::Array<MemObject *> _heap;
+ Common::Array<Class> _classtable; /**< Table of all classes */
+
private:
/** Map script ids to segment ids. */
Common::HashMap<int, SegmentId> _scriptSegMap;
-public: // TODO: make private
- Common::Array<MemObject *> _heap;
- bool _exportsAreWide;
- Common::Array<Class> _classtable; /**< Table of all classes */
ResourceManager *_resMan;
+ bool _exportsAreWide;
+
SegmentId Clones_seg_id; ///< ID of the (a) clones segment
SegmentId Lists_seg_id; ///< ID of the (a) list segment
SegmentId Nodes_seg_id; ///< ID of the (a) node segment