class ports(emulator): @staticmethod def get_system_list(): return ["ports"] def pre_configure(self): self.p_sPort = None logging.info("INFO: Script for port: {%s}" % self.m_sFilePath) with open(self.m_sFilePath, "r") as f: for line in f: if "_PORT_" in line: string = line.split("_PORT_")[1].strip() self.p_sPort = re.sub(r' +', " ", string).split(' ')[0].strip() self.p_sPort = self.p_sPort.replace('"', '') self.p_sPort = self.p_sPort.replace("'", '') # try to get if rom is needed on bash batch launcher try: self.p_sPortROM = re.sub(r' +', " ", string).split(' ')[1:] self.p_sPortROM = " ".join(self.p_sPortROM) self.p_sPortROM = self.p_sPortROM.replace('"', '') self.p_sPortROM = self.p_sPortROM.replace("'", '') except Exception as e: self.p_sPortROM = "" logging.info("INFO: Port ID: {%s}" % self.p_sPort) logging.info("INFO: Port ROM: {%s}" % self.p_sPortROM) break if not self.p_sPort: self.panic("Don't valid port game") p_sPortPath = os.path.join(self.m_sSystem, self.p_sPort, "emulators.cfg") self.m_sCfgSystemPath = os.path.join(RETROPIE_CFG_PATH, p_sPortPath) logging.info("INFO: emulators.cfg for this port: {%s}" % self.m_sCfgSystemPath) def direct_start(self): """ launch_core: run emulator without runcommand!""" if self.m_sFileNameVar and self.m_sFileNameVar in self.m_sCleanLaunch: self.m_sCleanLaunch = self.m_sCleanLaunch.replace( self.m_sFileNameVar, "\"%s\"" % self.p_sPortROM) commandline = self.m_sCleanLaunch if not os.path.exists("/tmp/retroarch"): os.system("mkdir /tmp/retroarch") self.m_oRunProcess = subprocess.Popen(commandline, shell=True) logging.info("INFO: Subprocess running: %s", commandline) def screen_set(self): self.m_oCRT = CRT(self.p_sPort) self.m_oCRT.screen_calculated(DB_PORTS) self.m_oBlackScreen.fill() logging.info("INFO: clean: %s", TMP_SLEEPER_FILE) remove_file(TMP_SLEEPER_FILE) def runcommand_start(self): """ launch_core: run emulator!""" commandline = "bash \"%s\"" % self.m_sFilePath self.m_oRunProcess = subprocess.Popen(shlex.split(commandline), shell=False) logging.info("INFO: Subprocess running: %s", commandline) self.runcommand_wait()
def run(sCommandline, sDBSys=None): oCRT = None if sDBSys: oCRT = CRT(sDBSys) oCRT.screen_calculated(CRT_DB_SYSTEMS_FILE) oRunProcess = subprocess.Popen(shlex.split(sCommandline), shell=False) iExitCode = oRunProcess.wait() if oCRT: oCRT.screen_restore()
def launch_test_suite(): global oCRT ra_version_fixes(RA_MD_CFG_FILE2) oCRT = CRT("megadrive") oCRT.screen_calculated(CRT_DB_SYSTEMS_FILE) commandline = "%s -L %s " % (RA_BIN_FILE, RA_MD_CORE_FILE) commandline += "--config %s " % RA_MD_CFG_FILE1 commandline += "--appendconfig %s " % RA_MD_CFG_FILE2 commandline += "\"%s\" " % TEST_SUITE_FILE commandline += "> /dev/null 2>&1" launch_application(commandline, True)
def launch_credits(): global oCRT global oBlackScreen global iExitCode ra_version_fixes(RA_GBA_CFG_FILE2) oCRT = CRT(sSystem) oBlackScreen = HideScreen() oBlackScreen.fill() oCRT.screen_calculated(CRT_DB_SYSTEMS_FILE) commandline = "%s -L %s " % (RA_BIN_FILE, RA_GBA_CORE_FILE) commandline += "--config %s " % RA_GBA_CFG_FILE1 commandline += "--appendconfig %s " % RA_GBA_CFG_FILE2 commandline += "\"%s\" " % ROM_FILE commandline += "> /dev/null 2>&1" oRunProcess = subprocess.Popen(commandline, shell=True) iExitCode = oRunProcess.wait() oCRT.screen_restore()