예제 #1
0
 def _save_new_resolution(self):
     if self.iToRes == 240:
         modify_line(CRT_UTILITY_FILE, "default",
                     "default %s" % self.sSystem60)
     elif self.iToRes == 270:
         modify_line(CRT_UTILITY_FILE, "default",
                     "default %s" % self.sSystem50)
예제 #2
0
 def nick(self, p_sNick):
     line = self.ini_nick + '=' + '"\'%s\'"' % p_sNick
     modify_line(CRT_NETPLAY_FILE, self.ini_nick, line)
     new = self.get_nick()
     if new == p_sNick: return new
     logging.info("INFO: %s wrong edited" % self.ini_nick)
     return False
예제 #3
0
 def get_host(self):
     value = ini_get(CRT_NETPLAY_FILE, self.ini_host)
     if not value:
         self._add_miss_ini(self.ini_host)
         value = ini_get(CRT_NETPLAY_FILE, self.ini_host)
     if not self.check_ip_format(value):
         line = self.ini_host + '=' + '"192.168.0.1"'
         modify_line(CRT_NETPLAY_FILE, self.ini_host, line)
         value = "192.168.0.1"
     return value
예제 #4
0
 def _save_current_theme(self):
     # identify element theme to find in CRT config
     p_sElement = str(self.RES_Y) + self.sTailSideH
     if self.iCurSide != 0:
         p_sElement = str(self.RES_Y) + self.sTailSideV
     # get current saved theme for current side
     p_sTheme = ini_get(CRT_UTILITY_FILE, p_sElement)
     self.sCurTheme = get_xml_value_esconfig("ThemeSet")
     if p_sTheme != self.sCurTheme:
         modify_line(CRT_UTILITY_FILE, p_sElement,
                     "%s %s" % (p_sElement, self.sCurTheme))
예제 #5
0
 def _scummvm_change_ini(self, p_sFile, p_sKey, p_sValue,
                              p_sSection = "[scummvm]"):
     p_sINI = ini_get(p_sFile, p_sKey)
     if p_sINI:
         logging.info("INFO: Changing {%s} to '%s'" % (p_sKey, p_sValue))
         p_sStr = p_sKey + "=" + p_sValue
         if (p_sValue != p_sINI):
             modify_line(p_sFile, p_sKey, p_sStr)
     else:
         logging.info("INFO: {%s} attribute not found", p_sKey)
         p_sStr = p_sSection + "\n"
         p_sStr += p_sKey + "=" + p_sValue + "\n"
         modify_line(p_sFile, p_sSection, p_sStr)
예제 #6
0
    def _write_boot_timing(self):
        p_sBootTimings = self.m_lBootTimings
        p_sBootTimings = list(map(str, p_sBootTimings))
        p_sBootTimings = " ".join(p_sBootTimings)
        logging.info("INFO: calculated resolution to add in config.txt: %s"% \
                     p_sBootTimings)

        os.system('cp %s %s' % (RASP_BOOTCFG_FILE, self.BOOTCFG_TEMP_FILE))
        modify_line(self.BOOTCFG_TEMP_FILE, "hdmi_timings=",
                    "hdmi_timings=%s" % p_sBootTimings)
        os.system('sudo cp %s %s' %
                  (self.BOOTCFG_TEMP_FILE, RASP_BOOTCFG_FILE))
        logging.info("INFO: boot resolution saved at %s" % RASP_BOOTCFG_FILE)
예제 #7
0
 def port(self, p_sPort):
     try:
         num = int(p_sPort)
         if num < 0 or num > 65535: return False
     except:
         logging.info("INFO: incorrect port")
         return False
     line = self.ini_port + '=' + '"%s"' % p_sPort
     modify_line(CRT_NETPLAY_FILE, self.ini_port, line)
     new = self.get_port()
     if new == p_sPort: return new
     logging.info("INFO: %s wrong edited" % self.ini_port)
     return False
