summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta2015-03-09 21:14:40 +0100
committerJan Cholasta2015-03-09 21:18:35 +0100
commit8ba724dcbdedea0bbcc7871be4353637597761d6 (patch)
tree2eef9585ded2196339effd2323c2985aa7ac3deb
parente89af4a09eb9d0ea2bd6644ccfd4fd9a07ce9f46 (diff)
downloadaur-8ba724dcbdedea0bbcc7871be4353637597761d6.tar.gz
Update gzdoom to 2.0.05
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD29
-rw-r--r--git-37321d1.patch182
-rw-r--r--git-c915049.patch1125
-rw-r--r--git-cab509c.patch143
-rw-r--r--git-fb3bf0e.patch25
-rw-r--r--gitinfo.h6
7 files changed, 1512 insertions, 16 deletions
diff --git a/.SRCINFO b/.SRCINFO
index c963cbfce161..cd5ee846b0e6 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = gzdoom
pkgdesc = Doom source port based on ZDoom with an OpenGL renderer.
- pkgver = 2.0.04
- pkgrel = 2
+ pkgver = 2.0.05
+ pkgrel = 1
url = http://www.osnanet.de/c.oelckers/gzdoom/
arch = i686
arch = x86_64
@@ -26,14 +26,22 @@ pkgbase = gzdoom
optdepends = hexen1-wad: Hexen demo game data
optdepends = strife0-wad: Strife shareware game data
optdepends = urbanbrawl-wad: Urban Brawl: Action Doom 2 game data
- source = https://github.com/coelckers/gzdoom/archive/g2.0.04.tar.gz
+ source = https://github.com/coelckers/gzdoom/archive/g2.0.05.tar.gz
source = gitinfo.h
+ source = git-c915049.patch
+ source = git-37321d1.patch
+ source = git-cab509c.patch
+ source = git-fb3bf0e.patch
source = config-update-fix.patch
source = doom-share-dir.patch
source = stack-noexec.patch
source = gzdoom.desktop
- md5sums = 6a97b12b99406c112279485054bf13a6
- md5sums = 6c0e3f9ec915af905f016442f5e0e25d
+ md5sums = 9ea9aece6aaf6c31ce7c7f079d86bd80
+ md5sums = e4d8f20a4e97ba6eade49862421a6039
+ md5sums = f293adb5f585ec1d245cc422ebd3a8f3
+ md5sums = 25c80530b4540bf805a5b14a22b8ec37
+ md5sums = 5536e58fdeb11a7618f39bc5a325dafe
+ md5sums = 94d5d45d4fab4896c4c20b9daeacdb46
md5sums = eed301389f533effbd127681a3ddc2c5
md5sums = 3ee3d6bb1f777445438bc40ae81a95df
md5sums = 4778bb22190c445a4ed764c64432de12
diff --git a/PKGBUILD b/PKGBUILD
index b992b75cfe56..3874c7f44b2a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,8 +2,8 @@
# Contributor: Christoph Zeiler <rabyte*gmail>
pkgname=gzdoom
-pkgver=2.0.04
-pkgrel=2
+pkgver=2.0.05
+pkgrel=1
pkgdesc="Doom source port based on ZDoom with an OpenGL renderer."
arch=('i686' 'x86_64')
url="http://www.osnanet.de/c.oelckers/gzdoom/"
@@ -21,13 +21,21 @@ optdepends=('blasphemer: Blasphemer (free Heretic) game data'
'strife0-wad: Strife shareware game data'
'urbanbrawl-wad: Urban Brawl: Action Doom 2 game data')
source=(https://github.com/coelckers/gzdoom/archive/g${pkgver}.tar.gz
- gitinfo.h \
- config-update-fix.patch \
- doom-share-dir.patch \
- stack-noexec.patch \
+ gitinfo.h
+ git-c915049.patch
+ git-37321d1.patch
+ git-cab509c.patch
+ git-fb3bf0e.patch
+ config-update-fix.patch
+ doom-share-dir.patch
+ stack-noexec.patch
gzdoom.desktop)
-md5sums=('6a97b12b99406c112279485054bf13a6'
- '6c0e3f9ec915af905f016442f5e0e25d'
+md5sums=('9ea9aece6aaf6c31ce7c7f079d86bd80'
+ 'e4d8f20a4e97ba6eade49862421a6039'
+ 'f293adb5f585ec1d245cc422ebd3a8f3'
+ '25c80530b4540bf805a5b14a22b8ec37'
+ '5536e58fdeb11a7618f39bc5a325dafe'
+ '94d5d45d4fab4896c4c20b9daeacdb46'
'eed301389f533effbd127681a3ddc2c5'
'3ee3d6bb1f777445438bc40ae81a95df'
'4778bb22190c445a4ed764c64432de12'
@@ -42,6 +50,11 @@ prepare() {
cp "$srcdir"/gitinfo.h src/gitinfo.h
+ patch -p1 <"$srcdir"/git-c915049.patch
+ patch -p1 <"$srcdir"/git-37321d1.patch
+ patch -p1 <"$srcdir"/git-cab509c.patch
+ patch -p1 <"$srcdir"/git-fb3bf0e.patch
+
patch -p1 <"$srcdir/config-update-fix.patch"
patch -p1 <"$srcdir/doom-share-dir.patch"
patch -p1 <"$srcdir/stack-noexec.patch"
diff --git a/git-37321d1.patch b/git-37321d1.patch
new file mode 100644
index 000000000000..f2f878f770b8
--- /dev/null
+++ b/git-37321d1.patch
@@ -0,0 +1,182 @@
+From 37321d1d483cee0c01285774921fb861bd6f9c1e Mon Sep 17 00:00:00 2001
+From: Edoardo Prezioso <edo88@email.it>
+Date: Thu, 8 Jan 2015 00:23:14 +0100
+Subject: [PATCH] - Implement SDL2 into GZDoom (needs improvements).
+
+Make also minor fixes.
+Now it compiles and runs fine for me, except for the invisible cursor in the menu (no idea why).
+---
+ src/posix/sdl/sdlglvideo.cpp | 67 ++++++++++++++++++++++++++------------------
+ src/posix/sdl/sdlglvideo.h | 9 +++---
+ 2 files changed, 44 insertions(+), 32 deletions(-)
+
+diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp
+index 649989e..9331c0f 100644
+--- a/src/posix/sdl/sdlglvideo.cpp
++++ b/src/posix/sdl/sdlglvideo.cpp
+@@ -1,8 +1,6 @@
+
+ // HEADER FILES ------------------------------------------------------------
+
+-#include <iostream>
+-
+ #include "doomtype.h"
+
+ #include "templates.h"
+@@ -48,6 +46,7 @@ extern IVideo *Video;
+ // extern int vid_renderer;
+
+ EXTERN_CVAR (Float, Gamma)
++EXTERN_CVAR (Int, vid_adapter)
+ EXTERN_CVAR (Int, vid_displaybits)
+ EXTERN_CVAR (Int, vid_renderer)
+
+@@ -156,14 +155,19 @@ bool SDLGLVideo::NextMode (int *width, int *height, bool *letterbox)
+ }
+ else
+ {
+- SDL_Rect **modes = SDL_ListModes (NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
+- if (modes != NULL && modes[IteratorMode] != NULL)
++ SDL_DisplayMode mode = {}, oldmode = {};
++ if(IteratorMode != 0)
++ SDL_GetDisplayMode(vid_adapter, IteratorMode-1, &oldmode);
++ do
+ {
+- *width = modes[IteratorMode]->w;
+- *height = modes[IteratorMode]->h;
++ if (SDL_GetDisplayMode(vid_adapter, IteratorMode, &mode) != 0)
++ return false;
+ ++IteratorMode;
+- return true;
+- }
++ } while(mode.w == oldmode.w && mode.h == oldmode.h);
++
++ *width = mode.w;
++ *height = mode.h;
++ return true;
+ }
+ return false;
+ }
+@@ -182,11 +186,11 @@ DFrameBuffer *SDLGLVideo::CreateFrameBuffer (int width, int height, bool fullscr
+ if (fb->Width == width &&
+ fb->Height == height)
+ {
+- bool fsnow = (fb->Screen->flags & SDL_FULLSCREEN) != 0;
++ bool fsnow = (SDL_GetWindowFlags (fb->Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
+
+ if (fsnow != fullscreen)
+ {
+- SDL_WM_ToggleFullScreen (fb->Screen);
++ SDL_SetWindowFullscreen (fb->Screen, fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
+ }
+ return old;
+ }
+@@ -336,30 +340,37 @@ SDLGLFB::SDLGLFB (void *, int width, int height, int, int, bool fullscreen)
+ return;
+ }
+
+-
+- Screen = SDL_SetVideoMode (width, height,
+- 32,
+- SDL_HWSURFACE|SDL_HWPALETTE|SDL_OPENGL | SDL_GL_DOUBLEBUFFER|SDL_ANYFORMAT|
+- (fullscreen ? SDL_FULLSCREEN : 0));
++ FString caption;
++ caption.Format(GAMESIG " %s (%s)", GetVersionString(), GetGitTime());
++ Screen = SDL_CreateWindow (caption,
++ SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter),
++ width, height, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)|SDL_WINDOW_OPENGL);
+
+ if (Screen == NULL)
+ return;
+
+- m_supportsGamma = -1 != SDL_GetGammaRamp(m_origGamma[0], m_origGamma[1], m_origGamma[2]);
+-
+-#if defined(__APPLE__)
+- // Need to set title here because a window is not created yet when calling the same function from main()
+- char caption[100];
+- mysnprintf(caption, countof(caption), GAMESIG " %s (%s)", GetVersionString(), GetGitTime());
+- SDL_WM_SetCaption(caption, NULL);
+-#endif // __APPLE__
++ GLContext = SDL_GL_CreateContext(Screen);
++ if (GLContext == NULL)
++ return;
++
++ m_supportsGamma = -1 != SDL_GetWindowGammaRamp(Screen, m_origGamma[0], m_origGamma[1], m_origGamma[2]);
+ }
+
+ SDLGLFB::~SDLGLFB ()
+ {
+- if (m_supportsGamma)
++ if (Screen)
+ {
+- SDL_SetGammaRamp(m_origGamma[0], m_origGamma[1], m_origGamma[2]);
++ if (m_supportsGamma)
++ {
++ SDL_SetWindowGammaRamp(Screen, m_origGamma[0], m_origGamma[1], m_origGamma[2]);
++ }
++
++ if (GLContext)
++ {
++ SDL_GL_DeleteContext(GLContext);
++ }
++
++ SDL_DestroyWindow(Screen);
+ }
+ }
+
+@@ -386,7 +397,7 @@ bool SDLGLFB::CanUpdate ()
+
+ void SDLGLFB::SetGammaTable(WORD *tbl)
+ {
+- SDL_SetGammaRamp(&tbl[0], &tbl[256], &tbl[512]);
++ SDL_SetWindowGammaRamp(Screen, &tbl[0], &tbl[256], &tbl[512]);
+ }
+
+ bool SDLGLFB::Lock(bool buffered)
+@@ -420,7 +431,7 @@ bool SDLGLFB::IsLocked ()
+
+ bool SDLGLFB::IsFullscreen ()
+ {
+- return (Screen->flags & SDL_FULLSCREEN) != 0;
++ return (SDL_GetWindowFlags (Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
+ }
+
+
+@@ -443,6 +454,6 @@ void SDLGLFB::NewRefreshRate ()
+
+ void SDLGLFB::SwapBuffers()
+ {
+- SDL_GL_SwapBuffers ();
++ SDL_GL_SwapWindow (Screen);
+ }
+
+diff --git a/src/posix/sdl/sdlglvideo.h b/src/posix/sdl/sdlglvideo.h
+index 205e416..3867be6 100644
+--- a/src/posix/sdl/sdlglvideo.h
++++ b/src/posix/sdl/sdlglvideo.h
+@@ -3,7 +3,6 @@
+
+ #include "hardware.h"
+ #include "v_video.h"
+-#include <SDL.h>
+ #include "gl/system/gl_system.h"
+
+ EXTERN_CVAR (Float, dimamount)
+@@ -70,9 +69,11 @@ protected:
+ SDLGLFB () {}
+ BYTE GammaTable[3][256];
+ bool UpdatePending;
+-
+- SDL_Surface *Screen;
+-
++
++ SDL_Window *Screen;
++
++ SDL_GLContext GLContext;
++
+ void UpdateColors ();
+
+ int m_Lock;
+--
+2.3.2
+
diff --git a/git-c915049.patch b/git-c915049.patch
new file mode 100644
index 000000000000..65140ffa1f3d
--- /dev/null
+++ b/git-c915049.patch
@@ -0,0 +1,1125 @@
+From c9150497e3472e1057ed8286237fcf07106a075d Mon Sep 17 00:00:00 2001
+From: Edoardo Prezioso <edo88@email.it>
+Date: Wed, 7 Jan 2015 21:07:40 +0100
+Subject: [PATCH] - Move sdlglvideo code from sdl to posix/sdl.
+
+Re-add sdlglvideo.cpp path in CMakeLists.txt . Warning: it won't compile yet.
+---
+ src/CMakeLists.txt | 6 +-
+ src/posix/sdl/sdlglvideo.cpp | 448 +++++++++++++++++++++++++++++++++++++++++++
+ src/posix/sdl/sdlglvideo.h | 82 ++++++++
+ src/sdl/sdlglvideo.cpp | 448 -------------------------------------------
+ src/sdl/sdlglvideo.h | 82 --------
+ 5 files changed, 532 insertions(+), 534 deletions(-)
+ create mode 100644 src/posix/sdl/sdlglvideo.cpp
+ create mode 100644 src/posix/sdl/sdlglvideo.h
+ delete mode 100644 src/sdl/sdlglvideo.cpp
+ delete mode 100644 src/sdl/sdlglvideo.h
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 4803006..3edcbaf 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -584,13 +584,11 @@ set( PLAT_SDL_SOURCES
+ posix/sdl/i_joystick.cpp
+ posix/sdl/i_main.cpp
+ posix/sdl/i_timer.cpp
+- posix/sdl/sdlvideo.cpp )
++ posix/sdl/sdlvideo.cpp
++ posix/sdl/sdlglvideo.cpp )
+ set( PLAT_OSX_SOURCES
+ posix/osx/iwadpicker_cocoa.mm
+ posix/osx/zdoom.icns )
+-
+-# Fixme: This must be adjusted to the new way of doing things:
+-# sdl/sdlglvideo.cpp
+ set( PLAT_COCOA_SOURCES
+ posix/cocoa/hid/HID_Config_Utilities.c
+ posix/cocoa/hid/HID_Error_Handler.c
+diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp
+new file mode 100644
+index 0000000..649989e
+--- /dev/null
++++ b/src/posix/sdl/sdlglvideo.cpp
+@@ -0,0 +1,448 @@
++
++// HEADER FILES ------------------------------------------------------------
++
++#include <iostream>
++
++#include "doomtype.h"
++
++#include "templates.h"
++#include "i_system.h"
++#include "i_video.h"
++#include "v_video.h"
++#include "v_pfx.h"
++#include "stats.h"
++#include "version.h"
++#include "c_console.h"
++
++#include "sdlglvideo.h"
++#include "gl/system/gl_system.h"
++#include "r_defs.h"
++#include "gl/gl_functions.h"
++//#include "gl/gl_intern.h"
++
++#include "gl/renderer/gl_renderer.h"
++#include "gl/system/gl_framebuffer.h"
++#include "gl/shaders/gl_shader.h"
++#include "gl/utility/gl_templates.h"
++#include "gl/textures/gl_material.h"
++#include "gl/system/gl_cvars.h"
++
++// MACROS ------------------------------------------------------------------
++
++// TYPES -------------------------------------------------------------------
++
++IMPLEMENT_ABSTRACT_CLASS(SDLGLFB)
++
++struct MiniModeInfo
++{
++ WORD Width, Height;
++};
++
++// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
++
++// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
++
++// EXTERNAL DATA DECLARATIONS ----------------------------------------------
++
++extern IVideo *Video;
++// extern int vid_renderer;
++
++EXTERN_CVAR (Float, Gamma)
++EXTERN_CVAR (Int, vid_displaybits)
++EXTERN_CVAR (Int, vid_renderer)
++
++
++// PUBLIC DATA DEFINITIONS -------------------------------------------------
++
++CUSTOM_CVAR(Int, gl_vid_multisample, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL )
++{
++ Printf("This won't take effect until " GAMENAME " is restarted.\n");
++}
++
++// PRIVATE DATA DEFINITIONS ------------------------------------------------
++
++// Dummy screen sizes to pass when windowed
++static MiniModeInfo WinModes[] =
++{
++ { 320, 200 },
++ { 320, 240 },
++ { 400, 225 }, // 16:9
++ { 400, 300 },
++ { 480, 270 }, // 16:9
++ { 480, 360 },
++ { 512, 288 }, // 16:9
++ { 512, 384 },
++ { 640, 360 }, // 16:9
++ { 640, 400 },
++ { 640, 480 },
++ { 720, 480 }, // 16:10
++ { 720, 540 },
++ { 800, 450 }, // 16:9
++ { 800, 500 }, // 16:10
++ { 800, 600 },
++ { 848, 480 }, // 16:9
++ { 960, 600 }, // 16:10
++ { 960, 720 },
++ { 1024, 576 }, // 16:9
++ { 1024, 600 }, // 17:10
++ { 1024, 640 }, // 16:10
++ { 1024, 768 },
++ { 1088, 612 }, // 16:9
++ { 1152, 648 }, // 16:9
++ { 1152, 720 }, // 16:10
++ { 1152, 864 },
++ { 1280, 720 }, // 16:9
++ { 1280, 800 }, // 16:10
++ { 1280, 960 },
++ { 1344, 756 }, // 16:9
++ { 1360, 768 }, // 16:9
++ { 1400, 787 }, // 16:9
++ { 1400, 875 }, // 16:10
++ { 1440, 900 },
++ { 1400, 1050 },
++ { 1600, 900 }, // 16:9
++ { 1600, 1000 }, // 16:10
++ { 1600, 1200 },
++ { 1680, 1050 }, // 16:10
++ { 1920, 1080 }, // 16:9
++ { 1920, 1200 }, // 16:10
++ { 2054, 1536 },
++ { 2560, 1440 }, // 16:9
++ { 2880, 1800 } // 16:10
++};
++
++// CODE --------------------------------------------------------------------
++
++SDLGLVideo::SDLGLVideo (int parm)
++{
++ IteratorBits = 0;
++ IteratorFS = false;
++ if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
++ fprintf( stderr, "Video initialization failed: %s\n",
++ SDL_GetError( ) );
++ }
++#ifndef _WIN32
++ // mouse cursor is visible by default on linux systems, we disable it by default
++ SDL_ShowCursor (0);
++#endif
++}
++
++SDLGLVideo::~SDLGLVideo ()
++{
++ if (GLRenderer != NULL) GLRenderer->FlushTextures();
++}
++
++void SDLGLVideo::StartModeIterator (int bits, bool fs)
++{
++ IteratorMode = 0;
++ IteratorBits = bits;
++ IteratorFS = fs;
++}
++
++bool SDLGLVideo::NextMode (int *width, int *height, bool *letterbox)
++{
++ if (IteratorBits != 8)
++ return false;
++
++ if (!IteratorFS)
++ {
++ if ((unsigned)IteratorMode < sizeof(WinModes)/sizeof(WinModes[0]))
++ {
++ *width = WinModes[IteratorMode].Width;
++ *height = WinModes[IteratorMode].Height;
++ ++IteratorMode;
++ return true;
++ }
++ }
++ else
++ {
++ SDL_Rect **modes = SDL_ListModes (NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
++ if (modes != NULL && modes[IteratorMode] != NULL)
++ {
++ *width = modes[IteratorMode]->w;
++ *height = modes[IteratorMode]->h;
++ ++IteratorMode;
++ return true;
++ }
++ }
++ return false;
++}
++
++DFrameBuffer *SDLGLVideo::CreateFrameBuffer (int width, int height, bool fullscreen, DFrameBuffer *old)
++{
++ static int retry = 0;
++ static int owidth, oheight;
++
++ PalEntry flashColor;
++// int flashAmount;
++
++ if (old != NULL)
++ { // Reuse the old framebuffer if its attributes are the same
++ SDLGLFB *fb = static_cast<SDLGLFB *> (old);
++ if (fb->Width == width &&
++ fb->Height == height)
++ {
++ bool fsnow = (fb->Screen->flags & SDL_FULLSCREEN) != 0;
++
++ if (fsnow != fullscreen)
++ {
++ SDL_WM_ToggleFullScreen (fb->Screen);
++ }
++ return old;
++ }
++// old->GetFlash (flashColor, flashAmount);
++ delete old;
++ }
++ else
++ {
++ flashColor = 0;
++// flashAmount = 0;
++ }
++
++ SDLGLFB *fb = new OpenGLFrameBuffer (0, width, height, 32, 60, fullscreen);
++ retry = 0;
++
++ // If we could not create the framebuffer, try again with slightly
++ // different parameters in this order:
++ // 1. Try with the closest size
++ // 2. Try in the opposite screen mode with the original size
++ // 3. Try in the opposite screen mode with the closest size
++ // This is a somewhat confusing mass of recursion here.
++
++ while (fb == NULL || !fb->IsValid ())
++ {
++ if (fb != NULL)
++ {
++ delete fb;
++ }
++
++ switch (retry)
++ {
++ case 0:
++ owidth = width;
++ oheight = height;
++ case 2:
++ // Try a different resolution. Hopefully that will work.
++ I_ClosestResolution (&width, &height, 8);
++ break;
++
++ case 1:
++ // Try changing fullscreen mode. Maybe that will work.
++ width = owidth;
++ height = oheight;
++ fullscreen = !fullscreen;
++ break;
++
++ default:
++ // I give up!
++ I_FatalError ("Could not create new screen (%d x %d)", owidth, oheight);
++
++ fprintf( stderr, "!!! [SDLGLVideo::CreateFrameBuffer] Got beyond I_FatalError !!!" );
++ return NULL; //[C] actually this shouldn't be reached; probably should be replaced with an ASSERT
++ }
++
++ ++retry;
++ fb = static_cast<SDLGLFB *>(CreateFrameBuffer (width, height, fullscreen, NULL));
++ }
++
++// fb->SetFlash (flashColor, flashAmount);
++ return fb;
++}
++
++void SDLGLVideo::SetWindowedScale (float scale)
++{
++}
++
++bool SDLGLVideo::SetResolution (int width, int height, int bits)
++{
++ // FIXME: Is it possible to do this without completely destroying the old
++ // interface?
++#ifndef NO_GL
++
++ if (GLRenderer != NULL) GLRenderer->FlushTextures();
++ I_ShutdownGraphics();
++
++ Video = new SDLGLVideo(0);
++ if (Video == NULL) I_FatalError ("Failed to initialize display");
++
++#if (defined(WINDOWS)) || defined(WIN32)
++ bits=32;
++#else
++ bits=24;
++#endif
++
++ V_DoModeSetup(width, height, bits);
++#endif
++ return true; // We must return true because the old video context no longer exists.
++}
++
++//==========================================================================
++//
++//
++//
++//==========================================================================
++
++bool SDLGLVideo::SetupPixelFormat(bool allowsoftware, int multisample)
++{
++ SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
++ SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
++ SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
++ SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 );
++ SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
++ SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 );
++// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
++ if (multisample > 0) {
++ SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
++ SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, multisample );
++ }
++ return true;
++}
++
++//==========================================================================
++//
++//
++//
++//==========================================================================
++
++bool SDLGLVideo::InitHardware (bool allowsoftware, int multisample)
++{
++ if (!SetupPixelFormat(allowsoftware, multisample))
++ {
++ Printf ("R_OPENGL: Reverting to software mode...\n");
++ return false;
++ }
++ return true;
++}
++
++
++// FrameBuffer implementation -----------------------------------------------
++
++SDLGLFB::SDLGLFB (void *, int width, int height, int, int, bool fullscreen)
++ : DFrameBuffer (width, height)
++{
++ static int localmultisample=-1;
++
++ if (localmultisample<0) localmultisample=gl_vid_multisample;
++
++ int i;
++
++ m_Lock=0;
++
++ UpdatePending = false;
++
++ if (!static_cast<SDLGLVideo*>(Video)->InitHardware(false, localmultisample))
++ {
++ vid_renderer = 0;
++ return;
++ }
++
++
++ Screen = SDL_SetVideoMode (width, height,
++ 32,
++ SDL_HWSURFACE|SDL_HWPALETTE|SDL_OPENGL | SDL_GL_DOUBLEBUFFER|SDL_ANYFORMAT|
++ (fullscreen ? SDL_FULLSCREEN : 0));
++
++ if (Screen == NULL)
++ return;
++
++ m_supportsGamma = -1 != SDL_GetGammaRamp(m_origGamma[0], m_origGamma[1], m_origGamma[2]);
++
++#if defined(__APPLE__)
++ // Need to set title here because a window is not created yet when calling the same function from main()
++ char caption[100];
++ mysnprintf(caption, countof(caption), GAMESIG " %s (%s)", GetVersionString(), GetGitTime());
++ SDL_WM_SetCaption(caption, NULL);
++#endif // __APPLE__
++}
++
++SDLGLFB::~SDLGLFB ()
++{
++ if (m_supportsGamma)
++ {
++ SDL_SetGammaRamp(m_origGamma[0], m_origGamma[1], m_origGamma[2]);
++ }
++}
++
++
++
++
++void SDLGLFB::InitializeState()
++{
++}
++
++bool SDLGLFB::CanUpdate ()
++{
++ if (m_Lock != 1)
++ {
++ if (m_Lock > 0)
++ {
++ UpdatePending = true;
++ --m_Lock;
++ }
++ return false;
++ }
++ return true;
++}
++
++void SDLGLFB::SetGammaTable(WORD *tbl)
++{
++ SDL_SetGammaRamp(&tbl[0], &tbl[256], &tbl[512]);
++}
++
++bool SDLGLFB::Lock(bool buffered)
++{
++ m_Lock++;
++ Buffer = MemBuffer;
++ return true;
++}
++
++bool SDLGLFB::Lock ()
++{
++ return Lock(false);
++}
++
++void SDLGLFB::Unlock ()
++{
++ if (UpdatePending && m_Lock == 1)
++ {
++ Update ();
++ }
++ else if (--m_Lock <= 0)
++ {
++ m_Lock = 0;
++ }
++}
++
++bool SDLGLFB::IsLocked ()
++{
++ return m_Lock>0;// true;
++}
++
++bool SDLGLFB::IsFullscreen ()
++{
++ return (Screen->flags & SDL_FULLSCREEN) != 0;
++}
++
++
++bool SDLGLFB::IsValid ()
++{
++ return DFrameBuffer::IsValid() && Screen != NULL;
++}
++
++void SDLGLFB::SetVSync( bool vsync )
++{
++#if defined (__APPLE__)
++ const GLint value = vsync ? 1 : 0;
++ CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval, &value );
++#endif
++}
++
++void SDLGLFB::NewRefreshRate ()
++{
++}
++
++void SDLGLFB::SwapBuffers()
++{
++ SDL_GL_SwapBuffers ();
++}
++
+diff --git a/src/posix/sdl/sdlglvideo.h b/src/posix/sdl/sdlglvideo.h
+new file mode 100644
+index 0000000..205e416
+--- /dev/null
++++ b/src/posix/sdl/sdlglvideo.h
+@@ -0,0 +1,82 @@
++#ifndef __SDLGLVIDEO_H__
++#define __SDLGLVIDEO_H__
++
++#include "hardware.h"
++#include "v_video.h"
++#include <SDL.h>
++#include "gl/system/gl_system.h"
++
++EXTERN_CVAR (Float, dimamount)
++EXTERN_CVAR (Color, dimcolor)
++
++struct FRenderer;
++FRenderer *gl_CreateInterface();
++
++class SDLGLVideo : public IVideo
++{
++ public:
++ SDLGLVideo (int parm);
++ ~SDLGLVideo ();
++
++ EDisplayType GetDisplayType () { return DISPLAY_Both; }
++ void SetWindowedScale (float scale);
++
++ DFrameBuffer *CreateFrameBuffer (int width, int height, bool fs, DFrameBuffer *old);
++
++ void StartModeIterator (int bits, bool fs);
++ bool NextMode (int *width, int *height, bool *letterbox);
++ bool SetResolution (int width, int height, int bits);
++
++ bool SetupPixelFormat(bool allowsoftware, int multisample);
++ bool InitHardware (bool allowsoftware, int multisample);
++
++private:
++ int IteratorMode;
++ int IteratorBits;
++ bool IteratorFS;
++};
++class SDLGLFB : public DFrameBuffer
++{
++ DECLARE_CLASS(SDLGLFB, DFrameBuffer)
++public:
++ // this must have the same parameters as the Windows version, even if they are not used!
++ SDLGLFB (void *hMonitor, int width, int height, int, int, bool fullscreen);
++ ~SDLGLFB ();
++
++ void ForceBuffering (bool force);
++ bool Lock(bool buffered);
++ bool Lock ();
++ void Unlock();
++ bool IsLocked ();
++
++ bool IsValid ();
++ bool IsFullscreen ();
++
++ virtual void SetVSync( bool vsync );
++ void SwapBuffers();
++
++ void NewRefreshRate ();
++
++ friend class SDLGLVideo;
++
++//[C]
++ int GetTrueHeight() { return GetHeight();}
++
++protected:
++ bool CanUpdate();
++ void SetGammaTable(WORD *tbl);
++ void InitializeState();
++
++ SDLGLFB () {}
++ BYTE GammaTable[3][256];
++ bool UpdatePending;
++
++ SDL_Surface *Screen;
++
++ void UpdateColors ();
++
++ int m_Lock;
++ Uint16 m_origGamma[3][256];
++ bool m_supportsGamma;
++};
++#endif
+diff --git a/src/sdl/sdlglvideo.cpp b/src/sdl/sdlglvideo.cpp
+deleted file mode 100644
+index 649989e..0000000
+--- a/src/sdl/sdlglvideo.cpp
++++ /dev/null
+@@ -1,448 +0,0 @@
+-
+-// HEADER FILES ------------------------------------------------------------
+-
+-#include <iostream>
+-
+-#include "doomtype.h"
+-
+-#include "templates.h"
+-#include "i_system.h"
+-#include "i_video.h"
+-#include "v_video.h"
+-#include "v_pfx.h"
+-#include "stats.h"
+-#include "version.h"
+-#include "c_console.h"
+-
+-#include "sdlglvideo.h"
+-#include "gl/system/gl_system.h"
+-#include "r_defs.h"
+-#include "gl/gl_functions.h"
+-//#include "gl/gl_intern.h"
+-
+-#include "gl/renderer/gl_renderer.h"
+-#include "gl/system/gl_framebuffer.h"
+-#include "gl/shaders/gl_shader.h"
+-#include "gl/utility/gl_templates.h"
+-#include "gl/textures/gl_material.h"
+-#include "gl/system/gl_cvars.h"
+-
+-// MACROS ------------------------------------------------------------------
+-
+-// TYPES -------------------------------------------------------------------
+-
+-IMPLEMENT_ABSTRACT_CLASS(SDLGLFB)
+-
+-struct MiniModeInfo
+-{
+- WORD Width, Height;
+-};
+-
+-// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
+-
+-// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
+-
+-// EXTERNAL DATA DECLARATIONS ----------------------------------------------
+-
+-extern IVideo *Video;
+-// extern int vid_renderer;
+-
+-EXTERN_CVAR (Float, Gamma)
+-EXTERN_CVAR (Int, vid_displaybits)
+-EXTERN_CVAR (Int, vid_renderer)
+-
+-
+-// PUBLIC DATA DEFINITIONS -------------------------------------------------
+-
+-CUSTOM_CVAR(Int, gl_vid_multisample, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL )
+-{
+- Printf("This won't take effect until " GAMENAME " is restarted.\n");
+-}
+-
+-// PRIVATE DATA DEFINITIONS ------------------------------------------------
+-
+-// Dummy screen sizes to pass when windowed
+-static MiniModeInfo WinModes[] =
+-{
+- { 320, 200 },
+- { 320, 240 },
+- { 400, 225 }, // 16:9
+- { 400, 300 },
+- { 480, 270 }, // 16:9
+- { 480, 360 },
+- { 512, 288 }, // 16:9
+- { 512, 384 },
+- { 640, 360 }, // 16:9
+- { 640, 400 },
+- { 640, 480 },
+- { 720, 480 }, // 16:10
+- { 720, 540 },
+- { 800, 450 }, // 16:9
+- { 800, 500 }, // 16:10
+- { 800, 600 },
+- { 848, 480 }, // 16:9
+- { 960, 600 }, // 16:10
+- { 960, 720 },
+- { 1024, 576 }, // 16:9
+- { 1024, 600 }, // 17:10
+- { 1024, 640 }, // 16:10
+- { 1024, 768 },
+- { 1088, 612 }, // 16:9
+- { 1152, 648 }, // 16:9
+- { 1152, 720 }, // 16:10
+- { 1152, 864 },
+- { 1280, 720 }, // 16:9
+- { 1280, 800 }, // 16:10
+- { 1280, 960 },
+- { 1344, 756 }, // 16:9
+- { 1360, 768 }, // 16:9
+- { 1400, 787 }, // 16:9
+- { 1400, 875 }, // 16:10
+- { 1440, 900 },
+- { 1400, 1050 },
+- { 1600, 900 }, // 16:9
+- { 1600, 1000 }, // 16:10
+- { 1600, 1200 },
+- { 1680, 1050 }, // 16:10
+- { 1920, 1080 }, // 16:9
+- { 1920, 1200 }, // 16:10
+- { 2054, 1536 },
+- { 2560, 1440 }, // 16:9
+- { 2880, 1800 } // 16:10
+-};
+-
+-// CODE --------------------------------------------------------------------
+-
+-SDLGLVideo::SDLGLVideo (int parm)
+-{
+- IteratorBits = 0;
+- IteratorFS = false;
+- if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
+- fprintf( stderr, "Video initialization failed: %s\n",
+- SDL_GetError( ) );
+- }
+-#ifndef _WIN32
+- // mouse cursor is visible by default on linux systems, we disable it by default
+- SDL_ShowCursor (0);
+-#endif
+-}
+-
+-SDLGLVideo::~SDLGLVideo ()
+-{
+- if (GLRenderer != NULL) GLRenderer->FlushTextures();
+-}
+-
+-void SDLGLVideo::StartModeIterator (int bits, bool fs)
+-{
+- IteratorMode = 0;
+- IteratorBits = bits;
+- IteratorFS = fs;
+-}
+-
+-bool SDLGLVideo::NextMode (int *width, int *height, bool *letterbox)
+-{
+- if (IteratorBits != 8)
+- return false;
+-
+- if (!IteratorFS)
+- {
+- if ((unsigned)IteratorMode < sizeof(WinModes)/sizeof(WinModes[0]))
+- {
+- *width = WinModes[IteratorMode].Width;
+- *height = WinModes[IteratorMode].Height;
+- ++IteratorMode;
+- return true;
+- }
+- }
+- else
+- {
+- SDL_Rect **modes = SDL_ListModes (NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
+- if (modes != NULL && modes[IteratorMode] != NULL)
+- {
+- *width = modes[IteratorMode]->w;
+- *height = modes[IteratorMode]->h;
+- ++IteratorMode;
+- return true;
+- }
+- }
+- return false;
+-}
+-
+-DFrameBuffer *SDLGLVideo::CreateFrameBuffer (int width, int height, bool fullscreen, DFrameBuffer *old)
+-{
+- static int retry = 0;
+- static int owidth, oheight;
+-
+- PalEntry flashColor;
+-// int flashAmount;
+-
+- if (old != NULL)
+- { // Reuse the old framebuffer if its attributes are the same
+- SDLGLFB *fb = static_cast<SDLGLFB *> (old);
+- if (fb->Width == width &&
+- fb->Height == height)
+- {
+- bool fsnow = (fb->Screen->flags & SDL_FULLSCREEN) != 0;
+-
+- if (fsnow != fullscreen)
+- {
+- SDL_WM_ToggleFullScreen (fb->Screen);
+- }
+- return old;
+- }
+-// old->GetFlash (flashColor, flashAmount);
+- delete old;
+- }
+- else
+- {
+- flashColor = 0;
+-// flashAmount = 0;
+- }
+-
+- SDLGLFB *fb = new OpenGLFrameBuffer (0, width, height, 32, 60, fullscreen);
+- retry = 0;
+-
+- // If we could not create the framebuffer, try again with slightly
+- // different parameters in this order:
+- // 1. Try with the closest size
+- // 2. Try in the opposite screen mode with the original size
+- // 3. Try in the opposite screen mode with the closest size
+- // This is a somewhat confusing mass of recursion here.
+-
+- while (fb == NULL || !fb->IsValid ())
+- {
+- if (fb != NULL)
+- {
+- delete fb;
+- }
+-
+- switch (retry)
+- {
+- case 0:
+- owidth = width;
+- oheight = height;
+- case 2:
+- // Try a different resolution. Hopefully that will work.
+- I_ClosestResolution (&width, &height, 8);
+- break;
+-
+- case 1:
+- // Try changing fullscreen mode. Maybe that will work.
+- width = owidth;
+- height = oheight;
+- fullscreen = !fullscreen;
+- break;
+-
+- default:
+- // I give up!
+- I_FatalError ("Could not create new screen (%d x %d)", owidth, oheight);
+-
+- fprintf( stderr, "!!! [SDLGLVideo::CreateFrameBuffer] Got beyond I_FatalError !!!" );
+- return NULL; //[C] actually this shouldn't be reached; probably should be replaced with an ASSERT
+- }
+-
+- ++retry;
+- fb = static_cast<SDLGLFB *>(CreateFrameBuffer (width, height, fullscreen, NULL));
+- }
+-
+-// fb->SetFlash (flashColor, flashAmount);
+- return fb;
+-}
+-
+-void SDLGLVideo::SetWindowedScale (float scale)
+-{
+-}
+-
+-bool SDLGLVideo::SetResolution (int width, int height, int bits)
+-{
+- // FIXME: Is it possible to do this without completely destroying the old
+- // interface?
+-#ifndef NO_GL
+-
+- if (GLRenderer != NULL) GLRenderer->FlushTextures();
+- I_ShutdownGraphics();
+-
+- Video = new SDLGLVideo(0);
+- if (Video == NULL) I_FatalError ("Failed to initialize display");
+-
+-#if (defined(WINDOWS)) || defined(WIN32)
+- bits=32;
+-#else
+- bits=24;
+-#endif
+-
+- V_DoModeSetup(width, height, bits);
+-#endif
+- return true; // We must return true because the old video context no longer exists.
+-}
+-
+-//==========================================================================
+-//
+-//
+-//
+-//==========================================================================
+-
+-bool SDLGLVideo::SetupPixelFormat(bool allowsoftware, int multisample)
+-{
+- SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
+- SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
+- SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
+- SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 );
+- SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
+- SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 );
+-// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+- if (multisample > 0) {
+- SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
+- SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, multisample );
+- }
+- return true;
+-}
+-
+-//==========================================================================
+-//
+-//
+-//
+-//==========================================================================
+-
+-bool SDLGLVideo::InitHardware (bool allowsoftware, int multisample)
+-{
+- if (!SetupPixelFormat(allowsoftware, multisample))
+- {
+- Printf ("R_OPENGL: Reverting to software mode...\n");
+- return false;
+- }
+- return true;
+-}
+-
+-
+-// FrameBuffer implementation -----------------------------------------------
+-
+-SDLGLFB::SDLGLFB (void *, int width, int height, int, int, bool fullscreen)
+- : DFrameBuffer (width, height)
+-{
+- static int localmultisample=-1;
+-
+- if (localmultisample<0) localmultisample=gl_vid_multisample;
+-
+- int i;
+-
+- m_Lock=0;
+-
+- UpdatePending = false;
+-
+- if (!static_cast<SDLGLVideo*>(Video)->InitHardware(false, localmultisample))
+- {
+- vid_renderer = 0;
+- return;
+- }
+-
+-
+- Screen = SDL_SetVideoMode (width, height,
+- 32,
+- SDL_HWSURFACE|SDL_HWPALETTE|SDL_OPENGL | SDL_GL_DOUBLEBUFFER|SDL_ANYFORMAT|
+- (fullscreen ? SDL_FULLSCREEN : 0));
+-
+- if (Screen == NULL)
+- return;
+-
+- m_supportsGamma = -1 != SDL_GetGammaRamp(m_origGamma[0], m_origGamma[1], m_origGamma[2]);
+-
+-#if defined(__APPLE__)
+- // Need to set title here because a window is not created yet when calling the same function from main()
+- char caption[100];
+- mysnprintf(caption, countof(caption), GAMESIG " %s (%s)", GetVersionString(), GetGitTime());
+- SDL_WM_SetCaption(caption, NULL);
+-#endif // __APPLE__
+-}
+-
+-SDLGLFB::~SDLGLFB ()
+-{
+- if (m_supportsGamma)
+- {
+- SDL_SetGammaRamp(m_origGamma[0], m_origGamma[1], m_origGamma[2]);
+- }
+-}
+-
+-
+-
+-
+-void SDLGLFB::InitializeState()
+-{
+-}
+-
+-bool SDLGLFB::CanUpdate ()
+-{
+- if (m_Lock != 1)
+- {
+- if (m_Lock > 0)
+- {
+- UpdatePending = true;
+- --m_Lock;
+- }
+- return false;
+- }
+- return true;
+-}
+-
+-void SDLGLFB::SetGammaTable(WORD *tbl)
+-{
+- SDL_SetGammaRamp(&tbl[0], &tbl[256], &tbl[512]);
+-}
+-
+-bool SDLGLFB::Lock(bool buffered)
+-{
+- m_Lock++;
+- Buffer = MemBuffer;
+- return true;
+-}
+-
+-bool SDLGLFB::Lock ()
+-{
+- return Lock(false);
+-}
+-
+-void SDLGLFB::Unlock ()
+-{
+- if (UpdatePending && m_Lock == 1)
+- {
+- Update ();
+- }
+- else if (--m_Lock <= 0)
+- {
+- m_Lock = 0;
+- }
+-}
+-
+-bool SDLGLFB::IsLocked ()
+-{
+- return m_Lock>0;// true;
+-}
+-
+-bool SDLGLFB::IsFullscreen ()
+-{
+- return (Screen->flags & SDL_FULLSCREEN) != 0;
+-}
+-
+-
+-bool SDLGLFB::IsValid ()
+-{
+- return DFrameBuffer::IsValid() && Screen != NULL;
+-}
+-
+-void SDLGLFB::SetVSync( bool vsync )
+-{
+-#if defined (__APPLE__)
+- const GLint value = vsync ? 1 : 0;
+- CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval, &value );
+-#endif
+-}
+-
+-void SDLGLFB::NewRefreshRate ()
+-{
+-}
+-
+-void SDLGLFB::SwapBuffers()
+-{
+- SDL_GL_SwapBuffers ();
+-}
+-
+diff --git a/src/sdl/sdlglvideo.h b/src/sdl/sdlglvideo.h
+deleted file mode 100644
+index 205e416..0000000
+--- a/src/sdl/sdlglvideo.h
++++ /dev/null
+@@ -1,82 +0,0 @@
+-#ifndef __SDLGLVIDEO_H__
+-#define __SDLGLVIDEO_H__
+-
+-#include "hardware.h"
+-#include "v_video.h"
+-#include <SDL.h>
+-#include "gl/system/gl_system.h"
+-
+-EXTERN_CVAR (Float, dimamount)
+-EXTERN_CVAR (Color, dimcolor)
+-
+-struct FRenderer;
+-FRenderer *gl_CreateInterface();
+-
+-class SDLGLVideo : public IVideo
+-{
+- public:
+- SDLGLVideo (int parm);
+- ~SDLGLVideo ();
+-
+- EDisplayType GetDisplayType () { return DISPLAY_Both; }
+- void SetWindowedScale (float scale);
+-
+- DFrameBuffer *CreateFrameBuffer (int width, int height, bool fs, DFrameBuffer *old);
+-
+- void StartModeIterator (int bits, bool fs);
+- bool NextMode (int *width, int *height, bool *letterbox);
+- bool SetResolution (int width, int height, int bits);
+-
+- bool SetupPixelFormat(bool allowsoftware, int multisample);
+- bool InitHardware (bool allowsoftware, int multisample);
+-
+-private:
+- int IteratorMode;
+- int IteratorBits;
+- bool IteratorFS;
+-};
+-class SDLGLFB : public DFrameBuffer
+-{
+- DECLARE_CLASS(SDLGLFB, DFrameBuffer)
+-public:
+- // this must have the same parameters as the Windows version, even if they are not used!
+- SDLGLFB (void *hMonitor, int width, int height, int, int, bool fullscreen);
+- ~SDLGLFB ();
+-
+- void ForceBuffering (bool force);
+- bool Lock(bool buffered);
+- bool Lock ();
+- void Unlock();
+- bool IsLocked ();
+-
+- bool IsValid ();
+- bool IsFullscreen ();
+-
+- virtual void SetVSync( bool vsync );
+- void SwapBuffers();
+-
+- void NewRefreshRate ();
+-
+- friend class SDLGLVideo;
+-
+-//[C]
+- int GetTrueHeight() { return GetHeight();}
+-
+-protected:
+- bool CanUpdate();
+- void SetGammaTable(WORD *tbl);
+- void InitializeState();
+-
+- SDLGLFB () {}
+- BYTE GammaTable[3][256];
+- bool UpdatePending;
+-
+- SDL_Surface *Screen;
+-
+- void UpdateColors ();
+-
+- int m_Lock;
+- Uint16 m_origGamma[3][256];
+- bool m_supportsGamma;
+-};
+-#endif
+--
+2.3.2
+
diff --git a/git-cab509c.patch b/git-cab509c.patch
new file mode 100644
index 000000000000..a48416598850
--- /dev/null
+++ b/git-cab509c.patch
@@ -0,0 +1,143 @@
+From cab509c4d20f0e5e57099d24792a853a7adaa326 Mon Sep 17 00:00:00 2001
+From: Edoardo Prezioso <edo88@email.it>
+Date: Thu, 8 Jan 2015 01:39:29 +0100
+Subject: [PATCH] Various improvements to SDL2 video code.
+
+- Ported the missing resolutions from zdoom.
+- Remove unneeded code which was removed also from zdoom.
+- Uncomment DOUBLEBUFFER GL attribute. It was present in the old SDL_SetVideoMode call code, so why not.
+---
+ src/posix/sdl/sdlglvideo.cpp | 60 ++++++++++++++++++--------------------------
+ src/posix/sdl/sdlglvideo.h | 1 -
+ 2 files changed, 25 insertions(+), 36 deletions(-)
+
+diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp
+index 9331c0f..54506b8 100644
+--- a/src/posix/sdl/sdlglvideo.cpp
++++ b/src/posix/sdl/sdlglvideo.cpp
+@@ -77,6 +77,7 @@ static MiniModeInfo WinModes[] =
+ { 720, 480 }, // 16:10
+ { 720, 540 },
+ { 800, 450 }, // 16:9
++ { 800, 480 },
+ { 800, 500 }, // 16:10
+ { 800, 600 },
+ { 848, 480 }, // 16:9
+@@ -91,23 +92,33 @@ static MiniModeInfo WinModes[] =
+ { 1152, 720 }, // 16:10
+ { 1152, 864 },
+ { 1280, 720 }, // 16:9
++ { 1280, 854 },
+ { 1280, 800 }, // 16:10
+ { 1280, 960 },
+- { 1344, 756 }, // 16:9
++ { 1280, 1024 }, // 5:4
+ { 1360, 768 }, // 16:9
++ { 1366, 768 },
+ { 1400, 787 }, // 16:9
+ { 1400, 875 }, // 16:10
+- { 1440, 900 },
+ { 1400, 1050 },
++ { 1440, 900 },
++ { 1440, 960 },
++ { 1440, 1080 },
+ { 1600, 900 }, // 16:9
+ { 1600, 1000 }, // 16:10
+ { 1600, 1200 },
+- { 1680, 1050 }, // 16:10
+- { 1920, 1080 }, // 16:9
+- { 1920, 1200 }, // 16:10
+- { 2054, 1536 },
+- { 2560, 1440 }, // 16:9
+- { 2880, 1800 } // 16:10
++ { 1920, 1080 },
++ { 1920, 1200 },
++ { 2048, 1536 },
++ { 2560, 1440 },
++ { 2560, 1600 },
++ { 2560, 2048 },
++ { 2880, 1800 },
++ { 3200, 1800 },
++ { 3840, 2160 },
++ { 3840, 2400 },
++ { 4096, 2160 },
++ { 5120, 2880 }
+ };
+
+ // CODE --------------------------------------------------------------------
+@@ -115,7 +126,6 @@ static MiniModeInfo WinModes[] =
+ SDLGLVideo::SDLGLVideo (int parm)
+ {
+ IteratorBits = 0;
+- IteratorFS = false;
+ if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
+ fprintf( stderr, "Video initialization failed: %s\n",
+ SDL_GetError( ) );
+@@ -135,38 +145,18 @@ void SDLGLVideo::StartModeIterator (int bits, bool fs)
+ {
+ IteratorMode = 0;
+ IteratorBits = bits;
+- IteratorFS = fs;
+ }
+
+ bool SDLGLVideo::NextMode (int *width, int *height, bool *letterbox)
+ {
+ if (IteratorBits != 8)
+ return false;
+-
+- if (!IteratorFS)
+- {
+- if ((unsigned)IteratorMode < sizeof(WinModes)/sizeof(WinModes[0]))
+- {
+- *width = WinModes[IteratorMode].Width;
+- *height = WinModes[IteratorMode].Height;
+- ++IteratorMode;
+- return true;
+- }
+- }
+- else
+- {
+- SDL_DisplayMode mode = {}, oldmode = {};
+- if(IteratorMode != 0)
+- SDL_GetDisplayMode(vid_adapter, IteratorMode-1, &oldmode);
+- do
+- {
+- if (SDL_GetDisplayMode(vid_adapter, IteratorMode, &mode) != 0)
+- return false;
+- ++IteratorMode;
+- } while(mode.w == oldmode.w && mode.h == oldmode.h);
+
+- *width = mode.w;
+- *height = mode.h;
++ if ((unsigned)IteratorMode < sizeof(WinModes)/sizeof(WinModes[0]))
++ {
++ *width = WinModes[IteratorMode].Width;
++ *height = WinModes[IteratorMode].Height;
++ ++IteratorMode;
+ return true;
+ }
+ return false;
+@@ -294,7 +284,7 @@ bool SDLGLVideo::SetupPixelFormat(bool allowsoftware, int multisample)
+ SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 );
+ SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
+ SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 );
+-// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
++ SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+ if (multisample > 0) {
+ SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
+ SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, multisample );
+diff --git a/src/posix/sdl/sdlglvideo.h b/src/posix/sdl/sdlglvideo.h
+index 3867be6..c2be3ba 100644
+--- a/src/posix/sdl/sdlglvideo.h
++++ b/src/posix/sdl/sdlglvideo.h
+@@ -32,7 +32,6 @@ class SDLGLVideo : public IVideo
+ private:
+ int IteratorMode;
+ int IteratorBits;
+- bool IteratorFS;
+ };
+ class SDLGLFB : public DFrameBuffer
+ {
+--
+2.3.2
+
diff --git a/git-fb3bf0e.patch b/git-fb3bf0e.patch
new file mode 100644
index 000000000000..327126642bfe
--- /dev/null
+++ b/git-fb3bf0e.patch
@@ -0,0 +1,25 @@
+From fb3bf0eb5868742d1771834588a4bbf3c888ac7d Mon Sep 17 00:00:00 2001
+From: Edoardo Prezioso <edo88@email.it>
+Date: Thu, 8 Jan 2015 13:18:00 +0100
+Subject: [PATCH] - Oops, forgot to reinclude missing SDL header.
+
+Strangely it compiled fine for me, though.
+---
+ src/posix/sdl/sdlglvideo.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/posix/sdl/sdlglvideo.h b/src/posix/sdl/sdlglvideo.h
+index c2be3ba..19e6a5f 100644
+--- a/src/posix/sdl/sdlglvideo.h
++++ b/src/posix/sdl/sdlglvideo.h
+@@ -3,6 +3,7 @@
+
+ #include "hardware.h"
+ #include "v_video.h"
++#include <SDL.h>
+ #include "gl/system/gl_system.h"
+
+ EXTERN_CVAR (Float, dimamount)
+--
+2.3.2
+
diff --git a/gitinfo.h b/gitinfo.h
index 48a921bfa03e..c6eb7160379b 100644
--- a/gitinfo.h
+++ b/gitinfo.h
@@ -3,6 +3,6 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
-#define GIT_DESCRIPTION "g2.0.04"
-#define GIT_HASH "8fabd17c56995dc0611908554e13fbf036d5fd58"
-#define GIT_TIME "2014-12-21 14:58:11 +0100"
+#define GIT_DESCRIPTION "g2.0.05"
+#define GIT_HASH "279fddf7c7e5efb1a2092ed35ba54ca9543ed9ba"
+#define GIT_TIME "2014-12-27 15:57:09 +0100"