aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/glulxe
diff options
context:
space:
mode:
authorPaul Gilbert2019-06-16 13:29:15 -0700
committerPaul Gilbert2019-06-16 14:59:26 -0700
commit553bb74f8c380ee31fb771c6619dad8e83fed8ce (patch)
treebf99be6554e96d66d2700837d7c08dc0d48ad127 /engines/glk/glulxe
parent3876fb67108284063b4d133cf087a04dae6993e4 (diff)
downloadscummvm-rg350-553bb74f8c380ee31fb771c6619dad8e83fed8ce.tar.gz
scummvm-rg350-553bb74f8c380ee31fb771c6619dad8e83fed8ce.tar.bz2
scummvm-rg350-553bb74f8c380ee31fb771c6619dad8e83fed8ce.zip
GLK: Further changeover of sub-engines to use new savegame code
Diffstat (limited to 'engines/glk/glulxe')
-rw-r--r--engines/glk/glulxe/exec.cpp8
-rw-r--r--engines/glk/glulxe/glulxe.h9
-rw-r--r--engines/glk/glulxe/serial.cpp18
3 files changed, 22 insertions, 13 deletions
diff --git a/engines/glk/glulxe/exec.cpp b/engines/glk/glulxe/exec.cpp
index 5fd15a3be6..cd26241700 100644
--- a/engines/glk/glulxe/exec.cpp
+++ b/engines/glk/glulxe/exec.cpp
@@ -681,12 +681,20 @@ PerformJump: /* goto label for successful jumping... ironic, no? */
case op_save:
push_callstub(inst[1].desttype, inst[1].value);
+#ifdef TODO
value = saveGameData(find_stream_by_id(inst[0].value), "Savegame").getCode() == Common::kNoError ? 0 : 1;
+#else
+ error("TODO");
+#endif
pop_callstub(value);
break;
case op_restore:
+#ifdef TODO
value = loadGameData(find_stream_by_id(inst[0].value)).getCode() == Common::kNoError ? 0 : 1;
+#else
+ error("TODO");
+#endif
if (value == 0) {
/* We've succeeded, and the stack now contains the callstub
saved during saveundo. Ignore this opcode's operand. */
diff --git a/engines/glk/glulxe/glulxe.h b/engines/glk/glulxe/glulxe.h
index 56a912eeca..bf1bad9afe 100644
--- a/engines/glk/glulxe/glulxe.h
+++ b/engines/glk/glulxe/glulxe.h
@@ -407,14 +407,15 @@ public:
}
/**
- * Load a savegame from the passed stream
+ * Load a savegame from the passed Quetzal file chunk stream
*/
- virtual Common::Error loadGameData(strid_t str) override;
+ virtual Common::Error readSaveData(Common::SeekableReadStream *rs) override;
/**
- * Save the game to the passed stream
+ * Save the game. The passed write stream represents access to the UMem chunk
+ * in the Quetzal save file that will be created
*/
- virtual Common::Error saveGameData(strid_t str, const Common::String &desc) override;
+ virtual Common::Error writeGameData(Common::WriteStream *ws) override;
/**
* \defgroup Main access methods
diff --git a/engines/glk/glulxe/serial.cpp b/engines/glk/glulxe/serial.cpp
index d485160302..81cfa9e41b 100644
--- a/engines/glk/glulxe/serial.cpp
+++ b/engines/glk/glulxe/serial.cpp
@@ -232,13 +232,13 @@ uint Glulxe::perform_restoreundo() {
return res;
}
-Common::Error Glulxe::saveGameData(strid_t str, const Common::String &desc) {
+Common::Error Glulxe::writeGameData(Common::WriteStream *ws) {
dest_t dest;
int ix;
- uint res, lx, val;
+ uint res = 0, lx, val;
uint memstart = 0, memlen = 0, stackstart = 0, stacklen = 0;
uint heapstart = 0, heaplen = 0, filestart = 0, filelen = 0;
-
+#ifdef TODO
stream_get_iosys(&val, &lx);
if (val != 2) {
/* Not using the Glk I/O system, so bail. This function only
@@ -246,14 +246,14 @@ Common::Error Glulxe::saveGameData(strid_t str, const Common::String &desc) {
fatal_error("Streams are only available in Glk I/O system.");
}
- if (str == nullptr)
+ if (ws == nullptr)
return Common::kUnknownError;
dest.ismem = false;
dest.size = 0;
dest.pos = 0;
dest.ptr = nullptr;
- dest.str = str;
+ dest.str = ws;
res = 0;
@@ -357,11 +357,11 @@ Common::Error Glulxe::saveGameData(strid_t str, const Common::String &desc) {
}
/* All done. */
-
+#endif
return res ? Common::kUnknownError : Common::kNoError;
}
-Common::Error Glulxe::loadGameData(strid_t str) {
+Common::Error Glulxe::readSaveData(Common::SeekableReadStream *rs) {
dest_t dest;
int ix;
uint lx, res, val;
@@ -369,7 +369,7 @@ Common::Error Glulxe::loadGameData(strid_t str) {
uint heapsumlen = 0;
uint *heapsumarr = nullptr;
bool fromshell = false;
-
+#ifdef TODO
/* If profiling is enabled and active then fail. */
#if VM_PROFILING
if (profile_profiling_active())
@@ -475,7 +475,7 @@ Common::Error Glulxe::loadGameData(strid_t str) {
if (res)
return Common::kUnknownError;
-
+#endif
return Common::kNoError;
}