Skip to content

Commit

Permalink
ReShade: Copy DLL name to game EXE folder
Browse files Browse the repository at this point in the history
  • Loading branch information
sonic2kk committed Aug 20, 2023
1 parent de141b4 commit 07140be
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PREFIX="/usr"
PROGNAME="SteamTinkerLaunch"
NICEPROGNAME="Steam Tinker Launch"
PROGVERS="v14.0.20230821-1 (reshade-dll-custom-name)"
PROGVERS="v14.0.20230821-2 (reshade-dll-custom-name)"
PROGCMD="${0##*/}"
SHOSTL="stl"
GHURL="https://github.com"
Expand Down Expand Up @@ -8555,6 +8555,8 @@ function chooseShaders {
fi
}

# TODO The NOD3D9 option is no longer used, so flag $2 can probably be skipped entirely in future
# There is possibly room for improvement with this function, since the logic around ReShade has been simplified
function installRSdll {
if [ ! -f "$INSTDESTDIR/$1" ] || [ "$1" == "F" ]; then
if [ -n "$2" ] && [ "$2" -eq 1 ]; then
Expand Down Expand Up @@ -8592,6 +8594,11 @@ function installReshade {

INSTDESTDIR="$SHADDESTDIR"

# Default ReShade DLL name to use to dxgi.dll if no DLL name is provided
if [ -z "$RESHADEDLLNAME" ]; then
RESHADEDLLNAME="$DXGI"
fi

# checking for previous dll conficts between $RS_DX_DEST and $RS_D9_DEST
# note: modern ReShade uses "ReShade_exenamehere.log", and old versions use "dxgi.log" (if ReShade dll is named dxgi.dll). we support both names.
RESHADE_CONFLICTS=$(find "$INSTDESTDIR" -maxdepth 1 \( -name "${RS_DX_DEST//.dll/.log}" -or -name "ReShade_*.log" \) -print0 | xargs -0 -r grep -l "Another ReShade instance was already loaded from" | wc -l)
Expand Down Expand Up @@ -8619,27 +8626,39 @@ function installReshade {
CHARCH="$GP"
fi

# TODO use $RESHADEDLLNAME
if [ -d "$INSTDESTDIR" ]; then
# TODO this could probably be simplified now that the ReShade logic is simpler
#32bit:
if [ "$(getArch "$CHARCH")" == "32" ]; then
writelog "INFO" "${FUNCNAME[0]} - Installing 32bit ${RESH} as '$CHARCH' is 32bit"
#d3d47
#d3d47 - Required for ReShade
installd3d47dll "$D3D47_32" "$INSTDESTDIR"

# actual ReShade DLL name (either d3d9/d3d11/dxgi, or a custom user selected name)
# TODO handle comma-separated ReShade DLL names
installRSdll "$RESHADEDLLNAME" "0" "$RS_32"

## LEGACY
#dxgi:
installRSdll "$RS_DX_DEST" "0" "$RS_32"
# installRSdll "$RS_DX_DEST" "0" "$RS_32"
#d3d9:
installRSdll "$RS_D9_DEST" "$NOD3D9" "$RS_32"
# installRSdll "$RS_D9_DEST" "$NOD3D9" "$RS_32"

# 64bit:
elif [ "$(getArch "$CHARCH")" == "64" ]; then
writelog "INFO" "${FUNCNAME[0]} - Installing 64bit ${RESH} as '$CHARCH' is 64bit"
#d3d47
installd3d47dll "$D3D47_64" "$INSTDESTDIR"

# actual ReShade DLL name (either d3d9/d3d11/dxgi, or a custom user selected name)
# TODO handle comma-separated ReShade DLL names
installRSdll "$RESHADEDLLNAME" "0" "$RS_64"

## LEGACY
#dxgi:
installRSdll "$RS_DX_DEST" "0" "$RS_64"
# installRSdll "$RS_DX_DEST" "0" "$RS_64"
#d3d9:
installRSdll "$RS_D9_DEST" "$NOD3D9" "$RS_64"
# installRSdll "$RS_D9_DEST" "$NOD3D9" "$RS_64"
else
writelog "SKIP" "${FUNCNAME[0]} - ERROR in ${RESH} installation - no file information detected for '$CHARCH' or any 'neighbor file' - setting USERESHADE=0 for this session"
export USERESHADE=0
Expand Down

0 comments on commit 07140be

Please sign in to comment.