mirror of
https://github.com/lutris/lutris
synced 2024-09-15 22:09:55 +00:00
Add support for antimicro config files
This commit is contained in:
parent
38f61efab6
commit
1b172178ec
|
@ -87,6 +87,7 @@ class Game(GObject.Object):
|
|||
self.load_config()
|
||||
self.game_uuid = None
|
||||
self.game_thread = None
|
||||
self.antimicro_thread = None
|
||||
self.prelaunch_pids = []
|
||||
self.prelaunch_executor = None
|
||||
self.heartbeat = None
|
||||
|
@ -339,6 +340,17 @@ class Game(GObject.Object):
|
|||
time.sleep(3)
|
||||
return display
|
||||
|
||||
def start_antimicrox(self, antimicro_config):
|
||||
"""Start Antimicrox with a given config path"""
|
||||
antimicro_path = system.find_executable("antimicrox")
|
||||
if not antimicro_path:
|
||||
logger.warning("Antimicrox is not installed.")
|
||||
return
|
||||
logger.info("Starting Antic")
|
||||
antimicro_command = [antimicro_path, "--hidden", "--tray", "--profile", antimicro_config]
|
||||
self.antimicro_thread = MonitoredCommand(antimicro_command)
|
||||
self.antimicro_thread.start()
|
||||
|
||||
@staticmethod
|
||||
def set_keyboard_layout(layout):
|
||||
setxkbmap_command = ["setxkbmap", "-model", "pc101", layout, "-print"]
|
||||
|
@ -451,8 +463,11 @@ class Game(GObject.Object):
|
|||
if xephyr != "off":
|
||||
env["DISPLAY"] = self.start_xephyr()
|
||||
|
||||
# Execution control
|
||||
antimicro_config = self.runner.system_config.get("antimicro_config")
|
||||
if system.path_exists(antimicro_config):
|
||||
self.start_antimicrox(antimicro_config)
|
||||
|
||||
# Execution control
|
||||
self.killswitch = self.get_killswitch()
|
||||
|
||||
if self.runner.system_config.get("prelaunch_command"):
|
||||
|
@ -573,11 +588,9 @@ class Game(GObject.Object):
|
|||
return False
|
||||
game_pids = self.get_game_pids()
|
||||
if not self.game_thread.is_running and not game_pids:
|
||||
|
||||
logger.debug("Game thread stopped")
|
||||
self.on_game_quit()
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def stop(self):
|
||||
|
@ -628,6 +641,9 @@ class Game(GObject.Object):
|
|||
|
||||
os.chdir(os.path.expanduser("~"))
|
||||
|
||||
if self.antimicro_thread:
|
||||
self.antimicro_thread.stop()
|
||||
|
||||
if self.resolution_changed or self.runner.system_config.get("reset_desktop"):
|
||||
DISPLAY_MANAGER.set_resolution(self.original_outputs)
|
||||
|
||||
|
|
|
@ -128,16 +128,11 @@ system_options = [ # pylint: disable=invalid-name
|
|||
"help": _("Restrict the game to a single CPU core."),
|
||||
},
|
||||
{
|
||||
"option":
|
||||
"restore_gamma",
|
||||
"type":
|
||||
"bool",
|
||||
"default":
|
||||
False,
|
||||
"label":
|
||||
_("Restore gamma on game exit"),
|
||||
"advanced":
|
||||
True,
|
||||
"option": "restore_gamma",
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
"label": _("Restore gamma on game exit"),
|
||||
"advanced": True,
|
||||
"help": _("Some games don't correctly restores gamma on exit, making "
|
||||
"your display too bright. Select this option to correct it."),
|
||||
},
|
||||
|
@ -189,18 +184,12 @@ system_options = [ # pylint: disable=invalid-name
|
|||
"help": _("Switch to US keyboard QWERTY layout while game is running"),
|
||||
},
|
||||
{
|
||||
"option":
|
||||
"optimus",
|
||||
"type":
|
||||
"choice",
|
||||
"default":
|
||||
"off",
|
||||
"choices":
|
||||
get_optirun_choices,
|
||||
"label":
|
||||
_("Optimus launcher (NVIDIA Optimus laptops)"),
|
||||
"advanced":
|
||||
True,
|
||||
"option": "optimus",
|
||||
"type": "choice",
|
||||
"default": "off",
|
||||
"choices": get_optirun_choices,
|
||||
"label": _("Optimus launcher (NVIDIA Optimus laptops)"),
|
||||
"advanced": True,
|
||||
"help": _("If you have installed the primus or bumblebee packages, "
|
||||
"select what launcher will run the game with the command, "
|
||||
"activating your NVIDIA graphic chip for high 3D "
|
||||
|
@ -341,6 +330,13 @@ system_options = [ # pylint: disable=invalid-name
|
|||
"label": _("Environment variables"),
|
||||
"help": _("Environment variables loaded at run time"),
|
||||
},
|
||||
{
|
||||
"option": "antimicro_config",
|
||||
"type": "file",
|
||||
"label": _("AntiMicroX Profile"),
|
||||
"advanced": True,
|
||||
"help": _("Path to an AntiMicroX profile file"),
|
||||
},
|
||||
{
|
||||
"option": "prefix_command",
|
||||
"type": "string",
|
||||
|
|
Loading…
Reference in a new issue