2007-05-30 21:56:52 +00: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.
|
2006-02-25 19:20:51 +00: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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 02:34:24 +01:00
|
|
|
*
|
2006-02-25 19:20:51 +00: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.
|
2014-02-18 02:34:24 +01:00
|
|
|
*
|
2006-02-25 19:20:51 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "base/plugins.h"
|
|
|
|
|
2020-08-03 22:57:54 +05:30
|
|
|
#include "engines/metaengine.h"
|
|
|
|
|
2008-09-27 23:27:01 +00:00
|
|
|
#include "common/archive.h"
|
2006-02-25 19:20:51 +00:00
|
|
|
#include "common/config-manager.h"
|
2006-04-19 20:26:27 +00:00
|
|
|
#include "common/list.h"
|
2006-02-25 19:20:51 +00:00
|
|
|
#include "common/md5.h"
|
2008-02-04 10:15:21 +00:00
|
|
|
#include "common/system.h"
|
2016-03-31 15:50:40 +03:00
|
|
|
#include "common/translation.h"
|
2006-02-25 19:20:51 +00:00
|
|
|
|
2011-08-05 13:33:42 +01:00
|
|
|
#include "audio/mididrv.h"
|
|
|
|
|
2020-08-25 13:52:43 +05:30
|
|
|
#include "scumm/detection.h"
|
|
|
|
#include "scumm/detection_tables.h"
|
2010-05-09 20:58:41 +00:00
|
|
|
#include "scumm/file.h"
|
|
|
|
#include "scumm/file_nes.h"
|
2021-05-16 20:25:35 +08:00
|
|
|
#include "scumm/scumm.h"
|
2008-02-02 00:54:52 +00:00
|
|
|
|
2006-02-25 19:20:51 +00:00
|
|
|
#pragma mark -
|
2020-08-04 21:00:31 +05:30
|
|
|
#pragma mark --- Detection code ---
|
2006-02-25 19:20:51 +00:00
|
|
|
#pragma mark -
|
|
|
|
|
2006-03-19 17:25:13 +00:00
|
|
|
|
2020-08-04 21:00:31 +05:30
|
|
|
// Various methods to help in core detection.
|
2020-08-25 13:52:43 +05:30
|
|
|
#include "scumm/detection_internal.h"
|
2006-05-03 19:34:53 +00:00
|
|
|
|
2006-03-19 17:25:13 +00:00
|
|
|
|
2006-02-25 19:20:51 +00:00
|
|
|
#pragma mark -
|
|
|
|
#pragma mark --- Plugin code ---
|
|
|
|
#pragma mark -
|
|
|
|
|
2021-05-16 20:25:35 +08:00
|
|
|
static const DebugChannelDef debugFlagList[] = {
|
|
|
|
{Scumm::DEBUG_SCRIPTS, "SCRIPTS", "Track script execution"},
|
|
|
|
{Scumm::DEBUG_OPCODES, "OPCODES", "Track opcode execution"},
|
|
|
|
{Scumm::DEBUG_IMUSE, "IMUSE", "Track iMUSE events"},
|
|
|
|
{Scumm::DEBUG_RESOURCE, "RESOURCE", "Track resource loading/management"},
|
|
|
|
{Scumm::DEBUG_VARS, "VARS", "Track variable changes",},
|
|
|
|
{Scumm::DEBUG_ACTORS, "ACTORS", "Actor-related debug"},
|
|
|
|
{Scumm::DEBUG_SOUND, "SOUND", "Sound related debug"},
|
|
|
|
{Scumm::DEBUG_INSANE, "INSANE", "Track INSANE"},
|
|
|
|
{Scumm::DEBUG_SMUSH, "SMUSH", "Track SMUSH"},
|
2021-05-22 03:56:02 -06:00
|
|
|
{Scumm::DEBUG_MOONBASE_AI, "MOONBASEAI", "Track Moonbase AI"},
|
|
|
|
DEBUG_CHANNEL_END
|
2021-05-16 20:25:35 +08:00
|
|
|
};
|
2006-02-25 19:20:51 +00:00
|
|
|
|
2006-04-08 08:43:28 +00:00
|
|
|
using namespace Scumm;
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
class ScummMetaEngineDetection : public MetaEngineDetection {
|
2008-02-02 00:54:52 +00:00
|
|
|
public:
|
2020-02-09 12:05:32 +01:00
|
|
|
const char *getEngineId() const override {
|
2016-09-15 18:23:35 +02:00
|
|
|
return "scumm";
|
|
|
|
}
|
|
|
|
|
2021-05-16 20:25:35 +08:00
|
|
|
const DebugChannelDef *getDebugChannels() const override {
|
|
|
|
return debugFlagList;
|
|
|
|
}
|
|
|
|
|
2020-02-09 12:05:32 +01:00
|
|
|
const char *getName() const override;
|
|
|
|
const char *getOriginalCopyright() const override;
|
2008-02-02 00:54:52 +00:00
|
|
|
|
2018-05-06 13:09:52 +02:00
|
|
|
PlainGameList getSupportedGames() const override;
|
2018-05-06 12:57:08 +02:00
|
|
|
PlainGameDescriptor findGame(const char *gameid) const override;
|
2020-02-09 12:05:32 +01:00
|
|
|
DetectedGames detectGames(const Common::FSList &fslist) const override;
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2020-02-09 12:05:32 +01:00
|
|
|
const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override;
|
2008-02-02 00:54:52 +00:00
|
|
|
};
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
PlainGameList ScummMetaEngineDetection::getSupportedGames() const {
|
2018-05-06 13:09:52 +02:00
|
|
|
return PlainGameList(gameDescriptions);
|
2006-02-25 19:20:51 +00:00
|
|
|
}
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
PlainGameDescriptor ScummMetaEngineDetection::findGame(const char *gameid) const {
|
2011-06-14 15:25:33 +02:00
|
|
|
return Engines::findGameID(gameid, gameDescriptions, obsoleteGameIDsTable);
|
2006-02-25 19:20:51 +00:00
|
|
|
}
|
|
|
|
|
2009-07-30 21:56:04 +00:00
|
|
|
static Common::String generatePreferredTarget(const DetectorResult &x) {
|
|
|
|
Common::String res(x.game.gameid);
|
|
|
|
|
|
|
|
if (x.game.preferredTag) {
|
|
|
|
res = res + "-" + x.game.preferredTag;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x.game.features & GF_DEMO) {
|
|
|
|
res = res + "-demo";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append the platform, if a non-standard one has been specified.
|
2013-05-02 18:26:58 -04:00
|
|
|
if (x.game.platform != Common::kPlatformDOS && x.game.platform != Common::kPlatformUnknown) {
|
2020-05-25 13:08:07 +02:00
|
|
|
// HACK: For CoMI, it's pointless to encode the fact that it's for Windows.
|
2009-07-30 21:56:04 +00:00
|
|
|
if (x.game.id != GID_CMI)
|
|
|
|
res = res + "-" + Common::getPlatformAbbrev(x.game.platform);
|
|
|
|
}
|
|
|
|
|
2020-05-25 13:08:07 +02:00
|
|
|
// Append the language, if a non-standard one has been specified.
|
2009-07-30 21:56:04 +00:00
|
|
|
if (x.language != Common::EN_ANY && x.language != Common::UNK_LANG) {
|
|
|
|
res = res + "-" + Common::getLanguageCode(x.language);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
DetectedGames ScummMetaEngineDetection::detectGames(const Common::FSList &fslist) const {
|
2017-12-02 17:14:22 +01:00
|
|
|
DetectedGames detectedGames;
|
2006-04-23 17:33:16 +00:00
|
|
|
Common::List<DetectorResult> results;
|
2008-02-02 00:54:52 +00:00
|
|
|
::detectGames(fslist, results, 0);
|
2007-04-03 19:36:17 +00:00
|
|
|
|
2007-12-23 14:43:15 +00:00
|
|
|
for (Common::List<DetectorResult>::iterator
|
|
|
|
x = results.begin(); x != results.end(); ++x) {
|
2007-06-15 17:40:59 +00:00
|
|
|
const PlainGameDescriptor *g = findPlainGameDescriptor(x->game.gameid, gameDescriptions);
|
|
|
|
assert(g);
|
2017-12-02 17:14:22 +01:00
|
|
|
|
2016-09-15 18:39:45 +02:00
|
|
|
DetectedGame game = DetectedGame(getEngineId(), x->game.gameid, g->description, x->language, x->game.platform, x->extra);
|
2007-02-09 18:23:59 +00:00
|
|
|
|
|
|
|
// Compute and set the preferred target name for this game.
|
|
|
|
// Based on generateComplexID() in advancedDetector.cpp.
|
2018-05-06 15:51:03 +02:00
|
|
|
game.preferredTarget = generatePreferredTarget(*x);
|
2009-07-30 21:56:04 +00:00
|
|
|
|
2018-05-06 15:51:03 +02:00
|
|
|
game.setGUIOptions(x->game.guioptions + MidiDriver::musicType2GUIO(x->game.midi));
|
|
|
|
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(x->language));
|
2009-06-06 17:59:54 +00:00
|
|
|
|
2017-12-02 17:14:22 +01:00
|
|
|
detectedGames.push_back(game);
|
2006-02-25 19:20:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return detectedGames;
|
|
|
|
}
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
const char *ScummMetaEngineDetection::getName() const {
|
2020-11-28 19:10:52 +01:00
|
|
|
return "SCUMM ["
|
|
|
|
|
|
|
|
#if defined(ENABLE_SCUMM_7_8) && defined(ENABLE_HE)
|
|
|
|
"all games"
|
|
|
|
#else
|
|
|
|
|
|
|
|
"v0-v6 games"
|
|
|
|
|
|
|
|
#if defined(ENABLE_SCUMM_7_8)
|
|
|
|
", v7 & v8 games"
|
|
|
|
#endif
|
|
|
|
#if defined(ENABLE_HE)
|
|
|
|
", HE71+ games"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
"]";
|
2008-02-02 00:54:52 +00:00
|
|
|
}
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
const char *ScummMetaEngineDetection::getOriginalCopyright() const {
|
2008-02-02 00:54:52 +00:00
|
|
|
return "LucasArts SCUMM Games (C) LucasArts\n"
|
|
|
|
"Humongous SCUMM Games (C) Humongous";
|
|
|
|
}
|
|
|
|
|
2016-03-31 15:50:40 +03:00
|
|
|
static const ExtraGuiOption comiObjectLabelsOption = {
|
|
|
|
_s("Show Object Line"),
|
|
|
|
_s("Show the names of objects at the bottom of the screen"),
|
|
|
|
"object_labels",
|
|
|
|
true
|
|
|
|
};
|
|
|
|
|
2020-05-02 13:31:43 -04:00
|
|
|
static const ExtraGuiOption mmnesObjectLabelsOption = {
|
|
|
|
_s("Use NES Classic Palette"),
|
|
|
|
_s("Use a more neutral color palette that closely emulates the NES Classic"),
|
|
|
|
"mm_nes_classic_palette",
|
|
|
|
false
|
|
|
|
};
|
|
|
|
|
2020-04-16 13:43:53 +03:00
|
|
|
static const ExtraGuiOption fmtownsTrimTo200 = {
|
|
|
|
_s("Trim FM-TOWNS games to 200 pixels height"),
|
|
|
|
_s("Cut the extra 40 pixels at the bottom of the screen, to make it standard 200 pixels height, allowing using 'aspect ratio correction'"),
|
|
|
|
"trim_fmtowns_to_200_pixels",
|
|
|
|
false
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
const ExtraGuiOptions ScummMetaEngineDetection::getExtraGuiOptions(const Common::String &target) const {
|
2016-03-31 15:50:40 +03:00
|
|
|
ExtraGuiOptions options;
|
2020-04-16 13:43:53 +03:00
|
|
|
// Query the GUI options
|
|
|
|
const Common::String guiOptionsString = ConfMan.get("guioptions", target);
|
|
|
|
const Common::String guiOptions = parseGameGUIOptions(guiOptionsString);
|
|
|
|
|
2016-03-31 15:50:40 +03:00
|
|
|
if (target.empty() || ConfMan.get("gameid", target) == "comi") {
|
|
|
|
options.push_back(comiObjectLabelsOption);
|
|
|
|
}
|
2020-05-02 13:31:43 -04:00
|
|
|
if (target.empty() || Common::parsePlatform(ConfMan.get("platform", target)) == Common::kPlatformNES) {
|
|
|
|
options.push_back(mmnesObjectLabelsOption);
|
|
|
|
}
|
2020-04-16 13:43:53 +03:00
|
|
|
if (target.empty() || (ConfMan.get("platform", target) == "fmtowns" && guiOptions.contains(GUIO_TRIM_FMTOWNS_TO_200_PIXELS))) {
|
|
|
|
options.push_back(fmtownsTrimTo200);
|
|
|
|
}
|
2016-03-31 15:50:40 +03:00
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
2020-10-11 23:14:39 +02:00
|
|
|
REGISTER_PLUGIN_STATIC(SCUMM_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, ScummMetaEngineDetection);
|