From 6d3dd3784e66c7f130a6778f765ef260f210533c Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Sat, 23 Dec 2023 12:16:57 +0200 Subject: [PATCH 1/4] RareCore: Temporarily disable automatic egl sync and remove UI option. Also set some more defaults for legendary because Rare lacks support for them. Forced at startup. * Set `disable_auto_crossover` to `false` because we don't support CX yet. * Set `egl_sync` to `false` because issues. --- .../components/tabs/games/integrations/egl_sync_group.py | 4 ++++ rare/shared/rare_core.py | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rare/components/tabs/games/integrations/egl_sync_group.py b/rare/components/tabs/games/integrations/egl_sync_group.py index fcacaf2a..31ff8637 100644 --- a/rare/components/tabs/games/integrations/egl_sync_group.py +++ b/rare/components/tabs/games/integrations/egl_sync_group.py @@ -65,6 +65,10 @@ class EGLSyncGroup(QGroupBox): self.ui.egl_sync_check.setChecked(self.core.egl_sync_enabled) self.ui.egl_sync_check.stateChanged.connect(self.egl_sync_changed) + # lk: Temporarily disable automatic sync with EGL + self.ui.egl_sync_check_label.setHidden(True) + self.ui.egl_sync_check.setHidden(True) + self.import_list = EGLSyncImportGroup(parent=self) self.ui.import_export_layout.addWidget(self.import_list) self.export_list = EGLSyncExportGroup(parent=self) diff --git a/rare/shared/rare_core.py b/rare/shared/rare_core.py index 5b7301af..25c46bf3 100644 --- a/rare/shared/rare_core.py +++ b/rare/shared/rare_core.py @@ -165,9 +165,14 @@ class RareCore(QObject): self.__core.lgd.config.set( "Legendary", "mac_install_dir", self.__core.get_default_install_dir(self.__core.default_platform) ) + # Always set these options - # Avoid falling back to Windows games on macOS - self.__core.lgd.config.set("Legendary", "install_platform_fallback", 'false') + # Avoid implicitly falling back to Windows games on macOS + self.__core.lgd.config.set("Legendary", "install_platform_fallback", str(False)) + # Force-disable automatic use of crossover on macOS (remove this when we support crossover) + self.__core.lgd.config.set("Legendary", "disable_auto_crossover", str(True)) + # Force-disable automatic sync with EGL, it seems to have issues + self.__core.lgd.config.set("Legendary", "egl_sync", str(False)) # workaround if egl sync enabled, but no programdata_path # programdata_path might be unset if logging in through the browser From eb0d727d34b32187def9f2e645979123123dc8b3 Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Fri, 22 Dec 2023 20:45:35 +0200 Subject: [PATCH 2/4] Misc: exclude deleted files in `ui2py.sh` --- misc/ui2py.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/misc/ui2py.sh b/misc/ui2py.sh index 1853fdbf..b89f1215 100755 --- a/misc/ui2py.sh +++ b/misc/ui2py.sh @@ -1,6 +1,10 @@ #!/bin/sh if [ -n "${1}" ]; then + if [ ! -f "${1}" ]; then + echo "${1} does not exist" + exit 0 + fi echo "Generating python file for ${1}" pyuic5 "${1}" -x -o "${1%.ui}.py" sed '/QtCore.QMetaObject.connectSlotsByName/d' -i "${1%.ui}.py" @@ -13,6 +17,10 @@ cd "$(dirname "$0")"/.. || exit changed="$(git diff --name-only HEAD | grep '\.ui')" for ui in $changed; do + if [ ! -f "$ui" ]; then + echo "$ui does not exist. Skipping" + continue + fi echo "Generating python file for ${ui}" pyuic5 "${ui}" -x -o "${ui%.ui}.py" sed '/QtCore.QMetaObject.connectSlotsByName/d' -i "${ui%.ui}.py" From 51904efa90444a191a2b75054ad503726f20c62c Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Wed, 20 Dec 2023 00:21:21 +0200 Subject: [PATCH 3/4] GameWidget: Request pixmap in paintEvent. Requesting the pixmap in `paintEvent` only loads the pixmap when the widget first becomes visible, making loading the library smoother. Also avoid spawning multiple singleshot QTimers and use QObject's internal timer, with CoarseTimer precision. --- .../tabs/games/game_widgets/game_widget.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rare/components/tabs/games/game_widgets/game_widget.py b/rare/components/tabs/games/game_widgets/game_widget.py index 3390a3ac..e5cf3d24 100644 --- a/rare/components/tabs/games/game_widgets/game_widget.py +++ b/rare/components/tabs/games/game_widgets/game_widget.py @@ -3,7 +3,7 @@ import random from logging import getLogger from PyQt5.QtCore import pyqtSignal, Qt, pyqtSlot, QObject, QEvent, QTimer -from PyQt5.QtGui import QMouseEvent, QShowEvent +from PyQt5.QtGui import QMouseEvent, QShowEvent, QPaintEvent from PyQt5.QtWidgets import QMessageBox, QAction from rare.models.game import RareGame @@ -106,11 +106,21 @@ class GameWidget(LibraryWidget): # lk: attributes as `GameWidgetUi` class __slots__ = "ui" + def paintEvent(self, a0: QPaintEvent) -> None: + if not self.visibleRegion().isNull() and self.rgame.pixmap.isNull(): + self.startTimer(random.randrange(42, 2361, 129), Qt.CoarseTimer) + # self.startTimer(random.randrange(42, 2361, 363), Qt.VeryCoarseTimer) + # self.rgame.load_pixmap() + # QTimer.singleShot(random.randrange(42, 2361, 7), Qt.VeryCoarseTimer, self.rgame.load_pixmap) + super().paintEvent(a0) + + def timerEvent(self, a0): + self.killTimer(a0.timerId()) + self.rgame.load_pixmap() + def showEvent(self, a0: QShowEvent) -> None: if a0.spontaneous(): return super().showEvent(a0) - if self.rgame.pixmap.isNull(): - QTimer.singleShot(random.randrange(42, 361, 7), self.rgame.load_pixmap) super().showEvent(a0) @pyqtSlot() From 69a73882f5553840a31f6f4d53286ff001981e2d Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Fri, 22 Dec 2023 20:58:36 +0200 Subject: [PATCH 4/4] Lgndr: Don't try to anonymize --- rare/lgndr/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rare/lgndr/core.py b/rare/lgndr/core.py index 251267c7..03f6b739 100644 --- a/rare/lgndr/core.py +++ b/rare/lgndr/core.py @@ -31,7 +31,7 @@ class LegendaryCore(LegendaryCoreReal): def __init__(self, *args, **kwargs): super(LegendaryCore, self).__init__(*args, **kwargs) self.log.info("Using Rare's LegendaryCore monkey") - self.log.info("Using config in %s", self.lgd.path.replace(os.getlogin(), "")) + self.log.info("Using config in %s", self.lgd.path) self.handler = LgndrLogHandler(logging.CRITICAL) self.log.addHandler(self.handler)