diff --git a/Source/engine/demomode.cpp b/Source/engine/demomode.cpp index d6680b482..4841c2710 100644 --- a/Source/engine/demomode.cpp +++ b/Source/engine/demomode.cpp @@ -390,6 +390,7 @@ void OverrideOptions() #endif sgOptions.Graphics.limitFPS.SetValue(false); } + forceResolution = Size(DemoGraphicsWidth, DemoGraphicsHeight); } bool IsRunning() diff --git a/Source/utils/display.cpp b/Source/utils/display.cpp index 4f8ad748f..43de24b1f 100644 --- a/Source/utils/display.cpp +++ b/Source/utils/display.cpp @@ -46,6 +46,8 @@ namespace devilution { extern SDLSurfaceUniquePtr RendererTextureSurface; /** defined in dx.cpp */ SDL_Window *ghMainWnd; +Size forceResolution; + Uint16 gnScreenWidth; Uint16 gnScreenHeight; Uint16 gnViewportHeight; @@ -155,7 +157,7 @@ void CalculateUIRectangle() Size GetPreferredWindowSize() { - Size windowSize = *sgOptions.Graphics.resolution; + Size windowSize = forceResolution.width != 0 ? forceResolution : *sgOptions.Graphics.resolution; #ifndef USE_SDL1 if (*sgOptions.Graphics.upscale && *sgOptions.Graphics.fitToScreen) { @@ -243,7 +245,7 @@ bool SpawnWindow(const char *lpWindowName) #endif #ifdef NXDK { - Size windowSize = *sgOptions.Graphics.resolution; + Size windowSize = forceResolution.width != 0 ? forceResolution : *sgOptions.Graphics.resolution; VIDEO_MODE xmode; void *p = nullptr; while (XVideoListModes(&xmode, 0, 0, &p)) { diff --git a/Source/utils/display.h b/Source/utils/display.h index 857cdb1ac..a2e97e436 100644 --- a/Source/utils/display.h +++ b/Source/utils/display.h @@ -10,6 +10,7 @@ #include "utils/sdl2_backports.h" #endif +#include "utils/attributes.h" #include "utils/sdl_ptrs.h" #include "utils/ui_fwd.h" @@ -26,6 +27,7 @@ extern SDLTextureUniquePtr texture; extern SDLPaletteUniquePtr Palette; extern SDL_Surface *PalSurface; extern unsigned int pal_surface_palette_version; +extern DVL_API_FOR_TEST Size forceResolution; #ifdef USE_SDL1 void SetVideoMode(int width, int height, int bpp, uint32_t flags); diff --git a/test/timedemo_test.cpp b/test/timedemo_test.cpp index 992e6df32..7d8080693 100644 --- a/test/timedemo_test.cpp +++ b/test/timedemo_test.cpp @@ -53,7 +53,7 @@ void RunTimedemo(std::string timedemoFolderName) demo::OverrideOptions(); - AdjustToScreenGeometry(*sgOptions.Graphics.resolution); + AdjustToScreenGeometry(forceResolution); StartGame(false, true);