fixed gog for sd card paths

This commit is contained in:
Roy 2024-05-08 01:55:55 -07:00 committed by GitHub
parent 0ab84b8a08
commit baaac65896
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -723,7 +723,7 @@ else:
# Gog Galaxy Scanner #Gog Galaxy Scanner
def getGogGameInfo(filePath): def getGogGameInfo(filePath):
# Check if the file contains any GOG entries # Check if the file contains any GOG entries
with open(filePath, 'r') as file: with open(filePath, 'r') as file:
@ -740,45 +740,55 @@ def getGogGameInfo(filePath):
depends_on = None depends_on = None
launch_command = None launch_command = None
start_menu_link = None start_menu_link = None
gog_entry = False
for line in file: for line in file:
split_line = line.split("=") if "GOG.com" in line:
if len(split_line) > 1: gog_entry = True
if "gameID" in line: if gog_entry:
game_id = re.findall(r'\"(.+?)\"', split_line[1]) split_line = line.split("=")
if game_id: if len(split_line) > 1:
game_id = game_id[0] if "gameID" in line:
if "gameName" in line: game_id = re.findall(r'\"(.+?)\"', split_line[1])
game_name = re.findall(r'\"(.+?)\"', split_line[1]) if game_id:
if game_name: game_id = game_id[0]
game_name = bytes(game_name[0], 'utf-8').decode('unicode_escape') if "gameName" in line:
game_name = game_name.replace('!22', '') game_name = re.findall(r'\"(.+?)\"', split_line[1])
if "exe" in line and "GOG Galaxy" in line and not "unins000.exe" in line: if game_name:
exe_path = re.findall(r'\"(.+?)\"', split_line[1]) game_name = bytes(game_name[0], 'utf-8').decode('unicode_escape')
if exe_path: game_name = game_name.replace('!22', '')
exe_path = exe_path[0].replace('\\\\', '\\') if "exe" in line and not "unins000.exe" in line:
if "dependsOn" in line: exe_path = re.findall(r'\"(.+?)\"', split_line[1])
depends_on = re.findall(r'\"(.+?)\"', split_line[1]) if exe_path:
if depends_on: exe_path = exe_path[0].replace('\\\\', '\\')
depends_on = depends_on[0] if "dependsOn" in line:
if "launchCommand" in line: depends_on = re.findall(r'\"(.+?)\"', split_line[1])
launch_command = re.findall(r'\"(.+?)\"', split_line[1]) if depends_on:
if launch_command: depends_on = depends_on[0]
launch_command = launch_command[0] if "launchCommand" in line:
if "startMenuLink" in line: launch_command = re.findall(r'\"(.+?)\"\s*$', split_line[1])
start_menu_link = re.findall(r'\"(.+?)\"', split_line[1]) if launch_command:
if start_menu_link: # Remove leading and trailing whitespace from the path
start_menu_link = start_menu_link[0] path = launch_command[0].strip()
if game_id and game_name and launch_command and 'GOG.com' in start_menu_link: # Reconstruct the launch command with the cleaned path
game_dict[game_name] = {'id': game_id, 'exe': exe_path} launch_command = f"\"{path}\""
game_id = None if "startMenuLink" in line:
game_name = None start_menu_link = re.findall(r'\"(.+?)\"', split_line[1])
exe_path = None if start_menu_link:
depends_on = None start_menu_link = start_menu_link[0]
launch_command = None if game_id and game_name and launch_command and start_menu_link and 'GOG.com' in start_menu_link:
start_menu_link = None 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
return game_dict return game_dict
# Define your paths # 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" 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" registry_file_path = f"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/system.reg"
@ -792,7 +802,9 @@ else:
for game, game_info in game_dict.items(): for game, game_info in game_dict.items():
if game_info['id']: if game_info['id']:
launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/\" %command% /command=runGame /gameId={game_info['id']} /path=\"{game_info['exe']}\"" # Strip leading and trailing spaces from the exe path
exe_path = game_info['exe'].strip()
launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/\" %command% /command=runGame /gameId={game_info['id']} /path=\"{exe_path}\""
exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/GalaxyClient.exe\"" exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/GalaxyClient.exe\""
start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/\""
create_new_entry(exe_path, game, launch_options, start_dir) create_new_entry(exe_path, game, launch_options, start_dir)
@ -802,6 +814,7 @@ else:
#Battle.net Scanner #Battle.net Scanner
# Define your mapping # Define your mapping
flavor_mapping = { flavor_mapping = {