From 471d63b27c97763f69e7a79bba0c5043c0774f0e Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Tue, 7 May 2024 23:20:09 -0700 Subject: [PATCH] Update NSLGameScanner.py --- NSLGameScanner.py | 68 +++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index f5aea67..6790ace 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -739,49 +739,43 @@ def getGogGameInfo(filePath): exe_path = None depends_on = None launch_command = None - start_menu_link = None for line in file: - split_line = line.split("=") - if len(split_line) > 1: - if "gameID" in line: - game_id = re.findall(r'\"(.+?)\"', split_line[1]) - if game_id: - game_id = game_id[0] - if "gameName" in line: - game_name = re.findall(r'\"(.+?)\"', split_line[1]) - if game_name: - game_name = bytes(game_name[0], 'utf-8').decode('unicode_escape') - game_name = game_name.replace('!22', '™') - if "exe" in line and "GOG Galaxy" in line and not "unins000.exe" in line: - exe_path = re.findall(r'\"(.+?)\"', split_line[1]) - if exe_path: - exe_path = exe_path[0].replace('\\\\', '\\') - if "dependsOn" in line: - depends_on = re.findall(r'\"(.+?)\"', split_line[1]) - if depends_on: - depends_on = depends_on[0] - if "launchCommand" in line: - launch_command = re.findall(r'\"(.+?)\"', split_line[1]) - if launch_command: - launch_command = launch_command[0] - if "startMenuLink" in line: - start_menu_link = re.findall(r'\"(.+?)\"', split_line[1]) - if start_menu_link: - start_menu_link = start_menu_link[0] - if game_id and game_name and launch_command and start_menu_link and "[GOG.com]" in start_menu_link: - game_dict[game_name] = {'id': game_id, 'exe': exe_path} - game_id = None - game_name = None - exe_path = None - depends_on = None - launch_command = None - start_menu_link = None + if "[Software\\Wow6432Node\\GOG.com\\Games\\" in line: + split_line = line.split("=") + if len(split_line) > 1: + if "gameID" in line: + game_id = re.findall(r'\"(.+?)\"', split_line[1]) + if game_id: + game_id = game_id[0] + if "gameName" in line: + game_name = re.findall(r'\"(.+?)\"', split_line[1]) + if game_name: + game_name = bytes(game_name[0], 'utf-8').decode('unicode_escape') + game_name = game_name.replace('!22', '™') + if "exe" in line and "GOG Galaxy" in line and not "unins000.exe" in line: + exe_path = re.findall(r'\"(.+?)\"', split_line[1]) + if exe_path: + exe_path = exe_path[0].replace('\\\\', '\\') + if "dependsOn" in line: + depends_on = re.findall(r'\"(.+?)\"', split_line[1]) + if depends_on: + depends_on = depends_on[0] + if "launchCommand" in line: + launch_command = re.findall(r'\"(.+?)\"', split_line[1]) + if launch_command: + launch_command = launch_command[0] + if game_id and game_name and launch_command: + game_dict[game_name] = {'id': game_id, 'exe': exe_path} + game_id = None + game_name = None + exe_path = None + depends_on = None + launch_command = None return game_dict - # Define your paths gog_games_directory = f"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/Games" registry_file_path = f"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/system.reg"