Exemplo n.º 1
0
 def opt1(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     try:
         self.m_oKeybCTRLClass
     except:
         self.m_oKeybCTRLClass = CTRLSMgmt()
     if p_iJoy == None:
         return self.opt1_datas()
     if p_iJoy & CRT_OK:
         if self.m_lLines[p_iLine]['value'] == "[FORCED]":
             self.info("PI2JAMMA is enabled", "icon_info")
             time.sleep(2)
             self.info()
             return
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         self.info("Please wait", "icon_clock")
         if new:
             self.m_oKeybCTRLClass.pi2jamma_enable_controls()
             ini_set(CRT_UTILITY_FILE, 'keyb_ipac', 'true')
         else:
             self.m_oKeybCTRLClass.pi2jamma_disable_controls()
             ini_set(CRT_UTILITY_FILE, 'keyb_ipac', 'false')
         value = self.m_oKeybCTRLClass.check_keyboard_enabled()
         self.m_lLines[p_iLine]['value'] = value
         if value:
             self.info([
                 "Enabled IPAC/Keyboard", "MAME Layout for 2 Players",
                 "in Retroarch and ES.", " ", "Enable only if you are not",
                 "going to use a joystick!"
             ], "icon_info")
             time.sleep(6)
         self.info()
Exemplo n.º 2
0
 def opt10(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt10_datas()
     if p_iJoy & CRT_OK:
         if self.m_lLines[p_iLine]['value'] == "N/A":
             self.info("FastBoot is enabled", "icon_info")
             time.sleep(2)
             self.info()
             return
     elif p_iJoy & CRT_LEFT or p_iJoy & CRT_RIGHT:
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         if value == "N/A": return
         new = explore_list(p_iJoy, value, list)
         if new:
             if new == "Disabled":
                 ini_set(RETROPIE_RUNCOMMAND_CFG_FILE, "image_delay", "0")
                 self.info("Please Wait", "icon_clock")
                 launching_images(False)
                 self.info()
             else:
                 ini_set(RETROPIE_RUNCOMMAND_CFG_FILE, "image_delay",
                         new.replace('s', ''))
                 if new == "1s" and value == "Disabled":
                     self.info("Please Wait", "icon_clock")
                     launching_images(True)
                     self.info()
             self.m_lLines[p_iLine].update({'value': new})
Exemplo n.º 3
0
    def emulatorcfg_prepare(self):
        """
        Prepare emulator to launch

        Panic
        -----
            if not valid default emulator is found
            if not cores are installed
        """
        try:
            self.emulatorcfg_add_systems()
            if self.emulatorcfg_default_check() == False:
                if self.m_bFastBoot:
                    ini_set(CRT_UTILITY_FILE, 'fast_boot', 'False')
                    logging.info(
                        "INFO: Wrong emulator selected, disabling fast boot")
                    self.panic("No valid emulator, FastBoot DISABLED.",
                               "Please, try again!")
                self.panic("No valid emulator selected", "Please, try again!")
            self.emulatorcfg_per_game()

        except IOError as e:
            infos = "Emulators.cfg [%s] not found" % self.m_sSystem
            infos2 = "Please, install one emulator or core"
            self.panic(infos, infos2)
        except Exception as e:
            infos = "Error in emulators.cfg [%s]" % self.m_sSystem
            self.panic(infos, str(e))
Exemplo n.º 4
0
 def change_music(self, p_sFolder):
     self.service_connection()
     try:
         ini_set(CRT_UTILITY_FILE, "music_folder", p_sFolder)
         #self.m_sFolder = None
         self.BGMCon.root.load_music()
     except Exception as e:
         logging.info("%s" % e)
     return False
Exemplo n.º 5
0
 def _save_current_theme(self):
     # identify element theme to find in CRT config
     p_sIni = "h_theme"
     if self.iCurSide != 0:
         p_sIni = "v_theme"
     # get current saved theme for current side
     p_sTheme = ini_get(CRT_UTILITY_FILE, p_sIni)
     p_sCurTheme = get_xml_value_esconfig("ThemeSet")
     if p_sTheme != p_sCurTheme:
         ini_set(CRT_UTILITY_FILE, p_sIni, p_sCurTheme)
Exemplo n.º 6
0
 def preset(self, p_sPreset):
     if p_sPreset.lower() in self.m_lPresets:
         command = 'amixer -q -D equal sset'
         p_lValues = self.m_lPresets[p_sPreset.lower()]
         for i in range(0, 10):
             string = ' "' + str(self.m_lFreqs[i]) + '" '
             string += str(p_lValues[i]) + '%'
             string += " > /dev/null 2>&1"
             os.system(command + string)
         ini_set(CRT_UTILITY_FILE, "audio_presets", p_sPreset.lower())
         return p_sPreset
Exemplo n.º 7
0
 def opt12(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt12_datas()
     if p_iJoy & CRT_OK:
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         if new: ini_set(RA_CFG_FILE, "menu_driver", "rgui")
         elif not new: ini_set(RA_CFG_FILE, "menu_driver", 'Null')
         self.m_lLines[p_iLine].update({'value': new})
Exemplo n.º 8
0
 def opt11(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt11_datas()
     if p_iJoy & CRT_OK:
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         if not new: ini_set(CRT_UTILITY_FILE, "scummvm_arc", "false")
         elif new: ini_set(CRT_UTILITY_FILE, "scummvm_arc", "true")
         self.m_lLines[p_iLine].update({'value': new})
Exemplo n.º 9
0
 def opt1(self, p_iJoy = None, p_iLine = None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt1_datas()
     if p_iJoy & CRT_OK:
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         if new: ini_set(CRT_UTILITY_FILE, "daphne_remap", "true")
         else: ini_set(CRT_UTILITY_FILE, "daphne_remap", "false")
         value = ini_get(CRT_UTILITY_FILE, "daphne_remap") == "true"
         self.m_lLines[p_iLine]['value'] = value
Exemplo n.º 10
0
 def opt4(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt4_datas()
     if p_iJoy & CRT_LEFT or p_iJoy & CRT_RIGHT:
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         if new:
             if new == "Runcommand":
                 ini_set(CRT_UTILITY_FILE, "fast_boot", "False")
             elif new == "FastBoot":
                 ini_set(CRT_UTILITY_FILE, "fast_boot", "True")
             self.m_lLines[p_iLine].update({'value': new})
Exemplo n.º 11
0
 def opt3(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt3_datas()
     if p_iJoy & CRT_LEFT or p_iJoy & CRT_RIGHT:
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         if new:
             if new == "Default":
                 ini_set(RETROPIE_RUNCOMMAND_CFG_FILE, "governor", "")
             else:
                 ini_set(RETROPIE_RUNCOMMAND_CFG_FILE, "governor",
                         new.lower())
             self.m_lLines[p_iLine].update({'value': new})
Exemplo n.º 12
0
 def opt1(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt1_datas()
     if p_iJoy & CRT_LEFT or p_iJoy & CRT_RIGHT:
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         if new:
             if new == "Manual": value = "manual"
             elif new == "50hz": value = "50"
             elif new == "60hz": value = "60"
             elif new == "Auto": value = "auto"
             ini_set(CRT_UTILITY_FILE, "freq_selector", value)
             self.m_lLines[p_iLine].update({'value': new})
Exemplo n.º 13
0
 def _ra_aspect_ratio(self):
     p_sVersion = "v1.7.5"
     p_sRatioNew = "23"  # default 1.7.5 value
     p_sRatioCur = ""
     if LooseVersion(self.m_sRAVersion) < LooseVersion(p_sVersion):
         p_sRatioNew = "22"
     p_sRatioCur = ini_get(self.m_sSystemCfgPath, "aspect_ratio_index")
     logging.info("INFO: Checking if aspect ratio number is %s" %
                  p_sRatioNew)
     if p_sRatioNew != p_sRatioCur.replace('"', ''):
         ini_set(self.m_sSystemCfgPath, "aspect_ratio_index", p_sRatioNew)
         logging.info("INFO: fixed: %s version: %s ratio: %s (was %s)" % \
                     (self.m_sSystemCfgPath, self.m_sRAVersion,
                      p_sRatioNew, p_sRatioCur))
     else:
         logging.info("INFO: retroarch aspect ratio number no need fix")
Exemplo n.º 14
0
    def _recovery_mode(self):
        """
        If recovery mode is enabled in /boot/config.txt this function will
        apply the selected MODE in crt_recovery_mode. This mode must be
        profiled in ~/CRT/bin/ScreenUtilityFiles/config_files/modes.cfg
        These MODES is a way to give compatibility to some TV or monitors.
        Basically are diffs to apply to the base timings to fit with with
        resolution. By default are three but is possible to create more
        following the scheme of current ones.
        """
        if self.m_bRecovery:
            p_lCheck = ini_set(CRT_FIXMODES_FILE, 'mode_default',
                               self.m_bRecovMode.upper())
            logging.info("INFO: changed recovery mode to {%s} " %
                         self.m_bRecovMode)
            self._clone_boot_cfg()

            ini_sect_set_key(self.m_sTempFile, 'CRT-RECOVERY',
                             'crt_recovery_enabled', 0)
            ini_sect_set_key(self.m_sTempFile, 'CRT-RECOVERY',
                             'crt_recovery_mode', 'DEFAULT')
            self._upload_boot_cfg()

            # Create timings with MODE for system/ES in /boot/config.txt
            p_oRESClass = saveboot()
            p_oRESClass.save()
            p_oRESClass.apply()
            self._restart_system()
Exemplo n.º 15
0
 def set_config(self, m_sScreen, m_sValue):
     if m_sScreen in self.m_lOLEDScrns:
         if m_sValue.lower() == "disabled": m_sValue = "0"
         else: m_sValue = m_sValue.lower().replace('m', '')
         if ini_set(CRT_OLED_FILE, m_sScreen, m_sValue):
             self.service_refresh()
             return True
     return False
Exemplo n.º 16
0
 def opt2(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt2_datas()
     if p_iJoy & CRT_OK:
         if self.m_lLines[p_iLine]['value'] == "N/A":
             self.info("FastBoot is enabled", "icon_info")
             time.sleep(2)
             self.info()
             return
         if self.m_lLines[p_iLine]['value'] == "--": return
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         if new != None:
             ini_set(CRT_UTILITY_FILE, "autosel_info", new)
             self.m_lLines[p_iLine].update({'value': new})
Exemplo n.º 17
0
 def opt3(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt3_datas()
     if p_iJoy & CRT_OK:
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         if not new: ini_set(CRT_UTILITY_FILE, "handheld_bezel", "false")
         elif new: ini_set(CRT_UTILITY_FILE, "handheld_bezel", "true")
         self.m_lLines[p_iLine].update({'value': new})
         if new == True:
             self.info([
                 "Long exposure to a", "static image could",
                 "damage your CRT"
             ], "icon_info")
             time.sleep(2)
             self.info()
Exemplo n.º 18
0
 def opt11(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt11_datas()
     if p_iJoy & CRT_OK:
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         if value == "N/A":
             self.info("FastBoot is enabled", "icon_info")
             time.sleep(2)
             self.info()
             return
         new = explore_list(p_iJoy, value, list)
         if new == False:
             ini_set(RETROPIE_RUNCOMMAND_CFG_FILE, "disable_menu", "1")
         elif new == True:
             ini_set(RETROPIE_RUNCOMMAND_CFG_FILE, "disable_menu", "0")
         self.m_lLines[p_iLine].update({'value': new})
Exemplo n.º 19
0
 def segacfg_write(self, p_dData):
     if self.m_sRndCore != self.m_sSelCore:
         logging.info("INFO: system: %s core: %s" %
                      (self.m_sSystemFreq, self.m_sSelCore))
         ini_set(self.m_sCustomRACFG, "custom_viewport_width",
                 p_dData["width"])
         ini_set(self.m_sCustomRACFG, "custom_viewport_height",
                 p_dData["height"])
         ini_set(self.m_sCustomRACFG, "custom_viewport_x", p_dData["x"])
         ini_set(self.m_sCustomRACFG, "custom_viewport_y", p_dData["y"])
         logging.info("INFO: Changes type %s => %s" %
                      (self.m_sViewPortType, str(p_dData)))
     else:
         logging.info("INFO: same SEGA core, changes already applied")
Exemplo n.º 20
0
 def opt1(self, p_iJoy=None, p_iLine=None):
     p_lLines = {}
     if p_iJoy == None:
         return self.opt1_datas()
     if p_iJoy & CRT_LEFT or p_iJoy & CRT_RIGHT:
         try:
             self.p_oRESClass
         except:
             self.p_oRESClass = saveboot()
         list = self.m_lLines[p_iLine]['options']
         value = self.m_lLines[p_iLine]['value']
         new = explore_list(p_iJoy, value, list)
         if new:
             value = new
             if new.lower() == "default": value = 'default'
             ini_set(CRT_FIXMODES_FILE, "mode_default", value)
             self.m_lLines[p_iLine].update({'value': new})
             self.info("Applying Mode", "icon_info")
             self.m_bPause[0] = True
             self.p_oRESClass.save()
             self.p_oRESClass.apply()
             self.m_bPause[0] = False
             time.sleep(1.5)
             self.info()
Exemplo n.º 21
0
    def ra_config_write(self, p_bSmooth):
        logging.info("result - w %s, h %s (%s/%s) - scale integer{%s} - %sHz - s[%s] smooth{%s}" % (
            self.cfg_hres,
            self.cfg_vres,
            self.cfg_offsetx,
            self.cfg_offsety,
            self.cfg_iscale,
            self.m_dVideo["R_Rate"],
            self.m_oCRT.m_sSide_Game,
            p_bSmooth
            ))
        # copy cfg base
        add_line(self.m_sCustomRACFG, 'custom_viewport_width = "%s"' % self.cfg_hres)
        add_line(self.m_sCustomRACFG, 'custom_viewport_height = "%s"' % self.cfg_vres)
        add_line(self.m_sCustomRACFG, 'custom_viewport_x = "%s"' % self.cfg_offsetx)
        add_line(self.m_sCustomRACFG, 'custom_viewport_y = "%s"' % self.cfg_offsety)
        add_line(self.m_sCustomRACFG, 'video_refresh_rate = "%s"' % self.m_dVideo["R_Rate"])

        # smooth vertical games on horizontal screens
        ini_set(self.m_sCustomRACFG, "video_smooth", str(p_bSmooth).lower())

        # Check orientation
        logging.info("m_sSide_Game %s" % (self.m_oCRT.m_sSide_Game))
        logging.info("System Side: %s" % (self.m_iSide))
        if self.m_oCRT.m_sSide_Game == "H":
            add_line(self.m_sCustomRACFG, 'video_rotation = "0"')
        elif self.m_oCRT.m_sSide_Game == "V3":
            add_line(self.m_sCustomRACFG, 'video_rotation = "1"')
        elif self.m_oCRT.m_sSide_Game == "V1":
            add_line(self.m_sCustomRACFG, 'video_rotation = "3"')

        # Video Scale Integer activation
        ini_set(self.m_sCustomRACFG, "video_scale_integer", self.cfg_iscale)

        # Change custom core config if applies, like neogeo
        if self.m_sCoreCFG:
            ini_set(self.m_sCustomRACFG, "core_options_path", self.m_sCoreCFG)

        # Check retroarch version
        ra_version_fixes(self.m_sCustomRACFG)
Exemplo n.º 22
0
 def lobby_disable(self):
     ini_set(CRT_UTILITY_FILE, "netplay_lobby", "false")
     return self.get_lobby()
Exemplo n.º 23
0
 def spectator_disable(self):
     ini_set(CRT_UTILITY_FILE, "netplay_spectator", "false")
     return self.get_spectator()
Exemplo n.º 24
0
 def disable(self):
     ini_set(CRT_UTILITY_FILE, "netplay", "false")
     return self.status()
Exemplo n.º 25
0
 def enable(self):
     ini_set(CRT_UTILITY_FILE, "netplay", "true")
     return self.status()
Exemplo n.º 26
0
 def ask_enable(self):
     ini_set(CRT_UTILITY_FILE, "netplay_ask", "true")
     return self.get_ask()
Exemplo n.º 27
0
 def ask_disable(self):
     ini_set(CRT_UTILITY_FILE, "netplay_ask", "false")
     return self.get_ask()
Exemplo n.º 28
0
 def country(self, p_sCountry):
     ini_set(CRT_UTILITY_FILE, "wifi_country", self.COUNTRY[p_sCountry])
     self.m_sCountry = p_sCountry
Exemplo n.º 29
0
 def lobby_enable(self):
     ini_set(CRT_UTILITY_FILE, "netplay_lobby", "true")
     return self.get_lobby()
Exemplo n.º 30
0
def update_last_hash(p_sFile):
    """ Update last hash if any change """
    sHashFile = md5_file(p_sFile)
    ini_set(CRT_ES_SYSTEMDB_FILE, "LAST_HASH", sHashFile)