2018-10-14 13:02:24 -07:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 18:47:58 +01:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2018-10-14 13:02:24 -07:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2018-10-14 13:02:24 -07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-08-08 04:14:56 +05:30
|
|
|
#include "base/plugins.h"
|
|
|
|
#include "common/md5.h"
|
|
|
|
#include "common/memstream.h"
|
|
|
|
#include "common/str-array.h"
|
|
|
|
#include "common/file.h"
|
|
|
|
#include "common/config-manager.h"
|
|
|
|
|
2018-12-31 19:15:07 -08:00
|
|
|
#include "glk/detection.h"
|
2020-08-08 04:14:56 +05:30
|
|
|
#include "glk/game_description.h"
|
2021-05-16 15:59:19 +08:00
|
|
|
#include "glk/glk.h"
|
2020-08-08 04:14:56 +05:30
|
|
|
|
2019-09-04 21:21:14 -07:00
|
|
|
#include "glk/adrift/detection.h"
|
2019-06-03 19:18:40 -07:00
|
|
|
#include "glk/advsys/detection.h"
|
2019-11-22 19:27:02 -08:00
|
|
|
#include "glk/agt/detection.h"
|
2018-12-27 13:20:53 +02:00
|
|
|
#include "glk/alan2/detection.h"
|
2019-06-26 21:42:47 -07:00
|
|
|
#include "glk/alan3/detection.h"
|
2019-10-19 21:26:04 -07:00
|
|
|
#include "glk/archetype/detection.h"
|
2021-08-22 13:34:06 +01:00
|
|
|
#include "glk/comprehend/detection.h"
|
2020-10-13 21:06:48 -07:00
|
|
|
#include "glk/glulx/detection.h"
|
2019-05-07 18:57:09 +10:00
|
|
|
#include "glk/hugo/detection.h"
|
2019-09-30 20:33:24 -07:00
|
|
|
#include "glk/jacl/detection.h"
|
2019-10-13 11:31:07 -07:00
|
|
|
#include "glk/level9/detection.h"
|
2019-05-07 15:27:14 +10:00
|
|
|
#include "glk/magnetic/detection.h"
|
2019-07-20 14:58:39 -07:00
|
|
|
#include "glk/quest/detection.h"
|
2018-11-14 18:01:42 -08:00
|
|
|
#include "glk/scott/detection.h"
|
2020-10-13 21:06:48 -07:00
|
|
|
#include "glk/zcode/detection.h"
|
2020-09-09 15:55:36 +01:00
|
|
|
|
|
|
|
#ifndef RELEASE_BUILD
|
2018-11-27 19:48:17 -08:00
|
|
|
#include "glk/tads/detection.h"
|
2020-09-09 15:55:36 +01:00
|
|
|
#endif
|
2018-10-14 13:02:24 -07:00
|
|
|
|
|
|
|
#include "base/plugins.h"
|
2018-11-03 20:41:59 -07:00
|
|
|
#include "common/md5.h"
|
|
|
|
#include "common/memstream.h"
|
2018-10-14 13:02:24 -07:00
|
|
|
#include "common/savefile.h"
|
|
|
|
#include "common/str-array.h"
|
|
|
|
#include "common/system.h"
|
|
|
|
#include "graphics/surface.h"
|
2018-10-17 22:45:25 -07:00
|
|
|
#include "common/config-manager.h"
|
2018-10-18 07:34:39 -07:00
|
|
|
#include "common/file.h"
|
2020-06-21 21:48:22 +01:00
|
|
|
#include "common/translation.h"
|
2018-10-14 13:02:24 -07:00
|
|
|
|
2021-05-16 15:59:19 +08:00
|
|
|
static const DebugChannelDef debugFlagList[] = {
|
|
|
|
{Glk::kDebugCore, "core", "Core engine debug level"},
|
|
|
|
{Glk::kDebugScripts, "scripts", "Game scripts"},
|
|
|
|
{Glk::kDebugGraphics, "graphics", "Graphics handling"},
|
|
|
|
{Glk::kDebugSound, "sound", "Sound and Music handling"},
|
|
|
|
{Glk::kDebugSpeech, "speech", "Text to Speech handling"},
|
|
|
|
DEBUG_CHANNEL_END
|
|
|
|
};
|
|
|
|
|
2019-07-06 10:13:58 -07:00
|
|
|
namespace Glk {
|
|
|
|
|
2020-06-21 22:48:53 +01:00
|
|
|
Common::String GlkDetectedGame::getGlkGUIOptions() {
|
|
|
|
#if defined (USE_TTS)
|
|
|
|
return GUIO2(GUIO_NOMUSIC, GUIO_NOSUBTITLES);
|
|
|
|
#else
|
|
|
|
return GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-06-21 18:12:29 -07:00
|
|
|
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common::String &filename,
|
|
|
|
GameSupportLevel supportLevel) :
|
2016-09-15 18:39:45 +02:00
|
|
|
DetectedGame("glk", id, desc, Common::EN_ANY, Common::kPlatformUnknown) {
|
2020-06-21 22:48:53 +01:00
|
|
|
setGUIOptions(getGlkGUIOptions());
|
2020-06-21 18:12:29 -07:00
|
|
|
gameSupportLevel = supportLevel;
|
2019-07-06 10:13:58 -07:00
|
|
|
addExtraEntry("filename", filename);
|
|
|
|
}
|
|
|
|
|
2019-07-06 17:24:37 -07:00
|
|
|
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common::String &filename,
|
2022-06-24 19:15:15 +01:00
|
|
|
Common::Language lang, Common::Platform p, GameSupportLevel supportLevel) : DetectedGame("glk", id, desc, lang, p) {
|
2020-06-21 22:48:53 +01:00
|
|
|
setGUIOptions(getGlkGUIOptions());
|
2020-06-21 18:12:29 -07:00
|
|
|
gameSupportLevel = supportLevel;
|
2019-07-06 10:13:58 -07:00
|
|
|
addExtraEntry("filename", filename);
|
|
|
|
}
|
|
|
|
|
2019-09-25 20:11:12 -07:00
|
|
|
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const char *xtra,
|
2020-06-21 18:12:29 -07:00
|
|
|
const Common::String &filename, Common::Language lang,
|
|
|
|
GameSupportLevel supportLevel) :
|
2016-09-15 18:39:45 +02:00
|
|
|
DetectedGame("glk", id, desc, lang, Common::kPlatformUnknown, xtra) {
|
2020-06-21 22:48:53 +01:00
|
|
|
setGUIOptions(getGlkGUIOptions());
|
2020-06-21 18:12:29 -07:00
|
|
|
gameSupportLevel = supportLevel;
|
2019-09-04 22:36:03 -07:00
|
|
|
addExtraEntry("filename", filename);
|
|
|
|
}
|
|
|
|
|
2019-07-06 17:24:37 -07:00
|
|
|
GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common::String &filename,
|
2020-06-21 18:12:29 -07:00
|
|
|
const Common::String &md5, size_t filesize, GameSupportLevel supportLevel) :
|
2016-09-15 18:39:45 +02:00
|
|
|
DetectedGame("glk", id, desc, Common::UNK_LANG, Common::kPlatformUnknown) {
|
2020-06-21 22:48:53 +01:00
|
|
|
setGUIOptions(getGlkGUIOptions());
|
2020-06-21 18:12:29 -07:00
|
|
|
gameSupportLevel = supportLevel;
|
2019-07-06 10:13:58 -07:00
|
|
|
addExtraEntry("filename", filename);
|
|
|
|
|
|
|
|
canBeAdded = true;
|
|
|
|
hasUnknownFiles = true;
|
|
|
|
|
|
|
|
FileProperties fp;
|
|
|
|
fp.md5 = md5;
|
|
|
|
fp.size = filesize;
|
|
|
|
matchedFiles[filename] = fp;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Glk
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
PlainGameList GlkMetaEngineDetection::getSupportedGames() const {
|
2018-11-14 18:01:42 -08:00
|
|
|
PlainGameList list;
|
2019-09-26 18:18:38 -07:00
|
|
|
Glk::Adrift::AdriftMetaEngine::getSupportedGames(list);
|
2019-06-16 19:23:30 -07:00
|
|
|
Glk::AdvSys::AdvSysMetaEngine::getSupportedGames(list);
|
2019-11-22 19:27:02 -08:00
|
|
|
Glk::AGT::AGTMetaEngine::getSupportedGames(list);
|
2019-06-23 16:55:34 -07:00
|
|
|
Glk::Alan2::Alan2MetaEngine::getSupportedGames(list);
|
2019-07-06 19:40:04 -07:00
|
|
|
Glk::Alan3::Alan3MetaEngine::getSupportedGames(list);
|
2019-10-19 21:26:04 -07:00
|
|
|
Glk::Archetype::ArchetypeMetaEngine::getSupportedGames(list);
|
2021-08-22 13:34:06 +01:00
|
|
|
Glk::Comprehend::ComprehendMetaEngine::getSupportedGames(list);
|
2020-10-13 21:06:48 -07:00
|
|
|
Glk::Glulx::GlulxMetaEngine::getSupportedGames(list);
|
2019-05-16 11:27:55 -10:00
|
|
|
Glk::Hugo::HugoMetaEngine::getSupportedGames(list);
|
2019-10-10 20:38:56 -07:00
|
|
|
Glk::JACL::JACLMetaEngine::getSupportedGames(list);
|
2019-10-13 11:31:07 -07:00
|
|
|
Glk::Level9::Level9MetaEngine::getSupportedGames(list);
|
2019-10-22 19:24:19 -07:00
|
|
|
Glk::Magnetic::MagneticMetaEngine::getSupportedGames(list);
|
2019-07-20 14:58:39 -07:00
|
|
|
Glk::Quest::QuestMetaEngine::getSupportedGames(list);
|
2018-11-14 18:01:42 -08:00
|
|
|
Glk::Scott::ScottMetaEngine::getSupportedGames(list);
|
2020-06-22 20:06:26 -07:00
|
|
|
Glk::ZCode::ZCodeMetaEngine::getSupportedGames(list);
|
2020-09-09 15:55:36 +01:00
|
|
|
#ifndef RELEASE_BUILD
|
|
|
|
Glk::TADS::TADSMetaEngine::getSupportedGames(list);
|
|
|
|
#endif
|
2018-11-14 18:01:42 -08:00
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2019-10-22 19:24:19 -07:00
|
|
|
#define FIND_GAME(SUBENGINE) \
|
|
|
|
Glk::GameDescriptor gd##SUBENGINE = Glk::SUBENGINE::SUBENGINE##MetaEngine::findGame(gameId); \
|
|
|
|
if (gd##SUBENGINE._description) return gd##SUBENGINE
|
2019-06-16 19:23:30 -07:00
|
|
|
|
2021-05-16 15:59:19 +08:00
|
|
|
const DebugChannelDef *GlkMetaEngineDetection::getDebugChannels() const {
|
|
|
|
return debugFlagList;
|
|
|
|
}
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
PlainGameDescriptor GlkMetaEngineDetection::findGame(const char *gameId) const {
|
2019-10-22 19:24:19 -07:00
|
|
|
FIND_GAME(Adrift);
|
|
|
|
FIND_GAME(AdvSys);
|
|
|
|
FIND_GAME(Alan2);
|
2019-11-22 19:27:02 -08:00
|
|
|
FIND_GAME(AGT);
|
2019-10-22 19:24:19 -07:00
|
|
|
FIND_GAME(Alan3);
|
2019-10-19 21:26:04 -07:00
|
|
|
FIND_GAME(Archetype);
|
2021-08-22 13:34:06 +01:00
|
|
|
FIND_GAME(Comprehend);
|
2020-10-13 21:06:48 -07:00
|
|
|
FIND_GAME(Glulx);
|
2019-10-22 19:24:19 -07:00
|
|
|
FIND_GAME(Hugo);
|
|
|
|
FIND_GAME(JACL);
|
2019-10-13 11:31:07 -07:00
|
|
|
FIND_GAME(Level9);
|
2019-10-22 19:24:19 -07:00
|
|
|
FIND_GAME(Magnetic);
|
|
|
|
FIND_GAME(Quest);
|
|
|
|
FIND_GAME(Scott);
|
2020-06-22 20:06:26 -07:00
|
|
|
FIND_GAME(ZCode);
|
2020-09-09 15:55:36 +01:00
|
|
|
#ifndef RELEASE_BUILD
|
|
|
|
FIND_GAME(TADS);
|
|
|
|
#endif
|
2019-10-22 19:24:19 -07:00
|
|
|
|
2018-11-14 18:01:42 -08:00
|
|
|
return PlainGameDescriptor();
|
|
|
|
}
|
|
|
|
|
2019-10-22 19:24:19 -07:00
|
|
|
#undef FIND_GAME
|
|
|
|
|
2022-05-15 03:57:40 +02:00
|
|
|
DetectedGames GlkMetaEngineDetection::detectGames(const Common::FSList &fslist, uint32 /*skipADFlags*/, bool /*skipIncomplete*/) {
|
2020-10-07 19:08:47 -07:00
|
|
|
#ifndef RELEASE_BUILD
|
2018-12-14 18:25:20 -08:00
|
|
|
// This is as good a place as any to detect multiple sub-engines using the same Ids
|
|
|
|
detectClashes();
|
2020-10-07 19:08:47 -07:00
|
|
|
#endif
|
2018-12-14 18:25:20 -08:00
|
|
|
|
2018-11-14 18:01:42 -08:00
|
|
|
DetectedGames detectedGames;
|
2019-09-26 18:18:38 -07:00
|
|
|
Glk::Adrift::AdriftMetaEngine::detectGames(fslist, detectedGames);
|
2019-06-16 19:23:30 -07:00
|
|
|
Glk::AdvSys::AdvSysMetaEngine::detectGames(fslist, detectedGames);
|
2019-11-22 19:27:02 -08:00
|
|
|
Glk::AGT::AGTMetaEngine::detectGames(fslist, detectedGames);
|
2019-06-23 16:55:34 -07:00
|
|
|
Glk::Alan2::Alan2MetaEngine::detectGames(fslist, detectedGames);
|
2019-07-06 19:40:04 -07:00
|
|
|
Glk::Alan3::Alan3MetaEngine::detectGames(fslist, detectedGames);
|
2019-10-19 21:26:04 -07:00
|
|
|
Glk::Archetype::ArchetypeMetaEngine::detectGames(fslist, detectedGames);
|
2021-08-22 13:34:06 +01:00
|
|
|
Glk::Comprehend::ComprehendMetaEngine::detectGames(fslist, detectedGames);
|
2020-10-13 21:06:48 -07:00
|
|
|
Glk::Glulx::GlulxMetaEngine::detectGames(fslist, detectedGames);
|
2019-05-16 11:27:55 -10:00
|
|
|
Glk::Hugo::HugoMetaEngine::detectGames(fslist, detectedGames);
|
2019-10-10 20:38:56 -07:00
|
|
|
Glk::JACL::JACLMetaEngine::detectGames(fslist, detectedGames);
|
2019-10-13 11:31:07 -07:00
|
|
|
Glk::Level9::Level9MetaEngine::detectGames(fslist, detectedGames);
|
2019-10-22 19:24:19 -07:00
|
|
|
Glk::Magnetic::MagneticMetaEngine::detectGames(fslist, detectedGames);
|
2019-07-20 14:58:39 -07:00
|
|
|
Glk::Quest::QuestMetaEngine::detectGames(fslist, detectedGames);
|
2018-11-14 18:01:42 -08:00
|
|
|
Glk::Scott::ScottMetaEngine::detectGames(fslist, detectedGames);
|
2020-06-22 20:06:26 -07:00
|
|
|
Glk::ZCode::ZCodeMetaEngine::detectGames(fslist, detectedGames);
|
2020-09-09 15:55:36 +01:00
|
|
|
#ifndef RELEASE_BUILD
|
|
|
|
Glk::TADS::TADSMetaEngine::detectGames(fslist, detectedGames);
|
|
|
|
#endif
|
2018-11-14 18:01:42 -08:00
|
|
|
|
|
|
|
return detectedGames;
|
2018-10-14 13:02:24 -07:00
|
|
|
}
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
void GlkMetaEngineDetection::detectClashes() const {
|
2018-12-14 18:25:20 -08:00
|
|
|
Common::StringMap map;
|
2019-09-26 18:18:38 -07:00
|
|
|
Glk::Adrift::AdriftMetaEngine::detectClashes(map);
|
2019-06-16 19:23:30 -07:00
|
|
|
Glk::AdvSys::AdvSysMetaEngine::detectClashes(map);
|
2019-11-22 19:27:02 -08:00
|
|
|
Glk::AGT::AGTMetaEngine::detectClashes(map);
|
2019-06-23 16:55:34 -07:00
|
|
|
Glk::Alan2::Alan2MetaEngine::detectClashes(map);
|
2019-07-06 19:40:04 -07:00
|
|
|
Glk::Alan3::Alan3MetaEngine::detectClashes(map);
|
2019-10-19 21:26:04 -07:00
|
|
|
Glk::Archetype::ArchetypeMetaEngine::detectClashes(map);
|
2021-08-22 13:34:06 +01:00
|
|
|
Glk::Comprehend::ComprehendMetaEngine::detectClashes(map);
|
2020-10-13 21:06:48 -07:00
|
|
|
Glk::Glulx::GlulxMetaEngine::detectClashes(map);
|
2019-05-16 11:27:55 -10:00
|
|
|
Glk::Hugo::HugoMetaEngine::detectClashes(map);
|
2019-10-10 20:38:56 -07:00
|
|
|
Glk::JACL::JACLMetaEngine::detectClashes(map);
|
2019-10-13 11:31:07 -07:00
|
|
|
Glk::Level9::Level9MetaEngine::detectClashes(map);
|
2019-10-22 19:24:19 -07:00
|
|
|
Glk::Magnetic::MagneticMetaEngine::detectClashes(map);
|
2019-07-20 14:58:39 -07:00
|
|
|
Glk::Quest::QuestMetaEngine::detectClashes(map);
|
2018-12-14 18:25:20 -08:00
|
|
|
Glk::Scott::ScottMetaEngine::detectClashes(map);
|
2020-06-22 20:06:26 -07:00
|
|
|
Glk::ZCode::ZCodeMetaEngine::detectClashes(map);
|
2020-09-09 15:55:36 +01:00
|
|
|
#ifndef RELEASE_BUILD
|
|
|
|
Glk::TADS::TADSMetaEngine::detectClashes(map);
|
|
|
|
#endif
|
2018-12-14 18:25:20 -08:00
|
|
|
}
|
|
|
|
|
2022-11-27 22:17:10 +00:00
|
|
|
uint GlkMetaEngineDetection::getMD5Bytes() const {
|
2022-11-30 23:27:39 +02:00
|
|
|
return 5000;
|
2022-11-27 22:17:10 +00:00
|
|
|
}
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
REGISTER_PLUGIN_STATIC(GLK_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, GlkMetaEngineDetection);
|