diff --git a/games/game_oblivion_remaster.py b/games/game_oblivion_remaster.py index 839e393..e61c00f 100644 --- a/games/game_oblivion_remaster.py +++ b/games/game_oblivion_remaster.py @@ -1,5 +1,6 @@ import os.path import shutil +import winreg from functools import cmp_to_key from pathlib import Path from typing import Sequence @@ -25,6 +26,15 @@ from ..basic_features.utils import is_directory from ..basic_game import BasicGame +def getLootPath() -> Path | None: + try: + with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{BF634210-A0D4-443F-A657-0DCE38040374}_is1") as key: + value = winreg.QueryValueEx(key, "InstallLocation") + return Path((value[0]+"/LOOT.exe").replace("/", "\\")) + except FileNotFoundError: + return None + + class OblivionRemasteredModDataChecker(mobase.ModDataChecker): _dirs = ["Data", "Paks", "OBSE", "Movies", "UE4SS"] _data_dirs = [ @@ -532,6 +542,12 @@ class OblivionRemasteredGame(BasicGame, mobase.IPluginFileMapper): .loaderPath() ), ), + mobase.ExecutableInfo( + "LOOT", + QFileInfo(str(getLootPath())) + ).withArgument( + '--game="Oblivion Remastered"' + ) ] def primaryPlugins(self) -> list[str]: @@ -581,6 +597,9 @@ class OblivionRemasteredGame(BasicGame, mobase.IPluginFileMapper): def loadOrderMechanism(self) -> mobase.LoadOrderMechanism: return mobase.LoadOrderMechanism.PLUGINS_TXT + def sortMechanism(self) -> mobase.SortMechanism: + return mobase.SortMechanism.LOOT + def initializeProfile( self, directory: QDir, settings: mobase.ProfileSetting ) -> None: