def iter_launchers(self) -> Iterator[MAMELauncher]: if self.driver_list: for driver_name in self.driver_list: launcher = self._process_machine(get_machine(driver_name, default_mame_executable)) if launcher: yield launcher return if self.source_file: for machine in iter_machines_from_source_file(self.source_file, self.emu.executable): if not _is_actually_machine(machine): continue if not machine.launchable: continue if not self.emu.executable.verifyroms(machine.basename): continue launcher = self._process_machine(machine) if launcher: yield launcher return for machine in iter_machines(self.emu.executable): if not main_config.full_rescan: if has_been_done('Arcade', machine.basename): continue if has_been_done('MAME', machine.basename): continue launcher = self._process_machine(machine) if launcher: yield launcher
def iter_launchers(self) -> Iterator[ROMLauncher]: file_list = [] #rom_list: list[tuple[ROM, Sequence[str]]] = [] for rom_dir in self.platform_config.paths: if not rom_dir.is_dir(): print('Oh no', self.name, 'has invalid ROM dir', rom_dir) continue #used_m3u_filenames = [] for root, dirs, files in os.walk(rom_dir): root_path = PurePath(root) if any(root_path.is_relative_to(ignored_directory) for ignored_directory in main_config.ignored_directories): continue subfolders = root_path.relative_to(rom_dir).parts if subfolders: if any(subfolder in main_config.skipped_subfolder_names for subfolder in subfolders): continue folder_check = self.platform.folder_check if folder_check: remaining_subdirs = [] #The subdirectories of rom_dir that aren't folder ROMs for d in dirs: folder_path = Path(root, d) if not main_config.full_rescan: if has_been_done('ROM', str(folder_path)): continue folder_rom = FolderROM(folder_path) media_type = folder_check(folder_rom) if media_type: folder_rom.media_type = media_type #rom_list.append((folder_rom, subfolders)) launcher = self._process_rom(folder_rom, subfolders) if launcher: yield launcher #file_list.append((folder_path, subfolders)) #Avoid descending further, even if we get a NotARomException #This will not work well if we have multiple emulators for these folder-having systems and one supports folders and one doesn't, but eh, worry about that later I think continue remaining_subdirs.append(d) dirs[:] = remaining_subdirs dirs.sort() for name in sorted(files): path = Path(root, name) #TODO: We might actually want to do something with associated documents later, but for now, we know we aren't doing anything with them if (not self.platform.is_valid_file_type(path.suffix[1:].lower())) and path.suffix[1:].lower() in {'txt', 'md', 'jpg', 'nfo', 'gif', 'bmp'}: continue if not main_config.full_rescan: if has_been_done('ROM', str(path)): continue file_list.append((path, subfolders)) yield from self._process_file_list(file_list)
def iter_launchers(self) -> Iterator[MAMEInbuiltLauncher]: for machine_name, inbuilt_game in machines_with_inbuilt_games.items(): if not main_config.full_rescan: if has_been_done('Inbuilt game', machine_name): continue launcher = self._process_inbuilt_game(machine_name, inbuilt_game) if launcher: yield launcher for machine_and_bios_name, inbuilt_game in bioses_with_inbuilt_games.items(): if not main_config.full_rescan: if has_been_done('Inbuilt game', machine_and_bios_name[0] + ':' + machine_and_bios_name[1]): continue launcher = self._process_inbuilt_game(machine_and_bios_name[0], inbuilt_game, machine_and_bios_name[1]) if launcher: yield launcher
def do_itch_io_games() -> None: time_started = time.perf_counter() for itch_io_folder_str in main_config.itch_io_folders: itch_io_folder = Path(itch_io_folder_str) if not itch_io_folder.is_dir(): if main_config.debug: print(itch_io_folder, 'does not exist/is not a directory') continue for subfolder in itch_io_folder.iterdir(): if not main_config.full_rescan: if has_been_done('itch.io', str(subfolder)): continue if not subfolder.is_dir(): continue if subfolder.name == 'downloads': continue if not (game := scan_itch_dir(subfolder)): if main_config.debug: print('itch.io subfolder does not have an itch.io game (detection may have failed)', subfolder) continue #TODO: Somehow, we need to add all the documentation etc to other folders with matching game IDs (they won't be launchable themselves) game.add_metadata() game.make_launcher()
def process_steam() -> None: if not is_steam_available: return time_started = time.perf_counter() compat_tool_appids = {compat_tool[0] for compat_tool in steam_installation.steamplay_compat_tools().values()} for folder, app_id, app_state in iter_steam_installed_appids(): if not main_config.full_rescan: if has_been_done('Steam', str(app_id)): continue if app_id in compat_tool_appids: continue try: process_game(app_id, folder, app_state) except NotActuallyAGameYouDingusException: continue except NotLaunchableError as ex: if main_config.debug: print(app_state.get('name', app_id), app_id, 'is skipped because', ex) continue if main_config.print_times: time_ended = time.perf_counter() print('Steam finished in', str(datetime.timedelta(seconds=time_ended - time_started)))
def iter_launchers(self) -> Iterator[ScummVMLauncher]: for section in scummvm_config.scummvm_ini.sections(): if section == 'scummvm': #Skip the top section continue if section == 'cloud': #This is not a game either continue if not main_config.full_rescan: if has_been_done('ScummVM', section): continue game = ScummVMGame(section) yield ScummVMLauncher(game, global_runners.scummvm)
def do_windows_gog_games() -> None: windows_gog_folders: Collection[Path] = main_config.windows_gog_folders for windows_gog_folder in windows_gog_folders: if not windows_gog_folder.is_dir(): if main_config.debug: print(windows_gog_folder, 'does not exist/is not a directory') continue for subfolder in windows_gog_folder.iterdir(): if not main_config.full_rescan: if has_been_done('GOG', str(subfolder)): continue if not subfolder.is_dir(): continue if not (windows_game := look_in_windows_gog_folder(subfolder)): if main_config.debug: print( 'GOG subfolder does not have a GOG game (detection may have failed)', subfolder) continue windows_game.add_metadata() windows_game.make_launchers()