Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FNA update script for Terraria -requires running the game in 64bit
#!/bin/bash
# FNA Update Script
# Written by Ethan "flibitijibibo" Lee
# Edited by TheDaftRick
#
# Released under public domain.
# No warranty implied; use at your own risk.
#
# Linux guide:
# Place this file fnaUpdate.sh in your Terraria folder
# Open your Terraria folder in terminal and run these two commands
# chmod +x fnaUpdate.sh
# ./fnaUpdate.sh -autoarch
# Add a Non-Steam game and select Terraria.bin.x86_64 in your Terraria folder
# Use this to run Terraria (Steam will still see you running the regular version of Terraria with all Steam features working)
#
# If you want to run the 32bit version of Terraria then use this script to update FNA to 1707
# https://gist.github.com/TheDaftRick/d5e49ebbfd8f09ddfb66dc29e775ece1
#
# Run this script in the game's executable folder.
# For OSX this will be Game.app/Contents/MacOS/.
#
# This script requires the following programs:
# - git
# - make
# - dmcs, the Mono C# compiler
# Be Smart. Be Safe.
set -e
# Move to script's directory
cd "`dirname "$0"`"
# Get the system architecture
UNAME=`uname`
ARCH=`uname -m`
# Grab native libraries
curl -O fna.flibitijibibo.com/archive/fnalibs.tar.bz2
if [ "$UNAME" == "Darwin" ]; then
tar xvfj fnalibs.tar.bz2 osx
else
if [ "$ARCH" == "x86_64" ]; then
tar xvfj fnalibs.tar.bz2 lib64
else
tar xvfj fnalibs.tar.bz2 lib
fi
fi
rm fnalibs.tar.bz2 # Wouldn't want to waste disk space, would we...
# Download and build latest FNA
if [ -d "FNA" ]; then
cd FNA
git pull
git submodule update
else
git clone --recursive git://github.com/FNA-XNA/FNA.git
cd FNA
fi
sed -i 's/IntPtr mem,/byte[] mem,/g' lib/SDL2-CS/src/SDL2.cs
make release
cd ..
cp FNA/bin/Release/* .
# We out.
echo Complete!
@elenapan

This comment has been minimized.

Copy link

commented Jun 2, 2019

Only tested this on multiplayer. It worked extremely well at first, however the more I played the more performance degraded back to "normal". Also the game crashed a couple of times. Anyway it is worth a shot if you have performance issues like I did.

Ubuntu 18.04, Nvidia GPU

@TheDaftRick

This comment has been minimized.

Copy link
Owner Author

commented Jun 2, 2019

Only tested this on multiplayer. It worked extremely well at first, however the more I played the more performance degraded back to "normal". Also the game crashed a couple of times. Anyway it is worth a shot if you have performance issues like I did.

Ubuntu 18.04, Nvidia GPU

https://gist.github.com/TheDaftRick/d5e49ebbfd8f09ddfb66dc29e775ece1
Give the FNA 1707 update a try with the 32bit version of Terraria

@elenapan

This comment has been minimized.

Copy link

commented Jun 3, 2019

@TheDaftRick
Thank you! After some testing in single player, the FNA1707 update for 32bit Terraria seems to be working just fine. I will report back if something goes wrong.

EDIT - Some things I noticed:

  • Pressing F1 makes the game crash.
  • Opening the settings while ingame (inside a world) makes the game crash. Opening it in the main menu is fine though.
@Art10001

This comment has been minimized.

Copy link

commented Jun 4, 2019

Hello. I ask this here because I did not find a discussion about this exact issue anywhere.
When I start Terraria in Linux, the CPU usage is normal, but when I load a world, one core goes up to 100% usage. When I am creating a world of any size, the amount of 100% used cores rises to 2. Why is that and how can I stop it? I think that it's Mono related. Could a FNA update fix it?
Thank you!

@weijiangan

This comment has been minimized.

Copy link

commented Aug 14, 2019

I get "sed: 1: "lib/SDL2-CS/src/SDL2.cs": extra characters at the end of l command" when running the script on Mac. Any advice? Should I replace all IntPtr to byte[]?

UPDATE:
Changing L60 to

sed -i '' 's/IntPtr mem,/byte[] mem,/g' lib/SDL2-CS/src/SDL2.cs

fixed it for me. On a side note: OMG. The performance improvements are incredible! No problems so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.