From 1db99fe6cb604f2bd6e04d231041f9ac867af05c Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sun, 4 May 2025 00:29:41 -0500 Subject: [PATCH] Check all possible LOOT reg entries --- games/game_oblivion_remaster.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/games/game_oblivion_remaster.py b/games/game_oblivion_remaster.py index 98a162c..59ff66f 100644 --- a/games/game_oblivion_remaster.py +++ b/games/game_oblivion_remaster.py @@ -27,15 +27,31 @@ from ..basic_game import BasicGame def getLootPath() -> Path | None: - try: - with winreg.OpenKeyEx( + paths = [ + ( + winreg.HKEY_CURRENT_USER, + "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{BF634210-A0D4-443F-A657-0DCE38040374}_is1", + "InstallLocation", + ), + ( 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 + "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{BF634210-A0D4-443F-A657-0DCE38040374}_is1", + "InstallLocation", + ), + (winreg.HKEY_LOCAL_MACHINE, "Software\\LOOT", "Installed Path"), + ] + + for path in paths: + try: + with winreg.OpenKeyEx( + path[0], + path[1], + ) as key: + value = winreg.QueryValueEx(key, path[2]) + return Path((value[0] + "/LOOT.exe").replace("/", "\\")) + except FileNotFoundError: + pass + return None class OblivionRemasteredModDataChecker(mobase.ModDataChecker):