[Scummvm-git-logs] scummvm master -> 0a08d2e18b202cc0167c5f9746c9707d5efe86ef
dreammaster
paulfgilbert at gmail.com
Sun Feb 10 20:19:27 CET 2019
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0a08d2e18b GLK: FROTZ: Fixes for saving and restoring in V6 games
Commit: 0a08d2e18b202cc0167c5f9746c9707d5efe86ef
https://github.com/scummvm/scummvm/commit/0a08d2e18b202cc0167c5f9746c9707d5efe86ef
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-02-10T11:19:18-08:00
Commit Message:
GLK: FROTZ: Fixes for saving and restoring in V6 games
Changed paths:
engines/glk/frotz/mem.cpp
engines/glk/frotz/mem.h
engines/glk/frotz/processor.cpp
engines/glk/frotz/processor.h
engines/glk/frotz/processor_buffer.cpp
engines/glk/frotz/processor_streams.cpp
engines/glk/frotz/quetzal.cpp
diff --git a/engines/glk/frotz/mem.cpp b/engines/glk/frotz/mem.cpp
index ea3ca18..32e3ab3 100644
--- a/engines/glk/frotz/mem.cpp
+++ b/engines/glk/frotz/mem.cpp
@@ -29,7 +29,7 @@ namespace Glk {
namespace Frotz {
Mem::Mem() : story_fp(nullptr), story_size(0), first_undo(nullptr), last_undo(nullptr),
- curr_undo(nullptr), undo_mem(nullptr), zmp(nullptr), prev_zmp(nullptr),
+ curr_undo(nullptr), undo_mem(nullptr), zmp(nullptr), pcp(nullptr), prev_zmp(nullptr),
undo_diff(nullptr), undo_count(0), reserve_mem(0) {
}
diff --git a/engines/glk/frotz/mem.h b/engines/glk/frotz/mem.h
index c58ef65..3a927e2 100644
--- a/engines/glk/frotz/mem.h
+++ b/engines/glk/frotz/mem.h
@@ -36,13 +36,15 @@ namespace Frotz {
#define SET_BYTE(addr,v) zmp[addr] = v
#define LOW_BYTE(addr,v) v = zmp[addr]
+typedef uint offset_t;
+
/**
* Stores undo information
*/
struct undo_struct {
undo_struct *next;
undo_struct *prev;
- long pc;
+ offset_t pc;
long diff_size;
zword frame_count;
zword stack_size;
@@ -150,6 +152,10 @@ public:
* Constructor
*/
Mem();
+
+ /**
+ * Destructor
+ */
virtual ~Mem() {}
/**
diff --git a/engines/glk/frotz/processor.cpp b/engines/glk/frotz/processor.cpp
index b9631c8..eebcc60 100644
--- a/engines/glk/frotz/processor.cpp
+++ b/engines/glk/frotz/processor.cpp
@@ -293,7 +293,7 @@ void Processor::interpret() {
}
void Processor::call(zword routine, int argc, zword *args, int ct) {
- long pc;
+ uint32 pc;
zword value;
zbyte count;
int i;
@@ -357,7 +357,7 @@ void Processor::call(zword routine, int argc, zword *args, int ct) {
}
void Processor::ret(zword value) {
- long pc;
+ offset_t pc;
int ct;
if (_sp > _fp)
@@ -369,7 +369,7 @@ void Processor::ret(zword value) {
_frameCount--;
_fp = _stack + 1 + *_sp++;
pc = *_sp++;
- pc = ((long)*_sp++ << 9) | pc;
+ pc = ((offset_t)*_sp++ << 9) | pc;
SET_PC(pc);
@@ -385,7 +385,7 @@ void Processor::ret(zword value) {
}
void Processor::branch(bool flag) {
- long pc;
+ offset_t pc;
zword offset;
zbyte specifier;
zbyte off1;
@@ -539,12 +539,12 @@ void Processor::z_check_arg_count() {
}
void Processor::z_jump() {
- long pc;
+ offset_t pc;
GET_PC(pc);
pc += (short)zargs[0] - 2;
- if ((uint)pc >= story_size)
+ if (pc >= story_size)
runtimeError(ERR_ILL_JUMP_ADDR);
SET_PC(pc);
diff --git a/engines/glk/frotz/processor.h b/engines/glk/frotz/processor.h
index 83d2443..e992a78 100644
--- a/engines/glk/frotz/processor.h
+++ b/engines/glk/frotz/processor.h
@@ -1734,7 +1734,10 @@ public:
/**
* Return the current program execution offset
*/
- uint getPC() const { return pcp - zmp; }
+ uint getPC() const {
+ assert(pcp);
+ return pcp - zmp;
+ }
/**
* Set the program execution offset
diff --git a/engines/glk/frotz/processor_buffer.cpp b/engines/glk/frotz/processor_buffer.cpp
index 65f1fda..9473411 100644
--- a/engines/glk/frotz/processor_buffer.cpp
+++ b/engines/glk/frotz/processor_buffer.cpp
@@ -167,7 +167,7 @@ void Processor::runtimeError(ErrorCode errNum) {
if ((_err_report_mode == ERR_REPORT_ALWAYS)
|| (_err_report_mode == ERR_REPORT_ONCE && wasfirst)) {
- long pc;
+ offset_t pc;
GET_PC(pc);
print_string("Warning: ");
print_string(ERR_MESSAGES[errNum - 1]);
diff --git a/engines/glk/frotz/processor_streams.cpp b/engines/glk/frotz/processor_streams.cpp
index 067708f..aedec2f 100644
--- a/engines/glk/frotz/processor_streams.cpp
+++ b/engines/glk/frotz/processor_streams.cpp
@@ -535,9 +535,10 @@ void Processor::z_restart() {
_frameCount = 0;
if (h_version != V6 && h_version != V9) {
- long pc = (long)h_start_pc;
+ offset_t pc = (offset_t)h_start_pc;
SET_PC(pc);
} else {
+ SET_PC(0);
call(h_start_pc, 0, nullptr, 0);
}
diff --git a/engines/glk/frotz/quetzal.cpp b/engines/glk/frotz/quetzal.cpp
index 53de293..e025b2b 100644
--- a/engines/glk/frotz/quetzal.cpp
+++ b/engines/glk/frotz/quetzal.cpp
@@ -53,7 +53,7 @@ bool Quetzal::read_long(Common::ReadStream *f, uint *result) {
bool Quetzal::save(Common::WriteStream *svf, Processor *proc, const Common::String &desc) {
Processor &p = *proc;
uint ifzslen = 0, cmemlen = 0, stkslen = 0, descLen = 0;
- uint pc;
+ offset_t pc;
zword i, j, n;
zword nvars, nargs, nstk;
zbyte var;
@@ -214,7 +214,7 @@ bool Quetzal::save(Common::WriteStream *svf, Processor *proc, const Common::Stri
int Quetzal::restore(Common::SeekableReadStream *svf, Processor *proc) {
Processor &p = *proc;
uint ifzslen, currlen, tmpl;
- uint pc;
+ offset_t pc;
zword i, tmpw;
int fatal = 0; // Set to -1 when errors must be fatal.
zbyte skip, progress = GOT_NONE;
More information about the Scummvm-git-logs
mailing list