diff --git a/gamefixes-steam/1137300.py b/gamefixes-steam/1137300.py index d85447ea..174272a5 100644 --- a/gamefixes-steam/1137300.py +++ b/gamefixes-steam/1137300.py @@ -2,7 +2,6 @@ UW support: RoseTheFlower/SherlockHolmesCOUltrawide UW support: PhantomGamers/shco-wsf """ -#pylint: disable=C0103 import os import sys @@ -31,12 +30,14 @@ def _get_pid(procname: str) -> int: return procpid def get_pid(procname: str, untilfound: bool=False) -> int: + """Get pid for processes launched afer the game that run in Proton (checks for Windows path)""" while True: pid = _get_pid(procname) if pid is not None or not untilfound: return pid def install_xdotool(path_to_exe: str): + """Copy xdotool (and libxdo.so.3) to executable's directory""" if not os.path.isfile(os.path.join(path_to_exe, 'busybox_AR')): url = 'https://busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox_AR' hashsum = '49061d5037e33742e90d2eb94aa3d8e12305ac5df5d380a3d31d50d7c026a40b' @@ -85,6 +86,7 @@ def install_xdotool(path_to_exe: str): os.remove(file) def load_trainer(trainer: str): + """Load trainer after game launches, minimizes it, and kills it when game closes""" path_to_exe = os.path.dirname(trainer) if not os.path.isfile(os.path.join(path_to_exe, 'xdotool')): install_xdotool(path_to_exe) @@ -117,6 +119,7 @@ def load_trainer(trainer: str): break def main(): + """Only applies fix for UW display. Checks for UW fix zip or extracted files, if none found download one""" screen_width,screen_height = util.get_resolution() #Checks for UW in case there's an UW fix present but display is not. #eg. the monitor changed or the files were moved from a PC to a SteamDeck @@ -124,13 +127,13 @@ def main(): install_dir = glob.escape(util.get_game_install_path()) bin_path = 'SH9/Binaries/Win64' path_to_exe = os.path.join(install_dir, bin_path) - UW_file = os.path.join(path_to_exe, 'Sherlock Holmes CO Ultrawide.exe') - UW_zip = os.path.join(install_dir,'Sherlock.Holmes.CO.Ultrawide.zip') - UW2_file = os.path.join(path_to_exe, 'SUWSF.asi') - UW2_zip = os.path.join(install_dir, 'SHCO-WSF.zip') + uw_file = os.path.join(path_to_exe, 'Sherlock Holmes CO Ultrawide.exe') + uw_zip = os.path.join(install_dir,'Sherlock.Holmes.CO.Ultrawide.zip') + uw2_file = os.path.join(path_to_exe, 'SUWSF.asi') + uw2_zip = os.path.join(install_dir, 'SHCO-WSF.zip') #Previously it didn't download anything, only checked if an UW fix was present. #added download since now it checks for UW display. - if not ((os.path.isfile(UW_zip) or os.path.isfile(UW_file)) or (os.path.isfile(UW2_zip) or os.path.isfile(UW2_file))): + if not ((os.path.isfile(uw_zip) or os.path.isfile(uw_file)) or (os.path.isfile(uw2_zip) or os.path.isfile(uw2_file))): url = 'https://github.com/RoseTheFlower/SherlockHolmesCOUltrawide/releases/download/v1.0/Sherlock.Holmes.CO.Ultrawide.zip' hashsum = '9142cfb7e64b95243e9f5df9f3aae19304128c5def51d9c1b292d23c02321eee' file = os.path.join(path_to_exe, os.path.basename(url)) @@ -139,13 +142,13 @@ def main(): file_sum = hashlib.sha256(f.read()).hexdigest() if hashsum != file_sum: os.remove(file) - if os.path.isfile(UW_zip) or os.path.isfile(UW_file): - if not os.path.isfile(UW_file): - with zipfile.ZipFile(UW_zip, 'r') as zip_ref: - zip_ref.extract(os.path.basename(UW_file), path_to_exe) - threading.Thread(target=load_trainer, args=[UW_file]).start() - elif os.path.isfile(UW2_zip) or os.path.isfile(UW2_file): - if not os.path.isfile(UW2_file): - with zipfile.ZipFile(UW2_zip, 'r') as zip_ref: + if os.path.isfile(uw_zip) or os.path.isfile(uw_file): + if not os.path.isfile(uw_file): + with zipfile.ZipFile(uw_zip, 'r') as zip_ref: + zip_ref.extract(os.path.basename(uw_file), path_to_exe) + threading.Thread(target=load_trainer, args=[uw_file]).start() + elif os.path.isfile(uw2_zip) or os.path.isfile(uw2_file): + if not os.path.isfile(uw2_file): + with zipfile.ZipFile(uw2_zip, 'r') as zip_ref: zip_ref.extractall() util.winedll_override('dsound', 'n')