[Scummvm-git-logs] scummvm-tools master -> 786824b6cfa059feb11fb8f7bf1889d27f8396ce

sdelamarre noreply at scummvm.org
Thu Mar 23 22:33:36 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-tools' repo located at https://github.com/scummvm/scummvm-tools .

Summary:
786824b6cf GOB: use start offsets of instructions


Commit: 786824b6cfa059feb11fb8f7bf1889d27f8396ce
    https://github.com/scummvm/scummvm-tools/commit/786824b6cfa059feb11fb8f7bf1889d27f8396ce
Author: BLooperZ (blooperz at users.noreply.github.com)
Date: 2023-03-23T23:33:33+01:00

Commit Message:
GOB: use start offsets of instructions

Changed paths:
    engines/gob/degob_script.cpp
    engines/gob/degob_script.h


diff --git a/engines/gob/degob_script.cpp b/engines/gob/degob_script.cpp
index f93f5312..20a6a4ff 100644
--- a/engines/gob/degob_script.cpp
+++ b/engines/gob/degob_script.cpp
@@ -214,7 +214,7 @@ void Script::print(const char *s, ...) const {
 	putString(buf);
 }
 void Script::printIndent() const {
-	print("%08d:", getPos());
+	print("%08d:", lastOffsetPos());
 	for (uint32 i = 0; i < _indent; i++)
 		putString("	");
 }
@@ -236,6 +236,8 @@ void Script::incIndent() { _indent++; }
 void Script::decIndent() { _indent--; }
 
 uint32 Script::getPos() const { return _ptr - _totData; }
+uint32 Script::lastOffsetPos() const { return _lastOffsetPos - _totData; }
+void Script::updateOffsetPos(uint32 pos) { _lastOffsetPos = _totData + pos; }
 void Script::skip(uint32 off) { seek(off, SEEK_CUR); }
 void Script::seek(uint32 off, int whence) {
 	switch (whence) {
@@ -904,7 +906,9 @@ void Script::funcBlock(int16 retFlag) {
 		if (cmd2 == 0)
 			cmd >>= 4;
 
+		updateOffsetPos(getPos());
 		funcOpcode(cmd2, cmd, params);
+		updateOffsetPos(getPos());
 
 	} while (params.counter != params.cmdCount);
 }
@@ -954,6 +958,7 @@ void Script::deGobFunction() {
 			print("--- %s ---\n", it->second.c_str());
 		}
 	}
+	updateOffsetPos(getPos());
 	printIndent();
 	print("sub_%d {\n", getPos());
 	incIndent();
diff --git a/engines/gob/degob_script.h b/engines/gob/degob_script.h
index 1ce5692f..49c450c9 100644
--- a/engines/gob/degob_script.h
+++ b/engines/gob/degob_script.h
@@ -68,6 +68,8 @@ public:
 	virtual ~Script();
 
 	uint32 getPos() const;
+	uint32 lastOffsetPos() const;
+	void updateOffsetPos(uint32 pos);
 	void skip(uint32 off);
 	void seek(uint32 off, int whence = SEEK_SET);
 
@@ -168,7 +170,7 @@ protected:
 	void deGobFunction();
 
 private:
-	byte *_totData, *_ptr;
+	byte *_totData, *_ptr, *_lastOffsetPos;
 	uint32 _totSize;
 
 protected:




More information about the Scummvm-git-logs mailing list