mirror of
https://github.com/ValveSoftware/Proton.git
synced 2024-12-26 14:45:48 +03:00
proton: Start unknown filetypes with 'start.exe'
Doom II for example launches with a batch script.
This commit is contained in:
parent
d0d0e9e9d5
commit
69942f9fc8
15
proton
15
proton
@ -269,6 +269,7 @@ ARCH_I386=1
|
||||
ARCH_X86_64=2
|
||||
def determine_architecture(path):
|
||||
#algorithm from file's msdos magic file
|
||||
try:
|
||||
with open(path, "rb") as f:
|
||||
magic = f.read(2)
|
||||
if magic != "MZ":
|
||||
@ -291,6 +292,10 @@ def determine_architecture(path):
|
||||
if arch == 0x014c:
|
||||
return ARCH_I386
|
||||
return ARCH_UNKNOWN
|
||||
except:
|
||||
return ARCH_UNKNOWN
|
||||
|
||||
game_arch = determine_architecture(sys.argv[2])
|
||||
|
||||
def dump_dbg_env(f):
|
||||
f.write("PATH=\"" + env["PATH"] + "\" \\\n")
|
||||
@ -309,8 +314,7 @@ def dump_dbg_env(f):
|
||||
f.write("\tWINEDLLOVERRIDES=\"" + env["WINEDLLOVERRIDES"] + "\" \\\n")
|
||||
|
||||
def dump_dbg_scripts():
|
||||
arch = determine_architecture(sys.argv[2])
|
||||
if arch == ARCH_X86_64:
|
||||
if game_arch == ARCH_X86_64:
|
||||
wine_name = "\"" + bindir + "wine64\""
|
||||
else:
|
||||
wine_name = "\"" + bindir + "wine\""
|
||||
@ -388,6 +392,9 @@ def dump_dbg_scripts():
|
||||
f.write(" \"" + arg + "\"")
|
||||
f.write(")\n")
|
||||
dump_dbg_env(f)
|
||||
if game_arch == ARCH_UNKNOWN:
|
||||
f.write("\t" + wine_name + " start \"${@:-${DEF_CMD[@]}}\"\n")
|
||||
else:
|
||||
f.write("\t" + wine_name + " \"${@:-${DEF_CMD[@]}}\"\n")
|
||||
os.chmod("/tmp/proton_run", 0755)
|
||||
|
||||
@ -397,6 +404,10 @@ if sys.argv[1] == "run":
|
||||
# if "PROTON_DUMP_DEBUG_COMMAND" in os.environ: #for now, we are always dumping the debug scripts
|
||||
dump_dbg_scripts()
|
||||
# else: #see above
|
||||
if game_arch == ARCH_UNKNOWN:
|
||||
#probably a batch script or something, hopefully start.exe can handle it
|
||||
run_wine([wine_path, "start", "/unix"] + sys.argv[2:])
|
||||
else:
|
||||
run_wine([wine_path] + sys.argv[2:])
|
||||
elif sys.argv[1] == "getcompatpath":
|
||||
#linux -> windows path
|
||||
|
Loading…
Reference in New Issue
Block a user