ICB: Switch detection from exe to game data. Added El Dorado to game entries

This commit is contained in:
Paweł Kołodziejski 2022-07-31 17:22:08 +02:00
parent 950e3f459e
commit f74192101c
No known key found for this signature in database
GPG Key ID: 0BDADC9E74440FF7
6 changed files with 195 additions and 44 deletions

@ -21,66 +21,100 @@
#include "engines/advancedDetector.h"
#include "engines/icb/detection.h"
namespace ICB {
static const PlainGameDescriptor icbGames[] = {
{ "icb", "In Cold Blood" },
{ "eldorado", "The Road to El Dorado" },
{ nullptr, nullptr }
};
static const char *directoryGlobs[] = {
"engine",
"linc",
"demo",
nullptr
};
static const ADGameDescription gameDescriptions[] = {
static const IcbGameDescription gameDescriptions[] = {
{
// In Cold Blood
// English GOG Version
"icb",
"GOG",
AD_ENTRY1s("engine.exe", "0c4a7a5046ec13ccac89ab3f959cc217", 837632),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
{
// In Cold Blood
// English GOG Version
"icb",
"GOG",
AD_ENTRY2s("g/speech.clu", "ced60009bdffa9a1055863bf10d2e79e", 7683040, "g/g", "ebe9e5377ee9d231e7a7e33666eb517b", 63892),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ICB
},
{
// In Cold Blood
// English Demo
"icb",
"Demo",
AD_ENTRY1s("engine.exe", "94222e343795853b0aa59cb9876415ae", 827392),
Common::EN_GRB,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
{
// In Cold Blood
// English Demo
"icb",
"Demo",
AD_ENTRY2s("g/speech.clu", "ced60009bdffa9a1055863bf10d2e79e", 7683040, "g/g", "f8e1a762cc25554846f6e45d59f55159", 54560),
Common::EN_GRB,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ICB
},
{
// In Cold Blood
// English Demo
"icb",
"Demo",
AD_ENTRY1s("engine.exe", "d0702069d95423107463001b99a19e73", 939520),
Common::EN_USA,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
{
// In Cold Blood
// English Demo
"icb",
"Demo",
AD_ENTRY2s("g/speech.clu", "ced60009bdffa9a1055863bf10d2e79e", 7683040, "g/g", "2b9a8ca8d7a1bd91701708535b171aa8", 62080),
Common::EN_USA,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ICB
},
AD_TABLE_END_MARKER
{
{
// The Road to El Dorado
// English
"eldorado",
"",
AD_ENTRY2s("g/speech.clu", "65acb862dcdef2a7a69b961760bd565e", 1927072, "g/g", "ed36c6fb807a3ececba1bbda94172842", 17704),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ELDORADO
},
{
{
// The Road to El Dorado
// Polish
"eldorado",
"",
AD_ENTRY2s("g/speech.clu", "b063eee3ae6e327c37149a8342700004", 2009640, "g/g", "1427ecf118fc37da4ebb2f29d16d3d9b", 18520),
Common::PL_POL,
Common::kPlatformWindows,
ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ELDORADO
},
{ AD_TABLE_END_MARKER, GType_ICB }
};
class IcbMetaEngineDetection : public AdvancedMetaEngineDetection {
public:
IcbMetaEngineDetection() : AdvancedMetaEngineDetection(gameDescriptions, sizeof(ADGameDescription), icbGames) {
IcbMetaEngineDetection() : AdvancedMetaEngineDetection(gameDescriptions, sizeof(IcbGameDescription), icbGames) {
_guiOptions = GUIO_NOMIDI;
_maxScanDepth = 3;
_directoryGlobs = directoryGlobs;
_flags = kADFlagMatchFullPaths;
}
const char *getEngineName() const override { return "In Cold Blood Engine"; }

41
engines/icb/detection.h Normal file

@ -0,0 +1,41 @@
/* 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.
*
* 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.
*
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ICB_DETECTION_H
#define ICB_DETECTION_H
#include "engines/advancedDetector.h"
namespace ICB {
enum IcbGameType {
GType_ICB,
GType_ELDORADO
};
struct IcbGameDescription {
ADGameDescription desc;
IcbGameType gameType;
};
} // End of namespace ICB
#endif // ICB_DETECTION_H

@ -38,18 +38,19 @@
#include "audio/mixer.h"
namespace ICB {
IcbEngine *g_icb;
IcbEngine::IcbEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
IcbEngine::IcbEngine(OSystem *syst, const IcbGameDescription *gameDesc) : Engine(syst) {
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, 127);
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_randomSource = new Common::RandomSource("icb");
g_icb = this;
_gameDescription = &gameDesc->desc;
_gameType = gameDesc->gameType;
(void)_gameDescription; // silence warning
}
@ -133,6 +134,66 @@ Common::KeymapArray IcbEngine::initKeymapsIcb(const char *target) {
return Keymap::arrayOf(engineKeyMap);
}
Common::KeymapArray IcbEngine::initKeymapsEldorado(const char *target) {
using namespace Common;
Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "eldorado", "The Road to El Dorado");
Action *act;
act = new Action(kStandardActionMoveUp, _("Up"));
act->setKeyEvent(KEYCODE_UP);
act->addDefaultInputMapping("JOY_UP");
engineKeyMap->addAction(act);
act = new Action(kStandardActionMoveDown, _("Down"));
act->setKeyEvent(KEYCODE_DOWN);
act->addDefaultInputMapping("JOY_DOWN");
engineKeyMap->addAction(act);
act = new Action(kStandardActionMoveLeft, _("Left"));
act->setKeyEvent(KEYCODE_LEFT);
act->addDefaultInputMapping("JOY_LEFT");
engineKeyMap->addAction(act);
act = new Action(kStandardActionMoveRight, _("Right"));
act->setKeyEvent(KEYCODE_RIGHT);
act->addDefaultInputMapping("JOY_RIGHT");
engineKeyMap->addAction(act);
act = new Action("BUSE", _("Interact"));
act->setKeyEvent(KeyState(KEYCODE_LCTRL));
act->addDefaultInputMapping("JOY_A");
engineKeyMap->addAction(act);
act = new Action("BINV", _("Inventory"));
act->setKeyEvent(KeyState(KEYCODE_RETURN));
act->addDefaultInputMapping("JOY_B");
engineKeyMap->addAction(act);
act = new Action("BCRU", _("Crouch"));
act->setKeyEvent(KeyState(KEYCODE_x));
act->addDefaultInputMapping("JOY_Y");
engineKeyMap->addAction(act);
act = new Action("BSID", _("Side Step"));
act->setKeyEvent(KeyState(KEYCODE_LSHIFT));
act->addDefaultInputMapping("JOY_RIGHT_TRIGGER");
engineKeyMap->addAction(act);
act = new Action("BRUN", _("Run"));
act->setKeyEvent(KeyState(KEYCODE_z));
act->addDefaultInputMapping("JOY_LEFT_TRIGGER");
engineKeyMap->addAction(act);
act = new Action("BPAS", _("Pause"));
act->setKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE));
act->addDefaultInputMapping("ESCAPE");
act->addDefaultInputMapping("JOY_BACK");
engineKeyMap->addAction(act);
return Keymap::arrayOf(engineKeyMap);
}
bool IcbEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsReturnToLauncher);

@ -30,24 +30,30 @@
#include "engines/advancedDetector.h"
#include "engines/engine.h"
#include "engines/icb/detection.h"
#include "common/random.h"
namespace ICB {
class IcbEngine : public Engine {
public:
IcbEngine(OSystem *syst, const ADGameDescription *gameDesc);
IcbEngine(OSystem *syst, const IcbGameDescription *gameDescIcb);
virtual ~IcbEngine();
Common::RandomSource *getRandomSource() { return _randomSource; }
static Common::Array<Common::Keymap *> initKeymapsIcb(const char *target);
static Common::Array<Common::Keymap *> initKeymapsEldorado(const char *target);
bool hasFeature(EngineFeature f) const override;
IcbGameType getGameType() { return _gameType; }
protected:
// Engine APIs
Common::Error run() override;
private:
IcbGameType _gameType;
void initGfx(bool hwAccel, bool fullscreen);
void mainLoop();
Common::RandomSource *_randomSource;

@ -40,7 +40,8 @@ public:
};
Common::Error IcbMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
*engine = new IcbEngine(syst, desc);
const IcbGameDescription *gd = (const IcbGameDescription *)desc;
*engine = new IcbEngine(syst, gd);
return Common::kNoError;
}
@ -49,6 +50,8 @@ Common::KeymapArray IcbMetaEngine::initKeymaps(const char *target) const {
if (gameId == "icb") {
return ICB::IcbEngine::initKeymapsIcb(target);
} else if (gameId == "eldorado") {
return ICB::IcbEngine::initKeymapsEldorado(target);
}
return AdvancedMetaEngine::initKeymaps(target);

@ -37,6 +37,7 @@
#include "engines/icb/mission.h"
#include "engines/icb/cluster_manager_pc.h"
#include "engines/icb/configfile.h"
#include "engines/icb/icb.h"
#include "common/str.h"
#include "common/config-manager.h"
@ -99,7 +100,12 @@ void ReadConfigFromIniFile() {
char configFile[1024];
uint32 temp;
sprintf(configFile, CONFIG_INI_FILENAME);
if (g_icb->getGameType() == GType_ICB)
sprintf(configFile, "engine\\icb.ini");
else if (g_icb->getGameType() == GType_ELDORADO)
sprintf(configFile, "engine\\eldorado.ini");
else
assert(false);
ConfigFile config;
pxString filename = configFile;