diff --git a/launcher/app/assets/js/processbuilder.js b/launcher/app/assets/js/processbuilder.js index 48da80e..fe0da64 100644 --- a/launcher/app/assets/js/processbuilder.js +++ b/launcher/app/assets/js/processbuilder.js @@ -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, {