Skip to content

Commit

Permalink
proton: Fix a couple simple crashes
Browse files Browse the repository at this point in the history
Fixes a crash when no verb is provided due to accessing a nonexistent index in `sys.argv`.
Allows the `STEAM_COMPAT_CLIENT_INSTALL_PATH` environment variable to not be set.
  • Loading branch information
alice945 authored Mar 21, 2023
1 parent b066633 commit eeb91d4
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions proton
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,9 @@ class CompatData:
os.symlink("/", self.prefix_dir + "/dosdevices/z:")

# collect configuration info
steamdir = os.environ["STEAM_COMPAT_CLIENT_INSTALL_PATH"]
steamdir = os.environ.get("STEAM_COMPAT_CLIENT_INSTALL_PATH")
if steamdir is None:
steamdir = ""

use_wined3d = "wined3d" in g_session.compat_config
use_dxvk_dxgi = not use_wined3d and \
Expand Down Expand Up @@ -892,10 +894,11 @@ class CompatData:
("GameOverlayRenderer64.dll", "GameOverlayRenderer64.dll"),
("SteamService.exe", "steam.exe"),
("Steam.dll", "Steam.dll")]
for (src,tgt) in filestocopy:
srcfile = steamdir + '/legacycompat/' + src
if os.path.isfile(srcfile):
try_copy(srcfile, steam_dir + tgt, prefix=self.prefix_dir, track_file=tracked_files, link_debug=True)
if steamdir:
for (src,tgt) in filestocopy:
srcfile = steamdir + '/legacycompat/' + src
if os.path.isfile(srcfile):
try_copy(srcfile, steam_dir + tgt, prefix=self.prefix_dir, track_file=tracked_files, link_debug=True)

filestocopy = [("steamclient64.dll", "steamclient64.dll"),
("GameOverlayRenderer.dll", "GameOverlayRenderer.dll"),
Expand Down Expand Up @@ -996,7 +999,7 @@ class CompatData:

# add Steam ffmpeg libraries to path
use_ffmpeg = "PROTON_NO_STEAM_FFMPEG" not in os.environ or not nonzero(os.environ["PROTON_NO_STEAM_FFMPEG"])
if use_ffmpeg and 'nosteamffmpeg' not in g_session.compat_config:
if use_ffmpeg and 'nosteamffmpeg' not in g_session.compat_config and steamdir:
prepend_to_env_str(g_session.env, ld_path_var, steamdir + "/ubuntu12_64/video/:" + steamdir + "/ubuntu12_32/video/", ":")

def comma_escaped(s):
Expand Down Expand Up @@ -1647,10 +1650,13 @@ if __name__ == "__main__":
if g_proton.missing_default_prefix():
g_proton.make_default_prefix()

g_session.init_session(sys.argv[1] != "runinprefix")
g_session.init_session(len(sys.argv) < 2 or sys.argv[1] != "runinprefix")

#determine mode
rc = 0
if len(sys.argv) < 2:
log("Need a verb.")
sys.exit(1)
if sys.argv[1] == "run":
#start target app
setup_game_dir_drive()
Expand All @@ -1674,7 +1680,7 @@ if __name__ == "__main__":
path = subprocess.check_output([g_proton.wine_bin, "winepath", sys.argv[2]], env=g_session.env, stderr=g_session.log_file)
sys.stdout.buffer.write(path)
else:
log("Need a verb.")
log("Bad verb.")
sys.exit(1)

sys.exit(rc)
Expand Down

0 comments on commit eeb91d4

Please sign in to comment.