Last active 3 months ago

Extracts LaunchOptions from steam, showing appid & options. python3 extract.py ~/.local/.steam/steam/userdata/#####/config/localconfig.vdf

jackz's Avatar jackz revised this gist 3 months ago. Go to revision

1 file changed, 1 insertion, 1 deletion

extract.py

@@ -1,4 +1,4 @@
1 - #generated by chatgpt
1 + # initially generated by chatgpt
2 2 import vdf
3 3
4 4 def extract_launch_options(filepath):

jackz's Avatar jackz revised this gist 3 months ago. Go to revision

1 file changed, 3 insertions, 7 deletions

extract.py

@@ -1,6 +1,5 @@
1 - # was generated with chatgpt
1 + #generated by chatgpt
2 2 import vdf
3 - import json
4 3
5 4 def extract_launch_options(filepath):
6 5 with open(filepath, 'r', encoding='utf-8') as f:
@@ -12,10 +11,7 @@ def extract_launch_options(filepath):
12 11 for key, val in node.items():
13 12 if isinstance(val, dict):
14 13 if key.isdigit() and "LaunchOptions" in val:
15 - results.append({
16 - "appid": key,
17 - "LaunchOptions": val["LaunchOptions"]
18 - })
14 + print(f"[{key}] {val['LaunchOptions']}")
19 15 walk(val)
20 16
21 17 walk(data)
@@ -28,4 +24,4 @@ if __name__ == "__main__":
28 24 parser.add_argument("filepath", help="the path to the VDF file to extract")
29 25 args = parser.parse_args()
30 26
31 - print(json.dumps(extract_launch_options(args.filepath), indent=2))
27 + extract_launch_options(args.filepath)

jackz's Avatar jackz revised this gist 3 months ago. Go to revision

1 file changed, 27 insertions, 19 deletions

extract.py

@@ -1,23 +1,31 @@
1 1 # was generated with chatgpt
2 + import vdf
2 3 import json
3 - import re
4 4
5 - def extract_launch_options(file_path):
6 - # Open the file and read the contents
7 - with open(file_path, 'r', encoding='utf-8') as file:
8 - file_contents = file.read()
9 -
10 - # Use a regular expression to find appids and their corresponding LaunchOptions
11 - pattern = r'"(\d+)"\s*\{[^}]*?"LaunchOptions"\s*"\s*([^"]+)\s*"'
12 -
13 - matches = re.findall(pattern, file_contents)
14 -
15 - if matches:
16 - for appid, launch_options in matches:
17 - print(f"AppID: {appid}")
18 - print(f"Launch Options: {launch_options}")
19 - print("-" * 40)
20 - else:
21 - print("No LaunchOptions found in the file.")
5 + def extract_launch_options(filepath):
6 + with open(filepath, 'r', encoding='utf-8') as f:
7 + data = vdf.load(f)
22 8
23 - extract_launch_options('/run/media/jackz/3a44ccb4-9c88-4e02-b399-dceb44b3229a/home/jackz/.steam/debian-installation/userdata/98487534/config/localconfig.vdf')
9 + results = []
10 +
11 + def walk(node):
12 + for key, val in node.items():
13 + if isinstance(val, dict):
14 + if key.isdigit() and "LaunchOptions" in val:
15 + results.append({
16 + "appid": key,
17 + "LaunchOptions": val["LaunchOptions"]
18 + })
19 + walk(val)
20 +
21 + walk(data)
22 + return results
23 +
24 + if __name__ == "__main__":
25 + import argparse
26 +
27 + parser = argparse.ArgumentParser("extract")
28 + parser.add_argument("filepath", help="the path to the VDF file to extract")
29 + args = parser.parse_args()
30 +
31 + print(json.dumps(extract_launch_options(args.filepath), indent=2))

jackz's Avatar jackz revised this gist 3 months ago. Go to revision

1 file changed, 23 insertions

extract.py(file created)

@@ -0,0 +1,23 @@
1 + # was generated with chatgpt
2 + import json
3 + import re
4 +
5 + def extract_launch_options(file_path):
6 + # Open the file and read the contents
7 + with open(file_path, 'r', encoding='utf-8') as file:
8 + file_contents = file.read()
9 +
10 + # Use a regular expression to find appids and their corresponding LaunchOptions
11 + pattern = r'"(\d+)"\s*\{[^}]*?"LaunchOptions"\s*"\s*([^"]+)\s*"'
12 +
13 + matches = re.findall(pattern, file_contents)
14 +
15 + if matches:
16 + for appid, launch_options in matches:
17 + print(f"AppID: {appid}")
18 + print(f"Launch Options: {launch_options}")
19 + print("-" * 40)
20 + else:
21 + print("No LaunchOptions found in the file.")
22 +
23 + extract_launch_options('/run/media/jackz/3a44ccb4-9c88-4e02-b399-dceb44b3229a/home/jackz/.steam/debian-installation/userdata/98487534/config/localconfig.vdf')
Newer Older