[BACK]Return to fnaify CVS log [TXT][DIR] Up to [local] / projects / fnaify

Annotation of projects/fnaify/fnaify, Revision 1.114

1.1       thfr        1: #!/bin/sh
                      2:
1.75      thfr        3: #########################################################################
1.107     thfr        4: # fnaify 2.1                                                           #
1.75      thfr        5: # ===============                                                      #
                      6: #                                                                      #
1.114   ! thfr        7: # Run FNA/XNA games on OpenBSD                                         #
1.75      thfr        8: #                                                                      #
                      9: # created 2017-12-27 by Thomas Frohwein (thfr)                         #
                     10: # portability fixes by Mariusz Zaborski (oshogbo)                      #
                     11: #                                                                      #
                     12: # FNA is a reimplementation of the Microsoft XNA Game Studio 4.0       #
                     13: # Refresh libraries.                                                   #
                     14: # Thanks to the great work by Ethan Lee (flibitijibibo) games using FNA        #
                     15: # are highly portable and can even run on OpenBSD. Please refer to     #
                     16: # https://fna-xna.github.io/ for more information about FNA.           #
                     17: #                                                                      #
                     18: # License: ISC                                                         #
                     19: #########################################################################
                     20:
1.67      thfr       21: # TODO:
1.77      thfr       22: # - fix FIXMEs
1.94      thfr       23: # - check_nlog now only looks at major version number; is there a better way?
                     24: #   (it reports only major in 'monodis --assembly': 3.0.0.0, 4.0.0.0)
1.105     thfr       25: # - fix whitespace issue seen with 'Battlepaths V1.8.vshost.exe.config', and Super
                     26: #   Daryl Deluxe
1.104     thfr       27: # - figure out how to do selection between AJ1.exe and AJ2.exe for Apple Jack
1.3       thfr       28:
1.107     thfr       29: USAGE="\nUsage: `basename $0` [-i|-y] [-hv] [-c <configfile>] [-d <depdir>] [-m <monopath>] [<gamedir>]\n\
1.11      thfr       30: \n\
1.107     thfr       31: -c: specify config file for dllmap (optional)\n\
1.25      thfr       32: -d: replace directories for finding dependencies\n\
1.46      thfr       33:     NOTE: separate multiple entries with ':' (default:
                     34:     /usr/local/share/fnaify-libs:/usr/local/lib:/usr/X11R6/lib)\n\
1.18      thfr       35: -h: print usage information\n\
1.107     thfr       36: -i: interactive mode\n\
                     37: -m: add directories to MONO_PATH\n\
                     38: -y: non-interactive mode; automatically replies 'yes' to all recommended choices\n\
1.11      thfr       39: -v: verbose output\n\
                     40: \n\
1.107     thfr       41: <gamedir> is optional and defaults to the current directory if not specified.\n\
1.11      thfr       42: "
                     43:
1.106     thfr       44: depdir="/usr/local/lib:/usr/X11R6/lib" # /usr/X11R6/lib is location of libfreetype.so on OpenBSD
                     45: gamedir="$PWD"
                     46: interaction=n  # y|n|i: yes to all, no to all, interactive
                     47: libatomstb_commit=f8291c591d04ac304c4f5324163bc83287de77b7
                     48: licenses=
                     49: monoconfig=
                     50: monopath="${MONO_PATH}:"
1.65      thfr       51: netstub_commit=e7d890e0ede0caa9e76ef37af6070344e3ab0abf
1.71      thfr       52: newline='
                     53: '
1.72      thfr       54: scriptfile=
1.89      thfr       55:
1.84      thfr       56: if [ -d "/usr/local/lib/steamworks-nosteam" ] ; then
                     57:        monopath="${monopath}/usr/local/lib/steamworks-nosteam:"
1.89      thfr       58:        depdir="/usr/local/lib/steamworks-nosteam:$depdir"
1.96      thfr       59: fi
                     60: if [ -d "/usr/local/share/steamstubs" ]; then
                     61:        monopath="${monopath}/usr/local/share/steamstubs:"
1.84      thfr       62: fi
1.76      thfr       63: if [ -d "/usr/local/share/fnaify-libs" ]; then
                     64:        depdir="/usr/local/share/fnaify-libs:$depdir"
                     65: fi
                     66:
1.51      thfr       67: while [ $# -gt 0 ]; do
1.3       thfr       68:        case "$1" in
1.106     thfr       69:                -c) monoconfig="$2"; shift;;
1.25      thfr       70:                -d) depdir="$2"; shift;;
1.11      thfr       71:                -h) echo "$USAGE"; exit 0;;
1.87      thfr       72:                -i) interaction=i;;
1.56      thfr       73:                -m) monopath="$2"; shift;;
1.3       thfr       74:                -v) FNAIFY_DEBUG=1;;
1.87      thfr       75:                -y) interaction=y;;
1.11      thfr       76:                -*) echo "$USAGE"; exit 1;;
                     77:                *) gamedir=$(readlink -f "$1");;
1.3       thfr       78:        esac
                     79:        shift
                     80: done
1.30      thfr       81: cd "$gamedir"
1.25      thfr       82:
1.108     thfr       83: debug_echo()
                     84: {
                     85:        if [ -z "$FNAIFY_DEBUG" ]; then
                     86:                return
                     87:        fi
                     88:        if [ "${1}" = '-n' ]; then
                     89:                printf "$2"
                     90:        else
                     91:                printf "$1\n"
                     92:        fi
                     93: }
                     94:
1.106     thfr       95: if [ -z "$monoconfig" ] ; then
1.109     thfr       96:        if [ -f "$HOME/.config/fnaify/fnaify.dllmap.config" ] ; then
1.106     thfr       97:                monoconfig="$HOME/.config/fnaify/fnaify.dllmap.config"
1.109     thfr       98:                # check for outdated config file
1.113     thfr       99:                if [ "x$(cat "$monoconfig" | grep -m 1 "LoadLibrary")" = "x" ] ; then
1.109     thfr      100:                        echo "WARNING: $monoconfig appears to be out of date. It is strongly recommended to remove it and re-run `basename $0`."
                    101:                fi
                    102:        else
                    103:                if [ -f "/usr/local/share/fnaify/fnaify.dllmap.config" ] ; then
                    104:                        monoconfig="/usr/local/share/fnaify/fnaify.dllmap.config"
                    105:                else    # in this case create ~/.config/fnaify/fnaify.dllmap.config
                    106:                        monoconfig="$HOME/.config/fnaify/fnaify.dllmap.config"
                    107:                        debug_echo "creating $monoconfig"
