Browse Source

SVid: Only switch video mode if full-screen

borderless counts as full-screen here (this is what RetroFW reports when
fullscreen=0)
pull/588/head
Gleb Mazovetskiy 6 years ago
parent
commit
658b44f613
  1. 2
      SourceX/display.h
  2. 25
      SourceX/storm/storm.cpp

2
SourceX/display.h

@ -19,8 +19,8 @@ extern unsigned int pal_surface_palette_version;
#ifdef USE_SDL1
void SetVideoMode(int width, int height, int bpp, std::uint32_t flags);
void SetVideoModeToPrimary(bool fullscreen);
bool IsFullScreen();
void SetVideoModeToPrimary(bool fullscreen = IsFullScreen());
#endif
// Returns:

25
SourceX/storm/storm.cpp

@ -22,6 +22,10 @@ DWORD nLastError = 0;
bool directFileAccess = false;
char SBasePath[DVL_MAX_PATH];
#ifdef USE_SDL1
static bool IsSVidVideoMode = false;
#endif
static std::string getIniPath()
{
char path[DVL_MAX_PATH];
@ -590,15 +594,18 @@ void SVidPlayBegin(char *filename, int a2, int a3, int a4, int a5, int flags, HA
// Set the video mode close to the SVid resolution while preserving aspect ratio.
{
const auto *display = SDL_GetVideoSurface();
int w, h;
if (display->w * SVidWidth > display->h * SVidHeight) {
w = SVidWidth;
h = SVidWidth * display->h / display->w;
} else {
w = SVidHeight * display->w / display->h;
h = SVidHeight;
IsSVidVideoMode = (display->flags & (SDL_FULLSCREEN | SDL_NOFRAME)) != 0;
if (IsSVidVideoMode) {
int w, h;
if (display->w * SVidWidth > display->h * SVidHeight) {
w = SVidWidth;
h = SVidWidth * display->h / display->w;
} else {
w = SVidHeight * display->w / display->h;
h = SVidHeight;
}
SetVideoMode(w, h, display->format->BitsPerPixel, display->flags);
}
SetVideoMode(w, h, display->format->BitsPerPixel, display->flags);
}
#endif
memcpy(SVidPreviousPalette, orig_palette, 1024);
@ -787,7 +794,7 @@ void SVidPlayEnd(HANDLE video)
}
}
#else
SetVideoModeToPrimary(IsFullScreen());
if (IsSVidVideoMode) SetVideoModeToPrimary();
#endif
}

Loading…
Cancel
Save