Patch Celeste.app for Wireless controller support on MacOS

tldr; Celeste ignores some wireless controllers because of an outdated library (a file that provides useful features to the main executable). Upgrading said library inside the .app/ fixes the issue.

My controller works with other MacOS games and I tried every possible settings both in Celeste and Steam.

By looking at the dynamic libraries packed in Celeste.app/, we might be able to pinpoint the issue.

App files are just folders with an extension. Any app can be unfolded with a right-click.

In Celeste.app/ we find libSDL2-2.0.0.dylib, which indicates that Celeste is based on the SDL (or Simple Directmedia Library): a general and well known library that abstracts away graphics hardware, “input devices” and audio devices among other things.

Provided the API has remained stable enough since 2.0.0, replacing libSDL2 by a newer version could do the trick.

Recent releases of the libSDL for MacOS consists of a folder named SDL.framework/ with no dylib in sight. I found that renaming SDL2.framework/Versions/A/SDL2 to libSDL2-2.0.0.dylib does the job. Running file ./SDL2 confirms that it is a dynamic library.

My first attempt was to inject the newer SDL using the DYLD_INSERT_LIBRARIES variable. Try it out if you want.

One option remains: to actually modify the game package and replace the old SDL.

Codesigning

Having replaced the file, the game won’t load anymore. It could be that we’ve just broken it, or maybe code signing is to blame. By running the command $PATH_TO_CELESTE_APP/Contents/MacOS/Celeste in a terminal, we get the following output:

System.DllNotFoundException: libSDL2-2.0.0.dylib 

Since the file is in there, it looks like something bigger is preventing Celeste from loading it. We could try manually codesigning Celeste.app/ and see what happens.

I found that creating a new signing certificate in the OS Keychain and running the following command will finally make the operating system comply.

sudo codesign --deep --force --verify --sign "MyCert" $PATH_TO_CELESTE_APP

Running Celeste again, my wireless controller is instantly recognized without any configuration.