-
-
Save pchome/da43ab29de689cc3c21445e2c7fb0676 to your computer and use it in GitHub Desktop.
Change user settings env vars using protonfixes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from protonfixes import util | |
from protonfixes import log | |
def main(): | |
""" GTA IV: EFLC game | |
""" | |
log.info('Applying fixes for GTA IV: EFLC') | |
util.append_argument('-windowed') | |
util.append_argument('-nomemrestrict') | |
util.append_argument('-norestrictions') | |
util.append_argument('-fullspecaudio') | |
util.ld_preload_remove('gameoverlayrenderer.so') | |
def game_settings(): | |
log.info('Applying settings for GTA IV: EFLC') | |
#log.debug('PWD: ' + util.game_install_path()) | |
return { | |
# Proton ------ | |
# Use wined3d for d3d11 instead of dxvk | |
"PROTON_USE_WINED3D11": "1", | |
# Use nvapi/nvcuda | |
"PROTON_USE_NVAPI" : "1", | |
# Nvidia ------ | |
#"__GL_YIELD" : "USLEEP", | |
#"__GL_THREADED_OPTIMIZATIONS" : "1", | |
#"__GL_SYNC_TO_VBLANK" : "0", | |
"__GL_SHADER_DISK_CACHE_PATH" : util.game_install_path(), | |
# strangle ------ | |
# https://gitlab.com/torkel104/libstrangle | |
# | |
# OpenGL | |
# -1 - Adaptive sync (unconfirmed if this actually works) | |
# 0 - Force off | |
# 1 - Force on | |
# n - Sync to refresh rate / n. | |
# Vulkan | |
# 0 - Force off | |
# 1 - Mailbox mode. Vsync with uncapped framerate. | |
# 2 - Traditional vsync with framerate capped to refresh rate. | |
# 3 - Adaptive vsync with tearing at low framerates. | |
"VSYNC" : "0", | |
"FPS" : "120", | |
# You can adjust the mipmap lod bias in both opengl and vulkan with the environment variable PICMIP. | |
# A higher value means blurrier textures. A negative value could make textures crisper. | |
"PICMIP" : "-1", | |
# Might crash if used together with other libs that hijack dlsym, such as Steam Overlay. | |
# It seems to work with Steam Overlay when placed at the end of LD_PRELOAD for some reason. | |
#"LD_PRELOAD" : util.ld_preload("libstrangle.so:libstrangle64.so"), | |
"LD_PRELOAD" : util.ld_preload("libstrangle.so"), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Gets the game id and applies a fix for user_settings if found | |
""" | |
from __future__ import print_function | |
import os | |
import re | |
import sys | |
from importlib import import_module | |
from . import log | |
def game_id(): | |
""" Trys to return the game id from environment variables | |
""" | |
if 'SteamAppId' in os.environ: | |
return os.environ['SteamAppId'] | |
if 'SteamGameId' in os.environ: | |
return os.environ['SteamGameId'] | |
if 'STEAM_COMPAT_DATA_PATH' in os.environ: | |
return re.findall(r'\d+', os.environ['STEAM_COMPAT_DATA_PATH'])[-1] | |
log.info('Game ID not found in environment variables') | |
return None | |
def game_settings(): | |
""" Loads a gamefix module by it's gameid | |
""" | |
if not 'waitforexitandrun' in sys.argv[1]: | |
return {} | |
gameid = game_id() | |
if gameid is not None: | |
localpath = os.path.expanduser('~/.config/protonfixes/localfixes') | |
if os.path.isfile(os.path.join(localpath, gameid + '.py')): | |
open(os.path.join(localpath, '__init__.py'), 'a').close() | |
sys.path.append(os.path.expanduser('~/.config/protonfixes')) | |
try: | |
game_module = import_module('localfixes.' + gameid) | |
log.info('Using local protonfix settings for gameid ' + gameid) | |
return game_module.game_settings() | |
except ImportError: | |
log.info('No local protonfix settings found for gameid ' + gameid) | |
else: | |
try: | |
game_module = import_module('protonfixes.gamefixes.' + gameid) | |
log.info('Using protonfix settings for gameid ' + gameid) | |
return game_module.game_settings() | |
except ImportError: | |
log.info('No protonfix settings found for gameid ' + gameid) | |
log.info('No protonfix settings found for gameid ' + game_id()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#to enable these settings, name this file "user_settings.py" | |
user_settings = { | |
#logs are saved to $HOME/steam-$STEAM_APP_ID.log, overwriting any previous log with that name | |
#"WINEDEBUG": "+timestamp,+pid,+tid,+seh,+debugstr,+module", | |
"DXVK_LOG_LEVEL": "info", | |
} | |
# protonfixes | |
# $XDG_CONFIG_HOME/protonfixes/localfixes/ for local changes | |
# https://github.com/simons-public/protonfixes | |
import protonfixes | |
from protonfixes import settings | |
from protonfixes import log | |
try: | |
user_settings.update(settings.game_settings()) | |
except: | |
log.err('Protonfixes settings FAILED') | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment