Launcher: SDL_VIDEODRIVER=wayland sur session Wayland (EGL/GL pour Iris)

This commit is contained in:
kisakay
2026-10-18 20:43:11 +02:00
parent f278884cfa
commit bae95baed3
+21
View File
@@ -55,6 +55,20 @@ function resolveSystemNativeDirs(){
return dirs
}
/**
* SurviePote : détecte une session Wayland (socket wayland-* du runtime dir).
*
* @returns {boolean} True si un socket Wayland est visible.
*/
function hasWaylandSocket(){
try {
const runtime = process.env.XDG_RUNTIME_DIR || '/run/user/' + (process.getuid ? process.getuid() : 1000)
return fs.readdirSync(runtime).some(f => f.startsWith('wayland-') && !f.endsWith('.lock'))
} catch(_err) {
return false
}
}
/**
* SurviePote : dossier des plugins SPA PipeWire (routage audio).
* Sans lui, OpenAL voit PipeWire mais ne peut router aucun son.
@@ -159,6 +173,13 @@ class ProcessBuilder {
logger.info('Set SPA_PLUGIN_DIR:', spa)
}
}
// SurviePote : sur Wayland, forcer SDL en natif plutôt que XWayland.
// XWayland rootless n'a pas de GLX direct -> backend OpenGL mort + Iris abort.
// En natif Wayland, EGL fonctionne et le backend OpenGL (requis par Iris) s'init.
if(!gameEnv.SDL_VIDEODRIVER && (gameEnv.WAYLAND_DISPLAY || hasWaylandSocket())){
gameEnv.SDL_VIDEODRIVER = 'wayland'
logger.info('Set SDL_VIDEODRIVER=wayland')
}
}
const child = child_process.spawn(ConfigManager.getJavaExecutable(this.server.rawServer.id), args, {