Skip to content

Commit

Permalink
improve resolution info in select dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
yukani committed Jul 11, 2023
1 parent 8e0cf73 commit 589806e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions source/app/platform/win/VideoModeSelectDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,17 @@ void FillAvailableVMs(HWND hVMSel) {
const auto aspectr = (float)vmi.height / (float)vmi.width;
// printf("%f\n", aspectr) // annoying printf that spams the console was here

const auto AddThisVMEntry = [&](auto type) {
char vmName[1024];
*std::format_to(vmName, "{} x {} x {} ({})", vmi.width, vmi.height, vmi.depth, type) = 0;
const auto idx = SendMessage(hVMSel, CB_ADDSTRING, NULL, (LPARAM)vmName); // Add entry, and get it's index
SendMessage(hVMSel, CB_SETITEMDATA, idx, i); // Set index of that entry to correspond to `i`
};
const auto gcd = std::gcd(vmi.width, vmi.height);
const auto ratioW = vmi.width / gcd, ratioH = vmi.height / gcd;

if (IsFullScreenRatio(aspectr)) {
AddThisVMEntry("FULLSCRCEEN");
} else if (IsWideScreenRatio(aspectr)) {
AddThisVMEntry("WIDESCREEN");
// NOTSA: Provide aspect ratio info (W:H) instead of 'FULLSCREEN' and 'WIDESCREEN'.
if (IsFullScreenRatio(aspectr) || IsWideScreenRatio(aspectr)) {
static char vmName[1024];
*std::format_to(vmName, "{} x {} x {} ({}:{})", vmi.width, vmi.height, vmi.depth, ratioW, ratioH) = 0;
const auto idx = SendMessage(hVMSel, CB_ADDSTRING, NULL, (LPARAM)vmName); // Add entry, and get it's index
SendMessage(hVMSel, CB_SETITEMDATA, idx, i); // Set index of that entry to correspond to `i`
} else {
DEV_LOG("Not listing video mode ({}) to device select! [Aspect Ratio: {}; Res: {} x {}]", i, aspectr, vmi.width, vmi.height);
DEV_LOG("Not listing video mode ({}) to device select! [{} x {} ({}:{})]", i, vmi.width, vmi.height, ratioW, ratioH);
}
}
}
Expand Down

0 comments on commit 589806e

Please sign in to comment.