From eece38609e7508582c0db6c47e740b4986e55482 Mon Sep 17 00:00:00 2001 From: Ronald Kinard Date: Sun, 31 Aug 2014 23:57:08 +0000 Subject: [PATCH 1/4] SDL2: Fix 320x200 mode --- src/sdl/i_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index fd029832a..2ee8352d2 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1652,7 +1652,7 @@ INT32 VID_SetMode(INT32 modeNum) vid.recalc = 1; vid.bpp = 1; - if (modeNum >= 0 && modeNum < MAXWINMODES-1) + if (modeNum >= 0 && modeNum < MAXWINMODES) { vid.width = windowedModes[modeNum][0]; vid.height = windowedModes[modeNum][1]; From 31abd19f75a38b8daeffdbe9891809903be8637c Mon Sep 17 00:00:00 2001 From: Ronald Kinard Date: Mon, 1 Sep 2014 00:15:08 +0000 Subject: [PATCH 2/4] SDL2: Reimplement some stubbed commands Also remove some unnecessary functions. --- src/sdl/i_video.c | 79 +++++------------------------------------------ 1 file changed, 7 insertions(+), 72 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 2ee8352d2..66070f6c3 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -629,50 +629,20 @@ static void VID_Command_Info_f (void) static void VID_Command_ModeList_f(void) { - SDL2STUB(); -#if 0 -#if !defined (DC) && !defined (_WIN32_WCE) && !defined (_PSP) && !defined(GP2X) - INT32 i; -#ifdef HWRENDER - if (rendermode == render_opengl) - modeList = SDL_ListModes(NULL, SDL_OPENGL|SDL_FULLSCREEN); - else -#endif - modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface - - if (modeList == (SDL_Rect **)0 && cv_fullscreen.value) + // List windowed modes + INT32 i = 0; + CONS_Printf("NOTE: Under SDL2, all modes are supported on all platforms.\n"); + CONS_Printf("Under opengl, fullscreen only supports native desktop resolution.\n"); + CONS_Printf("Under software, the mode is stretched up to desktop resolution.\n"); + for (i = 0; i < MAXWINMODES; i++) { - CONS_Printf("%s", M_GetText("No video modes present\n")); - cv_fullscreen.value = 0; + CONS_Printf("%2d: %dx%d\n", i, windowedModes[i][0], windowedModes[i][1]); } - else if (modeList != (SDL_Rect **)0) - { - numVidModes = 0; - if (modeList == (SDL_Rect **)-1) - numVidModes = -1; // should not happen with fullscreen modes - else while (modeList[numVidModes]) - numVidModes++; - } - CONS_Printf(M_GetText("Found %d FullScreen Video Modes:\n"), numVidModes); - for (i=0 ; i= numVidModes) - break; - CONS_Printf(M_GetText("%dx%d and "), - modeList[modeNum]->w, - modeList[modeNum]->h); - } - CONS_Printf("%s", M_GetText("None\n")); -#endif -#endif } static void VID_Command_Mode_f (void) { - SDL2STUB(); -#if 0 INT32 modenum; if (COM_Argc()!= 2) @@ -687,7 +657,6 @@ static void VID_Command_Mode_f (void) CONS_Printf(M_GetText("Video mode not present\n")); else setmodeneeded = modenum+1; // request vid mode change -#endif } #if 0 @@ -1614,37 +1583,6 @@ static inline void SDLESSet(void) SDL2STUB(); } -static void SDLWMSet(void) -{ - SDL2STUB(); -#if 0 -#ifdef RPC_NO_WINDOWS_H - SDL_SysWMinfo SDLWM; - memset(&SDLWM,0,sizeof (SDL_SysWMinfo)); - SDL_VERSION(&SDLWM.version) - if (SDL_GetWMInfo(&SDLWM)) - vid.WndParent = SDLWM.window; - else - vid.WndParent = INVALID_HANDLE_VALUE; - if (vid.WndParent != INVALID_HANDLE_VALUE) - { - SetFocus(vid.WndParent); - ShowWindow(vid.WndParent, SW_SHOW); - } - SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); -#endif - SDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE); -#endif -} - -#if 0 -static void* SDLGetDirect(void) -{ - // you can not use the video memory in pixels member in fullscreen mode - return NULL; -} -#endif - INT32 VID_SetMode(INT32 modeNum) { SDLdoUngrabMouse(); @@ -1757,7 +1695,6 @@ static void Impl_SetWindowName(const char *title) { return; } - SDL2STUB(); SDL_SetWindowTitle(window, title); } @@ -1959,8 +1896,6 @@ void I_StartupGraphics(void) if (!disable_mouse) SDL_ShowCursor(SDL_DISABLE); SDLdoUngrabMouse(); - SDLWMSet(); - graphics_started = true; } From 399eddefe6ea5c243f02d28976b263dc0a129472 Mon Sep 17 00:00:00 2001 From: Ronald Kinard Date: Mon, 1 Sep 2014 00:43:01 +0000 Subject: [PATCH 3/4] SDL2: Do not use xinput, force directinput Fixes axes issue with xinput controllers. --- src/sdl/i_system.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index cfc2e210d..d3793b6da 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1519,6 +1519,7 @@ static int joy_open2(const char *fname) void I_InitJoystick(void) { I_ShutdownJoystick(); + SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE); if (!strcmp(cv_usejoystick.string, "0") || M_CheckParm("-nojoy")) return; if (joy_open(cv_usejoystick.string) != -1) @@ -1534,6 +1535,7 @@ void I_InitJoystick(void) void I_InitJoystick2(void) { I_ShutdownJoystick2(); + SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE); if (!strcmp(cv_usejoystick2.string, "0") || M_CheckParm("-nojoy")) return; if (joy_open2(cv_usejoystick2.string) != -1) From 5b07cf8ff0d4dbd04180e5dcbcb090da5f4bf256 Mon Sep 17 00:00:00 2001 From: Ronald Kinard Date: Mon, 1 Sep 2014 00:59:41 +0000 Subject: [PATCH 4/4] SDL2: Add 1600x1200 mode --- src/sdl/i_video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 66070f6c3..336a57ea0 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -83,7 +83,7 @@ #endif // maximum number of windowed modes (see windowedModes[][]) -#define MAXWINMODES (17) +#define MAXWINMODES (18) /** \brief */ @@ -148,6 +148,7 @@ static INT32 windowedModes[MAXWINMODES][2] = {1920,1200}, // 1.60,6.00 {1920,1080}, // 1.66 {1680,1050}, // 1.60,5.25 + {1600,1200}, // 1.33 {1600, 900}, // 1.66 {1366, 768}, // 1.66 {1440, 900}, // 1.60,4.50