43
43
#include "m64p_vidext.h"
44
44
#include "vidext.h"
45
45
46
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
47
- #ifndef USE_GLES
48
- static int l_ForceCompatibilityContext = 1 ;
49
- #endif
50
- #include "vidext_sdl2_compat.h"
46
+ #ifndef USE_GLES
47
+ static int l_ForceCompatibilityContext = 1 ;
51
48
#endif
52
49
50
+ #include "vidext_sdl2_compat.h"
51
+
53
52
/* local variables */
54
53
static m64p_video_extension_functions l_ExternalVideoFuncTable = {17 , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL };
55
54
static int l_VideoExtensionActive = 0 ;
@@ -134,13 +133,11 @@ EXPORT m64p_error CALL VidExt_InitWithRenderMode(m64p_render_mode RenderMode)
134
133
l_RenderMode = RenderMode ;
135
134
#endif
136
135
137
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
138
136
SDL_SetHint (SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS , "1" );
139
137
/* retrieve default swap interval/VSync */
140
138
if (RenderMode == M64P_RENDER_OPENGL ) {
141
139
l_SwapControl = SDL_GL_GetSwapInterval ();
142
140
}
143
- #endif
144
141
145
142
#if SDL_VERSION_ATLEAST (2 ,24 ,0 )
146
143
/* fix DPI scaling issues on Windows */
@@ -188,9 +185,7 @@ EXPORT m64p_error CALL VidExt_Quit(void)
188
185
return M64ERR_NOT_INIT ;
189
186
190
187
SDL_ShowCursor (SDL_ENABLE );
191
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
192
188
SDL2_DestroyWindow ();
193
- #endif
194
189
#ifdef VIDEXT_VULKAN
195
190
if (l_RenderMode == M64P_RENDER_VULKAN ) {
196
191
SDL_Vulkan_UnloadLibrary ();
@@ -264,7 +259,6 @@ EXPORT m64p_error CALL VidExt_ListFullscreenRates(m64p_2d_size Size, int *NumRat
264
259
if (l_VideoExtensionActive )
265
260
return (* l_ExternalVideoFuncTable .VidExtFuncListRates )(Size , NumRates , Rates );
266
261
267
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
268
262
if (!SDL_WasInit (SDL_INIT_VIDEO ))
269
263
return M64ERR_NOT_INIT ;
270
264
@@ -299,10 +293,6 @@ EXPORT m64p_error CALL VidExt_ListFullscreenRates(m64p_2d_size Size, int *NumRat
299
293
* NumRates = rateCount ;
300
294
301
295
return M64ERR_SUCCESS ;
302
- #else
303
- // SDL1 doesn't support getting refresh rates
304
- return M64ERR_UNSUPPORTED ;
305
- #endif
306
296
}
307
297
308
298
EXPORT m64p_error CALL VidExt_SetVideoMode (int Width , int Height , int BitsPerPixel , m64p_video_mode ScreenMode , m64p_video_flags Flags )
@@ -377,14 +367,12 @@ EXPORT m64p_error CALL VidExt_SetVideoMode(int Width, int Height, int BitsPerPix
377
367
378
368
SDL_ShowCursor (SDL_DISABLE );
379
369
380
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
381
370
/* set swap interval/VSync */
382
371
if (l_RenderMode == M64P_RENDER_OPENGL &&
383
372
SDL_GL_SetSwapInterval (l_SwapControl ) != 0 )
384
373
{
385
374
DebugMessage (M64MSG_ERROR , "SDL swap interval (VSync) set failed: %s" , SDL_GetError ());
386
375
}
387
- #endif
388
376
389
377
l_Fullscreen = (ScreenMode == M64VIDEO_FULLSCREEN );
390
378
l_VideoOutputActive = 1 ;
@@ -409,7 +397,6 @@ EXPORT m64p_error CALL VidExt_SetVideoModeWithRate(int Width, int Height, int Re
409
397
return rval ;
410
398
}
411
399
412
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
413
400
if (!SDL_WasInit (SDL_INIT_VIDEO ) || !SDL_VideoWindow )
414
401
return M64ERR_NOT_INIT ;
415
402
@@ -486,10 +473,6 @@ EXPORT m64p_error CALL VidExt_SetVideoModeWithRate(int Width, int Height, int Re
486
473
StateChanged (M64CORE_VIDEO_SIZE , (Width << 16 ) | Height );
487
474
488
475
return M64ERR_SUCCESS ;
489
- #else
490
- // SDL1 doesn't support setting refresh rates
491
- return M64ERR_UNSUPPORTED ;
492
- #endif
493
476
}
494
477
495
478
EXPORT m64p_error CALL VidExt_ResizeWindow (int Width , int Height )
@@ -643,16 +626,11 @@ static const GLAttrMapNode GLAttrMap[] = {
643
626
{ M64P_GL_GREEN_SIZE , SDL_GL_GREEN_SIZE },
644
627
{ M64P_GL_BLUE_SIZE , SDL_GL_BLUE_SIZE },
645
628
{ M64P_GL_ALPHA_SIZE , SDL_GL_ALPHA_SIZE },
646
- #if !SDL_VERSION_ATLEAST (1 ,3 ,0 )
647
- { M64P_GL_SWAP_CONTROL , SDL_GL_SWAP_CONTROL },
648
- #endif
649
629
{ M64P_GL_MULTISAMPLEBUFFERS , SDL_GL_MULTISAMPLEBUFFERS },
650
630
{ M64P_GL_MULTISAMPLESAMPLES , SDL_GL_MULTISAMPLESAMPLES }
651
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
652
631
,{ M64P_GL_CONTEXT_MAJOR_VERSION , SDL_GL_CONTEXT_MAJOR_VERSION },
653
632
{ M64P_GL_CONTEXT_MINOR_VERSION , SDL_GL_CONTEXT_MINOR_VERSION },
654
633
{ M64P_GL_CONTEXT_PROFILE_MASK , SDL_GL_CONTEXT_PROFILE_MASK }
655
- #endif
656
634
};
657
635
static const int mapSize = sizeof (GLAttrMap ) / sizeof (GLAttrMapNode );
658
636
@@ -677,7 +655,6 @@ EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
677
655
}
678
656
679
657
/* translate the GL context type mask if necessary */
680
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
681
658
if (Attr == M64P_GL_CONTEXT_PROFILE_MASK )
682
659
{
683
660
switch (Value )
@@ -698,7 +675,6 @@ EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
698
675
Value = 0 ;
699
676
}
700
677
}
701
- #endif
702
678
703
679
for (i = 0 ; i < mapSize ; i ++ )
704
680
{
@@ -727,13 +703,11 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
727
703
if (!SDL_WasInit (SDL_INIT_VIDEO ))
728
704
return M64ERR_NOT_INIT ;
729
705
730
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
731
706
if (Attr == M64P_GL_SWAP_CONTROL )
732
707
{
733
708
* pValue = SDL_GL_GetSwapInterval ();
734
709
return M64ERR_SUCCESS ;
735
710
}
736
- #endif
737
711
738
712
for (i = 0 ; i < mapSize ; i ++ )
739
713
{
@@ -743,7 +717,6 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
743
717
if (SDL_GL_GetAttribute (GLAttrMap [i ].sdlAttr , & NewValue ) != 0 )
744
718
return M64ERR_SYSTEM_FAIL ;
745
719
/* translate the GL context type mask if necessary */
746
- #if SDL_VERSION_ATLEAST (2 ,0 ,0 )
747
720
if (Attr == M64P_GL_CONTEXT_PROFILE_MASK )
748
721
{
749
722
switch (NewValue )
@@ -761,7 +734,6 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
761
734
NewValue = 0 ;
762
735
}
763
736
}
764
- #endif
765
737
* pValue = NewValue ;
766
738
return M64ERR_SUCCESS ;
767
739
}
0 commit comments