From 0ed7d92abfc029bbe68eb20f5d8185537cffbc2d Mon Sep 17 00:00:00 2001 From: Mathieu Comandon Date: Mon, 30 Apr 2018 21:36:34 -0700 Subject: [PATCH] Unify list of cores and platforms in libretro runner --- lutris/runners/libretro.py | 183 ++++++++++++++----------------------- 1 file changed, 68 insertions(+), 115 deletions(-) diff --git a/lutris/runners/libretro.py b/lutris/runners/libretro.py index b95526043..c4f5dfd32 100644 --- a/lutris/runners/libretro.py +++ b/lutris/runners/libretro.py @@ -5,66 +5,70 @@ from lutris.util import system from lutris.util.log import logger from lutris import settings +# List of supported libretro cores +# First element is the human readable name for the core with the platform's short name +# Second element is the core identifier +# Third element is the platform's long name +LIBRETRO_CORES = [ + ('4do (3DO)', '4do', '3DO'), + ('atari800 (Atari 800/5200)', 'atari800', 'Atari 800/5200'), + ('blueMSX (MSX/MSX2/MSX+)', 'bluemsx', 'MSX/MSX2/MSX+'), + ('Caprice32 (Amstrad CPC)', 'cap32', 'Amstrad CPC'), + ('Citra (Nintendo 3DS)', 'citra', 'Nintendo 3DS'), + ('Citra Canary (Nintendo 3DS)', 'citra_canary', 'Nintendo 3DS'), + ('CrocoDS (Amstrad CPC)', 'crocods', 'Amstrad CPC'), + ('DesmuME (Nintendo DS)', 'desmume', 'Nintendo DS'), + ('Dolphin (Nintendo Wii/Gamecube)', 'dolphin', 'Nintendo Wii/Gamecube'), + ('EightyOne (Sinclair ZX81)', '81', 'Sinclair ZX81'), + ('FCEUmm (Nintendo Entertainment System)', 'fceumm', 'Nintendo NES'), + ('fMSX (MSX/MSX2/MSX2+)', 'fmsx', 'MSX/MSX2/MSX2+'), + ('Fuse (ZX Spectrum)', 'fuse', 'Sinclair ZX Spectrum'), + ('Gambatte (Game Boy Color)', 'gambatte', 'Nintendo Game Boy Color'), + ('Genesis Plus GX (Sega Genesis)', 'genesis_plus_gx', 'Sega Genesis'), + ('Handy (Atari Lynx)', 'handy', 'Atari Lynx'), + ('Hatari (Atari ST/STE/TT/Falcon)', 'hatari', 'Atari ST/STE/TT/Falcon'), + ('higan accuracy(Super Nintendo)', 'higan_sfc', 'Nintendo SNES'), + ('higan balanced(Super Nintendo)', 'higan_sfc_balanced', 'Nintendo SNES'), + ('MAME (Arcade)', 'mame', 'Arcade'), + ('Mednafen GBA (Game Boy Advance)', 'mednafen_gba', 'Nintendo Game Boy Advance'), + ('Mednafen NGP (SNK Neo Geo Pocket)', 'mednafen_ngp', 'SNK Neo Geo Pocket'), + ('Mednafen PCE FAST (TurboGrafx-16)', 'mednafen_pce_fast', 'NEC PC Engine (TurboGrafx-16)'), + ('Mednafen PCFX (NEC PC-FX)', 'mednafen_pcfx', 'NEC PC-FX'), + ('Mednafen Saturn (Sega Saturn)', 'mednafen_saturn', 'Sega Saturn'), + ('Mednafen SGX (NEC PC Engine SuperGrafx)', 'mednafen_supergrafx', 'NEC PC Engine (SuperGrafx)'), + ('Mednafen WSWAN (Bandai WonderSwan)', 'mednafen_wswan', 'Bandai WonderSwan'), + ('Mednafen PSX (Sony Playstation)', 'mednafen_psx', 'Sony PlayStation'), + ('Mednafen PSX OpenGL (Sony Playstation)', 'mednafen_psx_hw', 'Sony PlayStation'), + ('Mesen (Nintendo Entertainment System)', 'mesen', 'Nintendo NES'), + ('mGBA (Game Boy Advance)', 'mgba', 'Nintendo Game Boy Advance'), + ('Mupen64Plus (Nintendo 64)', 'mupen64plus', 'Nintendo N64'), + ('Nestopia (Nintendo Entertainment System)', 'nestopia', 'Nintendo NES'), + ('Neko Project 2 (NEC PC-98)', 'nekop2', 'NEC PC-98'), + ('Neko Project II kai (NEC PC-98)', 'np2kai', 'NEC PC-98'), + ('O2EM (Magnavox Odyssey²)', 'o2em', 'Magnavox Odyssey²'), + ('PCSX Rearmed (Sony Playstation)', 'pcsx_rearmed', 'Sony PlayStation'), + ('PicoDrive (Sega Genesis)', 'picodrive', 'Sega Genesis'), + ('Portable SHARP X68000 Emulator (SHARP X68000)', 'px68k', 'Sharp X68000'), + ('PPSSPP (PlayStation Portable)', 'ppsspp', 'Sony PlayStation Portable'), + ('ProSystem (Atari 7800)', 'prosystem', 'Atari 7800'), + ('Redream (Sega Dreamcast)', 'redream', 'Sega Dreamcast'), + ('Reicast (Sega Dreamcast)', 'reicast', 'Sega Dreamcast'), + ('Snes9x (Super Nintendo)', 'snes9x', 'Nintendo SNES'), + ('Stella (Atari 2600)', 'stella', 'Atari 2600'), + ('VecX (Vectrex)', 'vecx', 'Vectrex'), + ('Yabause (Sega Saturn)', 'yabause', 'Sega Saturn'), + ('VBA Next (Game Boy Advance)', 'vba_next', 'Nintendo Game Boy Advance'), + ('VBA-M (Game Boy Advance)', 'vbam', 'Nintendo Game Boy Advance'), + ('Virtual Jaguar (Atari Jaguar)', 'virtualjaguar', 'Atari Jaguar'), + ('VICE (Commodore 128)', 'vice_x128', 'Commodore 128'), + ('VICE (Commodore 16/Plus/4)', 'vice_xplus4', 'Commodore 16/Plus/4'), + ('VICE (Commodore 64)', 'vice_x64', 'Commodore 64'), + ('VICE (Commodore VIC-20)', 'vice_xvic', 'Commodore VIC-20') +] + def get_core_choices(): - # Don't forget to update self.platforms - # The order has to be the same! - return [ - ('4do (3DO)', '4do'), - ('atari800 (Atari 800/5200)', 'atari800'), - ('blueMSX (MSX/MSX2/MSX+)', 'bluemsx'), - ('Caprice32 (Amstrad CPC)', 'cap32'), - ('Citra (Nintendo 3DS)', 'citra'), - ('Citra Canary (Nintendo 3DS)', 'citra_canary'), - ('CrocoDS (Amstrad CPC)', 'crocods'), - ('DesmuME (Nintendo DS)', 'desmume'), - ('Dolphin (Nintendo Wii/Gamecube)', 'dolphin'), - ('EightyOne (Sinclair ZX81)', '81'), - ('FCEUmm (Nintendo Entertainment System)', 'fceumm'), - ('fMSX (MSX/MSX2/MSX2+)', 'fmsx'), - ('Fuse (ZX Spectrum)', 'fuse'), - ('Gambatte (Game Boy Color)', 'gambatte'), - ('Genesis Plus GX (Sega Genesis)', 'genesis_plus_gx'), - ('Handy (Atari Lynx)', 'handy'), - ('Hatari (Atari ST/STE/TT/Falcon)', 'hatari'), - ('higan accuracy(Super Nintendo)', 'higan_sfc'), - ('higan balanced(Super Nintendo)', 'higan_sfc_balanced'), - ('MAME (Arcade)', 'mame'), - ('Mednafen GBA (Game Boy Advance)', 'mednafen_gba'), - ('Mednafen NGP (SNK Neo Geo Pocket)', 'mednafen_ngp'), - ('Mednafen PCE FAST (TurboGrafx-16)', 'mednafen_pce_fast'), - ('Mednafen PCFX (NEC PC-FX)', 'mednafen_pcfx'), - ('Mednafen Saturn (Sega Saturn)', 'mednafen_saturn'), - ('Mednafen SGX (NEC PC Engine SuperGrafx)', 'mednafen_supergrafx'), - ('Mednafen WSWAN (Bandai WonderSwan)', 'mednafen_wswan'), - ('Mednafen PSX (Sony Playstation)', 'mednafen_psx'), - ('Mednafen PSX OpenGL (Sony Playstation)', 'mednafen_psx_hw'), - ('Mesen (Nintendo Entertainment System)', 'mesen'), - ('mGBA (Game Boy Advance)', 'mgba'), - ('Mupen64Plus (Nintendo 64)', 'mupen64plus'), - ('Nestopia (Nintendo Entertainment System)', 'nestopia'), - ('Neko Project 2 (NEC PC-98)', 'nekop2'), - ('Neko Project II kai (NEC PC-98)', 'np2kai'), - ('O2EM (Magnavox Odyssey²)', 'o2em'), - ('PCSX Rearmed (Sony Playstation)', 'pcsx_rearmed'), - ('PicoDrive (Sega Genesis)', 'picodrive'), - ('Portable SHARP X68000 Emulator (SHARP X68000)', 'px68k'), - ('PPSSPP (PlayStation Portable)', 'ppsspp'), - ('ProSystem (Atari 7800)', 'prosystem'), - ('Redream (Sega Dreamcast)', 'redream'), - ('Reicast (Sega Dreamcast)', 'reicast'), - ('Snes9x (Super Nintendo)', 'snes9x'), - ('Stella (Atari 2600)', 'stella'), - ('VecX (Vectrex)', 'vecx'), - ('Yabause (Sega Saturn)', 'yabause'), - ('VBA Next (Game Boy Advance)', 'vba_next'), - ('VBA-M (Game Boy Advance)', 'vbam'), - ('Virtual Jaguar (Atari Jaguar)', 'virtualjaguar'), - ('VICE (Commodore 128)', 'vice_x128'), - ('VICE (Commodore 16/Plus/4)', 'vice_xplus4'), - ('VICE (Commodore 64)', 'vice_x64'), - ('VICE (Commodore VIC-20)', 'vice_xvic'), - ] + return [(core[0], core[1]) for core in LIBRETRO_CORES] def get_default_config_path(): @@ -86,61 +90,6 @@ def get_default_info_directory(): class libretro(Runner): human_name = "Libretro" description = "Multi system emulator" - platforms = ( - '3DO', - 'Atari 800/5200', - 'MSX/MSX2/MSX+', - 'Amstrad CPC', - 'Nintendo 3DS', - 'Nintendo 3DS', - 'Amstrad CPC', - 'Nintendo DS', - 'Nintendo Wii/Gamecube', - 'Sinclair ZX81', - 'Nintendo NES', - 'MSX/MSX2/MSX2+', - 'Sinclair ZX Spectrum', - 'Nintendo Game Boy Color', - 'Sega Genesis', - 'Atari Lynx', - 'Atari ST/STE/TT/Falcon', - 'Nintendo SNES', - 'Nintendo SNES', - 'Arcade', - 'Nintendo Game Boy Advance', - 'SNK Neo Geo Pocket', - 'NEC PC Engine (TurboGrafx-16)', - 'NEC PC-FX', - 'Sega Saturn', - 'NEC PC Engine (SuperGrafx)', - 'Bandai WonderSwan', - 'Sony PlayStation', - 'Sony PlayStation', - 'Nintendo NES', - 'Nintendo Game Boy Advance', - 'Nintendo N64', - 'Nintendo NES', - 'NEC PC-98', - 'NEC PC-98', - 'Magnavox Odyssey²', - 'Sony PlayStation', - 'Sega Genesis', - 'Sharp X68000', - 'Sony PlayStation Portable', - 'Atari 7800', - 'Sega Dreamcast', - 'Sega Dreamcast', - 'Nintendo SNES', - 'Atari 2600', - 'Vectrex', - 'Sega Saturn', - 'Nintendo Game Boy Advance', - 'Nintendo Game Boy Advance', - 'Commodore 128', - 'Commodore 16/Plus/4', - 'Commodore 64', - 'Commodore VIC-20', - ) runnable_alone = True runner_executable = 'retroarch/retroarch' @@ -173,12 +122,16 @@ class libretro(Runner): } ] + @property + def platforms(self): + return [core[2] for core in LIBRETRO_CORES] + def get_platform(self): game_core = self.game_config.get('core') if game_core: - for index, core in enumerate(get_core_choices()): + for core in LIBRETRO_CORES: if core[1] == game_core: - return self.platforms[index] + return core[2] return '' def get_core_path(self, core):