mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
Changed "platform IDs" to just "platform", and now names are used instead of numerical IDs.
Check src/PlatformIds.cpp for a complete list.
This commit is contained in:
parent
b221ecdd94
commit
cb54d8ae6d
|
@ -241,6 +241,7 @@ set(ES_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/MathExp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/platform.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_draw_gl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/ScraperCmdLine.cpp
|
||||
|
|
|
@ -154,8 +154,8 @@ All systems must be contained within the <systemList> tag.-->
|
|||
<command>snesemulator %ROM%</command>
|
||||
<!-- This example would run the bash command "snesemulator /home/user/roms/snes/Super\ Mario\ World.sfc". -->
|
||||
|
||||
<!-- The Platform ID to use for scraping. 42 is the platform ID for the SNES. You can see the full list in src/PlatformIds.h. -->
|
||||
<platformid>42</system>
|
||||
<!-- The platform to use when scraping. You can see the full list of accepted platforms in src/PlatformIds.cpp. -->
|
||||
<platform>snes</platform>
|
||||
</system>
|
||||
</systemList>
|
||||
```
|
||||
|
|
76
src/PlatformId.cpp
Normal file
76
src/PlatformId.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
#include "PlatformId.h"
|
||||
|
||||
namespace PlatformIds
|
||||
{
|
||||
const char* PlatformNames[PLATFORM_COUNT + 1] = {
|
||||
"unknown", // = 0,
|
||||
|
||||
"3do", // = 1,
|
||||
"amiga", // = 2,
|
||||
"arcade", // = 3,
|
||||
"atari2600", // = 4,
|
||||
"atari5200", // = 5,
|
||||
"atari7800", // = 6,
|
||||
"atariJaguar", // = 7,
|
||||
"atariJaguarCD", // = 8,
|
||||
"atariXE", // = 9,
|
||||
"colecovision", // = 10,
|
||||
"commodore64", // = 11,
|
||||
"intellivision", // = 12,
|
||||
"mac", // = 13,
|
||||
"xbox", // = 14,
|
||||
"xbox360", // = 15,
|
||||
"neogeo", // = 16,
|
||||
"ngp", // = 17,
|
||||
"ngpc", // = 18,
|
||||
"n3ds", // = 19,
|
||||
"n64", // = 20,
|
||||
"nds", // = 21,
|
||||
"nes", // = 22,
|
||||
"gb", // = 23,
|
||||
"gba", // = 24,
|
||||
"gbc", // = 25,
|
||||
"gamecube", // = 26,
|
||||
"wii", // = 27,
|
||||
"wiiu", // = 28,
|
||||
"pc", // = 29,
|
||||
"sega32x", // = 30,
|
||||
"segacd", // = 31,
|
||||
"dreamcast", // = 32,
|
||||
"gamegear", // = 33,
|
||||
"genesis", // = 34,
|
||||
"mastersystem", // = 35,
|
||||
"megadrive", // = 36,
|
||||
"saturn", // = 37,
|
||||
"psx", // = 38,
|
||||
"ps2", // = 39,
|
||||
"ps3", // = 40,
|
||||
"ps4", // = 41,
|
||||
"psvita", // = 42,
|
||||
"psp", // = 43,
|
||||
"snes", // = 44,
|
||||
"pcengine", // = 45,
|
||||
"zxspectrum", // = 46,
|
||||
|
||||
"invalid" // = 47
|
||||
};
|
||||
|
||||
PlatformId getPlatformId(const char* str)
|
||||
{
|
||||
if(str == NULL)
|
||||
return PLATFORM_UNKNOWN;
|
||||
|
||||
for(unsigned int i = 1; i < PLATFORM_COUNT; i++)
|
||||
{
|
||||
if(strcmp(PlatformNames[i], str) == 0)
|
||||
return (PlatformId)i;
|
||||
}
|
||||
|
||||
return PLATFORM_UNKNOWN;
|
||||
}
|
||||
|
||||
const char* getPlatformName(PlatformId id)
|
||||
{
|
||||
return PlatformNames[id];
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace PlatformIds
|
||||
{
|
||||
enum PlatformId : unsigned int
|
||||
|
@ -22,35 +24,40 @@ namespace PlatformIds
|
|||
XBOX = 14,
|
||||
XBOX_360 = 15,
|
||||
NEOGEO = 16,
|
||||
NINTENDO_3DS = 17,
|
||||
NINTENDO_64 = 18,
|
||||
NINTENDO_DS = 19,
|
||||
NINTENDO_ENTERTAINMENT_SYSTEM = 20,
|
||||
GAME_BOY = 21,
|
||||
GAME_BOY_ADVANCE = 22,
|
||||
GAME_BOY_COLOR = 23,
|
||||
NINTENDO_GAMECUBE = 24,
|
||||
NINTENDO_WII = 25,
|
||||
NINTENDO_WII_U = 26,
|
||||
PC = 27,
|
||||
SEGA_32X = 28,
|
||||
SEGA_CD = 29,
|
||||
SEGA_DREAMCAST = 30,
|
||||
SEGA_GAME_GEAR = 31,
|
||||
SEGA_GENESIS = 32,
|
||||
SEGA_MASTER_SYSTEM = 33,
|
||||
SEGA_MEGA_DRIVE = 34,
|
||||
SEGA_SATURN = 35,
|
||||
PLAYSTATION = 36,
|
||||
PLAYSTATION_2 = 37,
|
||||
PLAYSTATION_3 = 38,
|
||||
PLAYSTATION_4 = 39,
|
||||
PLAYSTATION_VITA = 40,
|
||||
PLAYSTATION_PORTABLE = 41,
|
||||
SUPER_NINTENDO = 42,
|
||||
TURBOGRAFX_16 = 43,
|
||||
ZX_SPECTRUM = 44,
|
||||
NEOGEO_POCKET = 17,
|
||||
NEOGEO_POCKET_COLOR = 18,
|
||||
NINTENDO_3DS = 19,
|
||||
NINTENDO_64 = 20,
|
||||
NINTENDO_DS = 21,
|
||||
NINTENDO_ENTERTAINMENT_SYSTEM = 22,
|
||||
GAME_BOY = 23,
|
||||
GAME_BOY_ADVANCE = 24,
|
||||
GAME_BOY_COLOR = 25,
|
||||
NINTENDO_GAMECUBE = 26,
|
||||
NINTENDO_WII = 27,
|
||||
NINTENDO_WII_U = 28,
|
||||
PC = 29,
|
||||
SEGA_32X = 30,
|
||||
SEGA_CD = 31,
|
||||
SEGA_DREAMCAST = 32,
|
||||
SEGA_GAME_GEAR = 33,
|
||||
SEGA_GENESIS = 34,
|
||||
SEGA_MASTER_SYSTEM = 35,
|
||||
SEGA_MEGA_DRIVE = 36,
|
||||
SEGA_SATURN = 37,
|
||||
PLAYSTATION = 38,
|
||||
PLAYSTATION_2 = 39,
|
||||
PLAYSTATION_3 = 40,
|
||||
PLAYSTATION_4 = 41,
|
||||
PLAYSTATION_VITA = 42,
|
||||
PLAYSTATION_PORTABLE = 43,
|
||||
SUPER_NINTENDO = 44,
|
||||
TURBOGRAFX_16 = 45,
|
||||
ZX_SPECTRUM = 46,
|
||||
|
||||
PLATFORM_COUNT = 45
|
||||
PLATFORM_COUNT = 47
|
||||
};
|
||||
|
||||
PlatformId getPlatformId(const char* str);
|
||||
const char* getPlatformName(PlatformId id);
|
||||
}
|
||||
|
|
|
@ -257,7 +257,13 @@ bool SystemData::loadConfig()
|
|||
}
|
||||
|
||||
cmd = system.child("command").text().get();
|
||||
platformId = (PlatformIds::PlatformId)system.child("platformid").text().as_uint(PlatformIds::PLATFORM_UNKNOWN);
|
||||
|
||||
const char* platformIdString = system.child("platform").text().as_string();
|
||||
platformId = PlatformIds::getPlatformId(platformIdString);
|
||||
|
||||
// if there appears to be an actual platform ID supplied but it didn't match the list, warn
|
||||
if(platformIdString != NULL && platformIdString[0] != '\0' && platformId == PlatformIds::PLATFORM_UNKNOWN)
|
||||
LOG(LogWarning) << " Unknown platform for system \"" << name << "\" (platform \"" << platformIdString << "\")";
|
||||
|
||||
//validate
|
||||
if(name.empty() || path.empty() || extensions.empty() || cmd.empty())
|
||||
|
@ -300,7 +306,7 @@ void SystemData::writeExampleConfig(const std::string& path)
|
|||
" <!-- A \"pretty\" name, displayed in the header and such. -->\n"
|
||||
" <fullname>Nintendo Entertainment System</fullname>\n"
|
||||
"\n"
|
||||
" <!-- The path to start searching for ROMs in. '~' will be expanded to $HOME or $HOMEPATH, depending on platform. -->\n"
|
||||
" <!-- The path to start searching for ROMs in. '~' will be expanded to $HOME on Linux or %HOMEPATH% on Windows. -->\n"
|
||||
" <path>~/roms/nes</path>\n"
|
||||
"\n"
|
||||
" <!-- A list of extensions to search for, delimited by a space. You MUST include the period! It's also case sensitive. -->\n"
|
||||
|
@ -312,6 +318,9 @@ void SystemData::writeExampleConfig(const std::string& path)
|
|||
" %ROM_RAW% is the raw, unescaped path to the ROM. -->\n"
|
||||
" <command>retroarch -L ~/cores/libretro-fceumm.so %ROM%</command>\n"
|
||||
"\n"
|
||||
" <!-- The platform to use when scraping. You can see the full list of accepted platforms in src/PlatformIds.cpp. This tag is optional. -->\n"
|
||||
" <platform>nes</platform>\n"
|
||||
"\n"
|
||||
" </system>\n"
|
||||
"</systemList>\n";
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ void GuiScraperStart::pressedStart()
|
|||
if((*it)->getPlatformId() == PlatformIds::PLATFORM_UNKNOWN)
|
||||
{
|
||||
mWindow->pushGui(new GuiMsgBox(mWindow,
|
||||
strToUpper("Warning: some of your selected systems do not have a platform ID set. Results may be even more inaccurate than usual!\nContinue anyway?"),
|
||||
strToUpper("Warning: some of your selected systems do not have a platform set. Results may be even more inaccurate than usual!\nContinue anyway?"),
|
||||
"YES", std::bind(&GuiScraperStart::start, this),
|
||||
"NO", nullptr));
|
||||
return;
|
||||
|
|
|
@ -27,6 +27,8 @@ const std::map<PlatformId, const char*> gamesdb_platformid_map = boost::assign::
|
|||
(XBOX, "Microsoft Xbox")
|
||||
(XBOX_360, "Microsoft Xbox 360")
|
||||
(NEOGEO, "NeoGeo")
|
||||
(NEOGEO_POCKET, "Neo Geo Pocket")
|
||||
(NEOGEO_POCKET_COLOR, "Neo Geo Pocket Color")
|
||||
(NINTENDO_3DS, "Nintendo 3DS")
|
||||
(NINTENDO_64, "Nintendo 64")
|
||||
(NINTENDO_DS, "Nintendo DS")
|
||||
|
|
Loading…
Reference in a new issue