def prelaunch(self): config_file = self.get_config_file() if not os.path.exists(config_file): logger.warning( "Unable to find retroarch config. Except erratic behavior") return True retro_config = RetroConfig(config_file) retro_config['libretro_directory'] = get_default_cores_directory() retro_config['libretro_info_path'] = get_default_info_directory() # Change assets path to the Lutris provided one if necessary assets_directory = os.path.expanduser(retro_config['assets_directory']) if system.path_is_empty(assets_directory): retro_config['assets_directory'] = get_default_assets_directory() retro_config.save() core = self.game_config.get('core') info_file = os.path.join(get_default_info_directory(), '{}_libretro.info'.format(core)) if os.path.exists(info_file): core_config = RetroConfig(info_file) try: firmware_count = int(core_config['firmware_count']) except (ValueError, TypeError): firmware_count = 0 system_path = self.get_system_directory(retro_config) notes = core_config['notes'] or '' checksums = {} if notes.startswith('Suggested md5sums:'): parts = notes.split('|') for part in parts[1:]: checksum, filename = part.split(' = ') checksums[filename] = checksum for index in range(firmware_count): firmware_filename = core_config['firmware%d_path' % index] firmware_path = os.path.join(system_path, firmware_filename) if os.path.exists(firmware_path): if firmware_filename in checksums: checksum = system.get_md5_hash(firmware_path) if checksum == checksums[firmware_filename]: checksum_status = 'Checksum good' else: checksum_status = 'Checksum failed' else: checksum_status = 'No checksum info' logger.info("Firmware '{}' found ({})".format( firmware_filename, checksum_status)) else: logger.warning( "Firmware '{}' not found!".format(firmware_filename)) # Before closing issue #431 # TODO check for firmware*_opt and display an error message if # firmware is missing # TODO Add dialog for copying the firmware in the correct # location return True
def prelaunch(self): config_file = self.get_config_file() if not os.path.exists(config_file): logger.warning("Unable to find retroarch config. Except erratic behavior") return True retro_config = RetroConfig(config_file) retro_config['libretro_directory'] = get_default_cores_directory() retro_config['libretro_info_path'] = get_default_info_directory() # Change assets path to the Lutris provided one if necessary assets_directory = os.path.expanduser(retro_config['assets_directory']) if system.path_is_empty(assets_directory): retro_config['assets_directory'] = get_default_assets_directory() retro_config.save() core = self.game_config.get('core') info_file = os.path.join(get_default_info_directory(), '{}_libretro.info'.format(core)) if os.path.exists(info_file): core_config = RetroConfig(info_file) try: firmware_count = int(core_config['firmware_count']) except (ValueError, TypeError): firmware_count = 0 system_path = self.get_system_directory(retro_config) notes = core_config['notes'] or '' checksums = {} if notes.startswith('Suggested md5sums:'): parts = notes.split('|') for part in parts[1:]: checksum, filename = part.split(' = ') checksums[filename] = checksum for index in range(firmware_count): firmware_filename = core_config['firmware%d_path' % index] firmware_path = os.path.join(system_path, firmware_filename) if os.path.exists(firmware_path): if firmware_filename in checksums: checksum = system.get_md5_hash(firmware_path) if checksum == checksums[firmware_filename]: checksum_status = 'Checksum good' else: checksum_status = 'Checksum failed' else: checksum_status = 'No checksum info' logger.info("Firmware '{}' found ({})".format(firmware_filename, checksum_status)) else: logger.warning("Firmware '{}' not found!".format(firmware_filename)) # Before closing issue #431 # TODO check for firmware*_opt and display an error message if # firmware is missing # TODO Add dialog for copying the firmware in the correct # location return True
def find_good_bioses(self, bios_path): """ Check for correct bios files """ good_bios = {} for filename in os.listdir(bios_path): real_hash = get_md5_hash(os.path.join(bios_path, filename)) for bios_file in self.bios_checksums.keys(): if real_hash == self.bios_checksums[bios_file]: logging.debug("%s Checksum : OK", filename) good_bios[bios_file] = filename return good_bios
def prelaunch(self): config_file = self.get_config_file() # Create retroarch.cfg if it doesn't exist. if not system.path_exists(config_file): f = open(config_file, "w") f.write("# Lutris RetroArch Configuration") f.close() # Build the default config settings. retro_config = RetroConfig(config_file) retro_config["libretro_directory"] = get_default_config_path( "cores") retro_config["libretro_info_path"] = get_default_config_path( "info") retro_config["content_database_path"] = get_default_config_path( "database/rdb") retro_config["cheat_database_path"] = get_default_config_path( "database/cht") retro_config["cursor_directory"] = get_default_config_path( "database/cursors") retro_config["screenshot_directory"] = get_default_config_path( "screenshots") retro_config[ "input_remapping_directory"] = get_default_config_path( "remaps") retro_config["video_shader_dir"] = get_default_config_path( "shaders") retro_config["core_assets_directory"] = get_default_config_path( "downloads") retro_config["thumbnails_directory"] = get_default_config_path( "thumbnails") retro_config["playlist_directory"] = get_default_config_path( "playlists") retro_config["joypad_autoconfig_dir"] = get_default_config_path( "autoconfig") retro_config["rgui_config_directory"] = get_default_config_path( "config") retro_config["overlay_directory"] = get_default_config_path( "overlay") retro_config["assets_directory"] = get_default_config_path( "assets") retro_config.save() else: retro_config = RetroConfig(config_file) core = self.game_config.get("core") info_file = os.path.join(get_default_config_path("info"), "{}_libretro.info".format(core)) if system.path_exists(info_file): core_config = RetroConfig(info_file) try: firmware_count = int(core_config["firmware_count"]) except (ValueError, TypeError): firmware_count = 0 system_path = self.get_system_directory(retro_config) notes = core_config["notes"] or "" checksums = {} if notes.startswith("Suggested md5sums:"): parts = notes.split("|") for part in parts[1:]: checksum, filename = part.split(" = ") checksums[filename] = checksum for index in range(firmware_count): firmware_filename = core_config["firmware%d_path" % index] firmware_path = os.path.join(system_path, firmware_filename) if system.path_exists(firmware_path): if firmware_filename in checksums: checksum = system.get_md5_hash(firmware_path) if checksum == checksums[firmware_filename]: checksum_status = "Checksum good" else: checksum_status = "Checksum failed" else: checksum_status = "No checksum info" logger.info("Firmware '%s' found (%s)", firmware_filename, checksum_status) else: logger.warning("Firmware '%s' not found!", firmware_filename) # Before closing issue #431 # TODO check for firmware*_opt and display an error message if # firmware is missing # TODO Add dialog for copying the firmware in the correct # location return True
def check_md5(self, data): filename = self._get_file(data['file']) _hash = system.get_md5_hash(filename) if _hash != data['value']: raise ScriptingError("MD5 checksum mismatch", data)
def prelaunch(self): config_file = self.get_config_file() # Create retroarch.cfg if it doesn't exist. if not os.path.exists(config_file): f = open(config_file, 'w') f.write('# Lutris RetroArch Configuration') f.close() # Build the default config settings. retro_config = RetroConfig(config_file) retro_config['libretro_directory'] = get_default_config_path( 'cores') retro_config['libretro_info_path'] = get_default_config_path( 'info') retro_config['content_database_path'] = get_default_config_path( 'database/rdb') retro_config['cheat_database_path'] = get_default_config_path( 'database/cht') retro_config['cursor_directory'] = get_default_config_path( 'database/cursors') retro_config['screenshot_directory'] = get_default_config_path( 'screenshots') retro_config[ 'input_remapping_directory'] = get_default_config_path( 'remaps') retro_config['video_shader_dir'] = get_default_config_path( 'shaders') retro_config['core_assets_directory'] = get_default_config_path( 'downloads') retro_config['thumbnails_directory'] = get_default_config_path( 'thumbnails') retro_config['playlist_directory'] = get_default_config_path( 'playlists') retro_config['joypad_autoconfig_dir'] = get_default_config_path( 'autoconfig') retro_config['rgui_config_directory'] = get_default_config_path( 'config') retro_config['overlay_directory'] = get_default_config_path( 'overlay') retro_config['assets_directory'] = get_default_config_path( 'assets') retro_config.save() else: retro_config = RetroConfig(config_file) core = self.game_config.get('core') info_file = os.path.join(get_default_config_path('info'), '{}_libretro.info'.format(core)) if os.path.exists(info_file): core_config = RetroConfig(info_file) try: firmware_count = int(core_config['firmware_count']) except (ValueError, TypeError): firmware_count = 0 system_path = self.get_system_directory(retro_config) notes = core_config['notes'] or '' checksums = {} if notes.startswith('Suggested md5sums:'): parts = notes.split('|') for part in parts[1:]: checksum, filename = part.split(' = ') checksums[filename] = checksum for index in range(firmware_count): firmware_filename = core_config['firmware%d_path' % index] firmware_path = os.path.join(system_path, firmware_filename) if os.path.exists(firmware_path): if firmware_filename in checksums: checksum = system.get_md5_hash(firmware_path) if checksum == checksums[firmware_filename]: checksum_status = 'Checksum good' else: checksum_status = 'Checksum failed' else: checksum_status = 'No checksum info' logger.info("Firmware '{}' found ({})".format( firmware_filename, checksum_status)) else: logger.warning( "Firmware '{}' not found!".format(firmware_filename)) # Before closing issue #431 # TODO check for firmware*_opt and display an error message if # firmware is missing # TODO Add dialog for copying the firmware in the correct # location return True
def prelaunch(self): config_file = self.get_config_file() # Create retroarch.cfg if it doesn't exist. if not system.path_exists(config_file): f = open(config_file, "w") f.write("# Lutris RetroArch Configuration") f.close() # Build the default config settings. retro_config = RetroConfig(config_file) retro_config["libretro_directory"] = get_default_config_path("cores") retro_config["libretro_info_path"] = get_default_config_path("info") retro_config["content_database_path"] = get_default_config_path("database/rdb") retro_config["cheat_database_path"] = get_default_config_path("database/cht") retro_config["cursor_directory"] = get_default_config_path("database/cursors") retro_config["screenshot_directory"] = get_default_config_path("screenshots") retro_config["input_remapping_directory"] = get_default_config_path("remaps") retro_config["video_shader_dir"] = get_default_config_path("shaders") retro_config["core_assets_directory"] = get_default_config_path("downloads") retro_config["thumbnails_directory"] = get_default_config_path("thumbnails") retro_config["playlist_directory"] = get_default_config_path("playlists") retro_config["joypad_autoconfig_dir"] = get_default_config_path("autoconfig") retro_config["rgui_config_directory"] = get_default_config_path("config") retro_config["overlay_directory"] = get_default_config_path("overlay") retro_config["assets_directory"] = get_default_config_path("assets") retro_config.save() else: retro_config = RetroConfig(config_file) core = self.game_config.get("core") info_file = os.path.join( get_default_config_path("info"), "{}_libretro.info".format(core) ) if system.path_exists(info_file): core_config = RetroConfig(info_file) try: firmware_count = int(core_config["firmware_count"]) except (ValueError, TypeError): firmware_count = 0 system_path = self.get_system_directory(retro_config) notes = core_config["notes"] or "" checksums = {} if notes.startswith("Suggested md5sums:"): parts = notes.split("|") for part in parts[1:]: checksum, filename = part.split(" = ") checksums[filename] = checksum for index in range(firmware_count): firmware_filename = core_config["firmware%d_path" % index] firmware_path = os.path.join(system_path, firmware_filename) if system.path_exists(firmware_path): if firmware_filename in checksums: checksum = system.get_md5_hash(firmware_path) if checksum == checksums[firmware_filename]: checksum_status = "Checksum good" else: checksum_status = "Checksum failed" else: checksum_status = "No checksum info" logger.info( "Firmware '%s' found (%s)", firmware_filename, checksum_status ) else: logger.warning("Firmware '%s' not found!", firmware_filename) # Before closing issue #431 # TODO check for firmware*_opt and display an error message if # firmware is missing # TODO Add dialog for copying the firmware in the correct # location return True
def check_md5(self, data): self._check_required_params(["file", "value"], data, "check_md5") filename = self._get_file(data["file"]) _hash = system.get_md5_hash(filename) if _hash != data["value"]: raise ScriptingError("MD5 checksum mismatch", data)
def check_md5(self, data): self._check_required_params(['file', 'value'], data, 'check_md5') filename = self._get_file(data['file']) _hash = system.get_md5_hash(filename) if _hash != data['value']: raise ScriptingError("MD5 checksum mismatch", data)
def check_md5(self, data): filename = self._get_file(data['file']) _hash = get_md5_hash(filename) if _hash != data['value']: raise ScriptingError("MD5 checksum mismatch", data)