Legacy4J

Legacy4J

224k Downloads

[Bug/Glitch] Faulty Android/Pojav detection not loading SDL joystick subsystem

Closed this issue ยท 3 comments

commented

Legacy4J Version

1.20.4.1.8.4-lts

Mod Loader Version

Fabric Loader 0.17.1

Bug/Glitch Occurrence Context

Because of

public static String getNativesFileName(){
if (System.getenv("POJAV_NATIVEDIR") != null){
Legacy4J.LOGGER.warn("PojavLauncher Detected.");
return null;

init() always returns here on any Pojav based launcher
public void init() {
if (!init) {
Minecraft minecraft = Minecraft.getInstance();
if (nativesFile == null) {
String fileName = getNativesFileName();
if (fileName == null) {
Legacy4J.LOGGER.warn("{} isn't supported in this system. GLFW will be used instead.", getName());
LegacyOptions.selectedControllerHandler.set(GLFWControllerHandler.getInstance());
LegacyOptions.selectedControllerHandler.save();
init = true;
return;

So even if I provide SDL integration in the app, the subsystem doesn't get loaded.

Crash Report

WARNING: Assertion failure at SDL_AssertJoysticksLocked (/home/runner/work/Amethyst-Android/Amethyst-Android/app_pojavlauncher/src/main/jni/SDL/src/joystick/SDL_joystick.c:515), triggered 1 time: 'SDL_JoysticksLocked()'

What happened wrong?

Detection for android launchers is based solely on POJAV_NATIVEDIR rather than actually checking if a libSDL3.so is present which can be done by falling back to System.loadlLibrary() or just checking if the symbols are already loaded, so even if SDL3 integration is implemented (it is, Controlify works), it can't actually function as intended.

In theory we could just use a hack and init the subsytem ourselves but that sounds horrible.

commented

The hack has been done, I do not like it, please help
AngelAuraMC/Amethyst-Android@bbcbeeb

commented

An additional issue that comes with this is that SDL is not pre-enabled, it has to be enabled from the settings manually.

commented

This was discussed and diagnosed in the discord.
6085be5 has fixed it, thanks! ๐ŸŽ‰