ES-DE/es-app/src/PlatformId.h
Zachary Burke 7d50301b46 Majorly improved performance when fetching Mame names.
After profiling UI filtering and startup I determined that
getCleanMameName was responsible for the incredibly long load times when
loading/filtering Mame ROMS. This function was using a linear search
over a pre-sorted array to find a corresponding Mame ROM Name from the
ROM name. It now uses a binary search which improves UI load/filter
responsiveness by a couple orders of magnitude.

Single core performance on my i7 for 10,000 iterations was 2.01 secs vs
7.77e-4 secs
2018-01-03 13:47:39 -08:00

90 lines
1.7 KiB
C++

#pragma once
#ifndef ES_APP_PLATFORM_ID_H
#define ES_APP_PLATFORM_ID_H
namespace PlatformIds
{
enum PlatformId : unsigned int
{
PLATFORM_UNKNOWN = 0,
THREEDO, // name can't start with a constant
AMIGA,
AMSTRAD_CPC,
APPLE_II,
ARCADE,
ATARI_800,
ATARI_2600,
ATARI_5200,
ATARI_7800,
ATARI_LYNX,
ATARI_ST, // Atari ST/STE/Falcon
ATARI_JAGUAR,
ATARI_JAGUAR_CD,
ATARI_XE,
COLECOVISION,
COMMODORE_64,
INTELLIVISION,
MAC_OS,
XBOX,
XBOX_360,
MSX,
NEOGEO,
NEOGEO_POCKET,
NEOGEO_POCKET_COLOR,
NINTENDO_3DS,
NINTENDO_64,
NINTENDO_DS,
FAMICOM_DISK_SYSTEM,
NINTENDO_ENTERTAINMENT_SYSTEM,
GAME_BOY,
GAME_BOY_ADVANCE,
GAME_BOY_COLOR,
NINTENDO_GAMECUBE,
NINTENDO_WII,
NINTENDO_WII_U,
NINTENDO_VIRTUAL_BOY,
NINTENDO_GAME_AND_WATCH,
PC,
SEGA_32X,
SEGA_CD,
SEGA_DREAMCAST,
SEGA_GAME_GEAR,
SEGA_GENESIS,
SEGA_MASTER_SYSTEM,
SEGA_MEGA_DRIVE,
SEGA_SATURN,
SEGA_SG1000,
PLAYSTATION,
PLAYSTATION_2,
PLAYSTATION_3,
PLAYSTATION_4,
PLAYSTATION_VITA,
PLAYSTATION_PORTABLE,
SUPER_NINTENDO,
TURBOGRAFX_16, // (also PC Engine)
WONDERSWAN,
WONDERSWAN_COLOR,
ZX_SPECTRUM,
VIDEOPAC_ODYSSEY2,
VECTREX,
TRS80_COLOR_COMPUTER,
TANDY,
PLATFORM_IGNORE, // do not allow scraping for this system
PLATFORM_COUNT
};
PlatformId getPlatformId(const char* str);
const char* getPlatformName(PlatformId id);
// Get the number of Mame titles in the mameNameToRealName array
// Should only run this once and store in a static or cached variable
int getMameTitleCount();
// Perform a binary search for a game title given a rom name
const char* mameTitleSearch(const char* from);
}
#endif // ES_APP_PLATFORM_ID_H