Skip to content

Commit

Permalink
Set hardware surface video mode for the UX and for game runs with no
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
plrguez committed Aug 11, 2021
1 parent 407e723 commit e5206d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sdl-dingux/gui_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions src/sdl-dingux/sdl_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e5206d4

Please sign in to comment.