Skip to content

Commit

Permalink
Changed LiteralTypes to Enum classes
Browse files Browse the repository at this point in the history
- Logger: use Enum values for colors
- Use default parameters, if argument is equal
  • Loading branch information
Root-Core committed Jan 8, 2025
1 parent e106c5c commit a89786d
Show file tree
Hide file tree
Showing 40 changed files with 160 additions and 129 deletions.
18 changes: 9 additions & 9 deletions engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import sys

from .logger import log, LogLevelType
from .logger import log, LogLevel


class Engine:
Expand Down Expand Up @@ -90,7 +90,7 @@ def _is_ue4(self) -> bool:
"""Detect Unreal Engine 4"""
return False

def _log(self, ctx: str, msg: str, level: LogLevelType = 'INFO') -> None:
def _log(self, ctx: str, msg: str, level: LogLevel = LogLevel.INFO) -> None:
"""Log wrapper"""
if self.engine_name is None:
log.warn(ctx + ': Engine not defined')
Expand All @@ -117,7 +117,7 @@ def nosplash(self) -> bool:
self._add_argument('-nosplash')
self._log('nosplash', 'splash screen disabled')
else:
self._log('nosplash', 'not supported', 'WARN')
self._log('nosplash', 'not supported', LogLevel.WARN)
return False
return True

Expand All @@ -127,7 +127,7 @@ def info(self) -> bool:
self._add_argument('-help')
self._log('info', 'command line arguments')
else:
self._log('info', 'not supported', 'WARN')
self._log('info', 'not supported', LogLevel.WARN)
return False
return True

Expand All @@ -140,7 +140,7 @@ def nointro(self) -> bool:
self._add_argument('-skipintro')
self._log('nointro', 'intro videos disabled')
else:
self._log('nointro', 'not supported', 'WARN')
self._log('nointro', 'not supported', LogLevel.WARN)
return False
return True

Expand All @@ -150,7 +150,7 @@ def launcher(self) -> bool:
self._add_argument('-show-screen-selector')
self._log('launcher', 'forced')
else:
self._log('launcher', 'not supported', 'WARN')
self._log('launcher', 'not supported', LogLevel.WARN)
return False
return True

Expand All @@ -163,14 +163,14 @@ def windowed(self) -> bool:
self._add_argument('-windowed')
self._log('windowed', 'window')
else:
self._log('windowed', 'not supported', 'WARN')
self._log('windowed', 'not supported', LogLevel.WARN)
return False
return True

def resolution(self, res: str) -> bool:
"""Force screen resolution"""
if not isinstance(res, str):
self._log('resolution', 'not provided', 'WARN')
self._log('resolution', 'not provided', LogLevel.WARN)
return False

res_wh = res.split('x')
Expand All @@ -184,7 +184,7 @@ def resolution(self, res: str) -> bool:
self._add_argument('-width ' + res_wh[0] + ' -height ' + res_wh[1])
self._log('resolution', res)
else:
self._log('resolution', 'not supported', 'WARN')
self._log('resolution', 'not supported', LogLevel.WARN)
return False
return True

Expand Down
9 changes: 5 additions & 4 deletions gamefixes-gog/umu-1141086411.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@


def main() -> None:
util.winedll_override('d3d8', 'n,b') # GOG's dxcfg / Steam006 fixes
util.winedll_override(
'dsound', 'n,b'
) # Ultimate ASI Loader / Silent Hill 4 Randomizer
# GOG's dxcfg / Steam006 fixes
util.winedll_override('d3d8', util.DllOverride.NATIVE_BUILTIN)

# Ultimate ASI Loader / Silent Hill 4 Randomizer
util.winedll_override('dsound', util.DllOverride.NATIVE_BUILTIN)
4 changes: 2 additions & 2 deletions gamefixes-gog/umu-1580232252.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@


def main() -> None:
util.winedll_override('ddraw', 'n,b')
util.winedll_override('dinput', 'n,b')
util.winedll_override('ddraw', util.DllOverride.NATIVE_BUILTIN)
util.winedll_override('dinput', util.DllOverride.NATIVE_BUILTIN)
2 changes: 1 addition & 1 deletion gamefixes-gog/umu-1584652180.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@


def main() -> None:
util.winedll_override('ddraw', 'n,b') # GOG's dxcfg
util.winedll_override('ddraw', util.DllOverride.NATIVE_BUILTIN) # GOG's dxcfg
4 changes: 2 additions & 2 deletions gamefixes-gog/umu-1771973390.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

def main() -> None:
"""Override for wrapper shipped with the game"""
util.winedll_override('ddraw', 'n,b')
util.winedll_override('dinput', 'n,b')
util.winedll_override('ddraw', util.DllOverride.NATIVE_BUILTIN)
util.winedll_override('dinput', util.DllOverride.NATIVE_BUILTIN)
2 changes: 1 addition & 1 deletion gamefixes-steam/105000.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@


def main() -> None:
util.winedll_override('xaudio2_7', '')
util.winedll_override('xaudio2_7', util.DllOverride.DISABLED)
2 changes: 1 addition & 1 deletion gamefixes-steam/1062040.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
def main() -> None:
"""Dragon Star Varnir fix"""
# Fixes the startup process.
util.winedll_override('xactengine3_7', 'n')
util.winedll_override('xactengine3_7', util.DllOverride.NATIVE)
2 changes: 1 addition & 1 deletion gamefixes-steam/1286880.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

def main() -> None:
"""Needs builtin vulkan-1"""
util.winedll_override('vulkan-1', 'b')
util.winedll_override('vulkan-1', util.DllOverride.BUILTIN)
4 changes: 2 additions & 2 deletions gamefixes-steam/1500540.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@


def main() -> None:
util.winedll_override('dinput', 'n,b') # DxWrapper component
util.winedll_override('winmm', 'n,b') # Music playback
util.winedll_override('dinput', util.DllOverride.NATIVE_BUILTIN) # DxWrapper component
util.winedll_override('winmm', util.DllOverride.NATIVE_BUILTIN) # Music playback
2 changes: 1 addition & 1 deletion gamefixes-steam/1664350.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

def main() -> None:
"""Needs builtin vulkan-1"""
util.winedll_override('vulkan-1', 'b')
util.winedll_override('vulkan-1', util.DllOverride.BUILTIN)
2 changes: 1 addition & 1 deletion gamefixes-steam/1681970.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

def main() -> None:
util.protontricks('klite')
util.winedll_override('winegstreamer', '')
util.winedll_override('winegstreamer', util.DllOverride.DISABLED)
# it uses quartz instead of mfplat on win7
util.protontricks('win7')
2 changes: 1 addition & 1 deletion gamefixes-steam/200490.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@


def main() -> None:
util.winedll_override('libvkd3d-1', 'n')
util.winedll_override('libvkd3d-1', util.DllOverride.NATIVE)
util.protontricks('wmp11')
2 changes: 1 addition & 1 deletion gamefixes-steam/201480.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def main() -> None:
util.protontricks('dsound')
util.protontricks('dswave')
util.protontricks('directplay')
util.winedll_override('streamci', 'n')
util.winedll_override('streamci', util.DllOverride.NATIVE)
2 changes: 1 addition & 1 deletion gamefixes-steam/206480.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ def main() -> None:
"""Disable libglesv2"""
# gpu acceleration on wined3d https://bugs.winehq.org/show_bug.cgi?id=44985
# Make the store work.
util.winedll_override('libglesv2', '')
util.winedll_override('libglesv2', util.DllOverride.DISABLED)
2 changes: 1 addition & 1 deletion gamefixes-steam/212500.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ def main() -> None:
"""Disable libglesv2"""
## gpu acelleration on wined3d https://bugs.winehq.org/show_bug.cgi?id=44985
# Make the store work.
util.winedll_override('libglesv2', '')
util.winedll_override('libglesv2', util.DllOverride.DISABLED)
2 changes: 1 addition & 1 deletion gamefixes-steam/223750.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ def main() -> None:
util.protontricks('d3dx11_43')
util.protontricks('d3dcompiler_43')
util.protontricks('d3dcompiler_47')
util.winedll_override('wbemprox', 'n') # doesn't seem to be strictly needed
util.winedll_override('wbemprox', util.DllOverride.NATIVE) # doesn't seem to be strictly needed
2 changes: 1 addition & 1 deletion gamefixes-steam/230820.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@


def main() -> None:
util.winedll_override('xaudio2_7', '')
util.winedll_override('xaudio2_7', util.DllOverride.DISABLED)
3 changes: 2 additions & 1 deletion gamefixes-steam/23460.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

