Compare commits
2 Commits
e0a2f27265
...
3f0d259bf0
Author | SHA1 | Date | |
---|---|---|---|
3f0d259bf0
|
|||
1230d85fe6
|
@@ -395,15 +395,16 @@ class ContextMenuManager:
|
|||||||
os.makedirs(egs_desktop_dir, exist_ok=True)
|
os.makedirs(egs_desktop_dir, exist_ok=True)
|
||||||
desktop_path = self._get_egs_desktop_path(game_name)
|
desktop_path = self._get_egs_desktop_path(game_name)
|
||||||
comment = _('Launch game "{name}" with PortProton').format(name=game_name)
|
comment = _('Launch game "{name}" with PortProton').format(name=game_name)
|
||||||
desktop_entry = f"""[Desktop Entry]
|
desktop_entry =f"""\
|
||||||
Type=Application
|
[Desktop Entry]
|
||||||
Name={game_name}
|
Name={game_name}
|
||||||
Comment={comment}
|
Comment={comment}
|
||||||
Terminal=false
|
Exec="{self.legendary_path}" launch {app_name} --no-wine --wrapper "env START_FROM_STEAM=1 {wrapper}"
|
||||||
StartupNotify=true
|
Terminal=false
|
||||||
Exec="{self.legendary_path}" launch {app_name} --no-wine --wrapper "env START_FROM_STEAM=1 {wrapper}"
|
Type=Application
|
||||||
Icon={icon_path}
|
Categories=Game;
|
||||||
Categories=Game
|
StartupNotify=true
|
||||||
|
Icon={icon_path}
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
with open(desktop_path, "w", encoding="utf-8") as f:
|
with open(desktop_path, "w", encoding="utf-8") as f:
|
||||||
|
@@ -2072,41 +2072,36 @@ class MainWindow(QMainWindow):
|
|||||||
exe_name = os.path.splitext(current_exe)[0]
|
exe_name = os.path.splitext(current_exe)[0]
|
||||||
env_vars = os.environ.copy()
|
env_vars = os.environ.copy()
|
||||||
|
|
||||||
# Delay disabling gamepad handling to allow rumble to complete
|
|
||||||
if hasattr(self, 'input_manager'):
|
|
||||||
QTimer.singleShot(200, self.input_manager.disable_gamepad_handling)
|
|
||||||
|
|
||||||
if entry_exec_split[0] == "env" and len(entry_exec_split) > 1 and 'data/scripts/start.sh' in entry_exec_split[1]:
|
if entry_exec_split[0] == "env" and len(entry_exec_split) > 1 and 'data/scripts/start.sh' in entry_exec_split[1]:
|
||||||
env_vars['START_FROM_STEAM'] = '1'
|
env_vars['START_FROM_STEAM'] = '1'
|
||||||
elif entry_exec_split[0] == "flatpak":
|
elif entry_exec_split[0] == "flatpak":
|
||||||
env_vars['START_FROM_STEAM'] = '1'
|
env_vars['START_FROM_STEAM'] = '1'
|
||||||
return
|
|
||||||
|
|
||||||
# Запускаем игру
|
# Delay disabling gamepad handling to allow rumble to complete
|
||||||
self.current_running_button = update_button
|
if hasattr(self, 'input_manager'):
|
||||||
self.target_exe = current_exe
|
QTimer.singleShot(200, self.input_manager.disable_gamepad_handling)
|
||||||
exe_name = os.path.splitext(current_exe)[0]
|
|
||||||
env_vars = os.environ.copy()
|
# Запускаем игру
|
||||||
env_vars['START_FROM_STEAM'] = '1'
|
try:
|
||||||
try:
|
process = subprocess.Popen(entry_exec_split, env=env_vars, shell=False, preexec_fn=os.setsid)
|
||||||
process = subprocess.Popen(entry_exec_split, env=env_vars, shell=False, preexec_fn=os.setsid)
|
self.game_processes.append(process)
|
||||||
self.game_processes.append(process)
|
save_last_launch(exe_name, datetime.now())
|
||||||
save_last_launch(exe_name, datetime.now())
|
if update_button:
|
||||||
if update_button:
|
update_button.setText(_("Launching"))
|
||||||
update_button.setText(_("Launching"))
|
icon = self.theme_manager.get_icon("stop")
|
||||||
icon = self.theme_manager.get_icon("stop")
|
if isinstance(icon, str):
|
||||||
if isinstance(icon, str):
|
icon = QIcon(icon)
|
||||||
icon = QIcon(icon)
|
elif icon is None:
|
||||||
elif icon is None:
|
icon = QIcon()
|
||||||
icon = QIcon()
|
update_button.setIcon(icon)
|
||||||
update_button.setIcon(icon)
|
|
||||||
|
self.checkProcessTimer = QTimer(self)
|
||||||
|
self.checkProcessTimer.timeout.connect(self.checkTargetExe)
|
||||||
|
self.checkProcessTimer.start(500)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Failed to launch game {exe_name}: {e}")
|
||||||
|
QMessageBox.warning(self, _("Error"), _("Failed to launch game: {0}").format(str(e)))
|
||||||
|
|
||||||
self.checkProcessTimer = QTimer(self)
|
|
||||||
self.checkProcessTimer.timeout.connect(self.checkTargetExe)
|
|
||||||
self.checkProcessTimer.start(500)
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Failed to launch game {exe_name}: {e}")
|
|
||||||
QMessageBox.warning(self, _("Error"), _("Failed to launch game: {0}").format(str(e)))
|
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
"""Завершает все дочерние процессы и сохраняет настройки при закрытии окна."""
|
"""Завершает все дочерние процессы и сохраняет настройки при закрытии окна."""
|
||||||
|
Reference in New Issue
Block a user