1.106     thfr      108:                        mkdir -p ~/.config/fnaify
                    109:                        cat <<EOF > "$monoconfig"
                    110: <?xml version="1.0" encoding="utf-8"?>
                    111: <!-- mono config file for fnaify dllmaps -->
                    112: <configuration>
                    113:        <dllmap dll="FAudio" target="libFAudio.so"/>
                    114:        <dllmap dll="MojoShader.dll" target="libmojoshader.so"/>
                    115:        <dllmap dll="SDL2.dll" target="libSDL2.so"/>
                    116:        <!-- MidBoss needs libSDL2_image_compact.so -->
                    117:        <dllmap dll="SDL2_image.dll" target="libSDL2_image.so"/>
                    118:        <dllmap dll="SDL2_mixer.dll" target="libSDL2_mixer.so"/>
                    119:        <dllmap dll="SDL2_ttf.dll" target="libSDL2_ttf.so"/>
                    120:        <dllmap dll="SteamworksNative.dll" target="libSteamworksNative.so"/>
                    121:        <dllmap dll="freetype6" target="libfreetype.so" />
                    122:        <dllmap dll="freetype6.dll" target="libfreetype.so" />
                    123:        <dllmap dll="libtheorafile.dll" target="libtheorafile.so"/>
                    124:        <dllmap dll="libtheoraplay.dll" target="libtheoraplay.so"/>
                    125:        <dllmap dll="libvorbisfile.dll" target="libvorbisfile.so"/>
                    126:        <dllmap dll="openal32.dll" target="libopenal.so"/>
                    127:        <dllmap dll="soft_oal.dll" target="libopenal.so"/>
                    128:
                    129:        <!-- Atom Zombie Smasher -->
                    130:        <dllmap dll="msvcr100.dll" target="libc.so"/>
                    131:
                    132:        <!-- Terraria, Solaroids -->
                    133:        <dllmap dll="gdiplus.dll" target="libgdiplus.so"/>
                    134:
                    135:        <!-- MidBoss -->
                    136:        <dllmap dll="i:cygwin1.dll" target="libc.so"/>
                    137:        <dllmap dll="libc" target="libc.so"/>
                    138:        <dllmap dll="intl" target="libc.so"/>
                    139:        <dllmap dll="libintl" target="libc.so"/>
                    140:        <dllmap dll="i:libxslt.dll" target="libxslt.so"/>
                    141:        <dllmap dll="i:odbc32.dll" target="libodbc.so"/>
                    142:        <dllmap dll="oci" target="libclntsh.so"/>
                    143:        <dllmap dll="db2cli" target="libdb2_36.so"/>
                    144:        <dllmap dll="MonoPosixHelper" target="libMonoPosixHelper.so"/>
                    145:        <dllmap dll="i:msvcrt" target="libc.so"/>
                    146:        <dllmap dll="i:msvcrt.dll" target="libc.so"/>
                    147:        <dllmap dll="sqlite" target="libsqlite.so"/>
                    148:        <dllmap dll="sqlite3" target="libsqlite3.so"/>
                    149:        <dllmap dll="libX11" target="libX11.so"/>
                    150:        <dllmap dll="libcairo-2.dll" target="libcairo.so"/>
                    151:        <dllmap dll="libcups" target="libcups.so"/>
                    152:
                    153:        <!-- Nuclex.Input (Dead Pixels, Amazing Princess Sarah, Akane the Kunoichi -->
                    154:        <dllmap dll="kernel32">
                    155:                <dllentry dll="ld.so" name="LoadLibrary" target="dlopen"/>
                    156:        </dllmap>
                    157: </configuration>
                    158: EOF
                    159:                fi
                    160:        fi
                    161: fi
                    162:
1.62      thfr      163: # Variables and Functions
1.1       thfr      164:
                    165: SAVEIFS=$IFS
1.5       thfr      166: fna_warning=0
1.92      thfr      167: nlog_warning=0
1.65      thfr      168:
1.81      thfr      169: # array of lib names to ignore for the configuration checking
1.113     thfr      170: ignoredarray="
                    171: FarseerPhysics.Portable.xml
                    172: libCommunityExpressSW.so
1.103     thfr      173: libCSteamworks.so
1.113     thfr      174: libGalaxy64.so
                    175: libGalaxyCSharpGlue.so
                    176: libGalaxy.so
                    177: libParisSteam.so
                    178: libSkiaSharp.so
                    179: libSteamWrapper.so
                    180: libXNAFileDialog.so
                    181: libXNAWebRenderer.so
1.65      thfr      182: libsteam_api.so
                    183: libcef.so
                    184: libfmod.so
                    185: libfmodstudio.so
                    186: libtiny_jpeg.so
1.113     thfr      187: steamwrapper.so
                    188: steam_appid.txt
                    189: "
1.65      thfr      190:
1.81      thfr      191: # array of mono files that need to be removed from the game folder
1.113     thfr      192: monofilearray="
                    193: I18N.CJK.dll
                    194: I18N.MidEast.dll
                    195: I18N.Other.dll
                    196: I18N.Rare.dll
                    197: I18N.West.dll
                    198: I18N.dll
                    199: Microsoft.CSharp.dll
                    200: Mono.CSharp.dll
1.65      thfr      201: Mono.Posix.dll
                    202: Mono.Security.dll
                    203: System.Configuration.dll
                    204: System.Core.dll
                    205: System.Data.dll
1.113     thfr      206: System.Drawing.dll
                    207: System.Runtime.Serialization.dll
1.65      thfr      208: System.Security.dll
1.113     thfr      209: System.ServiceModel.dll
1.65      thfr      210: System.Xml.Linq.dll
1.113     thfr      211: System.Xml.dll
                    212: System.dll
1.65      thfr      213: WindowsBase.dll
1.113     thfr      214: monoconfig
1.65      thfr      215: monomachineconfig
1.113     thfr      216: mscorlib.dll
                    217: "
1.65      thfr      218:
                    219: needlibarray="" # array that will hold the names of needed libraries
                    220:
                    221: #list of exefiles and their number
                    222: exefile=
                    223: nexefile=0
                    224: my_exe=""      # the .exe selected for the launch script
1.68      thfr      225:
                    226: exe_flags=""
                    227: exe_env=""
                    228:
1.61      thfr      229: printdash()
1.12      thfr      230: {
1.61      thfr      231:        if [ -z "$*" ]; then
1.12      thfr      232:                return
                    233:        fi
1.61      thfr      234:        printf "$*\n"
1.1       thfr      235:        c=1
1.87      thfr      236:        dashes=
1.61      thfr      237:        while [ $c -lt $(echo "$*" | wc -c) ]
1.1       thfr      238:        do
1.87      thfr      239:                dashes="${dashes}-"
1.13      thfr      240:                # $((...)) for arithmetic substitution
                    241:                c=$((c+1))
1.1       thfr      242:        done
1.87      thfr      243:        echo "$dashes"
1.1       thfr      244: }
                    245:
1.62      thfr      246: inarray() # check if $1 is in array $2
1.1       thfr      247: {
                    248:        firstarg="$1"
                    249:        shift 1
1.21      thfr      250:        echo "$*" | grep -q "$firstarg"
1.1       thfr      251: }
                    252:
1.62      thfr      253: validlib() # returns 1 if $1 is in ignoredarray, otherwise 0
1.1       thfr      254: {
1.28      thfr      255:        libnam="$(trunklibnam $1)"
                    256:        if [ -n "$(echo \"$ignoredarray\" | grep $libnam)" ]; then
                    257:                return 1
1.51      thfr      258:        elif [ -n "$(echo \"$libnam\" | grep '\.dll[ \t]*')" ]; then
1.32      thfr      259:                return 1
1.28      thfr      260:        else
                    261:                return 0
                    262:        fi
1.1       thfr      263: }
                    264:
1.62      thfr      265: trunklibnam() # truncate library name
1.1       thfr      266: {
                    267:        libnam="$1"
1.31      thfr      268:        libnam="$(echo "$libnam" | sed -n -E "s/[\.0-9]*$//p")"
1.1       thfr      269:        libnam="$(echo "$libnam" | sed -E "s/(libSDL2[^-]*)-2\.0(\.so.*)/\1\2/")"
                    270:        echo "$libnam"
                    271: }
                    272:
1.13      thfr      273: libraryname()
                    274: {
                    275:         version="$1"
                    276:        if [ ! -e "$gamedir/$version" ]; then
1.62      thfr      277:                debug_echo "\nCouldn't find library directory $gamedir/$version"
1.13      thfr      278:        else
1.62      thfr      279:                debug_echo "\nEntering library directory $gamedir/$version"
1.13      thfr      280:                for file in $(ls "$gamedir/$version"); do
1.62      thfr      281:                        # sort out libs that need to be ignored
1.13      thfr      282:                        validlib $file
                    283:                        if [ $? -eq 1 ]; then
1.28      thfr      284:                                debug_echo "\tignored file: $file"
1.13      thfr      285:                                continue
                    286:                        fi
                    287:                        debug_echo -n "\tfound library file: $file"
                    288:                        file=$(trunklibnam "$file")
1.28      thfr      289:                        debug_echo -n " -> $file"
1.13      thfr      290:                        inarray $file ${needlibarray}
                    291:                        if [ $? -eq 0 ]; then
                    292:                                debug_echo " - already in array"
                    293:                        elif [ $? -eq 1 ]; then
                    294:                                needlibarray="$needlibarray$file "
1.28      thfr      295:                                debug_echo ""
1.13      thfr      296:                        else
1.87      thfr      297:                                echo "\n\t - ERROR: inarray returned with unexpected error\n"
1.13      thfr      298:                                exit 1
                    299:                        fi
                    300:                done
                    301:                debug_echo "Done with library directory $gamedir/$version"
                    302:        fi
                    303: }
                    304:
1.65      thfr      305: selectexe()
                    306: {
                    307:        # find correct .exe file for the wrapper script
                    308:        if [ $nexefile -gt 1 ]; then
1.87      thfr      309:                if [ "x$interaction" = "xi" ] ; then
                    310:                        i=1
                    311:                        while [ $i -le $nexefile ]; do
                    312:                                echo "$i: $(echo $exefile | cut -f $i -d ':')"
                    313:                                i=$((i + 1))
                    314:                        done
                    315:                        input_exe=0
                    316:                        while [ \( $(echo "$input_exe" | wc -c) -gt 2 \) -o \( -z "$(echo "$input_exe" | grep [1-9])" \) -o \( $input_exe -gt $((i - 1)) \) ]; do
                    317:                                echo -n "Enter number of .exe file to choose for wrapper script: "
                    318:                                read input_exe
                    319:                        done
                    320:                        # NOTE: this only works for up to 9 candidate files
                    321:                        my_exe="$(echo $exefile | cut -f $input_exe -d ':')"
                    322:                else
                    323:                        # FIXME: for now just pick the first .exe. Come up with
                    324:                        #        better heuristic (match directory or launch
1.98      thfr      325:                        #        script name; pick .exe with shortest name ... ?
1.87      thfr      326:                        my_exe="$(echo $exefile | cut -f 1 -d ':')"
                    327:                fi
1.65      thfr      328:        elif [ $nexefile -eq 1 ]; then
                    329:                my_exe="$exefile"
                    330:        else
                    331:                echo "ERROR: no .exe file found\n"
                    332:                exit 1
                    333:        fi
                    334:        my_exe="$(echo "$my_exe" | sed -E "s/[ \t]$//")" # trim trailing whitespace
                    335: }
                    336:
1.68      thfr      337: # check if Steamworks.NET.dll is present, move it away if stub is in $monopath
                    338: check_remove_steamworks()
                    339: {
1.77      thfr      340:        # FIXME: likely not whitespace-safe
1.68      thfr      341:        if [ -e "$gamedir/Steamworks.NET.dll" \
1.85      thfr      342:                -a -n "$monopath" -a -n "$(ls $(echo "$monopath" | tr -s ':' ' ') | grep -m 1 "Steamworks\.NET\.dll")" ]
1.68      thfr      343:        then
1.77      thfr      344:                if $(ls $(echo "$monopath" | tr -s ':' ' ') | grep -q "Steamworks\.NET\.dll"); then
1.68      thfr      345:                        debug_echo "\nFound Steamworks.NET.dll in gamedir and in monopath, moving it out of gamedir"
                    346:                        mkdir -p "$gamedir/fnaify-backup"
                    347:                        mv "$gamedir/Steamworks.NET.dll" "$gamedir/fnaify-backup/"
                    348:                fi
                    349:        fi
                    350: }
                    351:
1.65      thfr      352: create_wrapper()
                    353: {
                    354:        cat <<EOF > "$fullscriptpath"
                    355: #!/bin/sh
                    356:
                    357: # fnaify wrapper script for launching FNA games on BSD
                    358:
                    359: cd "\`dirname "\$0"\`" # Move to the game's location in case it was invoked from elsewhere
                    360:
1.106     thfr      361: LD_LIBRARY_PATH="$(echo "$depdir" | sed -E 's/:$//')" MONO_PATH="$(echo "$monopath" | sed -E 's/:$//' | sed -E 's/^://')" MONO_CONFIG="$monoconfig" $exe_env exec "$FNAIFY_MONO" "$(echo "$my_exe" | tr -d '\:')" $exe_flags \$*
1.65      thfr      362: EOF
                    363:
                    364:        chmod +x "$fullscriptpath"
                    365: }
                    366:
1.72      thfr      367: finish_fnaify()
                    368: {
1.93      thfr      369:        #echo ""
                    370:        #printdash $(echo "SETUP COMPLETE")
                    371:        #echo ""
1.72      thfr      372:        if [ -n "${licenses}" ]; then
                    373:                echo "Installed modules are under the following license(s):\n"
                    374:                echo "${licenses}"
                    375:        fi
                    376:        echo "To run the game in $gamedir, use\n"
                    377:        echo "./${scriptfile}\n"
1.98      thfr      378:        if [ $fna_warning -eq 1 ]; then
                    379:                echo "\nWARNING: version of FNA.dll potentially incompatible!"
                    380:                echo "If the game doesn't run, try running 'fnaify -i' (or 'fnaify -y').\n"
                    381:        fi
                    382:        if [ $nlog_warning -eq 1 ]; then
                    383:                echo "\nWARNING: version of NLog.dll potentially incompatible!"
                    384:                echo "If the game doesn't run, try running 'fnaify -i' (or 'fnaify -y').\n"
                    385:        fi
1.72      thfr      386:        exit 0
                    387: }
                    388:
1.65      thfr      389: # install FNA into gamedir; specify version (e.g. 17.12) as $1
                    390: # if XNA bridge should be installed, add "xna_bridge" as $2
                    391: install_fna()
                    392: {
                    393:        if [ $# -lt 1 ]; then
                    394:                echo "ERROR: install_fna called with insufficient arguments"
                    395:                exit 1
                    396:        fi
                    397:        fna_version=
                    398:        if [ "${1}" = 'latest' ]; then
                    399:                # get version number of latest release from GitHub API
                    400:                fna_version=$(ftp -Vo - https://api.github.com/repos/FNA-XNA/FNA/releases/latest \
                    401:                        | grep -Eo "\"tag_name\"\:\"[0-9\.]*\"" \
                    402:                        | cut -d\" -f4)
                    403:        else
                    404:                fna_version="$1"
                    405:        fi
1.87      thfr      406:        echo "\nInstalling FNA ..."
1.75      thfr      407:        licenses="${licenses}FNA:\t\tMs-PL (https://github.com/FNA-XNA/FNA/blob/master/licenses/LICENSE)${newline}"
1.65      thfr      408:        lastdir="$PWD"
                    409:        cd /tmp
                    410:        ftp -V https://github.com/FNA-XNA/FNA/releases/download/${fna_version}/FNA-$(echo $fna_version | tr -d '.').zip
                    411:        debug_echo "extracting FNA ${fna_version}"
                    412:        unzip FNA-$(echo $fna_version | tr -d '.').zip > /dev/null
1.68      thfr      413:        if [ \( $# -gt 1 \) -a \( x$2 = 'xxna_bridge' \) ]; then
1.87      thfr      414:                echo "\nInstalling FNA.NetStub for XNA ..."
1.74      thfr      415:                licenses="${licenses}FNA.NetStub:\tMs-PL (https://github.com/FNA-XNA/FNA.NetStub/blob/master/LICENSE)${newline}"
1.71      thfr      416:                ftp -V https://github.com/FNA-XNA/FNA.NetStub/archive/$netstub_commit.tar.gz
                    417:                tar zxf $netstub_commit.tar.gz
                    418:                mv FNA.NetStub-$netstub_commit FNA.NetStub
1.74      thfr      419:                echo -n "compiling XNA ABI/bridge files. This may take a moment... "
1.65      thfr      420:                xbuild FNA/abi/Microsoft.Xna.Framework.sln >> /tmp/fnaify-xbuild.log
1.73      thfr      421:                echo "done."
1.65      thfr      422:                cp /tmp/FNA/abi/bin/Debug/* "$gamedir/"
                    423:        else
1.74      thfr      424:                echo -n "compiling FNA ${fna_version} with xbuild... "
                    425:                xbuild FNA/FNA.sln >> /tmp/fnaify-xbuild.log
1.65      thfr      426:                debug_echo "done."
                    427:                echo "Moving FNA.dll to fnaify-backup subdirectory"
                    428:                mkdir -p "$gamedir/fnaify-backup"
                    429:                mv "$gamedir/FNA.dll" "$gamedir/fnaify-backup/"
                    430:                cp /tmp/FNA/bin/Debug/FNA.dll "$gamedir"
                    431:        fi
1.72      thfr      432:        debug_echo "removing the temporary build directory for FNA and returning to previous directory"
1.65      thfr      433:        rm -rf /tmp/FNA /tmp/FNA.NetStub
                    434:        cd "$lastdir"
                    435: }
1.13      thfr      436:
1.91      thfr      437: check_nlog()
                    438: {
                    439:        if [ -f "$gamedir/NLog.dll" ] ; then
                    440:                nlogversion=`monodis --assembly "$gamedir/NLog.dll" | grep "Version" | tr -d [:alpha:] | tr -d " " | tr -d \:`
                    441:                nlogmajor=`echo "$nlogversion" | sed -n -E "s/\..*//p"`
                    442:                nlogminor=`echo "$nlogversion" | sed -n -E "s/[0-9]+\.([0-9]+)\.[0-9]+\.[0-9]+/\1/p"`
                    443:                debug_echo -n "\tNLog.dll version $nlogversion, "
                    444:                debug_echo -n "major: $nlogmajor, "
                    445:                debug_echo "minor: $nlogminor"
                    446:                if [ \( $nlogmajor -lt 4 \) -a \( "x$interaction" = "xi" \) ] ; then
1.98      thfr      447:                        echo -n "\nInstall NLog 4.6.5 from www.nuget.org? [y/n] "
1.91      thfr      448:                        response=
                    449:                        until [ \( "x$response" = "xy" \) -o \( "x$response" = "xn" \) ]
                    450:                        do
                    451:                                read response
                    452:                        done
                    453:                elif [ \( $nlogmajor -lt 4 \) -a \( "x$interaction" = "xy" \) ] ; then
                    454:                        response="y"
                    455:                else
                    456:                        response="n"
                    457:                fi
                    458:                if [ "x$response" = "xy" ] ; then
                    459:                        debug_echo "Moving old NLog.dll out of the way"
                    460:                        mkdir -p "$gamedir/fnaify-backup"
                    461:                        mv "$gamedir/NLog.dll" "$gamedir/fnaify-backup/"
                    462:                        lastdir="$PWD"
                    463:                        mkdir /tmp/nlog
                    464:                        cd /tmp/nlog
                    465:                        echo "\nInstalling NLog 4.6.5 ..."
                    466:                        licenses="${licenses}NLog:\tBSD 3-clause (https://github.com/NLog/NLog/blob/master/LICENSE.txt)${newline}"
                    467:                        ftp -Vo nlog.4.6.5.nupkg https://www.nuget.org/api/v2/package/NLog/4.6.5
                    468:                        unzip nlog.4.6.5.nupkg > /dev/null
                    469:                        cp lib/net45/NLog.dll "$gamedir/"
                    470:                        cd "$lastdir"
1.100     thfr      471:                        rm -rf /tmp/nlog
1.98      thfr      472:                elif [ $nlogmajor -lt 4 ] ; then
                    473:                        nlog_warning=1
1.91      thfr      474:                fi
                    475:        fi
                    476: }
1.65      thfr      477: # check if this is an XNA game, otherwise abort
                    478: xnasetup()
                    479: {
                    480:        # reset exefile and nexefile to pick only XNA files
                    481:        exefile=
                    482:        nexefile=0
1.72      thfr      483:        IFS='
                    484: '
1.99      thfr      485:        for assembly in $(cd "${gamedir}" && find . -maxdepth 1 -type f | grep -E ".*\.exe$" | cut -f 2 -d "/" | sort); do
1.87      thfr      486:                debug_echo "Checking $assembly for XNA"
1.65      thfr      487:                monodis --assemblyref "${gamedir}/$assembly" 2>&1 \
                    488:                        | grep -iqm 1 "Microsoft.Xna.Framework"
                    489:                if [ $? -eq 0 ]; then
1.71      thfr      490:                        exefile="$exefile$assembly:"
1.65      thfr      491:                        nexefile=$((nexefile + 1))
                    492:                fi
                    493:        done
1.72      thfr      494:        IFS=$SAVEIFS
1.65      thfr      495:        if [ $nexefile -lt 1 ]; then
                    496:                echo "No FNA or XNA game found. Quitting."
                    497:                exit 1
                    498:        fi
1.75      thfr      499:        if [ -d "/usr/local/share/fnaify-libs/XNA-bridge" ];then
1.76      thfr      500:                monopath="${monopath}/usr/local/share/fnaify-libs/XNA-bridge:"
1.75      thfr      501:        else
1.87      thfr      502:                if [ "x$interaction" = "xi" ] ; then
                    503:                        echo -n "\nInstall FNA files from GitHub to for this XNA application? [y/n] "
                    504:                        response=
                    505:                        until [ \( "x$response" = "xy" \) -o \( "x$response" = "xn" \) ]
                    506:                        do
                    507:                                read response
                    508:                        done
                    509:                elif [ "x$interaction" = "xy" ] ; then
                    510:                        response="y"
                    511:                else
                    512:                        response="n"
                    513:                fi
                    514:
1.75      thfr      515:                if [ "$response" = "y" ]; then
                    516:                        install_fna latest xna_bridge
                    517:                else
1.97      thfr      518:                        echo "Failed to install FNA/XNA files. Try running with -i or -y flag\n"
1.75      thfr      519:                        exit 1
                    520:                fi
                    521:        fi
1.69      thfr      522:
                    523:        # convert .wma to .ogg and .wmv to .ogv
1.80      thfr      524:        # https://gist.github.com/flibitijibibo/c97bc14aab04b1277d8ef5e97fc9aeff
1.69      thfr      525:        IFS="
                    526: "
1.87      thfr      527:        # FIXME: check for errors on return of these commands
1.72      thfr      528:        echo -n "checking for WMA/WMV files and converting. This may take several minutes..."
1.69      thfr      529:        for afile in $(find "$gamedir" -name "*.wma"); do
1.80      thfr      530:                ffmpeg -loglevel fatal -i "$afile" -c:a libvorbis -q:a 10 \
                    531:                        "$(echo "$afile" | rev | cut -d. -f2-$(($(echo "$afile" \
                    532:                        | tr -dc '.' | wc -c) + 1)) | rev).ogg"
1.69      thfr      533:        done
                    534:        for vfile in $(find . -name "*.wmv"); do
1.80      thfr      535:                ffmpeg -loglevel fatal -i "$vfile" -c:v libtheora -q:v 10 -c:a libvorbis \
                    536:                        -q:a 10 "$(echo "$vfile" | rev | cut -d. -f2-$(($(echo "$vfile" \
                    537:                        | tr -dc '.' | wc -c) + 1)) | rev).ogv"
1.69      thfr      538:        done
                    539:        IFS=$SAVEIFS
1.72      thfr      540:        echo " done."
1.3       thfr      541:
1.65      thfr      542:        selectexe
1.68      thfr      543:        check_remove_steamworks
1.72      thfr      544:        debug_echo "creating launch script"
1.68      thfr      545:        exe_env="${exe_env}MONO_IOMAP=all "
1.72      thfr      546:        scriptfile="run_game.sh"
                    547:        fullscriptpath="$gamedir/$scriptfile"
1.65      thfr      548:        create_wrapper
1.72      thfr      549:        finish_fnaify
1.65      thfr      550: }
1.51      thfr      551:
1.62      thfr      552: # End of Variables and Functions
1.1       thfr      553:
1.47      thfr      554: debug_echo "Dependency directory string: $depdir"
1.46      thfr      555:
1.41      thfr      556: # Identify mono and FNA/MonoGame framework files first, warn/break if errors
1.16      thfr      557:
1.41      thfr      558: if [ -z "$FNAIFY_MONO" ]; then
                    559:        FNAIFY_MONO="mono"
                    560: fi
                    561:
1.62      thfr      562: debug_echo "Checking mono, monodis, framework library (FNA/MonoGame)..."
1.41      thfr      563: "$FNAIFY_MONO" --version 2>/dev/null >/dev/null
1.42      thfr      564: if [ "$?" -gt 0 ]; then
1.62      thfr      565:        echo "error calling mono - aborting... Please make sure that mono is in path or set it in FNAIFY_MONO environment variable!"
                    566:        exit 1
                    567: fi
                    568: # check if monodis can be called
                    569: monodis 2>/dev/null
                    570: if [ "$?" -eq 127 ]; then
1.64      thfr      571:        echo "error calling monodis - aborting... Please make sure that monodis is in the PATH!"
1.41      thfr      572:        exit 1
1.23      thfr      573: fi
1.41      thfr      574: # does any of the framework files exist in $gamedir?
                    575: if [ -e "$gamedir/FNA.dll" ]; then
                    576:        debug_echo "\tFound FNA.dll"
                    577: elif [ -e "$gamedir/MonoGame.Framework.dll" ]; then
                    578:        debug_echo "\tFound MonoGame.Framework.dll"
1.16      thfr      579: else
1.62      thfr      580:        # Atom Zombie Smasher is the only compatible game without framework files
1.21      thfr      581:        ls "$gamedir" | grep -iqm 1 "atomzombiesmasher"
1.51      thfr      582:        if [ $? -eq 0 ]; then
1.87      thfr      583:                debug_echo "Atom Zombie Smasher requires libatomstb.so"
                    584:                # FIXME: check for "libatomstb.so*" in depdirs
                    585:                #        only proceed if not found
                    586:                if [ "x$interaction" = "xi" ] ; then
1.88      thfr      587:                        echo -n "Compile and install libatomstb.so in game directory? [y/n]"
1.87      thfr      588:                        response=
                    589:                        until [ \( "x$response" = "xy" \) -o \( "x$response" = "xn" \) ]
                    590:                        do
                    591:                                read response
                    592:                        done
                    593:                elif [ "x$interaction" = "xy" ] ; then
                    594:                        response="y"
                    595:                else
                    596:                        response="n"
                    597:                fi
                    598:
                    599:                if [ "x$response" = "xy" ] ; then
                    600:                        lastdir="$PWD"
                    601:                        cd /tmp/
                    602:                        echo "\nInstalling libatomstb.so ..."
                    603:                        licenses="${licenses}libatomstb:\thttps://github.com/flibitijibibo/AZSNotSFML/blob/master/NotSFML.cs${newline}"
                    604:                        ftp -V https://github.com/flibitijibibo/AZSNotSFML/archive/$libatomstb_commit.tar.gz
                    605:                        tar zxf $libatomstb_commit.tar.gz
                    606:                        mv AZSNotSFML-$libatomstb_commit AZSNotSFML
                    607:                        echo -n "compiling libatomstb.so. This may take a moment... "
                    608:                        cc -O2 -pipe -c -fpic -I/usr/include/sys \
                    609:                                -o AZSNotSFML/atomstb/atomstb.o AZSNotSFML/atomstb/atomstb.c
                    610:                        cc -shared -o AZSNotSFML/atomstb/libatomstb.so \
                    611:                                AZSNotSFML/atomstb/atomstb.o
                    612:                        echo "done."
                    613:                        cp /tmp/AZSNotSFML/atomstb/libatomstb.so "$gamedir/"
                    614:                        cd "$lastdir"
1.100     thfr      615:                        rm -rf /tmp/AZSNotSFML
1.87      thfr      616:                fi
1.16      thfr      617:        else
1.91      thfr      618:                check_nlog
1.65      thfr      619:                xnasetup        # check if this is an XNA game and set up in that case
1.16      thfr      620:        fi
                    621: fi
                    622:
1.62      thfr      623: # The following code assumes that only one of FNA.dll and MonoGame.Framework.dll is present
                    624: if [ -e "$gamedir/FNA.dll" ]; then
                    625:        fnaversion=`monodis --assembly "$gamedir/FNA.dll" | grep "Version" | tr -d [:alpha:] | tr -d " " | tr -d \:`
                    626:        fnamajor=`echo "$fnaversion" | sed -n -E "s/\..*//p"`
                    627:        fnaminor=`echo "$fnaversion" | sed -n -E "s/[0-9]+\.([0-9]+)\.[0-9]+\.[0-9]+/\1/p"`
                    628:        debug_echo -n "\tFNA.dll version $fnaversion, "
                    629:        debug_echo -n "major: $fnamajor, "
                    630:        debug_echo "minor: $fnaminor"
                    631:        if [ $fnamajor -lt 16 ] || ( [ $fnamajor -eq 16 ] && [ $fnaminor -lt 5 ] )
                    632:        then
                    633:                fna_warning=1
1.41      thfr      634:        fi
1.62      thfr      635: elif [ -e "$gamedir/MonoGame.Framework.dll" ]; then
                    636:        mgversion=`monodis --assembly "$gamedir/MonoGame.Framework.dll" | grep "Version" | tr -d [:alpha:] | tr -d " " | tr -d \:`
                    637:        debug_echo "\tMonoGame.Framework.dll version $mgversion"
1.41      thfr      638: fi
1.91      thfr      639:
                    640: check_nlog
1.41      thfr      641:
1.62      thfr      642: debug_echo "\nTrying to identify the launch script file automatically..."
1.15      thfr      643: scount=0
1.62      thfr      644: scriptfilearray="" # files that are possible launchscripts
1.15      thfr      645: sfile=""
1.5       thfr      646: IFS="
                    647: "
1.101     thfr      648: for sfile in $(cd "$gamedir" && find . -maxdepth 1 -type f | grep -Ev "\.[^/]|mono.*config$" | cut -f 2 -d "/" | sort); do
1.14      thfr      649:        debug_echo "\tfound candidate for launch script file: $sfile"
1.15      thfr      650:        if [ -z "${scriptfilearray}" ]; then
                    651:                scriptfilearray="$sfile"
                    652:        else
                    653:                scriptfilearray="$scriptfilearray $sfile"
                    654:        fi
                    655:        scount=$((scount + 1))
1.5       thfr      656: done
                    657: IFS=$SAVEIFS
                    658:
1.87      thfr      659: if [ \( $scount -gt 1 \) -a \( "x$interaction" = "xi" \) ]; then
1.25      thfr      660:        i=1
1.15      thfr      661:        for fsc in $scriptfilearray; do
                    662:                echo "$i: ${fsc}"
                    663:                i=$((i + 1))
1.5       thfr      664:        done
1.25      thfr      665:        input_script=0
1.63      thfr      666:        # Parentheses for grouping must be escaped with '\'
1.26      thfr      667:        # check for range of numbers, number of characters, and presence of non-digit characters
1.51      thfr      668:        while [ \( $(echo "$input_script" | wc -c) -gt 2 \) -o \( -z "$(echo "$input_script" | grep [1-9])" \) -o \( $input_script -gt $((i - 1)) \) ]; do
1.26      thfr      669:                echo -n "Enter number of the file to use as the launch script: "
1.8       thfr      670:                read input_script
1.5       thfr      671:        done
1.15      thfr      672:        # http://www.etalabs.net/sh_tricks.html - Working with arrays
                    673:        set -- ${scriptfilearray}
1.25      thfr      674:        input_script="\$$input_script"
                    675:        # hmm, eval... simplest way to pick an array element it seems.
                    676:        # http://mywiki.wooledge.org/BashFAQ/048
                    677:        # NOTE: this only works for up to 9 candidate files
                    678:        scriptfile=$(eval echo "$input_script")
1.51      thfr      679: elif [ $scount -eq 1 ]; then
1.15      thfr      680:        scriptfile="${scriptfilearray}"
1.5       thfr      681: else
1.79      thfr      682:        scriptfile="run_game.sh"
1.1       thfr      683: fi
                    684:
1.63      thfr      685: debug_echo "Identified the following file as the launch script: ${scriptfile}\n"
1.1       thfr      686:
                    687: # path and file variable definitions
1.17      thfr      688: fullscriptpath="$gamedir/$scriptfile"
1.1       thfr      689:
1.63      thfr      690: configfilesarray="" # files in gamedir ending in '.config'
1.17      thfr      691: nconfigfilesarray=0
1.14      thfr      692: debug_echo "Identifying config files..."
1.1       thfr      693: IFS="
                    694: "
1.51      thfr      695: for cfile in $(ls "$gamedir" | grep "\.config$"); do
1.14      thfr      696:        debug_echo "\tfound config file: $cfile"
1.21      thfr      697:        configfilesarray="$configfilesarray$cfile "
1.17      thfr      698:        nconfigfilesarray=$((nconfigfilesarray + 1))
1.1       thfr      699: done
                    700: IFS=$SAVEIFS
1.63      thfr      701: debug_echo "Done identifying config files.\n"
1.1       thfr      702:
1.63      thfr      703: # identify required libraries in .config files and lib{,64} directories
                    704: # FIXME: filenames not whitespace-safe (but should not be used in such files anyway)
1.61      thfr      705: printdash $(debug_echo "Identifying libraries required by the game...")
1.1       thfr      706:
1.36      thfr      707: #for MidBoss, add SDL2_image_compact to needlib
1.35      thfr      708: MidBoss=0
                    709: ls "$gamedir" | grep -iqm 1 "midboss"
                    710: if [ $? -eq 0 ]; then
                    711:        MidBoss=1
1.36      thfr      712:        needlibarray="${needlibarray}libSDL2_image_compact.so "
1.87      thfr      713:        # FIXME: add option to compile https://github.com/FNA-XNA/SDL_image_compact ??
1.35      thfr      714: fi
                    715:
1.17      thfr      716: libraryname "lib64"
                    717: libraryname "lib"
1.1       thfr      718:
1.14      thfr      719: debug_echo "Obtaining library names from the following config files"
1.51      thfr      720: if [ $nconfigfilesarray -lt 1 ]; then
1.14      thfr      721:        debug_echo "No config files found."
1.1       thfr      722: else
1.62      thfr      723:        cfile=""
1.51      thfr      724:        for cfile in $configfilesarray; do
1.14      thfr      725:                debug_echo "\t$cfile"
1.17      thfr      726:                linuxlines=$(grep "os\=\"linux" "$gamedir/$cfile")
1.51      thfr      727:                for libstring in $(echo "$linuxlines" | sed -n -E "s/.*target=\"([^\"]+).*/\1/p"); do
1.1       thfr      728:                        # Fix where library name includes directory information
                    729:                        libstring=$(echo "$libstring" | sed -E 's/^.\///')
                    730:                        # remove directories at the start of lib name
                    731:                        libstring=$(echo "$libstring" | sed -E 's/^.*\///')
1.14      thfr      732:                        debug_echo -n "\t\tFound library string: $libstring"
1.62      thfr      733:                        # sort out libs that need to be ignored
1.1       thfr      734:                        validlib $libstring
1.51      thfr      735:                        if [ $? -eq 1 ]; then
1.14      thfr      736:                                debug_echo " - ignored"
1.1       thfr      737:                                continue
                    738:                        fi
                    739:                        libstring=$(trunklibnam "$libstring")
1.14      thfr      740:                        debug_echo -n " -> $libstring"
1.62      thfr      741:                        # add to libstring to needlibarray if not in there yet
1.17      thfr      742:                        inarray $libstring $needlibarray
1.51      thfr      743:                        if [ $? -eq 0 ]; then
1.14      thfr      744:                                debug_echo " - already in array"
1.51      thfr      745:                        elif [ $? -eq 1 ]; then
1.17      thfr      746:                                needlibarray="$needlibarray$libstring "
1.14      thfr      747:                                debug_echo " - added to array"
1.1       thfr      748:                        else
1.17      thfr      749:                                echo "\n\t - ERROR: inarray returned with unexpected error\n"
1.1       thfr      750:                                exit 1
                    751:                        fi
                    752:                done
                    753:        done
1.14      thfr      754:        debug_echo "Done with identifying libraries in config files"
1.1       thfr      755: fi
1.14      thfr      756: debug_echo "Done with identification of needed libraries."
1.1       thfr      757:
1.14      thfr      758: debug_echo -n "Fixing libpng filenames if present..."
1.27      thfr      759: needlibarray=$(echo "${needlibarray}" | sed -E "s/(libpng)..(\.so.*)/\1\2/")
1.18      thfr      760: debug_echo " done.\n"
1.1       thfr      761:
                    762: # Check if the libraries are available on the system (/usr/local/lib).
                    763: # If not, break and inform user which libraries need to be installed.
1.35      thfr      764: echo -n "Checking installed libraries... "
                    765: debug_echo ""
1.1       thfr      766:
1.51      thfr      767: # missinglibs[*] accumulates missing library names to inform user
1.18      thfr      768: missinglibs=""
1.51      thfr      769: for needlib in ${needlibarray}; do
1.89      thfr      770:        if $(ls $(echo "$depdir" | tr -s ':' ' ') | grep -q "$needlib")
1.1       thfr      771:        then
1.46      thfr      772:                IFS=$SAVEIFS
1.18      thfr      773:                debug_echo "\tfound library for: $needlib"
1.1       thfr      774:        else
1.46      thfr      775:                IFS=$SAVEIFS
1.18      thfr      776:                debug_echo "\tNot found: $needlib"
1.28      thfr      777:                missinglibs="$missinglibs$needlib "
1.1       thfr      778:        fi
                    779: done
1.63      thfr      780: echo "done.\n"
1.1       thfr      781:
1.51      thfr      782: if [ -n "${missinglibs}" ]; then
1.93      thfr      783:        #printdash $(echo "Result of configuration testing: FAILED")
1.63      thfr      784:        echo "\nCould not find the following libraries:\n
                    785:        ${missinglibs}\n"
1.1       thfr      786:        exit 1
1.93      thfr      787: #else
                    788:        #printdash $(echo "Result of configuration testing: SUCCESS")
1.81      thfr      789: fi
                    790:
                    791: # identify all .config files that do dllmap and move out of the way
1.84      thfr      792: debug_echo 'moving .config files with dllmap out of the way'
1.81      thfr      793: if [ ! -d "$gamedir/fnaify-backup" ] ; then    # FIXME: is this check needed?
                    794:        mkdir -p "$gamedir/fnaify-backup"
                    795: fi
1.90      thfr      796: for config_file in $(ls "$gamedir" | grep "\.config$"); do
                    797:        if $(grep -q "dllmap" "$config_file"); then
                    798:                mv "$config_file" "$gamedir/fnaify-backup/"
                    799:        fi
1.1       thfr      800: done
                    801:
1.87      thfr      802: # FIXME: leave this out if not importing libSDL2_image_compact??
1.81      thfr      803: # if MidBoss, add a FNA.dll.config to overwrite libSDL2_image_compact
1.87      thfr      804: #if [ $MidBoss -eq 1 ]; then
                    805:        #debug_echo 'creating FNA.dll.config for MidBoss'
                    806:        #cat <<EOF > "$gamedir/FNA.dll.config"
                    807: #<?xml version="1.0" encoding="utf-8"?>
                    808: #<configuration>
                    809:        #<dllmap dll="SDL2_image.dll" os="openbsd,freebsd,netbsd" target="libSDL2_image_compact.so"/>
                    810: #</configuration>
                    811: #EOF
                    812: #fi
1.1       thfr      813:
1.52      thfr      814: debug_echo "Moving some bundled dll files into fnaify-backup subfolder... "
1.51      thfr      815: for file in $monofilearray; do
                    816:        if [ -e "$gamedir/$file" ]; then
1.35      thfr      817:                debug_echo "\tFound bundled mono file: $file"
1.52      thfr      818:                mkdir -p "$gamedir/fnaify-backup"
                    819:                mv "$gamedir/$file" "$gamedir/fnaify-backup/"
1.1       thfr      820:        fi
                    821: done
1.53      thfr      822: debug_echo " done."
                    823:
                    824: # if necessary, replace FNA.dll
                    825: fna_replace=""
                    826: lastdir=""
1.37      thfr      827: if [ $fna_warning -eq 1 ]; then
1.87      thfr      828:        if [ "x$interaction" = "xi" ] ; then
                    829:                echo "\nWARNING: version of FNA.dll potentially incompatble!"
                    830:                echo "Fetch FNA 17.12 from GitHub, compile, and replace bundled FNA.dll?"
1.88      thfr      831:                echo "FNA is distributed under Microsoft Public License. The license"
1.87      thfr      832:                echo "can be viewed here:"
                    833:                echo "https://github.com/FNA-XNA/FNA/blob/master/licenses/LICENSE"
                    834:                echo -n "Proceed with replacing FNA with version 17.12 (recommended)? [y/n] "
                    835:                until [ "$fna_replace" = "y" -o "$fna_replace" = "n" ]; do
                    836:                        read fna_replace
                    837:                done
                    838:        elif [ "x$interaction" = "xy" ] ; then
                    839:                fna_replace="y"
                    840:        else
                    841:                fna_replace="n"
                    842:        fi
                    843:
1.62      thfr      844:        if [ "$fna_replace" = "y" ]; then
1.65      thfr      845:                install_fna 17.12
1.98      thfr      846:                fna_warning=0
1.53      thfr      847:        fi
1.37      thfr      848: fi
1.1       thfr      849:
1.68      thfr      850: check_remove_steamworks
1.56      thfr      851:
1.65      thfr      852: IFS="
                    853: "
1.101     thfr      854: for xfile in $(cd "$gamedir" && find . -maxdepth 1 -type f -iname "*.exe" | cut -f 2 -d "/" | sort); do
1.65      thfr      855:        exefile="$exefile$xfile:"
                    856:        nexefile=$((nexefile + 1))
                    857: done
                    858: IFS=$SAVEIFS
                    859: selectexe
1.22      thfr      860:
1.65      thfr      861: echo "Replacing launch script with BSD version..."
1.68      thfr      862: if [ \( -e "$fullscriptpath" \) -a \( ! -e "$fullscriptpath.linux" \) ]; then
1.62      thfr      863:        debug_echo -n "\t(creating copy of original launcher script with suffix '.linux')... "
1.1       thfr      864:        cp -p "$fullscriptpath" "$fullscriptpath.linux"
1.62      thfr      865:        debug_echo "done."
1.1       thfr      866: fi
1.3       thfr      867:
1.111     thfr      868: # Quirks for the runtime invocation of some games
                    869:
                    870: # Hacknet
1.51      thfr      871: if $(ls "$gamedir" | grep -iqm 1 hacknet); then
1.37      thfr      872:        debug_echo "Setting flag '-disableweb' for HackNet"
1.21      thfr      873:        exe_flags="-disableweb"
                    874: fi
1.111     thfr      875:
                    876: # WizOrb
1.51      thfr      877: if $(ls "$gamedir" | grep -iqm 1 wizorb); then
1.37      thfr      878:        debug_echo "Setting 'MONO_IOMAP=all' for WizOrb"
                    879:        exe_env="${exe_env}MONO_IOMAP=all "
1.111     thfr      880: fi
                    881:
                    882: # Terraria
                    883: if $(ls "$gamedir" | grep -iqm 1 terraria); then
                    884:        debug_echo "Setting 'MONO_FORCE_COMPAT' for Terraria"
                    885:        exe_env="${exe_env}MONO_FORCE_COMPAT=1 "
                    886: fi
                    887:
                    888: # Sword of the Stars: The Pit
                    889: if $(ls "$gamedir" | grep -qm 1 ThePit); then
                    890:        debug_echo "Setting 'MONO_FORCE_COMPAT' for Sword of the Stars: The Pit"
                    891:        exe_env="${exe_env}MONO_FORCE_COMPAT=1 "
1.21      thfr      892: fi
1.3       thfr      893:
1.112     thfr      894: # Blueberry Garden
                    895: if $(ls "$gamedir" | grep -qm 1 Blueberry.exe); then
                    896:        debug_echo "Setting 'MONO_FORCE_COMPAT' for Blueberry Garden"
                    897:        exe_env="${exe_env}MONO_FORCE_COMPAT=1 "
                    898: fi
                    899:
1.65      thfr      900: create_wrapper
1.21      thfr      901: debug_echo "Launcher script replaced.\n"
1.72      thfr      902: finish_fnaify

Contact: <mail@mail.thfr.info>