def main() -> None:
util.protontricks('dotnet35sp1')
util.winedll_override('libvkd3d-1', util.DllOverride.NATIVE)

# Videos play and audio works but screen is black.
# util.protontricks('quartz')
# util.protontricks('klite')
if os.path.isdir('./data/shared/videos'):
subprocess.call(['mv', './data/shared/videos', './data/shared/_videos'])
util.winedll_override('libvkd3d-1', 'n')
2 changes: 1 addition & 1 deletion gamefixes-steam/237890.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

def main() -> None:
util.protontricks('wmp9')
util.winedll_override('winegstreamer', '')
util.winedll_override('winegstreamer', util.DllOverride.DISABLED)
2 changes: 1 addition & 1 deletion gamefixes-steam/243200.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@


def main() -> None:
util.winedll_override('xaudio2_7', '')
util.winedll_override('xaudio2_7', util.DllOverride.DISABLED)
2 changes: 1 addition & 1 deletion gamefixes-steam/244210.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ def main() -> None:
# Fixes Content Manager (black windows)
util.protontricks('d3dx11_43')
util.protontricks('d3dcompiler_47')
util.winedll_override('dwrite', 'n,b')
util.winedll_override('dwrite', util.DllOverride.NATIVE_BUILTIN)
util.protontricks('win10')
util.set_environment('PULSE_LATENCY_MSEC', '60')
2 changes: 1 addition & 1 deletion gamefixes-steam/244850.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def main() -> None:
<gcServer enabled = "true" />
"""

util.set_xml_options(base_attibutte, game_opts, 'SpaceEngineers.exe.config', 'game')
util.set_xml_options(base_attibutte, game_opts, 'SpaceEngineers.exe.config')

util.append_argument('-skipintro')
4 changes: 2 additions & 2 deletions gamefixes-steam/287310.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
def main() -> None:
"""Sets the necessary dll overrides for the wrappers that are shipped with the game"""
# Set overrides
util.winedll_override('ddraw', 'n')
util.winedll_override('dinput', 'n')
util.winedll_override('ddraw', util.DllOverride.NATIVE)
util.winedll_override('dinput', util.DllOverride.NATIVE)
9 changes: 5 additions & 4 deletions gamefixes-steam/292410.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@


def main() -> None:
util.protontricks('lavfilters') # fix videos
util.winedll_override(
'd3d9', 'n,b'
) # in case user uses the ThirteenAG widescreen fix
# fix videos
util.protontricks('lavfilters')

# in case user uses the ThirteenAG widescreen fix
util.winedll_override('d3d9', util.DllOverride.NATIVE_BUILTIN)
2 changes: 1 addition & 1 deletion gamefixes-steam/33990.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@


def main() -> None:
util.winedll_override('libvkd3d-1', 'n')
util.winedll_override('libvkd3d-1', util.DllOverride.NATIVE)
util.protontricks('wmp11')
3 changes: 1 addition & 2 deletions gamefixes-steam/39500.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Game fix for Gothic 3"""

import os
from protonfixes import util


Expand All @@ -12,4 +11,4 @@ def main() -> None:
FpS.Max=0
"""

util.set_ini_options(game_opts, os.path.join('Ini', 'ge3.ini'), 'cp1251', 'game')
util.set_ini_options(game_opts, 'Ini/ge3.ini', 'cp1251')
4 changes: 2 additions & 2 deletions gamefixes-steam/559620.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

def main() -> None:
# Override ddraw (cutscenes+menu perf) and WinMM (Music)
util.winedll_override('ddraw', 'n,b')
util.winedll_override('winmm', 'n,b')
util.winedll_override('ddraw', util.DllOverride.NATIVE_BUILTIN)
util.winedll_override('winmm', util.DllOverride.NATIVE_BUILTIN)
2 changes: 1 addition & 1 deletion gamefixes-steam/593600.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

def main() -> None:
"""Overrides the mprapi.dll to native."""
util.winedll_override('mprapi', 'n')
util.winedll_override('mprapi', util.DllOverride.NATIVE)
2 changes: 1 addition & 1 deletion gamefixes-steam/63710.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ def main() -> None:
"""From: https://www.protondb.com/app/63710"""
util.protontricks('d3dcompiler_43')
util.protontricks('d3dx9_43')
util.winedll_override('openal32', 'b')
util.winedll_override('openal32', util.DllOverride.BUILTIN)
8 changes: 4 additions & 4 deletions gamefixes-steam/65540.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def main() -> None:

