[Scummvm-git-logs] scummvm master -> 8aa4a9cf6b893ddd47a9503c4dfc8d3fcb3afccc
dreammaster
dreammaster at scummvm.org
Wed Feb 10 03:55:27 UTC 2021
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:
8aa4a9cf6b AGS: Shift game scanner to be available via command line
Commit: 8aa4a9cf6b893ddd47a9503c4dfc8d3fcb3afccc
https://github.com/scummvm/scummvm/commit/8aa4a9cf6b893ddd47a9503c4dfc8d3fcb3afccc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-02-09T19:54:33-08:00
Commit Message:
AGS: Shift game scanner to be available via command line
Changed paths:
A engines/ags/game_scanner.cpp
A engines/ags/game_scanner.h
R engines/ags/tests/game_scanner.cpp
R engines/ags/tests/game_scanner.h
engines/ags/ags.cpp
engines/ags/ags.h
engines/ags/detection.cpp
engines/ags/module.mk
diff --git a/engines/ags/ags.cpp b/engines/ags/ags.cpp
index 1314d582eb..9d53c5939e 100644
--- a/engines/ags/ags.cpp
+++ b/engines/ags/ags.cpp
@@ -23,6 +23,7 @@
#include "ags/ags.h"
#include "ags/detection.h"
#include "ags/events.h"
+#include "ags/game_scanner.h"
#include "ags/music.h"
#include "common/scummsys.h"
#include "common/config-manager.h"
@@ -57,9 +58,6 @@
#include "ags/shared/util/directory.h"
#include "ags/shared/util/path.h"
-#ifdef ENABLE_AGS_SCANNER
-#include "ags/tests/game_scanner.h"
-#endif
#ifdef ENABLE_AGS_TESTS
#include "ags/tests/test_all.h"
#endif
@@ -285,8 +283,9 @@ AGSEngine::AGSEngine(OSystem *syst, const AGSGameDescription *gameDesc) : Engine
_rawScreen(nullptr), _screen(nullptr), _gfxDriver(nullptr),
_globals(nullptr) {
g_vm = this;
- DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
DebugMan.addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
+ DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
+ DebugMan.addDebugChannel(kDebugScan, "Scan", "Scan for unrecognised games");
_events = new EventsManager();
_music = new Music(_mixer);
@@ -310,19 +309,21 @@ const PluginVersion *AGSEngine::getNeededPlugins() const {
}
Common::Error AGSEngine::run() {
- const char *filename = _gameDescription->desc.filesDescriptions[0].fileName;
- const char *ARGV[] = { "scummvm.exe", filename };
- const int ARGC = 2;
+ if (debugChannelSet(-1, kDebugScan)) {
+ // Scan the given folder and subfolders for unknown games
+ AGS3::GameScanner scanner;
+ scanner.scan(ConfMan.get("path"));
+ return Common::kNoError;
+ }
-#if ENABLE_AGS_SCANNER
- AGS3::GameScanner scanner;
- scanner.scan();
- return Common::kNoError;
-#endif
#ifdef ENABLE_AGS_TESTS
AGS3::Test_DoAllTests();
return Common::kNoError;
#endif
+
+ const char *filename = _gameDescription->desc.filesDescriptions[0].fileName;
+ const char *ARGV[] = { "scummvm.exe", filename };
+ const int ARGC = 2;
AGS3::main_init(ARGC, ARGV);
#if AGS_PLATFORM_OS_WINDOWS
diff --git a/engines/ags/ags.h b/engines/ags/ags.h
index dc8ebd2561..a78501cd3a 100644
--- a/engines/ags/ags.h
+++ b/engines/ags/ags.h
@@ -47,8 +47,9 @@ namespace AGS {
#define SCREEN_HEIGHT 200
enum AGSDebugChannels {
- kDebugPath = 1 << 0,
- kDebugGraphics = 1 << 1
+ kDebugGraphics = 1 << 0,
+ kDebugPath = 1 << 1,
+ kDebugScan = 1 << 2
};
struct AGSGameDescription;
diff --git a/engines/ags/detection.cpp b/engines/ags/detection.cpp
index 98e00590a6..efdcea7958 100644
--- a/engines/ags/detection.cpp
+++ b/engines/ags/detection.cpp
@@ -21,6 +21,7 @@
*/
#include "base/plugins.h"
+#include "common/config-manager.h"
#include "common/file.h"
#include "common/md5.h"
#include "ags/detection.h"
@@ -69,9 +70,19 @@ ADDetectedGame AGSMetaEngineDetection::fallbackDetect(const FileMap &allFiles, c
AGS::g_fallbackDesc.desc.platform = Common::kPlatformDOS;
AGS::g_fallbackDesc.desc.flags = ADGF_NO_FLAGS;
- // // Set the defaults for gameid and extra
+ // FIXME: Hack to return match without checking for game data,
+ // so that the command line game scanner will work
+ if (ConfMan.get("gameid") == "ags-scan") {
+ _gameid = "ags-scan";
+ AGS::g_fallbackDesc.desc.gameId = "ags-scan";
+ return ADDetectedGame(&AGS::g_fallbackDesc.desc);
+ }
+
+ // Set the defaults for gameid and extra
_gameid = "ags";
_extra.clear();
+ AGS::g_fallbackDesc.desc.gameId = _gameid.c_str();
+ AGS::g_fallbackDesc.desc.extra = _extra.c_str();
// Scan for AGS games
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@@ -94,8 +105,6 @@ ADDetectedGame AGSMetaEngineDetection::fallbackDetect(const FileMap &allFiles, c
f.seek(0);
_md5 = Common::computeStreamMD5AsString(f, 5000);
- AGS::g_fallbackDesc.desc.gameId = _gameid.c_str();
- AGS::g_fallbackDesc.desc.extra = _extra.c_str();
AGS::g_fallbackDesc.desc.filesDescriptions[0].fileName = _filename.c_str();
AGS::g_fallbackDesc.desc.filesDescriptions[0].fileSize = f.size();
AGS::g_fallbackDesc.desc.filesDescriptions[0].md5 = _md5.c_str();
diff --git a/engines/ags/tests/game_scanner.cpp b/engines/ags/game_scanner.cpp
similarity index 96%
rename from engines/ags/tests/game_scanner.cpp
rename to engines/ags/game_scanner.cpp
index acbc39bf41..649114689a 100644
--- a/engines/ags/tests/game_scanner.cpp
+++ b/engines/ags/game_scanner.cpp
@@ -20,8 +20,8 @@
*
*/
-#include "ags/tests/game_scanner.h"
#include "ags/detection.h"
+#include "ags/game_scanner.h"
#include "ags/shared/ac/gamesetupstruct.h"
#include "ags/shared/core/assetmanager.h"
#include "ags/shared/util/multifilelib.h"
@@ -38,10 +38,10 @@ extern bool define_gamedata_location(const AGS::Shared::String &exe_path);
extern bool engine_try_init_gamedata(AGS::Shared::String gamepak_path);
extern GameSetupStruct game;
-void GameScanner::scan() {
+void GameScanner::scan(const Common::String &startFolder) {
detectClashes();
- Common::FSNode folder(".");
+ Common::FSNode folder(startFolder);
scanFolder(folder);
if (!_oldGames.empty()) {
@@ -53,6 +53,7 @@ void GameScanner::scan() {
debug("");
}
+ debug("// 2.5+ games that should be supported");
Common::HashMap<Common::String, bool> gameDescs;
for (EntryArray::iterator it = _games.begin(); it != _games.end(); ++it) {
if (!gameDescs.contains(it->_id))
diff --git a/engines/ags/tests/game_scanner.h b/engines/ags/game_scanner.h
similarity index 97%
rename from engines/ags/tests/game_scanner.h
rename to engines/ags/game_scanner.h
index bf9d70059f..92f206885f 100644
--- a/engines/ags/tests/game_scanner.h
+++ b/engines/ags/game_scanner.h
@@ -66,7 +66,7 @@ public:
/**
* Main execution method
*/
- void scan();
+ void scan(const Common::String &startFolder);
};
} // namespace AGS3
diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index 7527e888ec..a102e56a6b 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/ags
MODULE_OBJS = \
ags.o \
events.o \
+ game_scanner.o \
metaengine.o \
music.o \
lib/aastr-0.1.1/aarot.o \
@@ -306,11 +307,6 @@ MODULE_OBJS = \
plugins/ags_sprite_font/variable_width_sprite_font.o \
plugins/ags_tcp_ip/ags_tcp_ip.o
-ifdef ENABLE_AGS_SCANNER
-MODULE_OBJS += \
- tests/game_scanner.o
-endif
-
ifdef ENABLE_AGS_TESTS
MODULE_OBJS += \
tests/test_all.o \
More information about the Scummvm-git-logs
mailing list