def on_game_quit(self): """Restore some settings and cleanup after game quit.""" self.heartbeat = None quit_time = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) logger.debug("%s stopped at %s", self.name, quit_time) self.state = self.STATE_STOPPED os.chdir(os.path.expanduser('~')) if self.resolution_changed\ or self.runner.system_config.get('reset_desktop'): display.change_resolution(self.original_outputs) if self.runner.system_config.get('use_us_layout'): subprocess.Popen(['setxkbmap'], env=os.environ).communicate() if self.runner.system_config.get('restore_gamma'): display.restore_gamma() if self.runner.system_config.get('xboxdrv') \ and self.xboxdrv_thread.is_running: self.xboxdrv_thread.stop() if self.game_thread: self.game_thread.stop() self.process_return_codes() if self.exit_main_loop: exit()
def on_game_quit(self): """Restore some settings and cleanup after game quit.""" self.heartbeat = None if self.state != self.STATE_STOPPED: logger.debug("Game thread still running, stopping it (state: %s)", self.state) self.stop() quit_time = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) logger.debug("%s stopped at %s", self.name, quit_time) self.lastplayed = int(time.time()) self.save(metadata_only=True) os.chdir(os.path.expanduser('~')) if self.resolution_changed\ or self.runner.system_config.get('reset_desktop'): display.change_resolution(self.original_outputs) if self.runner.system_config.get('use_us_layout'): subprocess.Popen(['setxkbmap'], env=os.environ).communicate() if self.runner.system_config.get('restore_gamma'): display.restore_gamma() self.process_return_codes() if self.exit_main_loop: exit()
def on_game_quit(self): """Restore some settings and cleanup after game quit.""" if self.prelaunch_executor and self.prelaunch_executor.is_running: logger.info("Stopping prelaunch script") self.prelaunch_executor.stop() self.heartbeat = None if self.state != self.STATE_STOPPED: logger.warning("Game still running (state: %s)", self.state) self.stop() # Check for post game script postexit_command = self.runner.system_config.get("postexit_command") if system.path_exists(postexit_command): logger.info("Running post-exit command: %s", postexit_command) postexit_thread = MonitoredCommand( [postexit_command], include_processes=[os.path.basename(postexit_command)], cwd=self.directory, ) postexit_thread.start() if self.discord_presence.available: self.discord_presence.clear_discord_rich_presence() quit_time = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) logger.debug("%s stopped at %s", self.name, quit_time) self.lastplayed = int(time.time()) self.save(metadata_only=True) os.chdir(os.path.expanduser("~")) if self.resolution_changed or self.runner.system_config.get("reset_desktop"): display.change_resolution(self.original_outputs) if self.compositor_disabled: self.set_desktop_compositing(True) if self.runner.system_config.get("use_us_layout"): subprocess.Popen(["setxkbmap"], env=os.environ).communicate() if self.runner.system_config.get("restore_gamma"): display.restore_gamma() self.process_return_codes() if self.exit_main_loop: exit()
def on_game_quit(self): """Restore some settings and cleanup after game quit.""" if self.prelaunch_executor and self.prelaunch_executor.is_running: logger.info("Stopping prelaunch script") self.prelaunch_executor.stop() self.heartbeat = None if self.state != self.STATE_STOPPED: logger.warning("Game still running (state: %s)", self.state) self.stop() # Check for post game script postexit_command = self.runner.system_config.get("postexit_command") if system.path_exists(postexit_command): logger.info("Running post-exit command: %s", postexit_command) postexit_thread = MonitoredCommand( [postexit_command], include_processes=[os.path.basename(postexit_command)], cwd=self.directory, ) postexit_thread.start() quit_time = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) logger.debug("%s stopped at %s", self.name, quit_time) self.lastplayed = int(time.time()) self.save(metadata_only=True) os.chdir(os.path.expanduser("~")) if self.resolution_changed or self.runner.system_config.get( "reset_desktop"): display.change_resolution(self.original_outputs) if self.compositor_disabled: self.set_desktop_compositing(True) if self.runner.system_config.get("use_us_layout"): subprocess.Popen(["setxkbmap"], env=os.environ).communicate() if self.runner.system_config.get("restore_gamma"): display.restore_gamma() self.process_return_codes() if self.exit_main_loop: exit()
def quit_game(self): """Quit the game and cleanup.""" self.heartbeat = None quit_time = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) logger.debug("game has quit at %s" % quit_time) if self.resolution_changed\ or self.runner.system_config.get('reset_desktop'): display.change_resolution(self.original_outputs) if self.runner.system_config.get('restore_gamma'): display.restore_gamma() if self.runner.system_config.get('xboxdrv'): self.xboxdrv_thread.stop() if self.game_thread: self.game_thread.stop()
def on_game_quit(self): """Restore some settings and cleanup after game quit.""" self.heartbeat = None quit_time = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) logger.debug("game has quit at %s" % quit_time) self.state = self.STATE_STOPPED if self.resolution_changed\ or self.runner.system_config.get('reset_desktop'): display.change_resolution(self.original_outputs) if self.runner.system_config.get('restore_gamma'): display.restore_gamma() if self.runner.system_config.get('xboxdrv'): self.xboxdrv_thread.stop() if self.game_thread: self.game_thread.stop()
def quit_game(self): """Quit the game and cleanup.""" self.heartbeat = None quit_time = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) logger.debug("game has quit at %s" % quit_time) if self.resolution_changed\ or self.runner.system_config.get('reset_desktop'): display.change_resolution(self.original_outputs) if self.runner.system_config.get('restore_gamma'): display.restore_gamma() if self.runner.system_config.get('xboxdrv'): self.xboxdrv_thread.stop() if self.game_thread: self.game_thread.stop()
def on_game_quit(self): """Restore some settings and cleanup after game quit.""" self.heartbeat = None quit_time = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) logger.debug("game has quit at %s" % quit_time) self.state = self.STATE_STOPPED self.game_log = self.game_thread.stdout if self.resolution_changed\ or self.runner.system_config.get('reset_desktop'): display.change_resolution(self.original_outputs) if self.runner.system_config.get('restore_gamma'): display.restore_gamma() if self.runner.system_config.get('xboxdrv'): self.xboxdrv_thread.stop() if self.game_thread: self.game_thread.stop()