Skip to content

Commit

Permalink
refactor: format gamefix modules through ruff
Browse files Browse the repository at this point in the history
- Enforces single quotes, a line length of 88, and updates the format of comments
  • Loading branch information
R1kaB3rN committed Aug 9, 2024
1 parent dc8a68d commit aba4cae
Show file tree
Hide file tree
Showing 273 changed files with 1,299 additions and 1,189 deletions.
6 changes: 3 additions & 3 deletions gamefixes-egs/umu-990080.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""" Game fix Hogwarts Legacy
"""
#pylint: disable=C0103
"""Game fix Hogwarts Legacy"""
# pylint: disable=C0103

from protonfixes import util


def main():
# Requires vcrun2019 to launch
util.protontricks('vcrun2019')
6 changes: 3 additions & 3 deletions gamefixes-gog/umu-1228964594.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""" Game fix for Soldier of Fortune II: Double Helix - Gold Edition
"""
#pylint: disable=C0103
"""Game fix for Soldier of Fortune II: Double Helix - Gold Edition"""
# pylint: disable=C0103

from protonfixes import util


def main():
# Fix display issues
util.set_environment('MESA_EXTENSION_MAX_YEAR', '2003')
Expand Down
30 changes: 15 additions & 15 deletions gamefixes-gog/umu-1564851593.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
from protonfixes.logger import log

# Archive containing the text injecting framework
arc = "https://github.com/user-attachments/files/16136393/d3d9-2206220222.zip"
arc = 'https://github.com/user-attachments/files/16136393/d3d9-2206220222.zip'

# Digest of the archive, d3d9.dll proxy and JSON
hashsum_arc = "caed98ec44d4270290f0652502344a40c1d45216caa8935b41e7d9f461ae2d24"
hashsum_d3d9 = "17e1c6706c684b19d05e89b588ba5101bf3ee40429cecf803c6e98af9b342129"
hashsum_config = "aecb441fdc9c9e2ba78df63dfbe14f48c31dfd5ad571adba988ba362fc814377"
hashsum_arc = 'caed98ec44d4270290f0652502344a40c1d45216caa8935b41e7d9f461ae2d24'
hashsum_d3d9 = '17e1c6706c684b19d05e89b588ba5101bf3ee40429cecf803c6e98af9b342129'
hashsum_config = 'aecb441fdc9c9e2ba78df63dfbe14f48c31dfd5ad571adba988ba362fc814377'


def main(): # pylint: disable=R0914
tmp = f"{mkdtemp()}/d3d9-2206220222.zip"
tmp = f'{mkdtemp()}/d3d9-2206220222.zip'
install_dir = util.get_game_install_path()
path_config = f"{install_dir}/config.json"
path_dll = f"{install_dir}/d3d9.dll"
path_config = f'{install_dir}/config.json'
path_dll = f'{install_dir}/d3d9.dll'
hashsum = sha256()

# Ensure that the text injection files do not already exist before opening
Expand All @@ -36,8 +36,8 @@ def main(): # pylint: disable=R0914
)
return

config = open(path_config, mode="rb") # pylint: disable=R1732
dll = open(path_dll, mode="rb") # pylint: disable=R1732
config = open(path_config, mode='rb') # pylint: disable=R1732
dll = open(path_dll, mode='rb') # pylint: disable=R1732

