sdl12-compat: quirks: Force "tucnak" to x11, software renderer, and no framebuffer texture.

From e511d82c9f5f5b20eb3ccb7c7f37b5007a073a23 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 1 Sep 2022 11:42:44 -0400
Subject: [PATCH] quirks: Force "tucnak" to x11, software renderer, and no
 framebuffer texture.

It uses rendering and the event loop from different threads, so it upsets
OpenGL and is hard to work around, beyond just falling back to an
all-software rendering path (which means it has to use X11 too).

There is a real SDL2 target for this app, which doesn't have these
limitations, but this gets the SDL 1.2 target working.

Fixes #182.
---
 COMPATIBILITY.md   | 13 +++++++++++++
 src/SDL12_compat.c |  7 +++++++
 2 files changed, 20 insertions(+)

diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md
index b8796216d..c0994cd67 100644
--- a/COMPATIBILITY.md
+++ b/COMPATIBILITY.md
@@ -47,3 +47,16 @@ directly, so this does not prevent the game from working on Wayland. No
 XWayland needed!
 
 
+## Tucnak (Linux)
+
+There is an SDL2 target for libzia (which tucnak uses for rendering), and you
+should use that in modern times. But if you're on the SDL 1.2 target,
+tucnak tries to render from a background thread, and does its event loop on
+another, so we can't cleanly hook in to make it draw from the main thread.
+
+sdl12-compat will force SDL2 to use X11, software rendering, and no texture
+framebuffer, to avoid using OpenGL, to avoid the threading problems this
+will cause. The app is perfectly usable in this configuration (and largely
+matches how they expected you to use it with SDL 1.2 anyhow).
+
+
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 2f5973df6..bb015e5a7 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1184,6 +1184,13 @@ static QuirkEntryType quirks[] = {
     {"dosbox_i686", "SDL12COMPAT_USE_KEYBOARD_LAYOUT", "0"},
     {"dosbox_x86_64", "SDL12COMPAT_USE_KEYBOARD_LAYOUT", "0"},
 
+    /* Tucnak's 1.2 target wants to render and run its event loop from
+       background threads, which upsets OpenGL. Force software renderer and
+       x11. If you want Wayland, etc, use tuknak's existing SDL2 target. */
+    {"tucnak", "SDL_VIDEODRIVER", "x11"},
+    {"tucnak", "SDL_RENDER_DRIVER", "software"},
+    {"tucnak", "SDL_FRAMEBUFFER_ACCELERATION", "false"},
+
     /* The 32-bit Steam build only of Multiwinia Quits but doesn't re-Init */
     {"multiwinia.bin.x86", "SDL12COMPAT_NO_QUIT_VIDEO", "1"}
 #else