Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cease to Breathe fix #54

Merged
merged 3 commits into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions gamefixes-steam/1873170.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
""" Cease to Breathe
Replace included nwjs(0.71) wich doesn't work with 0.86
Fix cursor hitbox (set frame=false in package.json)
Updated from 0.85 that didn't display custom cursors.
"""
#pylint: disable=C0103

import os
import glob
import shutil
import urllib.request
import zipfile
import subprocess
import hashlib
from protonfixes import util
from protonfixes.logger import log

def main():
util.replace_command('CTB.exe', 'nw.exe')
install_dir = glob.escape(util.get_game_install_path())
if not os.path.isfile(os.path.join(install_dir, 'nw.exe')):
url = 'https://dl.nwjs.io/v0.86.0/nwjs-v0.86.0-win-x64.zip'
R1kaB3rN marked this conversation as resolved.
Show resolved Hide resolved
nwjs = os.path.basename(url)
urllib.request.urlretrieve(url, nwjs)
with open(nwjs, "rb") as f:
nwjs_sum = hashlib.sha256(f.read()).hexdigest()
urllib.request.urlretrieve(f"https://dl.nwjs.io/{nwjs.split('-', 2)[1]}/SHASUMS256.txt", 'SHASUMS256.txt')
if subprocess.check_output(f"grep -F '{nwjs}' ./SHASUMS256.txt", shell=True,universal_newlines=True)[:64] == nwjs_sum:
with zipfile.ZipFile(nwjs, 'r') as zip_ref:
zip_ref.extractall(install_dir)
nwjs = os.path.join(install_dir, nwjs.rsplit('.', 1)[0])
shutil.copytree(nwjs, install_dir, dirs_exist_ok=True)
shutil.rmtree(nwjs)
else:
log(f"{nwjs} checksum doesn't match, fix not applied.")
subprocess.call([f"sed -i 's/\"frame\": true/\"frame\": false/' \"{install_dir}/package.json\""], shell=True)