Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
moraroy authored Feb 18, 2025
1 parent c1cccbd commit f2f53a9
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions NSLGameScanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
vkplay_launcher = os.environ.get('vkplay_launcher', '')
hoyoplay_launcher = os.environ.get('hoyoplay_launcher', '')
gamejolt_launcher = os.environ.get('gamejolt_launcher', '')
minecraft_launcher = os.environ.get('minecraft_launcher', '')
#Variables of the Launchers

# Define the path of the Launchers
Expand Down Expand Up @@ -1827,6 +1828,67 @@ def extract_json_objects(content):



#Minecraft Legacy Launcher Scanner

# Path to the JSON file
file_path = f"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{minecraft_launcher}/pfx/drive_c/users/deck/AppData/Roaming/.minecraft/launcher_settings.json"

# Function to convert Windows path to Unix path dynamically
def convert_to_unix_path(windows_path, home_dir):
unix_path = windows_path.replace('\\', '/')

if len(windows_path) > 2 and windows_path[1] == ":":
unix_path = unix_path[2:]
unix_path = os.path.join(home_dir, unix_path.lstrip('/'))

return unix_path

# Check if the JSON file exists
if os.path.exists(file_path):
try:
with open(file_path, 'r') as file:
# Parse the JSON data
data = json.load(file)

# Extract the productLibraryDir
product_library_dir = data.get('productLibraryDir')

if product_library_dir:
home_dir = os.path.expanduser("~")
unix_product_library_dir = convert_to_unix_path(product_library_dir, home_dir)

# Define the target file path
target_file = os.path.join(unix_product_library_dir, 'dungeons', 'dungeons', 'Dungeons.exe')

# Check if the file exists
if os.path.exists(target_file):
print(f"File exists: {target_file}")
else:
print(f"File does not exist: {target_file}")

# Set the display name to the game shortcut name from the JSON
display_name = "Minecraft Dungeons"
launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{minecraft_launcher}/\" %command%"
exe_path = f"\"{target_file}\""
start_dir = f"\"{os.path.dirname(target_file)}\""


# Create the new entry (this is where you can use your custom function for Steam shortcuts)
create_new_entry(exe_path, display_name, launch_options, start_dir)

else:
print("Key 'productLibraryDir' not found in the JSON.")
except json.JSONDecodeError:
print("Error decoding the JSON file.")
else:
print("Skipping Minecraft Legacy Launcher Scanner")

# End of the Minecraft Legacy Launcher






# Only write back to the shortcuts.vdf and config.vdf files if new shortcuts were added or compattools changed
# Function to send a notification with an optional icon
Expand Down

0 comments on commit f2f53a9

Please sign in to comment.