[Scummvm-git-logs] scummvm master -> 9106c454a0dab0470a2cdcd266056d80b8e159c5

Die4Ever noreply at scummvm.org
Sat Feb 12 22:09:16 UTC 2022


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:
bc2661886b GROOVIE: fix TLC directLoad
9106c454a0 GROOVIE: UHP fix savename length


Commit: bc2661886b66a1e1da16b7e9d56f4cb74d2b75e6
    https://github.com/scummvm/scummvm/commit/bc2661886b66a1e1da16b7e9d56f4cb74d2b75e6
Author: Die4Ever (die4ever2005 at gmail.com)
Date: 2022-02-12T16:08:43-06:00

Commit Message:
GROOVIE: fix TLC directLoad

Changed paths:
    engines/groovie/script.cpp


diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index f7e6c1dfe93..6d5da30fd7f 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -179,6 +179,7 @@ bool Script::loadScript(Common::String filename) {
 
 	// Load the code
 	_codeSize = scriptfile->size();
+	delete[] _code;
 	_code = new byte[_codeSize];
 	if (!_code)
 		return false;
@@ -268,6 +269,7 @@ void Script::directGameLoad(int slot) {
 		_code = _savedCode;
 		_codeSize = _savedCodeSize;
 		_savedCode = nullptr;
+		_scriptFile = _savedScriptFile;
 	}
 
 	uint16 targetInstruction = 0;
@@ -300,6 +302,23 @@ void Script::directGameLoad(int slot) {
 		setVariable(0x19, slot);
 		_currentInstruction = 0x23B4;
 		return;
+	} else if (_version == kGroovieTLC) {
+		// Save the current code
+		_savedCode = _code;
+		_code = nullptr;
+		_savedCodeSize = _codeSize;
+
+		// Save the filename of the current script
+		_savedScriptFile = _scriptFile;
+
+		_savedInstruction = 0x45;
+		_savedStacktop = 0;
+
+		loadScript("register.grv");
+
+		setVariable(0x19, slot);
+		_currentInstruction = 0x5CF;
+		return;
 	}
 
 	if (midiInitScript && !_vm->_musicPlayer->isMidiInit()) {
@@ -1879,6 +1898,7 @@ void Script::o_loadscript() {
 
 	// Save the current code
 	_savedCode = _code;
+	_code = nullptr;
 	_savedCodeSize = _codeSize;
 	_savedInstruction = _currentInstruction;
 


Commit: 9106c454a0dab0470a2cdcd266056d80b8e159c5
    https://github.com/scummvm/scummvm/commit/9106c454a0dab0470a2cdcd266056d80b8e159c5
Author: Die4Ever (die4ever2005 at gmail.com)
Date: 2022-02-12T16:08:49-06:00

Commit Message:
GROOVIE: UHP fix savename length

Changed paths:
    engines/groovie/script.cpp
    engines/groovie/script.h


diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 6d5da30fd7f..8c2cc7b73b8 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -616,13 +616,18 @@ bool Script::canDirectSave() const {
 }
 
 void Script::directGameSave(int slot, const Common::String &desc) {
-	char name[19];
+	char name[27];
 	debugC(0, kDebugScript, "directGameSave %d %s", slot, desc.c_str());
 	if (slot < 0 || slot > MAX_SAVES - 1) {
 		return;
 	}
 	const char *saveName = desc.c_str();
-	uint name_len = _version == kGroovieTLC ? 19 : 15;
+	uint name_len = _version == 15;
+	if (_version == kGroovieTLC) {
+		name_len = 19;
+	} else if (_version == kGroovieUHP) {
+		name_len = 27;
+	}
 	for (uint i = 0; i < desc.size() && i < name_len; i++) {
 		name[i] = saveName[i] - 0x30;
 	}
@@ -632,7 +637,7 @@ void Script::directGameSave(int slot, const Common::String &desc) {
 	savegame(slot, name);
 }
 
-void Script::savegame(uint slot, const char name[19]) {
+void Script::savegame(uint slot, const char name[27]) {
 	char newchar;
 	debugC(0, kDebugScript, "savegame %d, canDirectSave: %d", slot, canDirectSave());
 	Common::OutSaveFile *file = SaveLoad::openForSaving(ConfMan.getActiveDomainName(), slot);
@@ -652,13 +657,18 @@ void Script::savegame(uint slot, const char name[19]) {
 	}
 
 	// Saving the variables. It is endian safe because they're byte variables
-	uint name_len = _version == kGroovieTLC ? 19 : 15;
+	uint name_len = _version == 15;
+	if (_version == kGroovieTLC) {
+		name_len = 19;
+	} else if (_version == kGroovieUHP) {
+		name_len = 27;
+	}
 	file->write(name, name_len);
 	file->write(_variables + name_len, 0x400 - name_len);
 	delete file;
 
 	// Cache the saved name
-	char cacheName[20];
+	char cacheName[28];
 	for (uint i = 0; i < name_len; i++) {
 		newchar = name[i] + 0x30;
 		if ((newchar < 0x30 || newchar > 0x39) && (newchar < 0x41 || newchar > 0x7A) && newchar != 0x2E) {
diff --git a/engines/groovie/script.h b/engines/groovie/script.h
index bcbde67aa7b..ff1b378e4dd 100644
--- a/engines/groovie/script.h
+++ b/engines/groovie/script.h
@@ -161,7 +161,7 @@ private:
 
 	void loadgame(uint slot);
 	bool preview_loadgame(uint slot);
-	void savegame(uint slot, const char name[19]);
+	void savegame(uint slot, const char name[27]);
 	bool playvideofromref(uint32 fileref, bool loopUntilAudioDone = false);
 	bool playBackgroundSound(uint32 fileref, uint32 loops);
 	void printString(Graphics::Surface *surface, const char *str);




More information about the Scummvm-git-logs mailing list