more compact available video modes logging

This commit is contained in:
thrust26 2020-05-22 09:05:48 +02:00
parent 38146f9f21
commit b703d3df92
1 changed files with 22 additions and 9 deletions

View File

@ -101,19 +101,32 @@ void FrameBufferSDL2::queryHardware(vector<Common::Size>& fullscreenRes,
int numModes = SDL_GetNumDisplayModes(i); int numModes = SDL_GetNumDisplayModes(i);
ostringstream s; ostringstream s;
s << "Supported video modes for display " << i << ":"; s << "Supported video modes (" << numModes << ") for display " << i << ":";
Logger::debug(s.str());
string lastRes = "";
for (int m = 0; m < numModes; m++) for (int m = 0; m < numModes; m++)
{ {
SDL_DisplayMode mode; SDL_DisplayMode mode;
ostringstream res;
SDL_GetDisplayMode(i, m, &mode); SDL_GetDisplayMode(i, m, &mode);
s.str(""); res << std::setw(4) << mode.w << "x" << std::setw(4) << mode.h;
s << " " << m << ": " << mode.w << "x" << mode.h << "@" << mode.refresh_rate << "Hz";
if (mode.w == display.w && mode.h == display.h && mode.refresh_rate == display.refresh_rate) if(lastRes != res.str())
s << " (active)"; {
Logger::debug(s.str()); Logger::debug(s.str());
s.str("");
lastRes = res.str();
s << lastRes << ": ";
} }
s << mode.refresh_rate << "Hz";
if(mode.w == display.w && mode.h == display.h && mode.refresh_rate == display.refresh_rate)
s << "* ";
else
s << " ";
}
Logger::debug(s.str());
} }
// Now get the maximum windowed desktop resolution // Now get the maximum windowed desktop resolution
@ -412,7 +425,7 @@ bool FrameBufferSDL2::createRenderer(bool force)
if(recreate) if(recreate)
{ {
cerr << "Create new renderer " << int(myBufferType) << endl; cerr << "Create new renderer for buffer type #" << int(myBufferType) << endl;
if(myRenderer) if(myRenderer)
SDL_DestroyRenderer(myRenderer); SDL_DestroyRenderer(myRenderer);