diff --git a/README.md b/README.md index bc9e1d05..004f5bfb 100644 --- a/README.md +++ b/README.md @@ -276,6 +276,7 @@ the Wine prefix. Removing the option will revert to the previous behavior. | noforcelgadd | | Disable forcelgadd. If both this and `forcelgadd` are set, enabled wins. | | oldglstr | PROTON_OLD_GL_STRING | Set some driver overrides to limit the length of the GL extension string, for old games that crash on very long extension strings. | | | WINE_FULLSCREEN_INTEGER_SCALING | Enable integer scaling mode, to give sharp pixels when upscaling. | +| cmdlineappend:| | 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. | | d9vk | PROTON_USE_D9VK | **Note: Obsoleted in Proton 5.0.** In older versions, use Vulkan-based DXVK instead of OpenGL-based wined3d for d3d9. | diff --git a/proton b/proton index 8152314a..d4a49abd 100755 --- a/proton +++ b/proton @@ -365,6 +365,14 @@ class CompatData: self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll") 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: def __init__(self): self.log_file = None @@ -373,10 +381,23 @@ class Session: "steam.exe": "b", #always use our special built-in steam.exe "mfplay": "n" #disable built-in mfplay } + + self.compat_config = set() + self.cmdlineappend = [] + if "STEAM_COMPAT_CONFIG" in os.environ: - self.compat_config = set(os.environ["STEAM_COMPAT_CONFIG"].split(",")) - else: - self.compat_config = set() + config = os.environ["STEAM_COMPAT_CONFIG"] + + 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 if not "noforcelgadd" in self.compat_config: @@ -483,7 +504,7 @@ class Session: with open(g_proton.version_file, "r") as f: self.log_file.write("Proton: " + f.readline().strip() + "\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("======================\n") self.log_file.flush() @@ -627,7 +648,7 @@ class Session: self.dump_dbg_scripts() except OSError: 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__":