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 #ifdef USE_SDL1
void SetVideoMode(int width, int height, int bpp, std::uint32_t flags); void SetVideoMode(int width, int height, int bpp, std::uint32_t flags);
void SetVideoModeToPrimary(bool fullscreen);
bool IsFullScreen(); bool IsFullScreen();
void SetVideoModeToPrimary(bool fullscreen = IsFullScreen());
#endif #endif
// Returns: // Returns:

25
SourceX/storm/storm.cpp

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

Loading…
Cancel
Save