-
-
Save strycore/31c4c6adc73407a19d17f3b838180533 to your computer and use it in GitHub Desktop.
DXVK helper script
This file contains hidden or 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
#!/bin/bash | |
### USER DEFINED VARIABLES | |
steam_path="/media/data/games/Steam" | |
# The Witness | |
# game_path="/media/data/games/Steam/steamapps/common/The Witness" | |
# game_exe="witness64_d3d11.exe" | |
# game_name="The Witness" | |
# Hellblade: Senua's Sacrifice | |
game_path="/media/data/games/Steam/steamapps/common/Hellblade" | |
game_exe="HellbladeGame.exe" | |
game_name="Hellblade" | |
# Strider | |
game_path="/media/data/games/Steam/steamapps/common/Strider" | |
game_exe="StriderX64_r.exe" | |
game_name="Strider" | |
prefix_path="/home/strider/Games/wine/prefixes/directx11" | |
### WINEDEBUG CONFIGURATION | |
# Best setting for maximum performance | |
# export WINEDEBUG=-all | |
# Default debug verbosity | |
# export WINEDEBUG= | |
# Output more Direct3D information, useful for bug reports. | |
# export WINEDEBUG=+tid,+d3d11,+d3d | |
### WINE CONFIGURATION | |
# WineHQ Staging (location for Ubuntu PPA) | |
export WINE="/opt/wine-staging/bin/wine" | |
# Latest Lutris Staging build | |
# export WINE="$HOME/.local/share/lutris/runners/wine/staging-2.21-x86_64/bin/wine" | |
# Prefix architecture | |
export WINEARCH=win64 | |
# Prefix path | |
export WINEPREFIX="$prefix_path" | |
root_path=$(pwd) | |
bin_path=$root_path/bin | |
log_path=$root_path/logs/ | |
log_file=$log_path/wine-$(date "+%s").log | |
mkdir -p $log_path | |
RunSteam() { | |
echo "Launching Steam" | |
cd $steam_path | |
$WINE Steam.exe > $log_file 2>&1 | |
} | |
RecompileShaders() { | |
dxvk_shaders_path="/tmp/dxvk-shaders" | |
rm -rf $dxvk_shaders_path | |
mv "$DXVK_SHADER_DUMP_PATH" $dxvk_shaders_path | |
decompiled_shaders_path="/tmp/dxvk-shaders-decompiled" | |
mkdir -p "$decompiled_shaders_path" | |
rm $dxvk_shaders_path/*.dxbc | |
for shader_file in $dxvk_shaders_path/* ; do | |
"${bin_path}/spirv-cross" --output "${decompiled_shaders_path}/$(basename $shader_file)" "$shader_file" --vulkan-semantics | |
done | |
recompiled_shaders_path="/tmp/dxvk-shaders-recompiled" | |
mkdir -p "$recompiled_shaders_path" | |
for shader_file in $decompiled_shaders_path/* ; do | |
shader_name=$(basename $shader_file) | |
shader_prefix="${shader_name:0:1}" | |
if [[ $shader_prefix == "V" ]]; then | |
shader_type="vert" | |
fi | |
if [[ $shader_prefix == "P" ]]; then | |
shader_type="frag" | |
fi | |
$bin_path/glslangValidator -V -S "$shader_type" -o "$recompiled_shaders_path/$shader_name" $shader_file | |
done | |
game_shaders_path="$game_path/dxvk_shaders" | |
rm -rf "$game_shaders_path" | |
# mv "$recompiled_shaders_path" "$game_shaders_path" | |
# rm -rf /tmp/dxvk-shaders* | |
} | |
RunGame() { | |
echo "Launching $game_name" | |
cd "$game_path" | |
# DXVK_SHADER_READ_PATH="./recompiled" | |
$WINE $game_exe # > $log_file 2>&1 | |
if [[ $DXVK_SHADER_DUMP_PATH ]]; then | |
# RecompileShaders | |
echo "Remember to recompile" | |
fi | |
} | |
### OPTION HANDLING | |
if [[ $1 == '--help' ]]; then | |
echo "dxvk helper script" | |
echo "Options:" | |
echo " --version: Display Wine version" | |
echo " --kill: Kill all running Wine processes" | |
echo " --boot: Run wineboot" | |
echo " --config: Run winecfg" | |
echo " --winetricks: Run winetricks" | |
echo " --regedit: Launch registry editor" | |
echo " --dump: Dump DX11 shaders" | |
exit | |
fi | |
if [[ $1 == '--version' ]]; then | |
${WINE} --version | |
exit | |
fi | |
if [[ $1 == '--kill' ]]; then | |
${WINE}server -k | |
exit | |
fi | |
if [[ $1 == '--boot' ]]; then | |
${WINE}boot | |
exit | |
fi | |
if [[ $1 == '--config' ]]; then | |
${WINE}cfg | |
exit | |
fi | |
if [[ $1 == '--winetricks' ]]; then | |
winetricks | |
exit | |
fi | |
if [[ $1 == '--regedit' ]]; then | |
$WINE regedit | |
exit | |
fi | |
if [[ $1 == '--dump' ]]; then | |
export DXVK_SHADER_DUMP_PATH="${game_path}/shaders" | |
mkdir -p "$DXVK_SHADER_DUMP_PATH" | |
shift | |
fi | |
if [[ $1 == '--apply' ]]; then | |
export | |
echo "Applying DXVK recompiled shaders from $DXVK_SHADER_READ_PATH" | |
shift | |
fi | |
if [[ $1 == 'run' ]]; then | |
# RunSteam & | |
# sleep 15 | |
RunGame | |
echo "exiting..." | |
fi | |
if [[ $1 == 'recompile' ]]; then | |
export DXVK_SHADER_DUMP_PATH="${game_path}/shaders" | |
RecompileShaders | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment