Linux script fixups (#550)

This commit is contained in:
Michał Lewandowski
2025-06-25 12:06:40 +02:00
committed by GitHub
parent 16d219f038
commit c487e78656
3 changed files with 75 additions and 106 deletions
+2 -1
View File
@@ -252,7 +252,8 @@ copy $(SolutionDir)external\xess\bin\libxess_dx11.dll $(SolutionDir)x64\Release\
copy $(SolutionDir)external\FidelityFX-SDK\docs\license.md $(SolutionDir)x64\Release\a\Licenses\FidelityFX_LICENSE.md /Y
copy $(SolutionDir)external\FidelityFX-SDK\PrebuiltSignedDLL\*.dll $(SolutionDir)x64\Release\a\ /Y
copy $(SolutionDir)OptiScaler.ini $(SolutionDir)x64\Release\a\ /Y
copy "$(SolutionDir)OptiScaler Setup.bat" $(SolutionDir)x64\Release\a\ /Y
copy $(SolutionDir)setup_windows.bat $(SolutionDir)x64\Release\a\ /Y
copy $(SolutionDir)setup_linux.sh $(SolutionDir)x64\Release\a\ /Y
md $(SolutionDir)x64\Release\a\D3D12_Optiscaler\
copy "$(SolutionDir)external\directx_agility_sdk\lib\*.dll" $(SolutionDir)x64\Release\a\D3D12_Optiscaler\ /Y
copy "$(SolutionDir)external\directx_agility_sdk\LICENSE.txt" $(SolutionDir)x64\Release\a\Licenses\DirectX_LICENSE.txt /Y
+71 -103
View File
@@ -1,6 +1,5 @@
#!/bin/bash
# Setup OptiScaler for your game (Linux version)
clear
echo " :::::::: ::::::::: ::::::::::: ::::::::::: :::::::: :::::::: ::: ::: :::::::::: ::::::::: "
@@ -14,14 +13,13 @@ echo ""
echo "Coping is strong with this one..."
echo ""
# Remove extraction marker file if it exists
rm -f "$SCRIPT_DIR/!! EXTRACT ALL FILES TO GAME FOLDER !!" 2>/dev/null
# Get the script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
GAME_PATH="$SCRIPT_DIR"
OPTISCALER_FILE="$GAME_PATH/OptiScaler.dll"
SETUP_SUCCESS=false
OPTISCALER_FILE="$SCRIPT_DIR/OptiScaler.dll"
# Remove junk files
rm -f "$SCRIPT_DIR/!! EXTRACT ALL FILES TO GAME FOLDER !!" 2>/dev/null
rm -f "$SCRIPT_DIR/setup_windows.bat" 2>/dev/null
# Check if OptiScaler.dll exists
if [ ! -f "OptiScaler.dll" ]; then
@@ -36,15 +34,15 @@ if [ ! -f "OptiScaler.dll" ]; then
exit 1
fi
# Check if the Engine folder exists (Unreal Engine detection)
if [ -d "$GAME_PATH/Engine" ]; then
# Unreal Engine detection
if [ -d "$SCRIPT_DIR/Engine" ]; then
echo "Found Engine folder, if this is an Unreal Engine game then please extract OptiScaler to #CODENAME#/Binaries/Win64"
echo ""
while true; do
read -p "Continue installation to current folder? [y/n]: " continue_choice
continue_choice=$(echo "$continue_choice" | tr -d ' ')
if [ "$continue_choice" = "y" ] || [ "$continue_choice" = "Y" ]; then
break
elif [ "$continue_choice" = "n" ] || [ "$continue_choice" = "N" ]; then
@@ -55,7 +53,6 @@ if [ -d "$GAME_PATH/Engine" ]; then
done
fi
# Function to select filename
select_filename() {
while true; do
echo ""
@@ -68,9 +65,9 @@ select_filename() {
echo " [6] wininet.dll"
echo " [7] winhttp.dll"
echo " [8] OptiScaler.asi"
read -p "Enter 1-8 (or press Enter for default): " filename_choice
case "$filename_choice" in
""|"1")
selected_filename="dxgi.dll"
@@ -97,116 +94,100 @@ select_filename() {
selected_filename="OptiScaler.asi"
;;
*)
clear
echo "Invalid choice. Please select a valid option."
echo ""
continue
;;
esac
# Check if file already exists
if [ -f "$selected_filename" ]; then
echo ""
echo "WARNING: $selected_filename already exists in the current folder."
echo ""
while true; do
read -p "Do you want to overwrite $selected_filename? [y/n]: " overwrite_choice
overwrite_choice=$(echo "$overwrite_choice" | tr -d ' ')
if [ "$overwrite_choice" = "y" ] || [ "$overwrite_choice" = "Y" ]; then
read -p "Do you want to overwrite it? [y/n]: " overwrite_choice
overwrite_choice=${overwrite_choice,,}
if [[ "$overwrite_choice" =~ ^(yes|y)$ ]]; then
break 2 # Break out of both loops
elif [ "$overwrite_choice" = "n" ] || [ "$overwrite_choice" = "N" ]; then
break # Break inner loop, continue filename selection
elif [[ "$overwrite_choice" =~ ^(no|n)$ ]]; then
clear
break # Break out of the inner loop, continue filename selection
else
clear
echo "Invalid choice. Please enter 'y' or 'n'."
fi
done
else
else
break # File doesn't exist, proceed
fi
done
}
# Call filename selection function
select_filename
echo ""
# Try to detect GPU type
# Try to detect Nvidia
NVIDIA_DETECTED=false
if command -v nvidia-smi >/dev/null 2>&1; then
if nvidia-smi >/dev/null 2>&1; then
NVIDIA_DETECTED=true
echo "Nvidia GPU detected."
fi
elif [ -d "/proc/driver/nvidia" ] || lspci 2>/dev/null | grep -i nvidia >/dev/null 2>&1; then
NVIDIA_DETECTED=true
echo "Nvidia GPU detected."
fi
# GPU type detection and configuration
echo ""
echo "Are you using an Nvidia GPU or AMD/Intel GPU?"
echo "[1] AMD/Intel"
echo "[2] Nvidia"
while true; do
echo ""
if [ "$NVIDIA_DETECTED" = true ]; then
read -p "Enter 1 or 2 (or press Enter for Nvidia): " gpu_choice
default_value="y"
read -r -p "Are you using an Nvidia GPU [Y/n]: " using_nvidia
else
read -p "Enter 1 or 2 (or press Enter for AMD/Intel): " gpu_choice
default_value="n"
read -r -p "Are you using an Nvidia GPU [y/N]: " using_nvidia
fi
using_nvidia=${using_nvidia,,}
using_nvidia=${using_nvidia:-$default_value}
case "$gpu_choice" in
""|"1")
# Default logic: if Nvidia detected, skip AMD/Intel unless explicitly chosen
if [ "$gpu_choice" = "1" ] || [ "$NVIDIA_DETECTED" = false ]; then
# AMD/Intel GPU - ask about DLSS usage
echo ""
echo "Will you try to use DLSS inputs? (enables spoofing, required for DLSS FG, Reflex->AL2)"
echo "[1] Yes"
echo "[2] No"
while true; do
read -p "Enter 1 or 2 (or press Enter for Yes): " enabling_spoofing
case "$enabling_spoofing" in
""|"1")
# Keep spoofing enabled (default)
break
;;
"2")
# Disable spoofing
config_file="OptiScaler.ini"
if [ ! -f "$config_file" ]; then
echo "Config file not found: $config_file"
read -p "Press Enter to continue..."
else
# Use sed to replace Dxgi=auto with Dxgi=false
sed -i 's/Dxgi=auto/Dxgi=false/g' "$config_file"
echo "Spoofing disabled in configuration."
fi
break
;;
*)
echo "Invalid choice. Please enter 1 or 2."
continue
;;
esac
done
if [[ "$using_nvidia" =~ ^(no|n)$ ]]; then
while true; do
echo ""
read -r -p "Will you try to use DLSS inputs? (enables spoofing, required for DLSS FG, Reflex->AL2) [Y/n]: " using_dlss
using_dlss=${using_dlss,,}
using_dlss=${using_dlss:-y}
if [[ "$using_dlss" =~ ^(no|n)$ ]]; then
# Disable spoofing
config_file="OptiScaler.ini"
if [ ! -f "$config_file" ]; then
echo "Config file not found: $config_file"
read -p "Press Enter to continue..."
else
# Use sed to replace Dxgi=auto with Dxgi=false
sed -i 's/Dxgi=auto/Dxgi=false/g' "$config_file"
echo "Spoofing disabled in configuration."
fi
break
elif [[ "$using_dlss" =~ ^(yes|y)$ ]]; then
break
else
echo "Invalid choice. Please enter 'y' or 'n'."
continue
fi
break
;;
"2")
# Nvidia GPU - skip spoofing configuration
break
;;
*)
echo "Invalid choice. Please enter 1 or 2."
continue
;;
esac
done
break
elif [[ "$using_nvidia" =~ ^(yes|y)$ ]]; then
break
else
echo "Invalid choice. Please enter 'y' or 'n'."
continue
fi
done
# Complete setup - rename OptiScaler file
# Rename OptiScaler file
echo ""
if [ "$overwrite_choice" = "y" ] || [ "$overwrite_choice" = "Y" ]; then
echo "Removing previous $selected_filename..."
@@ -248,7 +229,6 @@ if [ "$remove_choice" = "y" ] || [ "$remove_choice" = "Y" ]; then
# Remove OptiScaler files
rm -f OptiScaler.log
rm -f OptiScaler.ini
rm -f "OptiScaler Setup.bat"
rm -f SELECTED_FILENAME_PLACEHOLDER
# Remove directories
@@ -297,29 +277,17 @@ echo ""
# Display Wine DLL override information
echo "IMPORTANT FOR LINUX/WINE USERS:"
echo "You need to add the renamed DLL to Wine overrides:"
echo "You might need to add the renamed DLL to Wine overrides"
echo "Example, if using Steam, add this to launch options:"
echo ""
echo "WINEDLLOVERRIDES=$selected_filename=n,b %COMMAND%"
echo ""
echo "For example, if using Steam, add this to launch options:"
echo "WINEDLLOVERRIDES=$selected_filename=n,b %command%"
echo ""
echo "Remember: Insert key opens OptiScaler overlay, Page Up/Down for performance stats"
echo ""
echo "Note: If you need to send log files for support, set LogLevel=0 and"
echo "LogToFile=true in OptiScaler.ini (forced debugging is disabled since 0.7.7-Pre8)"
echo ""
echo "IMPORTANT: Do not rename OptiScaler.ini - it must stay as OptiScaler.ini"
echo ""
SETUP_SUCCESS=true
# Cleanup - remove setup script
read -p "Press Enter to exit..."
if [ "$SETUP_SUCCESS" = true ]; then
# Remove this setup script
rm -f "$0"
fi
rm -f "$0"
exit 0
+2 -2
View File
@@ -187,14 +187,14 @@ set setupSuccess=true
pause
if "%setupSuccess%"=="true" (
REM Remove "OptiScaler Setup.bat"
REM Remove "setup_windows.bat"
del %0
)
exit /b
:create_uninstaller
copy /y NUL "Remove OptiScaler.bat"
copy /y NUL "Remove setup_windows.bat"
(
echo @echo off