Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SOURCE FILE:--------------------------------------
- #Fundamental: Can save you from some headaches on 64-bit systems, such as when the system's default Wine (which often is 64-bit) is used instead of the supplied 32-bit Wine.
- export WINEARCH=win32
- #General: Some general options that apply to all scripts and make sure that everything is alright.
- [[ -z $WINEDLLOVERRIDES ]] && export WINEDLLOVERRIDES="winemenubuilder.exe=d" #Prohibit creation of desktop entries while allowing custom setting in script
- [[ -z $WINEDEBUG ]] && export WINEDEBUG="-all" #Defaults to the most efficient option, allows setting in script
- [[ -z "$WINEPREFIX" ]] && printf "$(tput bold)$(tput setaf 1)Warning: \$WINEPREFIX is not defined; please define it.\n$(tput sgr0)" && exit 1 #Used in order to avoid starting in the default prefix
- [[ "$WINEPREFIX" = "$HOME/.local/share/wineprefixes/" ]] && printf "$(tput bold)$(tput setaf 1)Warning: Incomplete script. Please stop define \$WINEPREFIX properly.\n$(tput sgr0)" && exit 1
- #Prefix specific settings
- #Useful if there are multiple games using the same prefix; they will use the same settings, and the scripts for each individual games are minimized in size.
- WINE_GLOBAL_WINEVER=1.7.2 #Default version; the script is built upon using custm Wine versions
- [[ "$WINEPREFIX" = "$HOME/.local/share/wineprefixes/NFS" ]] && export WINEVER=$WINE_GLOBAL_WINEVER
- #Steam has multiple default settings. These settings may also be overridden in a script, and some exceptions have been made in order to support a wider amount of games. Some games don't like GL threading, some games need a patched Wine and etc.
- WINE_APP_STEAM_WINEVER=1.7.2
- if [[ "$WINEPREFIX" = "$HOME/.local/share/wineprefixes/Steam" ]]; then
- if [[ -z $STEAM_WINEVER_OVERRIDE ]]; then
- export WINEVER=$WINE_APP_STEAM_WINEVER
- else
- export WINEVER=$STEAM_WINEVER_OVERRIDE
- fi
- if [[ -z $GLTHREAD ]] && [[ -z $GLTHREAD_OVERRIDE ]]; then
- export GLTHREAD=1
- fi
- fi
- WINE_GAME_HALO_WINEVER=1.5.20
- [[ "$WINEPREFIX" = "$HOME/.local/share/wineprefixes/Halo" ]] && export WINEVER=$WINE_GAME_HALO_WINEVER
- [[ "$WINEPREFIX" = "$HOME/.local/share/wineprefixes/Halo1.00" ]] && export WINEVER=$WINE_GAME_HALO_WINEVER
- [[ "$WINEPREFIX" = "$HOME/.local/share/wineprefixes/HaloCE_OS" ]] && export WINEVER=$WINE_GAME_HALO_WINEVER
- #If no WINEVER is set, the default version will be used.
- if [[ -z $WINEVER ]];then
- printf "$(tput bold)$(tput setaf 4)Warning: No Wine version was provided. Will default to version $WINE_GLOBAL_WINEVER.\n$(tput sgr0)"
- export WINEVER=$WINE_GLOBAL_WINEVER
- fi
- #Imports the binaries of a custom build of Wine to the PATH variable. Commenting out these lines would make it use the default one.
- export WINEBIN=$HOME/Winebuilds/$WINEVER/bin/wine #A relic; unstable and not really practical.
- export PATH=$HOME/Winebuilds/${WINEVER}/bin:$PATH #Append the specific Wine version to PATH within script; does not work globally.
- #Option handling: Simplify the setting of environment variables while keeping it simple. LOG_TIME is a function that kind of works for non-Steam games for counting hours and is added upon personal preference. The resulting files of LOG_TIME are easily understandable, as it appends the game session's time to a list of game times. From it one can calculate average playtime or total playtime. Some other options are for optimization or compatibility, as is the case with PA_DSPMODE.
- if [[ $GLTHREAD = 1 ]]; then
- printf "$(tput bold)$(tput setaf 4)OpenGL threading is enabled\n$(tput sgr0)"
- export LD_PRELOAD="libpthread.so.0 libGL.so.1"
- export __GL_THREADED_OPTIMIZATIONS=1
- fi
- if [[ -n $GLAA ]]; then
- printf "$(tput bold)$(tput setaf 4)Antialiasing forced to mode $GLAA\n$(tput sgr0)"
- export __GL_FSAA_MODE=$GLAA
- fi
- if [[ -n $GLANISO ]]; then
- printf "$(tput bold)$(tput setaf 4)Anisotropic filtering forced to mode $GLANISO\n$(tput sgr0)"
- export __GL_LOG_MAX_ANISO=$GLANISO
- fi
- if [[ $GLVBLANK = 1 ]]; then
- printf "$(tput bold)$(tput setaf 4)Sync to vblank enabled\n$(tput sgr0)"
- export __GL_SYNC_TO_VBLANK=1
- else
- printf "$(tput bold)$(tput setaf 4)Sync to vblank disabled\n$(tput sgr0)"
- export __GL_SYNC_TO_VBLANK=0
- fi
- if [[ $LOG_TIME = 1 ]]; then
- LOG_BASE_DIR="$HOME/System/Gametimes"
- if [[ -n "$LOG_FILE_NAME" ]]; then
- printf "$(tput bold)$(tput setaf 4)Info: Time logging enabled\n$(tput sgr0)"
- WINE_RUN_PREFIX="/usr/bin/time --format=%e -a -o "${LOG_BASE_DIR}/${LOG_FILE_NAME}" $WINE_RUN_PREFIX"
- else
- printf "$(tput bold)$(tput setaf 3)Warning: No log file for time logging specified. Skipping.\n$(tput sgr0)"
- fi
- fi
- if [[ $PA_DSPMODE = 1 ]];then
- printf "$(tput bold)$(tput setaf 4)PulseAudio DSP mode enabled\n$(tput sgr0)"
- WINE_RUN_PREFIX="$WINE_RUN_PREFIX padsp"
- fi
- export WINE_RUN_PREFIX
- #Functions: Mini-scripts to be used in interactive shells or for simplicity.
- test_environment(){
- #Used for a quick overview of the current environment, mostly for debugging purposes.
- printf "$(tput bold)$(tput setaf 4)
- $(export)
- Debug parameters: $WINEDEBUG
- Prefix: $WINEPREFIX
- Wine binary: $WINEBIN
- $([[ $GLTHREAD = 1 ]] && printf "OpenGL Threading: $__GL_THREADED_OPTIMIZATIONS, $LD_PRELOAD")
- Current directory: $PWD
- Wine version: $WINEVER\n$(tput sgr0)"
- }
- explorer(){
- wine explorer
- }
- regedit(){
- wine regedit
- }
- #Aliases: Wine-specific aliases; define them yourself.
- alias wine-4gb-fixer="wine $HOME/Game\ mods/4gb_patch.exe" #Solves a LOT of issues with memory bottlenecking because of 32-bit. Skyrim, Metro 2033 and others really need this tool to work as best as they can with high memory consumption.
- -----------------------------------------------
- Template file:------------------------------------
- #! /bin/bash
- #Environment variables
- export WINEPREFIX=$HOME/.local/share/wineprefixes/ #Needs to be complete with prefix; not changing this will make the script stop as a safety measure.
- GLTHREAD=0
- #GLAA=
- #GLANISO=
- WINEVER=
- source "$HOME/Quicklists/Wine launchers/wine_globalrc.sh" #Source script that uses provided information to set up the environment.
- #Pre-run: Most likely cd'ing into the directory of the executable.
- cd "$WINEPREFIX/drive_c/"
- #Running: Perhaps the most hacky solution I've made for the script. It tests if there are more than 2 bytes of input, and will run the command if this is true. Needs improvement.
- if [ "$(echo $@|wc -c)" -ge 2 ];then
- "$@"
- else
- $WINE_RUN_PREFIX wine
- fi
- #WINE_RUN_PREFIX is defined by the source script and involves things such as PA_DSP
- #Template for running with a virtual desktop
- #$WINE_RUN_PREFIX wine explorer /desktop=TITLE,1920x1080
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement