From 907f36e07404c529bd13e4c3569570748160652c Mon Sep 17 00:00:00 2001 From: cuu Date: Mon, 11 Jun 2018 16:01:02 +0800 Subject: [PATCH] add RETRO_CONFIG field in action.config to allow to specify the configuration file --- Menu/GameShell/20_Retro Games/MAME/action.config | 3 ++- sys.py/UI/Emulator/fav_list_page.py | 8 +++++++- sys.py/UI/Emulator/rom_list_page.py | 7 ++++++- sys.py/UI/main_screen.py | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Menu/GameShell/20_Retro Games/MAME/action.config b/Menu/GameShell/20_Retro Games/MAME/action.config index 4c5f31a..3c729c4 100644 --- a/Menu/GameShell/20_Retro Games/MAME/action.config +++ b/Menu/GameShell/20_Retro Games/MAME/action.config @@ -3,4 +3,5 @@ ROM_SO=/home/cpi/apps/emulators/mame2003_plus_libretro.so EXT=zip LAUNCHER=retroarch -L TITLE=MAME Roms -SO_URL=http://buildbot.libretro.com/nightly/linux/armhf/latest/mame2003_plus_libretro.so.zip \ No newline at end of file +SO_URL=http://buildbot.libretro.com/nightly/linux/armhf/latest/mame2003_plus_libretro.so.zip +RETRO_CONFIG=/home/cpi/apps/configs/mame.config diff --git a/sys.py/UI/Emulator/fav_list_page.py b/sys.py/UI/Emulator/fav_list_page.py index 6598056..1c0d857 100644 --- a/sys.py/UI/Emulator/fav_list_page.py +++ b/sys.py/UI/Emulator/fav_list_page.py @@ -312,7 +312,13 @@ class FavListPage(Page): # check ROM_SO exists if FileExists(self._Emulator["ROM_SO"]): escaped_path = CmdClean( cur_li._Path) - cmdpath = " ".join( (self._Emulator["LAUNCHER"],self._Emulator["ROM_SO"], escaped_path)) + + custom_config = "" + if self._Emulator["RETRO_CONFIG"] != "" and len(self._Emulator["RETRO_CONFIG"]) > 5: + custom_config = " -c " + self._Emulator["RETRO_CONFIG"] + + cmdpath = " ".join( (self._Emulator["LAUNCHER"],self._Emulator["ROM_SO"], custom_config, escaped_path)) + pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath)) return else: diff --git a/sys.py/UI/Emulator/rom_list_page.py b/sys.py/UI/Emulator/rom_list_page.py index 891d0cf..f094b5f 100644 --- a/sys.py/UI/Emulator/rom_list_page.py +++ b/sys.py/UI/Emulator/rom_list_page.py @@ -341,7 +341,12 @@ class RomListPage(Page): # check ROM_SO exists if FileExists(self._Emulator["ROM_SO"]): escaped_path = CmdClean( cur_li._Path) - cmdpath = " ".join( (self._Emulator["LAUNCHER"],self._Emulator["ROM_SO"], escaped_path)) + + custom_config = "" + if self._Emulator["RETRO_CONFIG"] != "" and len(self._Emulator["RETRO_CONFIG"]) > 5: + custom_config = " -c " + self._Emulator["RETRO_CONFIG"] + + cmdpath = " ".join( (self._Emulator["LAUNCHER"],self._Emulator["ROM_SO"], custom_config, escaped_path)) pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath)) return else: diff --git a/sys.py/UI/main_screen.py b/sys.py/UI/main_screen.py index 0ace849..9c9b885 100644 --- a/sys.py/UI/main_screen.py +++ b/sys.py/UI/main_screen.py @@ -409,7 +409,7 @@ class MainScreen(object): obj["LAUNCHER"] = "" obj["TITLE"] = "Game" obj["SO_URL"] = "" - + obj["RETRO_CONFIG"] = "" ## try: f = open(_dir+"/"+i+"/"+emulator_flag) except IOError: