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

platform.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 "common/platform.h"
00024 #include "common/str.h"
00025 
00026 namespace Common {
00027 
00028 const PlatformDescription g_platforms[] = {
00029     { "2gs", "2gs", "2gs", "Apple IIgs", kPlatformApple2GS },
00030     { "apple2", "apple2", "apple2", "Apple II", kPlatformApple2 },
00031     { "3do", "3do", "3do", "3DO", kPlatform3DO },
00032     { "acorn", "acorn", "acorn", "Acorn", kPlatformAcorn },
00033     { "amiga", "ami", "amiga", "Amiga", kPlatformAmiga },
00034     { "atari8", "atari8", "atari8", "Atari 8-bit", kPlatformAtari8Bit },
00035     { "atari", "atari-st", "st", "Atari ST", kPlatformAtariST },
00036     { "c64", "c64", "c64", "Commodore 64", kPlatformC64 },
00037     { "pc", "dos", "ibm", "DOS", kPlatformDOS },
00038     { "pc98", "pc98", "pc98", "PC-98", kPlatformPC98 },
00039     { "wii", "wii", "wii", "Nintendo Wii", kPlatformWii },
00040     { "coco3", "coco3", "coco3", "CoCo3", kPlatformCoCo3 },
00041 
00042     // The 'official' spelling seems to be "FM-TOWNS" (e.g. in the Indy4 demo).
00043     // However, on the net many variations can be seen, like "FMTOWNS",
00044     // "FM TOWNS", "FmTowns", etc.
00045     { "fmtowns", "towns", "fm", "FM-TOWNS", kPlatformFMTowns },
00046 
00047     { "linux", "linux", "linux", "Linux", kPlatformLinux },
00048     { "macintosh", "mac", "mac", "Macintosh", kPlatformMacintosh },
00049     { "pce", "pce", "pce", "PC-Engine", kPlatformPCEngine },
00050     { "nes", "nes", "nes", "NES", kPlatformNES },
00051     { "segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD },
00052     { "windows", "win", "win", "Windows", kPlatformWindows },
00053     { "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX },
00054     //ResidualVM: playstation2, xbox
00055     { "playstation2", "ps2", "ps2", "Sony PlayStation 2", kPlatformPS2 },
00056     { "xbox", "xbox", "xbox", "Microsoft Xbox", kPlatformXbox },
00057     { "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi },
00058     { "ios", "ios", "ios", "Apple iOS", kPlatformIOS },
00059     { "os2", "os2", "os2", "OS/2", kPlatformOS2 },
00060     { "beos", "beos", "beos", "BeOS", kPlatformBeOS },
00061 
00062     { nullptr, nullptr, nullptr, "Default", kPlatformUnknown }
00063 };
00064 
00065 Platform parsePlatform(const String &str) {
00066     if (str.empty())
00067         return kPlatformUnknown;
00068 
00069     // Handle some special case separately, for compatibility with old config
00070     // files.
00071     if (str == "1")
00072         return kPlatformAmiga;
00073     else if (str == "2")
00074         return kPlatformAtariST;
00075     else if (str == "3")
00076         return kPlatformMacintosh;
00077 
00078     const PlatformDescription *l = g_platforms;
00079     for (; l->code; ++l) {
00080         if (str.equalsIgnoreCase(l->code) || str.equalsIgnoreCase(l->code2) || str.equalsIgnoreCase(l->abbrev))
00081             return l->id;
00082     }
00083 
00084     return kPlatformUnknown;
00085 }
00086 
00087 
00088 const char *getPlatformCode(Platform id) {
00089     const PlatformDescription *l = g_platforms;
00090     for (; l->code; ++l) {
00091         if (l->id == id)
00092             return l->code;
00093     }
00094     return nullptr;
00095 }
00096 
00097 const char *getPlatformAbbrev(Platform id) {
00098     const PlatformDescription *l = g_platforms;
00099     for (; l->code; ++l) {
00100         if (l->id == id)
00101             return l->abbrev;
00102     }
00103     return nullptr;
00104 }
00105 
00106 const char *getPlatformDescription(Platform id) {
00107     const PlatformDescription *l = g_platforms;
00108     for (; l->code; ++l) {
00109         if (l->id == id)
00110             return l->description;
00111     }
00112     return l->description;
00113 }
00114 
00115 } // End of namespace Common


Generated on Sat Mar 16 2019 05:01:49 for ResidualVM by doxygen 1.7.1
curved edge   curved edge