Skip to content

Commit

Permalink
style(steam): Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TwentyPast4 committed Jun 29, 2024
1 parent a52b172 commit 38cf2c5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pbpy/pbsteamcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ def publish_build(branch_type, steamcmd_exec_path, publish_stagedir, app_script,
pblog.error("steamcmd was not configured.")
return False

script_path = (Path() / app_script.format(branch_type)).resolve()
# The basic needed command line to get into steamcmd
base_steamcmd_command = [steamcmd_exec_path, "+login", pbconfig.get_user("steamcmd", "username"), pbconfig.get_user("steamcmd", "password")]

command = [steamcmd_exec_path, "+login", pbconfig.get_user("steamcmd", "username"), pbconfig.get_user("steamcmd", "password")]
# if drm wrapping is configured
if drm_app_id and drm_exe_path:
if not Path.is_absolute(drm_exe_path):
drm_exe_path = (Path(pbconfig.config_filepath).parent / drm_exe_path).resolve()
if not Path.is_file(drm_exe_path):
pblog.error("steamcmd/drm/targetbinary does not exist.")
return False
drm_command = command.copy()
drm_output = "wrappedBin" + Path(drm_exe_path).suffix
drm_command.extend(["+drm_wrap", drm_exe_path, drm_output, "drmtoolp", "0", "+quit"])
drm_command = base_steamcmd_command.copy()
drm_output = "wrappedBin" + Path(drm_exe_path).suffix # save file to wrappedBin.exe temporarily
drm_command.extend(["+drm_wrap", drm_exe_path, drm_output, "drmtoolp", "0", "+quit"]) # the drm wrap command https://partner.steamgames.com/doc/features/drm
pblog.info("Wrapping game with steamworks DRM...")
drm_proc = pbtools.run_with_output(drm_command)
pbtools.remove_file(drm_exe_path) # remove original file in any case
Expand All @@ -32,11 +33,13 @@ def publish_build(branch_type, steamcmd_exec_path, publish_stagedir, app_script,

shutil.move(drm_output, drm_exe_path) # move drm-wrapped file to location of original

command.extend(["+run_app_build", script_path, "+quit"])
proc = pbtools.run(command)
script_path = (Path() / app_script.format(branch_type)).resolve()
build_cmd = base_steamcmd_command.copy()
build_cmd.extend(["+run_app_build", script_path, "+quit"])
proc = pbtools.run(build_cmd)
result = proc.returncode

if Path.is_file(drm_exe_path):
pbtools.remove_file(drm_exe_path) # remove drm wrapped file, so that a subsequent build will re-build a non-wrapped version
pbtools.remove_file(drm_exe_path) # remove drm wrapped file, so that a subsequent build will re-build a non-wrapped executable

return result

0 comments on commit 38cf2c5

Please sign in to comment.