def autosetup_gog_game(self, file_id, silent=False): """Automatically guess the best way to install a GOG game by inspecting its contents. This chooses the right runner (DOSBox, Wine) for Windows game files. Linux setup files don't use innosetup, they can be unzipped instead. """ file_path = self.game_files[file_id] file_list = extract.get_innoextract_list(file_path) dosbox_found = False scummvm_found = False windows_override_found = False # DOS games that also have a Windows executable for filename in file_list: if "dosbox/dosbox.exe" in filename.lower(): dosbox_found = True if "scummvm/scummvm.exe" in filename.lower(): scummvm_found = True if "_some_windows.exe" in filename.lower(): # There's not a good way to handle exceptions without extracting the .info file # before extracting the game. Added for Quake but GlQuake.exe doesn't run on modern wine windows_override_found = True if dosbox_found and not windows_override_found: self._extract_gog_game(file_id) dosbox_config = { "working_dir": "$GAMEDIR/DOSBOX", } for filename in os.listdir(self.target_path): if filename.endswith("_single.conf"): dosbox_config["main_file"] = filename elif filename.endswith(".conf"): dosbox_config["config_file"] = filename self.installer.script["game"] = dosbox_config self.installer.runner = "dosbox" elif scummvm_found: self._extract_gog_game(file_id) arguments = None for filename in os.listdir(self.target_path): if filename.startswith("goggame") and filename.endswith( ".info"): arguments = self._get_scummvm_arguments( os.path.join(self.target_path, filename)) if not arguments: raise RuntimeError("Unable to get ScummVM arguments") logger.info("ScummVM config: %s", arguments) self.installer.script["game"] = arguments self.installer.runner = "scummvm" else: args = "/SP- /NOCANCEL" if silent: args += " /SUPPRESSMSGBOXES /VERYSILENT /NOGUI" self.installer.is_gog = True return self.task({ "name": "wineexec", "prefix": "$GAMEDIR", "executable": file_id, "args": args })
def autosetup_gog_game(self, file_id): """Automatically guess the best way to install a GOG game by inspecting its contents. This chooses the right runner (DOSBox, Wine) for Windows game files. Linux setup files don't use innosetup, they can be unzipped instead. """ file_path = self.game_files[file_id] file_list = extract.get_innoextract_list(file_path) dosbox_found = False scummvm_found = False for filename in file_list: if "dosbox/dosbox.exe" in filename.lower(): dosbox_found = True if "scummvm/scummvm.exe" in filename.lower(): scummvm_found = True if dosbox_found: self._extract_gog_game(file_id) dosbox_config = { "working_dir": "$GAMEDIR/DOSBOX", } for filename in os.listdir(self.target_path): if filename.endswith("_single.conf"): dosbox_config["main_file"] = filename elif filename.endswith(".conf"): dosbox_config["config_file"] = filename self.installer.script["game"] = dosbox_config self.installer.runner = "dosbox" elif scummvm_found: self._extract_gog_game(file_id) arguments = None for filename in os.listdir(self.target_path): if filename.startswith("goggame") and filename.endswith( ".info"): arguments = self._get_scummvm_arguments( os.path.join(self.target_path, filename)) if not arguments: raise RuntimeError("Unable to get ScummVM arguments") logger.info("ScummVM config: %s", arguments) self.installer.script["game"] = arguments self.installer.runner = "scummvm" else: return self.task({ "name": "wineexec", "prefix": "$GAMEDIR", "executable": file_id, "args": "/SP- /NOCANCEL" })