Just bought Silicon Zeroes (I know I’m late to the game, been too busy in Zachtronics land) and I’m met with this screen…

Well it’s not a great first start experience, but luckily someone encountered a similar problem in 2018: github.com/PleasingFungus/Silicon-Zeroes/issues/127

But hey, at least it’s better than Prime Mover which crashes on startup without any indication to why. I even looked at the strace attempts, but that’s not the game this post is about.

So with that, I’m mostly making this post for my own reference down the road, and as a guide for those who don’t immediately understand how an LD_PRELOAD library works.

Fix it

Drop the code in a .c file:

// gcc -shared -fpic -Os -o /tmp/Si0s.so this.c -ldl
#define _GNU_SOURCE 1
#include <dlfcn.h>
#include <stdlib.h>
#include <stdio.h>

int FMOD_System_GetNumDrivers(void *, int *);
int FMOD_System_GetDriverInfo(void *, int, char *, int, void *, int *, int *, int *);
int FMOD_System_SetDriver(void *, int);

int FMOD_System_Create(void** sys)
  __typeof(FMOD_System_Create) *real_create = dlsym(RTLD_NEXT, "FMOD_System_Create");
  if (!real_create) {
    fprintf(stderr, "dlsym: %s\n", dlerror());
  int ret, drv, numdrv;
  if ((ret = real_create(sys)))
    return ret;
  const char *drvstr = getenv("FMODSUX_SETDRIVER");
  if (drvstr && sscanf(drvstr, "%d", &drv) == 1)
    FMOD_System_SetDriver(*sys, drv);
  else if (!FMOD_System_GetNumDrivers(*sys, &numdrv))
    for (drv = 0; drv < numdrv; drv++) {
      char namebuf[50];
      int rate, mode, nch;
      if (!FMOD_System_GetDriverInfo(*sys, drv, namebuf, sizeof namebuf, 0, &rate, &mode, &nch))
	printf("%2d: mode %d, %d/%dch: %s\n", drv, mode, rate, nch, namebuf);
  return 0;

Now compile that into a shared library for our system:

gcc -shared -fpic -Os -o $HOME/SOME/PATH/Si0s.so THAT_FILE.c -ldl

Of course you should replace the path with somewhere that you’ll remember why it’s there.

Then in your launch options, set the LD_PRELOAD envvar there:

LD_PRELOAD=$HOME/???/Si0s.so %command%, s/???/wherever you put the compiled file.

And now you should be good to go!

Perhaps this should be added to the game’s libraries…

If the dev ever reads this, just edit SiliconZeroes.sh:

diff --git a/SiliconZeroes.sh b/SiliconZeroes.sh.new
index d4c717d..9488d13 100755
--- a/SiliconZeroes.sh
+++ b/SiliconZeroes.sh.new
@@ -1,3 +1,4 @@
 export LD_LIBRARY_PATH="libraries:$LD_LIBRARY_PATH"
+export LD_PRELOAD="libraries/fmodsounddevfix.so $LD_PRELOAD"
 exec ./rawexec "$@"

And distribute a copy of that library with the fixed function override.

Spring Swapping in the Spring

It's spring, and that means... it's time for spring spring swapping?
At least, that's what I ended up doing.
Following up on [m...
Continue reading...

Beat Saber Mods and Linux

Published on March 18, 2022

The ZSA Moonlander First Impressions

Published on September 26, 2021