예제 #8
0
 def _fix_daphne_cfg(self):
     for control in self.m_lDaphneBTN:
         lValues = ini_getlist(self.DAPHNE_CFG_FILE, control[0])
         # clean returned empty values:
         iClearPos = []
         for idx, value in enumerate(lValues):
             if value == "": iClearPos.append(idx)
         if iClearPos:
             for pos in sorted(iClearPos, reverse=True):
                 del lValues[pos]
         # edit daphne controls config file
         if lValues[-1] != control[1]:
             lValues[-1] = control[1]
             sNewLine = control[0] + " = "
             sNewLine += " ".join(lValues)
             modify_line(self.DAPHNE_CFG_FILE, control[0], sNewLine)
예제 #9
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('"', ''):
         modify_line(self.m_sSystemCfgPath, "aspect_ratio_index",
                     "aspect_ratio_index = \"%s\"" % 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")
예제 #10
0
 def mode(self, p_sMode):
     if p_sMode.lower() == "host":
         line = self.ini_mode + '="H"'
         value = "H"
     elif p_sMode.lower() == "client":
         line = self.ini_mode + '="C"'
         value = "C"
     else:
         logging.info("INFO: no valid mode: host or client")
         return False
     modify_line(CRT_NETPLAY_FILE, self.ini_mode, line)
     new = self.get_mode()
     if new == p_sMode.lower():
         self.validate_host()
         return new
     logging.info("INFO: %s wrong edited" % self.ini_mode)
     return False
예제 #11
0
    def _frontend_rotation(self):
        show_info("WAIT, PREPARING ROTATION...")
        # remove first all trigger files
        self.__clean()
        p_sFileTail = "_" + str(self.RES_Y) + "p"
        p_sTheme = None
        p_sIntro = None

        if self.iToMode == 0:
            p_sFileTail += "_0"
            p_sIntro = INTRO_VID0_FILE
            touch_file(ROTMODES_YOKO_FILE)
            os.system('sudo rm %s >> /dev/null 2>&1' % ESSYSTEMS_TEMP_FILE)
            os.system('sudo mv %s %s >> /dev/null 2>&1' %
                      (ESTHEMES_DIS_PATH, ES_THEMES_PRI_PATH))
            for theme in THEME_LIST:
                VTHEME270_DST_PATH = os.path.join(ES_CFG_PATH, theme)
                os.system('sudo rm -R %s >> /dev/null 2>&1' %
                          VTHEME270_DST_PATH)
        else:
            if not os.path.exists(ES_THEMES_SEC_PATH):
                os.system('mkdir %s >> /dev/null 2>&1' % ES_THEMES_SEC_PATH)
            os.system('cp %s %s >> /dev/null 2>&1' %
                      (ESSYSTEMS_VERT_FILE, ESSYSTEMS_TEMP_FILE))
            os.system('sudo mv %s %s >> /dev/null 2>&1' %
                      (ES_THEMES_PRI_PATH, ESTHEMES_DIS_PATH))
            for theme in THEME_LIST:
                VTHEME270_SRC_PATH = os.path.join(CRT_ES_RES_PATH, theme)
                os.system('cp -R %s %s >> /dev/null 2>&1' %
                          (VTHEME270_SRC_PATH, ES_THEMES_SEC_PATH))

            if self.iToMode == 90:
                p_sFileTail += "_1"
                p_sIntro = INTRO_VID1_FILE
                touch_file(ROTMODES_TATE1_FILE)
            elif self.iToMode == -90:
                p_sFileTail += "_3"
                p_sIntro = INTRO_VID3_FILE
                touch_file(ROTMODES_TATE3_FILE)

        modify_line(CRT_UTILITY_FILE, 'frontend_rotation',
                    'frontend_rotation %s' % self.iToMode)
        os.system('sudo cp %s %s >> /dev/null 2>&1' %
                  (p_sIntro, INTRO_VID_DEF_FILE))
        self._fix_aspect_ratio_images(p_sFileTail)
        self._fix_icons_image()
예제 #12
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_scaleint, self.m_dVideo["R_Rate"],
               self.m_oCRT.m_sSide_Game, p_bSmooth))
        # copy cfg base
        shutil.copy2(CFG_ARCADE_BASE, TMP_ARCADE_FILE)
        add_line(TMP_ARCADE_FILE,
                 'custom_viewport_width = "%s"' % self.cfg_hres)
        add_line(TMP_ARCADE_FILE,
                 'custom_viewport_height = "%s"' % self.cfg_vres)
        add_line(TMP_ARCADE_FILE,
                 'custom_viewport_x = "%s"' % self.cfg_offsetx)
        add_line(TMP_ARCADE_FILE,
                 'custom_viewport_y = "%s"' % self.cfg_offsety)
        add_line(TMP_ARCADE_FILE,
                 'video_refresh_rate = "%s"' % self.m_dVideo["R_Rate"])

        # smooth vertical games on horizontal screens
        modify_line(TMP_ARCADE_FILE, "video_smooth",
                    'video_smooth = "%s"' % str(p_bSmooth).lower())

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

        # Video Scale Integer activation
        modify_line(TMP_ARCADE_FILE, "video_scale_integer =",
                    'video_scale_integer = "%s"' % self.cfg_scaleint)

        # Change custom core config if applies, like neogeo
        if self.m_sCstCoreCFG:
            modify_line(TMP_ARCADE_FILE, "core_options_path",
                        'core_options_path = "%s"' % self.m_sCstCoreCFG)

        # Check retroarch version
        ra_version_fixes(TMP_ARCADE_FILE)
