Skip to content

Instantly share code, notes, and snippets.

@flibitijibibo
Last active April 5, 2024 06:00
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save flibitijibibo/f06e3f60eb66e5462da824e490229591 to your computer and use it in GitHub Desktop.
Save flibitijibibo/f06e3f60eb66e5462da824e490229591 to your computer and use it in GitHub Desktop.
Use this to update a game's FNA installation!
#!/bin/bash
# FNA Update Script
# Written by Ethan "flibitijibibo" Lee
#
# Released under public domain.
# No warranty implied; use at your own risk.
#
# Run this script in the game's executable folder.
#
# This script requires the following programs:
# - git
# - msbuild, which should include a C# compiler
#
# You may want to update MonoKickstart as well!
# https://github.com/flibitijibibo/MonoKickstart/tree/master/precompiled
# Be Smart. Be Safe.
set -e
# Move to script's directory
cd "`dirname "$0"`"
# Grab native libraries
curl -O https://fna.flibitijibibo.com/archive/fnalibs.tar.bz2
tar xvfj fnalibs.tar.bz2 lib64
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 https://github.com/FNA-XNA/FNA
cd FNA
curl -o FNA.Settings.props https://flibitijibibo.com/Terraria.Settings.props
fi
msbuild /p:Configuration=Release /p:Platform=x86 FNA.sln
cd ..
cp FNA/bin/Release/* .
# We out.
echo Complete!
@MyNameIsKeegan
Copy link

Yep, that worked! I was running just by "Run in Konsole" via the context menu. I had also forgotten how to open the script from terminal... Was it an issue of Manjaro using zsh by default instead of bash?
Thanks for the help and quick reply!

@MyNameIsKeegan
Copy link

Got caught up with something almost immediately after running that script, but finally got to try running Terraria... and it crashes after a couple seconds with a black screen. Any ideas?

@luna-nas
Copy link

@MyNameIsKeegan been getting the same error, seems to this:
Exception: System.TypeLoadException: Could not resolve type with token 01000203 from typeref (expected class 'SDL2.SDL_image' in assembly 'FNA, Version=22.2.0.0, Culture=neutral, PublicKeyToken=null') at (wrapper managed-to-native) System.RuntimeMethodHandle.GetFunctionPointer(intptr) at System.RuntimeMethodHandle.GetFunctionPointer () [0x00000] in <d1664be62cd44600bbd25f7afa292479>:0 at Terraria.Program.ForceJITOnAssembly (System.Reflection.Assembly assembly) [0x00060] in <2587bb223ae24a7fa015a01bdfbc78b9>:0 at Terraria.Program.ForceLoadAssembly (System.Reflection.Assembly assembly, System.Boolean initializeStaticMembers) [0x0000d] in <2587bb223ae24a7fa015a01bdfbc78b9>:0 at Terraria.Program.ForceLoadThread (System.Object threadContext) [0x00005] in <2587bb223ae24a7fa015a01bdfbc78b9>:0 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00025] in <d1664be62cd44600bbd25f7afa292479>:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <d1664be62cd44600bbd25f7afa292479>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <d1664be62cd44600bbd25f7afa292479>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <d1664be62cd44600bbd25f7afa292479>:0 at System.Threading.ThreadHelper.ThreadStart (System.Object obj) [0x0000f] in <d1664be62cd44600bbd25f7afa292479>:0

@luna-nas
Copy link

For anyone in the future, I fixed this by downloading FNA myself and changing the Makefile to have
lib/SDL2-CS/src/SDL2_gfx.cs \ lib/SDL2-CS/src/SDL2_image.cs \ lib/SDL2-CS/src/SDL2_mixer.cs \ lib/SDL2-CS/src/SDL2_ttf.cs \
at the bottom of the sources list, game runs significantly better now

@MyNameIsKeegan
Copy link

It runs now! And of course much better performance, thank you for your help! Audio is a bit crunchy and crackly now which is annoying but a big step forward from black screen.

@libjared
Copy link

msbuild can be installed on arch linux with the mono-msbuild package

@CoolGirlAyden
Copy link

Msbuild doesn't seem to work for me, so instead I just used xbuild and it worked flawlessly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment