Repository navigation
Expand file tree
/
Copy pathheadless.py
More file actions
54 lines (45 loc) · 1.48 KB
/
Copy pathheadless.py
File metadata and controls
54 lines (45 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
"""Small wrapper that locates the newest PPSSPPHeadless binary (same way
test.py does) and forwards all command line arguments to it.
Usage:
python3 headless.py [OPTIONS] [FILES...]
"""
import glob
import os
import subprocess
import sys
PPSSPP_EXECUTABLES = [
# Windows
"Windows\\Debug\\PPSSPPHeadless.exe",
"Windows\\Release\\PPSSPPHeadless.exe",
"Windows\\x64\\Debug\\PPSSPPHeadless.exe",
"Windows\\x64\\Release\\PPSSPPHeadless.exe",
"build*/PPSSPPHeadless.exe",
"./PPSSPPHeadless.exe",
# Mac
"build*/Debug/PPSSPPHeadless",
"build*/Release/PPSSPPHeadless",
"build*/RelWithDebInfo/PPSSPPHeadless",
"build*/MinSizeRel/PPSSPPHeadless",
# Linux
"build*/PPSSPPHeadless",
"./PPSSPPHeadless",
]
def find_headless():
env_path = os.environ.get("PPSSPP_HEADLESS")
if env_path and os.path.exists(env_path):
return env_path
possible_exes = [glob.glob(f) for f in PPSSPP_EXECUTABLES]
possible_exes = [x for sublist in possible_exes for x in sublist]
existing = [f for f in possible_exes if os.path.exists(f)]
if not existing:
return None
return max(existing, key=os.path.getmtime)
def main():
headless = find_headless()
if headless is None:
print("ERROR: PPSSPPHeadless binary not found. Set PPSSPP_HEADLESS or run from the repo root.", file=sys.stderr)
return 2
return subprocess.call([headless] + sys.argv[1:])
if __name__ == "__main__":
sys.exit(main())