[Scummvm-git-logs] scummvm master -> 31e6d9f72463fb6a2d21fd79e0e16d26474b26c7
dreammaster
paulfgilbert at gmail.com
Fri May 3 11:50:51 CEST 2019
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a6b1bc98ae GLK: GLULXE: Move savegame code into loadGameData/saveGameData
31e6d9f724 GLK: GLULXE: Rearrange fields to suppress VS alignment warning
Commit: a6b1bc98ae21348c8492c62d07fed738357777d6
https://github.com/scummvm/scummvm/commit/a6b1bc98ae21348c8492c62d07fed738357777d6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-05-03T19:49:21+10:00
Commit Message:
GLK: GLULXE: Move savegame code into loadGameData/saveGameData
Changed paths:
engines/glk/glulxe/exec.cpp
engines/glk/glulxe/glulxe.cpp
engines/glk/glulxe/glulxe.h
engines/glk/glulxe/serial.cpp
diff --git a/engines/glk/glulxe/exec.cpp b/engines/glk/glulxe/exec.cpp
index 01faad8..5fd15a3 100644
--- a/engines/glk/glulxe/exec.cpp
+++ b/engines/glk/glulxe/exec.cpp
@@ -681,12 +681,12 @@ PerformJump: /* goto label for successful jumping... ironic, no? */
case op_save:
push_callstub(inst[1].desttype, inst[1].value);
- value = perform_save(find_stream_by_id(inst[0].value));
+ value = saveGameData(find_stream_by_id(inst[0].value), "Savegame").getCode() == Common::kNoError ? 0 : 1;
pop_callstub(value);
break;
case op_restore:
- value = perform_restore(find_stream_by_id(inst[0].value), false);
+ value = loadGameData(find_stream_by_id(inst[0].value)).getCode() == Common::kNoError ? 0 : 1;
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.cpp b/engines/glk/glulxe/glulxe.cpp
index 5251b30..cbe09ce 100644
--- a/engines/glk/glulxe/glulxe.cpp
+++ b/engines/glk/glulxe/glulxe.cpp
@@ -74,16 +74,6 @@ void Glulxe::runGame() {
profile_quit();
}
-Common::Error Glulxe::loadGameData(strid_t file) {
- // TODO
- return Common::kNoError;
-}
-
-Common::Error Glulxe::saveGameData(strid_t file, const Common::String &desc) {
- // TODO
- return Common::kNoError;
-}
-
bool Glulxe::is_gamefile_valid() {
if (_gameFile.size() < 8) {
GUIErrorMessage(_("This is too short to be a valid Glulx file."));
diff --git a/engines/glk/glulxe/glulxe.h b/engines/glk/glulxe/glulxe.h
index b5f13dc..13a82b7 100644
--- a/engines/glk/glulxe/glulxe.h
+++ b/engines/glk/glulxe/glulxe.h
@@ -411,12 +411,12 @@ public:
/**
* Load a savegame from the passed stream
*/
- virtual Common::Error loadGameData(strid_t file) override;
+ virtual Common::Error loadGameData(strid_t str) override;
/**
* Save the game to the passed stream
*/
- virtual Common::Error saveGameData(strid_t file, const Common::String &desc) override;
+ virtual Common::Error saveGameData(strid_t str, const Common::String &desc) override;
/**
* \defgroup Main access methods
@@ -935,20 +935,6 @@ public:
void final_serial();
/**
- * Write the state to the output stream. This returns 0 on success, 1 on failure.
- */
- uint perform_save(strid_t str);
-
- /**
- * Pull a state pointer from a stream. This returns 0 on success, 1 on failure. Note that if it succeeds,
- * the frameptr, localsbase, and valstackbase registers are invalid; they must be rebuilt from the stack.
- *
- * If fromshell is true, the restore is being invoked by the library shell (an autorestore of some kind).
- * This currently happens only in iosglk.
- */
- uint perform_restore(strid_t str, int fromshell);
-
- /**
* Add a state pointer to the undo chain. This returns 0 on success, 1 on failure.
*/
uint perform_saveundo();
diff --git a/engines/glk/glulxe/serial.cpp b/engines/glk/glulxe/serial.cpp
index d138027..d485160 100644
--- a/engines/glk/glulxe/serial.cpp
+++ b/engines/glk/glulxe/serial.cpp
@@ -232,7 +232,7 @@ uint Glulxe::perform_restoreundo() {
return res;
}
-uint Glulxe::perform_save(strid_t str) {
+Common::Error Glulxe::saveGameData(strid_t str, const Common::String &desc) {
dest_t dest;
int ix;
uint res, lx, val;
@@ -246,8 +246,8 @@ uint Glulxe::perform_save(strid_t str) {
fatal_error("Streams are only available in Glk I/O system.");
}
- if (str == 0)
- return 1;
+ if (str == nullptr)
+ return Common::kUnknownError;
dest.ismem = false;
dest.size = 0;
@@ -358,16 +358,17 @@ uint Glulxe::perform_save(strid_t str) {
/* All done. */
- return res;
+ return res ? Common::kUnknownError : Common::kNoError;
}
-uint Glulxe::perform_restore(strid_t str, int fromshell) {
+Common::Error Glulxe::loadGameData(strid_t str) {
dest_t dest;
int ix;
uint lx, res, val;
uint filestart, filelen = 0;
uint heapsumlen = 0;
uint *heapsumarr = nullptr;
+ bool fromshell = false;
/* If profiling is enabled and active then fail. */
#if VM_PROFILING
@@ -384,7 +385,7 @@ uint Glulxe::perform_restore(strid_t str, int fromshell) {
}
if (str == 0)
- return 1;
+ return Common::kUnknownError;
dest.ismem = false;
dest.size = 0;
@@ -402,7 +403,7 @@ uint Glulxe::perform_restore(strid_t str, int fromshell) {
}
if (res == 0 && val != IFFID('F', 'O', 'R', 'M')) {
/* ### bad header */
- return 1;
+ return Common::kUnknownError;
}
if (res == 0) {
res = read_long(&dest, &filelen);
@@ -414,7 +415,7 @@ uint Glulxe::perform_restore(strid_t str, int fromshell) {
}
if (res == 0 && val != IFFID('I', 'F', 'Z', 'S')) { /* ### ? */
/* ### bad header */
- return 1;
+ return Common::kUnknownError;
}
while (res == 0 && dest.pos < filestart + filelen) {
@@ -435,7 +436,7 @@ uint Glulxe::perform_restore(strid_t str, int fromshell) {
res = read_byte(&dest, &dummy);
if (res == 0 && Mem1(ix) != dummy) {
/* ### non-matching header */
- return 1;
+ return Common::kUnknownError;
}
}
} else if (chunktype == IFFID('C', 'M', 'e', 'm')) {
@@ -453,7 +454,7 @@ uint Glulxe::perform_restore(strid_t str, int fromshell) {
if (chunkstart + chunklen != dest.pos) {
/* ### funny chunk length */
- return 1;
+ return Common::kUnknownError;
}
if ((chunklen & 1) != 0) {
@@ -473,9 +474,9 @@ uint Glulxe::perform_restore(strid_t str, int fromshell) {
}
if (res)
- return 1;
+ return Common::kUnknownError;
- return 0;
+ return Common::kNoError;
}
int Glulxe::reposition_write(dest_t *dest, uint pos) {
Commit: 31e6d9f72463fb6a2d21fd79e0e16d26474b26c7
https://github.com/scummvm/scummvm/commit/31e6d9f72463fb6a2d21fd79e0e16d26474b26c7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-05-03T19:50:29+10:00
Commit Message:
GLK: GLULXE: Rearrange fields to suppress VS alignment warning
Changed paths:
engines/glk/glulxe/glulxe.h
diff --git a/engines/glk/glulxe/glulxe.h b/engines/glk/glulxe/glulxe.h
index 13a82b7..c0008e8 100644
--- a/engines/glk/glulxe/glulxe.h
+++ b/engines/glk/glulxe/glulxe.h
@@ -44,12 +44,11 @@ private:
* \defgroup vm fields
* @{
*/
- CharHandler stream_char_handler;
- UnicharHandler stream_unichar_handler, glkio_unichar_han_ptr;
-
bool vm_exited_cleanly;
uint gamefile_start, gamefile_len;
char *init_err, *init_err2;
+ UnicharHandler stream_unichar_handler, glkio_unichar_han_ptr;
+ CharHandler stream_char_handler;
byte *memmap;
byte *stack;
More information about the Scummvm-git-logs
mailing list