From e5206d435042b03c61ab1bf9488b843221d73bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Luis=20Rodr=C3=ADguez=20Gonz=C3=A1lez?= Date: Wed, 11 Aug 2021 21:32:02 +0200 Subject: [PATCH] Set hardware surface video mode for the UX and for game runs with no hardware scaling. This looks like prevent screen from getting bad (flickering colors) on some devices as (LDKV, RG350M/V). Also set triple buffer for the UX to avoid screen flickering. --- src/sdl-dingux/gui_main.cpp | 8 ++++++++ src/sdl-dingux/sdl_video.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/sdl-dingux/gui_main.cpp b/src/sdl-dingux/gui_main.cpp index a09274d8d..70e09e685 100644 --- a/src/sdl-dingux/gui_main.cpp +++ b/src/sdl-dingux/gui_main.cpp @@ -1763,7 +1763,11 @@ void ss_prog_run(void) SDL_InitSubSystem(SDL_INIT_VIDEO); } +#ifdef DEVICE_GCW0 + gui_screen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE|SDL_TRIPLEBUF); +#else gui_screen = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE); +#endif SDL_ShowCursor(0); prep_bg(); @@ -2215,7 +2219,11 @@ void GuiRun() use_language_pack = gui_load_language_pack(); set_language(); +#ifdef DEVICE_GCW0 + gui_screen = SDL_SetVideoMode(GUI_SCREEN_W, GUI_SCREEN_H, 16, SDL_HWSURFACE | SDL_TRIPLEBUF); +#else gui_screen = SDL_SetVideoMode(GUI_SCREEN_W, GUI_SCREEN_H, 16, SDL_SWSURFACE); +#endif SDL_ShowCursor(0); SDL_JoystickOpen(0); diff --git a/src/sdl-dingux/sdl_video.cpp b/src/sdl-dingux/sdl_video.cpp index 4c55c0c1c..bd5aeff67 100644 --- a/src/sdl-dingux/sdl_video.cpp +++ b/src/sdl-dingux/sdl_video.cpp @@ -1932,7 +1932,11 @@ int VideoInit() #else SDL_DOUBLEBUF #endif +#ifdef DEVICE_GCW0 + ) : SDL_HWSURFACE); +#else ) : SDL_SWSURFACE); +#endif if(!(SDL_WasInit(SDL_INIT_VIDEO) & SDL_INIT_VIDEO)) { SDL_InitSubSystem(SDL_INIT_VIDEO); @@ -2209,7 +2213,11 @@ int VideoInitForce320x240() SDL_InitSubSystem(SDL_INIT_VIDEO); } +#ifdef DEVICE_GCW0 + screen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE|SDL_TRIPLEBUF); +#else screen = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE); +#endif SDL_ShowCursor(SDL_DISABLE); if(!screen) {