SHA256
1
0
forked from pool/sdl12_compat

- Add 0001-SDL_GetWMInfo-work-like-1.2-when-SDL_SetVideoMode-ha.patch

to unbreak use with schismtracker.
- Add 0001-Set-pixels-in-SDL_CreateYUVOverlay-Fix-164.patch
  to unbreak use with MPlayer.
- Hot enable sdl12-compat to be the SDL1 replacement [boo#1198182]

OBS-URL: https://build.opensuse.org/package/show/games/sdl12_compat?expand=0&rev=7
This commit is contained in:
Jan Engelhardt 2022-05-16 12:44:32 +00:00 committed by Git OBS Bridge
parent 339db58eb3
commit 744ab7058f
4 changed files with 121 additions and 5 deletions

View File

@ -0,0 +1,70 @@
From 32bcfa763d90cd2391493a396f21b98716b52bda Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <icculus@icculus.org>
Date: Tue, 8 Mar 2022 15:19:41 -0500
Subject: [PATCH] SDL_GetWMInfo: work like 1.2 when SDL_SetVideoMode() hasn't
been called yet.
Fixes #163.
---
src/SDL12_compat.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index b5a851b..ea99f2c 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -6218,6 +6218,9 @@ DECLSPEC int SDLCALL
SDL_GetWMInfo(SDL12_SysWMinfo *info12)
{
SDL_SysWMinfo info20;
+ SDL_bool temp_window = SDL_FALSE;
+ SDL_Window *win20 = VideoWindow20;
+ int rc;
if (info12->version.major > 1) {
SDL20_SetError("Requested version is unsupported");
@@ -6227,15 +6230,30 @@ SDL_GetWMInfo(SDL12_SysWMinfo *info12)
return 0; /* some programs only test against 0, not -1 */
}
+ if (win20 == NULL) {
+ /* It was legal to call SDL_GetWMInfo without SDL_SetVideoMode() on X11 and Windows (and others...?) in 1.2. */
+ win20 = SDL20_CreateWindow("SDL_GetWMInfo support window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 128, 128, SDL_WINDOW_HIDDEN);
+ if (!win20) {
+ return 0;
+ }
+ temp_window = SDL_TRUE;
+ }
+
SDL_zero(info20);
SDL_VERSION(&info20.version);
- if (!SDL20_GetWindowWMInfo(VideoWindow20, &info20)) {
+ rc = SDL20_GetWindowWMInfo(win20, &info20);
+
+ if (temp_window) {
+ SDL20_DestroyWindow(win20);
+ }
+
+ if (!rc) {
return 0; /* some programs only test against 0, not -1 */
}
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
SDL_assert(info20.subsystem == SDL_SYSWM_WINDOWS);
- info12->window = info20.info.win.window;
+ info12->window = temp_window ? 0 : info20.info.win.window;
if (SDL_VERSIONNUM(info12->version.major, info12->version.minor, info12->version.patch) >= SDL_VERSIONNUM(1, 2, 5)) {
info12->hglrc = (HGLRC) VideoGLContext20;
}
@@ -6243,7 +6261,7 @@ SDL_GetWMInfo(SDL12_SysWMinfo *info12)
SDL_assert(info20.subsystem == SDL_SYSWM_X11);
info12->subsystem = SDL12_SYSWM_X11;
info12->info.x11.display = info20.info.x11.display;
- info12->info.x11.window = info20.info.x11.window;
+ info12->info.x11.window = temp_window ? 0 : info20.info.x11.window;
if (SDL_VERSIONNUM(info12->version.major, info12->version.minor, info12->version.patch) >= SDL_VERSIONNUM(1, 0, 2)) {
info12->info.x11.fswindow = 0; /* these don't exist in SDL2. */
info12->info.x11.wmwindow = 0;
--
2.36.1

View File

@ -0,0 +1,39 @@
From f4980108b0fbe59e04aaba6b18be760a607ab923 Mon Sep 17 00:00:00 2001
From: David Gow <david@ingeniumdigital.com>
Date: Mon, 7 Mar 2022 16:01:50 +0800
Subject: [PATCH] Set 'pixels' in SDL_CreateYUVOverlay() (Fix #164)
Some applications, such as mplayer with -vo sdl will access the 'pixels'
member of an SDL_Overlay immediately after creating it, without ever
locking it. This works on (at least some backends for) SDL 1.2, but
crashed on sdl12-compat, as pixels remained unset until
SDL_LockYUVOverlay() is called.
Set pixels in SDL_CreateYUVOverlay(), as well as hwdata->dirty, which
makes it possible to have a working YUV overlay without ever
locking/unlocking it. This is required for mplayer's sdl vo backend to
function.
Fixes issue #164
---
src/SDL12_compat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index b3a411e..b5a851b 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -6337,6 +6337,10 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format12, SDL12_Surface *display12)
retval->hw_overlay = 1;
retval->pitches = hwdata->pitches;
+ /* Some programs (e.g. mplayer) access pixels without locking. */
+ retval->pixels = hwdata->pixels;
+ hwdata->dirty = SDL_TRUE;
+
return retval;
}
--
2.36.1

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon May 16 12:34:45 UTC 2022 - Jan Engelhardt <jengelh@inai.de>
- Add 0001-SDL_GetWMInfo-work-like-1.2-when-SDL_SetVideoMode-ha.patch
to unbreak use with schismtracker.
- Add 0001-Set-pixels-in-SDL_CreateYUVOverlay-Fix-164.patch
to unbreak use with MPlayer.
- Hot enable sdl12-compat to be the SDL1 replacement [boo#1198182]
-------------------------------------------------------------------
Sat Mar 5 16:00:57 UTC 2022 - Jan Engelhardt <jengelh@inai.de>

View File

@ -16,11 +16,8 @@
#
# Avoid being considered a replacement for SDL1 currently
%define __provides_exclude_from ^%_libdir/libSDL-1.*\.so\..*$
Name: sdl12_compat
%define lname sdl12_compat-libSDL-1_2-0
%define lname libSDL-1_2-0
%global _lto_cflags %_lto_cflags -ffat-lto-objects
Version: 1.2.52
Release: 0
@ -30,6 +27,8 @@ Group: Development/Libraries/X11
URL: https://github.com/libsdl-org/sdl12-compat
Source: https://github.com/libsdl-org/sdl12-compat/archive/refs/tags/release-%version.tar.gz
Source9: %name-rpmlintrc
Patch1: 0001-SDL_GetWMInfo-work-like-1.2-when-SDL_SetVideoMode-ha.patch
Patch2: 0001-Set-pixels-in-SDL_CreateYUVOverlay-Fix-164.patch
BuildRequires: cmake
BuildRequires: pkg-config
BuildRequires: pkgconfig(sdl2)
@ -54,7 +53,6 @@ Summary: Libraries, includes and more to develop SDL-1.2 applications
Group: Development/Libraries/X11
Requires: %lname = %version
Conflicts: SDL-devel
AutoReqProv: off
Provides: pkgconfig(sdl12_compat) = %version-%release
%description devel