[Scummvm-git-logs] scummvm master -> 27dd56eed679ec213ae9555f25dd6d3f073797b9

sev- noreply at scummvm.org
Fri Feb 13 22:08:57 UTC 2026


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

Summary:
27dd56eed6 SCUMM: Add getEncByte helper method


Commit: 27dd56eed679ec213ae9555f25dd6d3f073797b9
    https://github.com/scummvm/scummvm/commit/27dd56eed679ec213ae9555f25dd6d3f073797b9
Author: Sebastien Ronsse (sronsse at gmail.com)
Date: 2026-02-13T23:08:52+01:00

Commit Message:
SCUMM: Add getEncByte helper method

Changed paths:
    engines/scumm/resource.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index 9f59eb7cb2b..b1f543fec90 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -65,7 +65,6 @@ static bool checkTryMedia(BaseScummFile *handle);
 /* Open a room */
 void ScummEngine::openRoom(const int room) {
 	bool result;
-	byte encByte = 0;
 
 	debugC(DEBUG_GENERAL, "openRoom(%d)", room);
 	assert(room >= 0);
@@ -102,22 +101,11 @@ void ScummEngine::openRoom(const int room) {
 
 		Common::Path filename(generateFilename(room));
 
-		// Determine the encryption, if any.
-		if (_game.features & GF_USE_KEY) {
-			if (_game.version <= 3)
-				encByte = 0xFF;
-			else if ((_game.version == 4) && (room == 0 || room >= 900))
-				encByte = 0;
-			else
-				encByte = 0x69;
-		} else
-			encByte = 0;
-
 		if (room > 0 && (_game.version == 8))
 			VAR(VAR_CURRENTDISK) = diskNumber;
 
 		// Try to open the file
-		result = openResourceFile(filename, encByte);
+		result = openResourceFile(filename, getEncByte(room));
 
 		if (result) {
 			if (room == 0)
@@ -138,7 +126,7 @@ void ScummEngine::openRoom(const int room) {
 	do {
 		char buf[16];
 		snprintf(buf, sizeof(buf), "%.3d.lfl", room);
-		encByte = 0;
+		byte encByte = 0;
 		if (openResourceFile(buf, encByte))
 			break;
 		askForDisk(buf, diskNumber);
@@ -205,6 +193,19 @@ bool ScummEngine::openFile(BaseScummFile &file, const Common::Path &filename, bo
 	return result;
 }
 
+byte ScummEngine::getEncByte(int room) {
+	// Determine the encryption, if any.
+	if (_game.features & GF_USE_KEY) {
+		if (_game.version <= 3)
+			return 0xFF;
+		else if ((_game.version == 4) && (room == 0 || room >= 900))
+			return 0;
+		else
+			return 0x69;
+	} else
+		return 0;
+}
+
 bool ScummEngine::openResourceFile(const Common::Path &filename, byte encByte) {
 	debugC(DEBUG_GENERAL, "openResourceFile(%s)", filename.toString().c_str());
 
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 40131598084..9563158a6bd 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1089,6 +1089,7 @@ protected:
 	void deleteRoomOffsets();
 	virtual void readRoomsOffsets();
 	void askForDisk(const Common::Path &filename, int disknum);
+	byte getEncByte(int room);
 	bool openResourceFile(const Common::Path &filename, byte encByte);
 
 	void loadPtrToResource(ResType type, ResId idx, const byte *ptr);




More information about the Scummvm-git-logs mailing list