ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

obsolete.cpp

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "engines/obsolete.h"
00024 
00025 #include "common/config-manager.h"
00026 
00027 
00028 namespace Engines {
00029 
00030 void upgradeTargetIfNecessary(const ObsoleteGameID *obsoleteList) {
00031     if (obsoleteList == 0)
00032         return;
00033 
00034     Common::String gameid = ConfMan.get("gameid");
00035 
00036     for (const ObsoleteGameID *o = obsoleteList; o->from; ++o) {
00037         if (gameid.equalsIgnoreCase(o->from)) {
00038             gameid = o->to;
00039             ConfMan.set("gameid", gameid);
00040 
00041             if (o->platform != Common::kPlatformUnknown)
00042                 ConfMan.set("platform", Common::getPlatformCode(o->platform));
00043 
00044             warning("Target upgraded from %s to %s", o->from, o->to);
00045 
00046             // WORKAROUND: Fix for bug #1719463: "DETECTOR: Launching
00047             // undefined target adds launcher entry"
00048             if (ConfMan.hasKey("id_came_from_command_line")) {
00049                 warning("Target came from command line. Skipping save");
00050             } else {
00051                 ConfMan.flushToDisk();
00052             }
00053             break;
00054         }
00055     }
00056 }
00057 
00058 PlainGameDescriptor findGameID(
00059     const char *gameid,
00060     const PlainGameDescriptor *gameids,
00061     const ObsoleteGameID *obsoleteList
00062     ) {
00063     // First search the list of supported gameids for a match.
00064     const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, gameids);
00065     if (g)
00066         return *g;
00067 
00068     // If we didn't find the gameid in the main list, check if it
00069     // is an obsolete game id.
00070     if (obsoleteList != 0) {
00071         const ObsoleteGameID *o = obsoleteList;
00072         while (o->from) {
00073             if (0 == scumm_stricmp(gameid, o->from)) {
00074                 g = findPlainGameDescriptor(o->to, gameids);
00075                 if (g && g->description)
00076                     return PlainGameDescriptor::of(gameid, g->description);
00077                 else
00078                     return PlainGameDescriptor::of(gameid, "Obsolete game ID");
00079             }
00080             o++;
00081         }
00082     }
00083 
00084     // No match found
00085     return PlainGameDescriptor::empty();
00086 }
00087 
00088 } // End of namespace Engines


Generated on Sat Mar 23 2019 05:01:53 for ResidualVM by doxygen 1.7.1
curved edge   curved edge