def load_game_variant(self, variant_uuid): # game_database = fsgs.get_game_database() # values = game_database.get_game_values_for_uuid(variant_uuid) from .Database import Database database = Database.instance() try: database_name = database.find_game_database_for_game_variant( variant_uuid) except LookupError: return False values = self.game.set_from_variant_uuid(database_name, variant_uuid) if not values: return False # print("") # for key in sorted(values.keys()): # print(" * {0} = {1}".format(key, values[key])) # print("") from fsgs.platform import PlatformHandler platform_handler = PlatformHandler.create(self.game.platform.id) loader = platform_handler.get_loader(self) self.config.load(loader.load_values(values)) return True
def create_context(self): item = self.items[0] variant_uuid = item.configurations[0][0] database_name = item.configurations[0][2] print("\nitem:\n", item.configurations) print("\nitem[0]:\n", item.configurations[0]) print("\n\nvariant_uuid =", variant_uuid, "\n\n") # print("\n\ncreate_context") # print("configurations: ", item.configurations) # configs = sort_configurations(item.configurations) # configs = item.configurations # config = configs[0] # self.context = GameContext.create_for_game( # item.platform, item.name, config) values = fsgs.game.set_from_variant_uuid(database_name, variant_uuid) # print("") # for key in sorted(values.keys()): # print(" * {0} = {1}".format(key, values[key])) # print("") self.platform_handler = PlatformHandler.create(fsgs.game.platform.id) loader = self.platform_handler.get_loader(fsgs) fsgs.config.load(loader.load_values(values))
def start_local_game_other(cls): if True: platform_id = LauncherConfig.get(Option.PLATFORM).lower() platform_handler = PlatformHandler.create(platform_id) else: database_name = LauncherConfig.get("__database") variant_uuid = LauncherConfig.get("variant_uuid") assert variant_uuid fsgs.game.set_from_variant_uuid(database_name, variant_uuid) platform_handler = PlatformHandler.create(fsgs.game.platform.id) runner = platform_handler.get_runner(fsgs) task = RunnerTask(runner) from .ui.launcherwindow import LauncherWindow dialog = LaunchDialog(LauncherWindow.current(), gettext("Launching Game"), task) dialog.show() LauncherConfig.set("__running", "1") task.start()
def start(self): assert self.thread is None platform_handler = PlatformHandler.create(self.fsgs.game.platform.id) self.runner = platform_handler.get_runner(self.fsgs) device_helper = EnumerateHelper() device_helper.default_port_selection(self.runner.ports) self.thread = threading.Thread(target=self._thread) self.thread.start()
def start_local_game_other(cls): if True: platform_id = LauncherConfig.get(Option.PLATFORM).lower() platform_handler = PlatformHandler.create(platform_id) else: database_name = LauncherConfig.get("__database") variant_uuid = LauncherConfig.get("variant_uuid") assert variant_uuid fsgs.game.set_from_variant_uuid(database_name, variant_uuid) platform_handler = PlatformHandler.create(fsgs.game.platform.id) runner = platform_handler.get_runner(fsgs) task = RunnerTask(runner) from .ui.launcherwindow import LauncherWindow dialog = LaunchDialog( LauncherWindow.current(), gettext("Launching Game"), task ) dialog.show() LauncherConfig.set("__running", "1") task.start()
def run_game(self): from fsgs.platform import PlatformHandler platform_handler = PlatformHandler.create(self.game.platform.id) runner = platform_handler.get_runner(self) from fsgs.input.enumeratehelper import EnumerateHelper device_helper = EnumerateHelper() device_helper.default_port_selection(runner.ports) runner.prepare() process = runner.run() process.wait() runner.finish()
def run_game(self): from fsgs.platform import PlatformHandler platform_handler = PlatformHandler.create(self.game.platform.id) runner = platform_handler.get_runner(self) from fsgs.input.enumeratehelper import EnumerateHelper device_helper = EnumerateHelper() device_helper.default_port_selection(runner.ports, runner.options) runner.prepare() process = runner.run() process.wait() runner.finish()
def load_values(cls, values, uuid=""): # print("loading config values", values) platform_id = values.get("platform", "").lower() if platform_id in ["amiga", "cdtv", "cd32"]: value_config_loader = ValueConfigLoader(uuid=uuid) value_config_loader.load_values(values) config = value_config_loader.get_config() cls.load(config) values["__config_name"] = config.get("__config_name") else: print("Warning: Non-Amiga game loaded") platform_handler = PlatformHandler.create(platform_id) loader = platform_handler.get_loader(fsgs) fsgs.config.load(loader.load_values(values)) cls.post_load_values(values)
def load_values(cls, values, uuid=""): print("loading config values", values) platform_id = values.get("platform", "").lower() if platform_id in ["amiga", "cdtv", "cd32"]: value_config_loader = ValueConfigLoader(uuid=uuid) value_config_loader.load_values(values) config = value_config_loader.get_config() cls.load(config) values["__config_name"] = config.get("__config_name") else: print("Warning: Non-Amiga game loaded") platform_handler = PlatformHandler.create(platform_id) loader = platform_handler.get_loader(fsgs) fsgs.config.load(loader.load_values(values)) cls.post_load_values(values)
def load_values(cls, values, uuid=""): print("loading config values", values) platform_id = values.get("platform", "").lower() if platform_id in ["amiga", "cdtv", "cd32"]: value_config_loader = ValueConfigLoader(uuid=uuid) value_config_loader.load_values(values) config = value_config_loader.get_config() cls.load(config) config_name = config.get("__config_name", "") else: print("Warning: Non-Amiga game loaded") platform_handler = PlatformHandler.create(platform_id) loader = platform_handler.get_loader(fsgs) fsgs.config.load(loader.load_values(values)) config_name = "{0} ({1})".format(values.get("game_name"), values.get("platform_name")) LauncherSettings.set("config_path", "") # print("config is", config) # config["x_config_uuid"] = uuid if config_name: config_name = cls.create_fs_name(config_name) # else: # config_name, ext = os.path.splitext(os.path.basename(path)) if "(" in config_name: config_base = config_name.split("(")[0].strip() else: config_base = config_name # game = name # if not Config.get("title"): # Config.set("title", config_base) LauncherSettings.set("config_base", config_base) LauncherSettings.set("config_name", config_name) LauncherSettings.set("config_xml_path", "") # Settings.set("config_changed", "0") cls.set("__changed", "0")
def load_values(cls, values, uuid=""): print("loading config values", values) platform_id = values.get("platform", "").lower() if platform_id in ["amiga", "cdtv", "cd32"]: value_config_loader = ValueConfigLoader(uuid=uuid) value_config_loader.load_values(values) config = value_config_loader.get_config() cls.load(config) config_name = config.get("__config_name", "") else: print("Warning: Non-Amiga game loaded") platform_handler = PlatformHandler.create(platform_id) loader = platform_handler.get_loader(fsgs) fsgs.config.load(loader.load_values(values)) config_name = "{0} ({1})".format( values.get("game_name"), values.get("platform_name")) LauncherSettings.set("config_path", "") # print("config is", config) # config["x_config_uuid"] = uuid if config_name: config_name = cls.create_fs_name(config_name) # else: # config_name, ext = os.path.splitext(os.path.basename(path)) if "(" in config_name: config_base = config_name.split("(")[0].strip() else: config_base = config_name # game = name # if not Config.get("title"): # Config.set("title", config_base) LauncherSettings.set("config_base", config_base) LauncherSettings.set("config_name", config_name) LauncherSettings.set("config_xml_path", "") # Settings.set("config_changed", "0") cls.set("__changed", "0")