# Check if the text injection framework files have already been replaced
if (
Expand All @@ -57,10 +57,10 @@ def main(): # pylint: disable=R0914
# Download the archive
with urlopen(arc, timeout=30) as resp:
if resp.status != 200:
log.warning(f"github returned the status code: {resp.status}")
log.warning(f'github returned the status code: {resp.status}')
return

with open(tmp, mode="wb", buffering=0) as file:
with open(tmp, mode='wb', buffering=0) as file:
chunk_size = 64 * 1024 # 64 KB
buffer = bytearray(chunk_size)
view = memoryview(buffer)
Expand All @@ -70,7 +70,7 @@ def main(): # pylint: disable=R0914
hashsum.update(view[:size])

if hashsum_arc != hashsum.hexdigest():
log.warning(f"Digest mismatch: {arc}")
log.warning(f'Digest mismatch: {arc}')
log.warn(f"Expected '{hashsum_arc}', skipping...")
return

Expand All @@ -82,10 +82,10 @@ def main(): # pylint: disable=R0914
randstr = os.urandom(16).hex()
log.info(f"Renaming 'config.json' -> '.{randstr}.config.json.bak'")
log.info(f"Renaming 'd3d9.dll' -> '.{randstr}.d3d9.dll.bak'")
os.rename(path_config, f"{install_dir}/.{randstr}.config.json.bak")
os.rename(path_dll, f"{install_dir}/.{randstr}.d3d9.dll.bak")
os.rename(path_config, f'{install_dir}/.{randstr}.config.json.bak')
os.rename(path_dll, f'{install_dir}/.{randstr}.d3d9.dll.bak')

with ZipFile(tmp, mode="r") as zipfile:
with ZipFile(tmp, mode='r') as zipfile:
log.info("Fixing in-game font for 'Flowers - Le Volume Sur Hiver'...")
zipfile.extractall(install_dir)

Expand Down
6 changes: 3 additions & 3 deletions gamefixes-gog/umu-1580232252.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""" Resident Evil (1997)
"""
#pylint: disable=C0103
"""Resident Evil (1997)"""
# pylint: disable=C0103

from protonfixes import util


def main():
util.winedll_override('ddraw', 'n,b')
util.winedll_override('dinput', 'n,b')
6 changes: 3 additions & 3 deletions gamefixes-gog/umu-22610.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
""" Alien Breed: Impact
"""
#pylint: disable=C0103
"""Alien Breed: Impact"""
# pylint: disable=C0103

from protonfixes import util


def main():
util.protontricks('physx')
6 changes: 3 additions & 3 deletions gamefixes-gog/umu-22650.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
""" Alien Breed 2: Assault
"""
#pylint: disable=C0103
"""Alien Breed 2: Assault"""
# pylint: disable=C0103

from protonfixes import util


def main():
util.protontricks('physx')
6 changes: 3 additions & 3 deletions gamefixes-gog/umu-22670.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
""" Alien Breed 3: Descent
"""
#pylint: disable=C0103
"""Alien Breed 3: Descent"""
# pylint: disable=C0103

from protonfixes import util


def main():
util.protontricks('physx')
5 changes: 3 additions & 2 deletions gamefixes-gog/umu-metalgearsolid.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
"""
METAL GEAR SOLID
"""
#pylint: disable=C0103
# pylint: disable=C0103

from protonfixes import util


def main():
"""
override for wrapper shipped with the game
Expand Down
15 changes: 10 additions & 5 deletions gamefixes-gog/umu-silenthill4.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
"""
"""
Silent Hill 4: The Room
"""
#pylint: disable=C0103
# pylint: disable=C0103

from protonfixes import util


def main():
util.winedll_override('d3d8', 'n,b') # GOG's dxcfg / Steam006 fixes
util.winedll_override('dinput8', 'n,b') # GOG's controller fix / Silent Hill 4: Wrapper by Nemesis / ThirteenAG's widescreen fix
util.winedll_override('dsound', 'n,b') # Ultimate ASI Loader / Silent Hill 4 Randomizer
util.winedll_override('d3d8', 'n,b') # GOG's dxcfg / Steam006 fixes
util.winedll_override(
'dinput8', 'n,b'
) # GOG's controller fix / Silent Hill 4: Wrapper by Nemesis / ThirteenAG's widescreen fix
util.winedll_override(
'dsound', 'n,b'
) # Ultimate ASI Loader / Silent Hill 4 Randomizer
7 changes: 4 additions & 3 deletions gamefixes-gog/umu-wheeloftime.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""
"""
The Wheel of Time
"""
#pylint: disable=C0103
# pylint: disable=C0103

from protonfixes import util


def main():
util.winedll_override('ddraw', 'n,b') # GOG's dxcfg
util.winedll_override('ddraw', 'n,b') # GOG's dxcfg
9 changes: 4 additions & 5 deletions gamefixes-steam/1017900.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
""" Game fix for Age of Empires: DE
"""
#pylint: disable=C0103
"""Game fix for Age of Empires: DE"""
# pylint: disable=C0103

from protonfixes import util


def main():
""" Changes the proton argument from the launcher to the game
"""
"""Changes the proton argument from the launcher to the game"""

# Replace launcher with game exe in proton arguments
util.append_argument('-NoStartup')
6 changes: 3 additions & 3 deletions gamefixes-steam/10220.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""" Postal III
"""
#pylint: disable=C0103
"""Postal III"""
# pylint: disable=C0103

from protonfixes import util


# Missing fonts for console and various UI
# grep -rh --include "*.res" '"name"' . | awk -F '"' '{print $4}' | awk '!visited[$0]++'
def main():
Expand Down
9 changes: 4 additions & 5 deletions gamefixes-steam/1030830.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
""" Game fix for Mafia II Definitive Edition
"""
#pylint: disable=C0103
"""Game fix for Mafia II Definitive Edition"""
# pylint: disable=C0103

from protonfixes import util


def main():
""" Enable NVIDIA PhysX support.
"""
"""Enable NVIDIA PhysX support."""
util.protontricks('physx')
7 changes: 4 additions & 3 deletions gamefixes-steam/105000.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
""" A New Beginning - Final Cut
"""A New Beginning - Final Cut
https://github.com/ValveSoftware/Proton/issues/1412
No cutscene audio in Daedalic Games (Memoria, The Night of the Rabbit, A New Beginning - Final Cut) (105000 230820 243200) #1412
No cutscene audio in Daedalic Games (Memoria, The Night of the Rabbit, A New Beginning - Final Cut) (105000 230820 243200) #1412
"""
#pylint: disable=C0103
# pylint: disable=C0103

from protonfixes import util


def main():
util.winedll_override('xaudio2_7', 'd')
14 changes: 10 additions & 4 deletions gamefixes-steam/105400.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
""" Game fix for Fable III
"""
"""Game fix for Fable III"""

#pylint: disable=C0103
# pylint: disable=C0103

import os
import shutil
Expand All @@ -15,7 +14,14 @@ def main():
util.protontricks('xliveless')

# Remove Windows Live folder
dirpath = os.path.join(util.protonprefix(),"drive_c","Program Files","Common Files","Microsoft Shared","Windows Live")
dirpath = os.path.join(
util.protonprefix(),
'drive_c',
'Program Files',
'Common Files',
'Microsoft Shared',
'Windows Live',
)
if os.path.exists(dirpath):
shutil.rmtree(dirpath)
else:
Expand Down
9 changes: 4 additions & 5 deletions gamefixes-steam/105450.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
""" Game fix for Age Of Empire 3: Complete Collection
"""
#pylint: disable=C0103
"""Game fix for Age Of Empire 3: Complete Collection"""
# pylint: disable=C0103

from protonfixes import util


def main():
""" installs corefonts, l3codecx, mfc42, winxp
"""
"""installs corefonts, l3codecx, mfc42, winxp"""

# https://github.com/ValveSoftware/Proton/issues/17#issuecomment-415977510
util.protontricks('mfc42')
Expand Down
8 changes: 4 additions & 4 deletions gamefixes-steam/1056640.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
""" Game fix for Phantasy Star Online 2
"""
#pylint: disable=C0103
"""Game fix for Phantasy Star Online 2"""
# pylint: disable=C0103

from protonfixes import util


def main():
util.set_environment('WINE_NO_OPEN_FILE_SEARCH','pso2_bin/data')
util.set_environment('WINE_NO_OPEN_FILE_SEARCH', 'pso2_bin/data')
9 changes: 4 additions & 5 deletions gamefixes-steam/1062040.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
""" Dragon Star Varnir
"""
#pylint: disable=C0103
"""Dragon Star Varnir"""

# pylint: disable=C0103
from protonfixes import util


def main():
""" Dragon Star Varnir fix
"""
"""Dragon Star Varnir fix"""
# Fixes the startup process.
util.winedll_override('xactengine3_7', 'n')
9 changes: 4 additions & 5 deletions gamefixes-steam/1063730.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
""" Game fix for New World
"""
#pylint: disable=C0103
"""Game fix for New World"""
# pylint: disable=C0103

from protonfixes import util


def main():
""" Needs core count limit
"""
"""Needs core count limit"""
# Fix the startup process:
util.set_cpu_topology_limit(12)
6 changes: 2 additions & 4 deletions gamefixes-steam/108710.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
""" Alan Wake
"""
"""Alan Wake"""

from protonfixes import util


def main():
""" Installs d3dcompiler_47
"""
"""Installs d3dcompiler_47"""

# Fixes error on launch
util.protontricks('d3dcompiler_47')
10 changes: 5 additions & 5 deletions gamefixes-steam/1097150.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
""" Game fix for Fall Guys
"""
#pylint: disable=C0103
"""Game fix for Fall Guys"""

# pylint: disable=C0103
from protonfixes import util


def main():
""" Create symlink of eac so at the right location
"""
"""Create symlink of eac so at the right location"""
util.install_eac_runtime()
util.set_environment('DOTNET_BUNDLE_EXTRACT_BASE_DIR', '')
6 changes: 2 additions & 4 deletions gamefixes-steam/1097880.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
""" Game fix for Super Naughty Maid 2
"""
"""Game fix for Super Naughty Maid 2"""

from protonfixes import util


def main():
""" installs quartz, wmp9
"""
"""installs quartz, wmp9"""

# The whole game is only videos and require wmp9 & quartz
util.protontricks('quartz')
Expand Down
Loading

0 comments on commit aba4cae

Please sign in to comment.