proton: Add cmdlineappend: compat config option

This commit is contained in:
Andrew Eikum 2020-03-18 13:50:34 -05:00
parent 13ccf8a854
commit a9575f7c77
2 changed files with 27 additions and 5 deletions

View file

@ -276,6 +276,7 @@ the Wine prefix. Removing the option will revert to the previous behavior.
| <tt>noforcelgadd</tt> | | Disable forcelgadd. If both this and `forcelgadd` are set, enabled wins. | | <tt>noforcelgadd</tt> | | Disable forcelgadd. If both this and `forcelgadd` are set, enabled wins. |
| <tt>oldglstr</tt> | <tt>PROTON_OLD_GL_STRING</tt> | Set some driver overrides to limit the length of the GL extension string, for old games that crash on very long extension strings. | | <tt>oldglstr</tt> | <tt>PROTON_OLD_GL_STRING</tt> | Set some driver overrides to limit the length of the GL extension string, for old games that crash on very long extension strings. |
| | <tt>WINE_FULLSCREEN_INTEGER_SCALING</tt> | Enable integer scaling mode, to give sharp pixels when upscaling. | | | <tt>WINE_FULLSCREEN_INTEGER_SCALING</tt> | Enable integer scaling mode, to give sharp pixels when upscaling. |
| <tt>cmdlineappend:</tt>| | Append the string after the colon as an argument to the game command. May be specified more than once. Escape commas and backslashes with a backslash. |
| <tt>d9vk</tt> | <tt>PROTON_USE_D9VK</tt> | **Note: Obsoleted in Proton 5.0.** In older versions, use Vulkan-based DXVK instead of OpenGL-based wined3d for d3d9. | | <tt>d9vk</tt> | <tt>PROTON_USE_D9VK</tt> | **Note: Obsoleted in Proton 5.0.** In older versions, use Vulkan-based DXVK instead of OpenGL-based wined3d for d3d9. |
<!-- Target: GitHub Flavor Markdown. To test locally: pandoc -f markdown_github -t html README.md --> <!-- Target: GitHub Flavor Markdown. To test locally: pandoc -f markdown_github -t html README.md -->

31
proton
View file

@ -365,6 +365,14 @@ class CompatData:
self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll") self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll")
g_session.dlloverrides[f] = "n" g_session.dlloverrides[f] = "n"
def comma_escaped(s):
escaped = False
idx = -1
while s[idx] == '\\':
escaped = not escaped
idx = idx - 1
return escaped
class Session: class Session:
def __init__(self): def __init__(self):
self.log_file = None self.log_file = None
@ -373,10 +381,23 @@ class Session:
"steam.exe": "b", #always use our special built-in steam.exe "steam.exe": "b", #always use our special built-in steam.exe
"mfplay": "n" #disable built-in mfplay "mfplay": "n" #disable built-in mfplay
} }
self.compat_config = set()
self.cmdlineappend = []
if "STEAM_COMPAT_CONFIG" in os.environ: if "STEAM_COMPAT_CONFIG" in os.environ:
self.compat_config = set(os.environ["STEAM_COMPAT_CONFIG"].split(",")) config = os.environ["STEAM_COMPAT_CONFIG"]
else:
self.compat_config = set() while config:
(cur, sep, config) = config.partition(',')
if cur.startswith("cmdlineappend:"):
while comma_escaped(cur):
(a, b, c) = config.partition(',')
cur = cur[:-1] + ',' + a
config = c
self.cmdlineappend.append(cur[14:].replace('\\\\','\\'))
else:
self.compat_config.add(cur)
#turn forcelgadd on by default unless it is disabled in compat config #turn forcelgadd on by default unless it is disabled in compat config
if not "noforcelgadd" in self.compat_config: if not "noforcelgadd" in self.compat_config:
@ -483,7 +504,7 @@ class Session:
with open(g_proton.version_file, "r") as f: with open(g_proton.version_file, "r") as f:
self.log_file.write("Proton: " + f.readline().strip() + "\n") self.log_file.write("Proton: " + f.readline().strip() + "\n")
self.log_file.write("SteamGameId: " + self.env["SteamGameId"] + "\n") self.log_file.write("SteamGameId: " + self.env["SteamGameId"] + "\n")
self.log_file.write("Command: " + str(sys.argv[2:]) + "\n") self.log_file.write("Command: " + str(sys.argv[2:] + self.cmdlineappend) + "\n")
self.log_file.write("Options: " + str(self.compat_config) + "\n") self.log_file.write("Options: " + str(self.compat_config) + "\n")
self.log_file.write("======================\n") self.log_file.write("======================\n")
self.log_file.flush() self.log_file.flush()
@ -627,7 +648,7 @@ class Session:
self.dump_dbg_scripts() self.dump_dbg_scripts()
except OSError: except OSError:
log("Unable to write debug scripts! " + str(sys.exc_info()[1])) log("Unable to write debug scripts! " + str(sys.exc_info()[1]))
self.run_proc([g_proton.wine_bin, "steam"] + sys.argv[2:]) self.run_proc([g_proton.wine_bin, "steam"] + sys.argv[2:] + self.cmdlineappend)
if __name__ == "__main__": if __name__ == "__main__":