diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp index 5562543..4a07187 100644 --- a/Src/OSD/SDL/Main.cpp +++ b/Src/OSD/SDL/Main.cpp @@ -119,7 +119,7 @@ static bool SetGLGeometry(unsigned *xOffsetPtr, unsigned *yOffsetPtr, unsigned * float yRes = float(*yResPtr); if (keepAspectRatio) { - float model3Ratio = 496.0/384.0; + float model3Ratio = float(496.0/384.0); if (yRes < (xRes/model3Ratio)) xRes = yRes*model3Ratio; if (xRes < (yRes*model3Ratio)) @@ -176,6 +176,42 @@ static void GLAPIENTRY DebugCallback(GLenum source, GLenum type, GLuint id, GLen printf("OGLDebug:: 0x%X: %s\n", id, message); } +// In windows with an nvidia card (sorry not tested anything else) you can customise the resolution. +// This also allows you to set a totally custom refresh rate. Apparently you can drive most monitors at +// 57.5fps with no issues. Anyway this code will automatically pick up your custom refresh rate, and set it if it exists +// It it doesn't exist, then it'll probably just default to 60 or whatever your refresh rate is. +static void SetFullScreenRefreshRate() +{ + float refreshRateHz = std::abs(s_runtime_config["RefreshRate"].ValueAs()); + + if (refreshRateHz > 57.f && refreshRateHz < 58.f) { + + int display_in_use = 0; /* Only using first display */ + + int display_mode_count = SDL_GetNumDisplayModes(display_in_use); + if (display_mode_count < 1) { + return; + } + + for (int i = 0; i < display_mode_count; ++i) { + + SDL_DisplayMode mode; + + if (SDL_GetDisplayMode(display_in_use, i, &mode) != 0) { + return; + } + + if (SDL_BITSPERPIXEL(mode.format) >= 24 && mode.refresh_rate == 58 && mode.w == totalXRes && mode.h == totalYRes) { + int result = SDL_SetWindowDisplayMode(s_window, &mode); + if (result == 0) { + printf("Custom fullscreen mode set: %ix%i@57.524 Hz\n", mode.w, mode.h); + } + break; + } + } + } +} + /* * CreateGLScreen(): * @@ -1049,6 +1085,9 @@ int Supermodel(const Game &game, ROMSet *rom_set, IEmulator *Model3, CInputs *In SDL_SetWindowTitle(s_window, baseTitleStr); SDL_SetWindowSize(s_window, totalXRes, totalYRes); SDL_SetWindowPosition(s_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); + + SetFullScreenRefreshRate(); + bool stretch = s_runtime_config["Stretch"].ValueAs(); bool fullscreen = s_runtime_config["FullScreen"].ValueAs(); if (OKAY != ResizeGLScreen(&xOffset, &yOffset ,&xRes, &yRes, &totalXRes, &totalYRes, !stretch, fullscreen)) diff --git a/Src/OSD/Windows/FileSystemPath.cpp b/Src/OSD/Windows/FileSystemPath.cpp index 9536d27..b0ca737 100644 --- a/Src/OSD/Windows/FileSystemPath.cpp +++ b/Src/OSD/Windows/FileSystemPath.cpp @@ -42,5 +42,7 @@ namespace FileSystemPath case Screenshots: return ""; } + + return ""; } }