aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devtools/tasmrecover/tasm/cpp.py7
-rw-r--r--engines/dreamweb/dreambase.h57
-rw-r--r--engines/dreamweb/dreamgen.h7
-rw-r--r--engines/dreamweb/runtime.h20
4 files changed, 72 insertions, 19 deletions
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py
index a302fa1164..b545d99f9b 100644
--- a/devtools/tasmrecover/tasm/cpp.py
+++ b/devtools/tasmrecover/tasm/cpp.py
@@ -612,12 +612,15 @@ namespace %s {
self.hd.write(
"""\n#include "dreamweb/runtime.h"
-#include "structs.h"
+#include "dreamweb/structs.h"
+#include "dreamweb/dreambase.h"
namespace %s {
-class %sContext : public Context {
+class %sContext : public DreamBase, public Context {
public:
+ DreamGenContext() : DreamBase(), Context(_realData) {}
+
void __start();
"""
%(self.namespace, self.namespace))
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
new file mode 100644
index 0000000000..db3c6d94c3
--- /dev/null
+++ b/engines/dreamweb/dreambase.h
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DREAMBASE_H
+#define DREAMBASE_H
+
+#include "common/scummsys.h"
+
+#include "dreamweb/runtime.h"
+
+namespace DreamWeb {
+ class DreamWebEngine;
+}
+
+
+namespace DreamGen {
+
+class DreamBase {
+public:
+ enum { kDefaultDataSegment = 0x1000 };
+
+ DreamWeb::DreamWebEngine *engine;
+
+ SegmentPtr _realData; ///< the primary data segment, points to a huge blob of binary data
+ SegmentRef data; ///< fake segment register always pointing to data segment
+
+ DreamBase() : _realData(new Segment()), data(kDefaultDataSegment, _realData) {
+ }
+
+
+public:
+// TODO: Move functions from stubs.h which do not access any Context member variables to here.
+};
+
+
+} // End of namespace DreamGen
+
+#endif
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 9b5a798782..33a362f449 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -27,12 +27,15 @@
#include "dreamweb/runtime.h"
-#include "structs.h"
+#include "dreamweb/structs.h"
+#include "dreamweb/dreambase.h"
namespace DreamGen {
-class DreamGenContext : public Context {
+class DreamGenContext : public DreamBase, public Context {
public:
+ DreamGenContext() : DreamBase(), Context(_realData) {}
+
void __start();
#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()
diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h
index 2a23c3ec8d..48f7c88a20 100644
--- a/engines/dreamweb/runtime.h
+++ b/engines/dreamweb/runtime.h
@@ -31,10 +31,6 @@
#include "common/list.h"
#include "common/ptr.h"
-namespace DreamWeb {
- class DreamWebEngine;
-}
-
namespace DreamGen {
struct Register {
@@ -242,8 +238,6 @@ class Context {
FreeSegmentList _freeSegments;
public:
- DreamWeb::DreamWebEngine *engine;
-
enum { kDefaultDataSegment = 0x1000 };
Register ax, dx, bx, cx, si, di;
@@ -256,21 +250,17 @@ public:
LowPartOfRegister dl;
HighPartOfRegister dh;
- SegmentPtr _realData; ///< the primary data segment, points to a huge blob of binary data
SegmentRef cs;
MutableSegmentRef ds;
MutableSegmentRef es;
- SegmentRef data; ///< fake segment register always pointing to data segment
Flags flags;
- inline Context(): engine(0), al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx),
- _realData(new Segment()),
- cs(kDefaultDataSegment, _realData),
- ds(this, kDefaultDataSegment, _realData),
- es(this, kDefaultDataSegment, _realData),
- data(kDefaultDataSegment, _realData) {
+ Context(SegmentPtr realData): al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx),
+ cs(kDefaultDataSegment, realData),
+ ds(this, kDefaultDataSegment, realData),
+ es(this, kDefaultDataSegment, realData) {
- _segments[kDefaultDataSegment] = _realData;
+ _segments[kDefaultDataSegment] = realData;
}
SegmentRef getSegment(uint16 value) {