예제 #13
0
def update_last_hash(p_sFile):
    """ Update last hash if any change """
    sHashFile = md5_file(p_sFile)
    modify_line(CRT_ES_SYSTEMDB_FILE, "LAST_HASH",
                "LAST_HASH = \"%s\"" % sHashFile)
예제 #14
0
    def adv_config_generate(self):
        display_ror = "no"
        display_rol = "no"

        if self.m_oCRT.m_sSide_Game == 'V':
            if self.m_iSide == 1:
                display_ror = "yes"
            elif self.m_iSide == 3:
                display_rol = "yes"

        logging.info("INFO: advmame result - ror %s, rol %s - DIR: %s" % (display_ror, display_rol, self.m_sFileDir))

        modify_line(RC_ADVANCEDMAME_FILE, "display_ror ", "display_ror %s" % display_ror)
        modify_line(RC_ADVANCEDMAME_FILE, "display_rol ", "display_rol %s" % display_rol)
        # put the correct game folder
        modify_line(RC_ADVANCEDMAME_FILE, "dir_rom ", "dir_rom %s:/home/pi/RetroPie/BIOS" % self.m_sFileDir)
        # after run this options are lost, reenable it
        modify_line(RC_ADVANCEDMAME_FILE, "misc_smp ", "misc_smp yes")
        modify_line(RC_ADVANCEDMAME_FILE, "display_vsync ", "display_vsync yes")
        modify_line(RC_ADVANCEDMAME_FILE, "misc_safequit ", "misc_safequit no")
        modify_line(RC_ADVANCEDMAME_FILE, "misc_quiet ", "misc_quiet yes")
        modify_line(RC_ADVANCEDMAME_FILE, "display_resizeeffect ", "display_resizeeffect auto")
        modify_line(RC_ADVANCEDMAME_FILE, "display_resize ", "display_resize integer")
        modify_line(RC_ADVANCEDMAME_FILE, "display_mode ", "display_mode auto")
        modify_line(RC_ADVANCEDMAME_FILE, "display_aspect ", "display_aspect 4/3")
        modify_line(RC_ADVANCEDMAME_FILE, "display_expand ", "display_expand 1.0")
예제 #15
0
def save_configuration():
    modify_line(CRT_UTILITY_FILE, 'game_rotation',
                'game_rotation %s' % opt[0][2])
    modify_line(CRT_UTILITY_FILE, 'frontend_rotation',
                'frontend_rotation %s' % opt[1][2])
    modify_line(CRT_UTILITY_FILE, 'handheld_bezel',
                'handheld_bezel %s' % opt[2][2])
    modify_line(CRT_UTILITY_FILE, 'freq_selector',
                'freq_selector %s' % opt[3][2])
    modify_line(CRT_UTILITY_FILE, 'integer_scale',
                'integer_scale %s' % opt[6][2])
    modify_line(CRT_UTILITY_FILE, 'scummvm_arc', 'scummvm_arc %s' % opt[7][2])
def save_configuration():
    if bChangeMode:
        modify_line(CRT_FIXMODES_FILE, "mode_default",
                    "mode_default %s" % lModeSel[0])