From 780db83e13c12965af415c52c06f6d0e024cc135 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 2 Jun 2018 14:45:36 +0200 Subject: DC: Update for the engineId changes --- backends/platform/dc/dc.h | 2 +- backends/platform/dc/dcmain.cpp | 17 ++++++++++------- backends/platform/dc/selector.cpp | 7 ++++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index a3f7423eed..cdea88e6b3 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -262,7 +262,7 @@ public: extern int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, byte &shiftFlags, Interactive *inter = NULL); -extern bool selectGame(char *&, char *&, Common::Language &, Common::Platform &, class Icon &); +extern bool selectGame(char *&, char *&, char *&, Common::Language &, Common::Platform &, class Icon &); #ifdef DYNAMIC_MODULES extern bool selectPluginDir(Common::String &selection, const Common::FSNode &base); #endif diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index c84aef9c47..26cf9de5b4 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -365,28 +365,31 @@ int main() int DCLauncherDialog::runModal() { - char *base = NULL, *dir = NULL; + char *engineId = NULL, *gameId = NULL, *dir = NULL; Common::Language language = Common::UNK_LANG; Common::Platform platform = Common::kPlatformUnknown; - if (!selectGame(base, dir, language, platform, icon)) + if (!selectGame(engineId, gameId, dir, language, platform, icon)) g_system->quit(); // Set the game path. - ConfMan.addGameDomain(base); + ConfMan.addGameDomain(gameId); + ConfMan.set("engineid", engineId, gameId); + ConfMan.set("gameid", gameId, gameId); + if (dir != NULL) - ConfMan.set("path", dir, base); + ConfMan.set("path", dir, gameId); // Set the game language. if (language != Common::UNK_LANG) - ConfMan.set("language", Common::getLanguageCode(language), base); + ConfMan.set("language", Common::getLanguageCode(language), gameId); // Set the game platform. if (platform != Common::kPlatformUnknown) - ConfMan.set("platform", Common::getPlatformCode(platform), base); + ConfMan.set("platform", Common::getPlatformCode(platform), gameId); // Set the target. - ConfMan.setActiveDomain(base); + ConfMan.setActiveDomain(gameId); return 0; } diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index 18528f86e1..f70ce67d51 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -137,6 +137,7 @@ void draw_trans_quad(float x1, float y1, float x2, float y2, struct Game { char dir[256]; + char engine_id[256]; char filename_base[256]; char text[256]; Common::Language language; @@ -233,6 +234,8 @@ static int findGames(Game *games, int max, bool use_ini) } if (curr_game < max) { strcpy(games[curr_game].filename_base, (*i)._key.c_str()); + strncpy(games[curr_game].engine_id, (*i)._value["engineid"].c_str(), 256); + games[curr_game].engine_id[255] = '\0'; strncpy(games[curr_game].dir, dirs[j].node.getPath().c_str(), 256); games[curr_game].dir[255] = '\0'; games[curr_game].language = Common::UNK_LANG; @@ -278,6 +281,7 @@ static int findGames(Game *games, int max, bool use_ini) for (DetectedGames::const_iterator ge = candidates.begin(); ge != candidates.end(); ++ge) if (curr_game < max) { + strcpy(games[curr_game].engine_id, ge->engineId.c_str()); strcpy(games[curr_game].filename_base, ge->gameId.c_str()); strcpy(games[curr_game].dir, dirs[curr_dir-1].name); games[curr_game].language = ge->language; @@ -465,7 +469,7 @@ int gameMenu(Game *games, int num_games) } } -bool selectGame(char *&ret, char *&dir_ret, Common::Language &lang_ret, Common::Platform &plf_ret, Icon &icon) +bool selectGame(char *&engineId, char *&ret, char *&dir_ret, Common::Language &lang_ret, Common::Platform &plf_ret, Icon &icon) { Game *games = new Game[MAX_GAMES]; int selected, num_games; @@ -510,6 +514,7 @@ bool selectGame(char *&ret, char *&dir_ret, Common::Language &lang_ret, Common:: chdir("/"); dir_ret = the_game.dir; #endif + engineId = the_game.engine_id; ret = the_game.filename_base; lang_ret = the_game.language; plf_ret = the_game.platform; -- cgit v1.2.3