# Fix background music / Gothic 2 startup
util.protontricks('directmusic')
util.winedll_override('*dsound', 'b') # Override registry entry
util.winedll_override('*dsound', util.DllOverride.BUILTIN) # Override registry entry

# Fix crackling audio
util.set_environment('PULSE_LATENCY_MSEC', '90')
Expand All @@ -21,12 +21,12 @@ def main() -> None:
# Gothic 2: https://steamcommunity.com/sharedfiles/filedetails/?id=2787015529
#
# This might also be necessary for the GOG release
util.winedll_override('ddraw', 'n,b')
util.winedll_override('ddraw', util.DllOverride.NATIVE_BUILTIN)

# Fix extreme mouse stutter and allow additional use of 'GRawInput (mouse fix)' from workshop
# Gothic 1: https://steamcommunity.com/sharedfiles/filedetails/?id=3054112346
# Gothic 2: https://steamcommunity.com/sharedfiles/filedetails/?id=3054078559
util.winedll_override('dinput', 'n,b')
util.winedll_override('dinput', util.DllOverride.NATIVE_BUILTIN)


def set_resolution() -> None:
Expand All @@ -51,4 +51,4 @@ def set_resolution() -> None:
"""
)

util.set_ini_options(game_opts, 'system/Gothic.ini', 'cp1251', 'game')
util.set_ini_options(game_opts, 'system/Gothic.ini', 'cp1251')
2 changes: 1 addition & 1 deletion gamefixes-steam/70400.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def main() -> None:
util.protontricks('dmusic')
util.protontricks('dsound')
util.protontricks('dswave')
util.winedll_override('streamci', 'n')
util.winedll_override('streamci', util.DllOverride.NATIVE)
util.protontricks('sound=alsa')

""" Fix for audio stutter/desync
Expand Down
2 changes: 1 addition & 1 deletion gamefixes-steam/70420.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def main() -> None:
util.protontricks('dmusic')
util.protontricks('dsound')
util.protontricks('dswave')
util.winedll_override('streamci', 'n')
util.winedll_override('streamci', util.DllOverride.NATIVE)
util.protontricks('sound=alsa')

""" Fix for audio stutter/desync
Expand Down
2 changes: 1 addition & 1 deletion gamefixes-steam/950670.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def modify_settings() -> None:
r.DepthOfFieldQuality=0
r.LensFlareQuality=0
"""
util.set_ini_options(game_opts, path, 'utf-8', 'game')
util.set_ini_options(game_opts, path)


def clear_logs() -> None:
Expand Down
2 changes: 1 addition & 1 deletion gamefixes-steam/968370.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@


def main() -> None:
util.winedll_override('d3d9', '')
util.winedll_override('d3d9', util.DllOverride.DISABLED)
util.protontricks('segoe_script')
2 changes: 1 addition & 1 deletion gamefixes-umu/umu-silenthill3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
def main() -> None:
# Needs directmusic for some cutscenes
util.protontricks('directmusic')
util.winedll_override('dsound', 'builtin')
util.winedll_override('dsound', util.DllOverride.NATIVE_BUILTIN)
2 changes: 1 addition & 1 deletion gamefixes-umu/umu-starcitizen.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ def main() -> None:
util.protontricks('powershell')

# RSI Launcher animation
util.winedll_override('libglesv2', 'b')
util.winedll_override('libglesv2', util.DllOverride.BUILTIN)
2 changes: 1 addition & 1 deletion gamefixes-zoomplatform/umu-240200.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@


def main() -> None:
util.winedll_override('d3d8', 'n,b')
util.winedll_override('d3d8', util.DllOverride.NATIVE_BUILTIN)
util.protontricks('vcrun2019')
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@


def main() -> None:
util.winedll_override('d3d8', 'n,b')
util.winedll_override('ddraw', 'b')
util.winedll_override('winmm', 'n,b')
util.winedll_override('d3d8', util.DllOverride.NATIVE_BUILTIN)
util.winedll_override('ddraw', util.DllOverride.BUILTIN)
util.winedll_override('winmm', util.DllOverride.NATIVE_BUILTIN)
Loading

0 comments on commit a89786d

Please sign in to comment.