[Scummvm-git-logs] scummvm master -> c5995d64e75075a8dc6b5e3c369d7258c6ccc117

sluicebox noreply at scummvm.org
Thu Mar 21 14:38:28 UTC 2024


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:
c5995d64e7 AGI: Refactor away agiDetectGame


Commit: c5995d64e75075a8dc6b5e3c369d7258c6ccc117
    https://github.com/scummvm/scummvm/commit/c5995d64e75075a8dc6b5e3c369d7258c6ccc117
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-03-21T07:37:27-07:00

Commit Message:
AGI: Refactor away agiDetectGame

Changed paths:
    engines/agi/agi.cpp
    engines/agi/agi.h
    engines/agi/metaengine.cpp


diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index af566f52986..e94d9d3b0bd 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -437,17 +437,23 @@ void AgiEngine::initialize() {
 
 	_game.name[0] = '\0';
 
-	debugC(2, kDebugLevelMain, "Detect game");
+	if (getVersion() <= 0x2001) {
+		_loader = new AgiLoader_v1(this);
+	} else if (getVersion() <= 0x2999) {
+		_loader = new AgiLoader_v2(this);
+	} else {
+		_loader = new AgiLoader_v3(this);
+	}
 
-	if (agiDetectGame() == errOK) {
+	debugC(2, kDebugLevelMain, "Detect game");
+	int ec = _loader->detectGame();
+	if (ec == errOK) {
 		debugC(2, kDebugLevelMain, "game loaded");
 	} else {
 		warning("Could not open AGI game");
 	}
 	// finally set up actual VM opcodes, because we should now have figured out the right AGI version
 	setupOpCodes(getVersion());
-
-	debugC(2, kDebugLevelMain, "Init sound");
 }
 
 bool AgiEngine::promptIsEnabled() {
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index b20e622bd22..95eeb7e48da 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -873,7 +873,6 @@ public:
 
 	int agiInit();
 	void agiDeinit();
-	int agiDetectGame();
 	int agiLoadResource(int16 resourceType, int16 resourceNr);
 	void agiUnloadResource(int16 resourceType, int16 resourceNr);
 	void agiUnloadResources();
diff --git a/engines/agi/metaengine.cpp b/engines/agi/metaengine.cpp
index d3ffad7584b..5f393b66eed 100644
--- a/engines/agi/metaengine.cpp
+++ b/engines/agi/metaengine.cpp
@@ -435,21 +435,4 @@ bool AgiBase::canSaveGameStateCurrently(Common::U32String *msg) {
 	return false;
 }
 
-int AgiEngine::agiDetectGame() {
-	int ec = errOK;
-
-	assert(_gameDescription != nullptr);
-
-	if (getVersion() <= 0x2001) {
-		_loader = new AgiLoader_v1(this);
-	} else if (getVersion() <= 0x2999) {
-		_loader = new AgiLoader_v2(this);
-	} else {
-		_loader = new AgiLoader_v3(this);
-	}
-	ec = _loader->detectGame();
-
-	return ec;
-}
-
 } // End of namespace Agi




More information about the Scummvm-git-logs mailing list