Skip to content

Instantly share code, notes, and snippets.

@flibitijibibo
Last active February 27, 2024 04:35
Show Gist options
  • Save flibitijibibo/9a1490cca64d6a75448d8c6bc04f71ab to your computer and use it in GitHub Desktop.
Save flibitijibibo/9a1490cca64d6a75448d8c6bc04f71ab to your computer and use it in GitHub Desktop.
Script for converting Stardew Valley for Windows (XNA) to Linux/macOS-compatible (FNA)
#!/bin/bash
# Stardew Valley XnaToFna Automation Script
# Written by Ethan "flibitijibibo" Lee
#
# Usage: Place in Stardew Valley folder, run from terminal.
# NOTE: Be sure you have Mono 4.4 or newer! Stardew's XML structures need it!
# Be smart. Be safe.
set -e
# Move to script directory
cd "`dirname "$0"`"
# Build FNA and XnaToFna
git clone --recursive git://github.com/0x0ade/XnaToFna.git
cd XnaToFna
xbuild
cp bin/Debug/XnaToFna.exe ..
cp bin/Debug/FNA.dll ..
cp bin/Debug/FNA.dll.config ..
# Grab the FNA native libraries
curl -O fna.flibitijibibo.com/archive/fnalibs.tar.bz2
if [ "`uname`" == "Darwin" ]
then
tar xvfj fnalibs.tar.bz2 osx
cp osx/libSDL2-2.0.0.dylib ..
cp osx/libopenal.1.dylib ..
cp osx/libmojoshader.dylib ..
else
if [ "`uname -m`" == "x86_64" ]
then
tar xvfj fnalibs.tar.bz2 lib64
cp lib64/libSDL2-2.0.so.0 ..
cp lib64/libopenal.so.1 ..
cp lib64/libmojoshader.so ..
else
tar xvfj fnalibs.tar.bz2 lib
cp lib/libSDL2-2.0.so.0 ..
cp lib/libopenal.so.1 ..
cp lib/libmojoshader.so ..
fi
fi
# Back up Stardew binaries, relink to FNA
cd ..
mkdir orig
cp Stardew\ Valley.exe orig
cp xTile.dll orig
mono XnaToFna.exe --skip-content --skip-xwb --skip-xgs
# We out.
echo Done! Run \"mono Stardew\ Valley.exe\" to go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment