Batch #12168 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_02331 EnumerateDisplayModesDX7: logic confirmed by peer review Peer-reviewed-by: Yommy, alisonrag, gordaoprogramas, codeplay Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
#include "Render/DX7/DirectDrawEnumeration.h"
|
|
#include "Render/DisplayMode.h"
|
|
|
|
#include <VersionHelpers.h>
|
|
#include <format>
|
|
|
|
// OFFSET: 0x0056BDD0
|
|
// FUNCTION: fn_02331
|
|
std::vector<DisplayMode> EnumerateDisplayModesDX7(unsigned deviceIndex) {
|
|
std::vector<DisplayMode> result;
|
|
|
|
if (DirectDrawEnumeration::DevicesSeen() == 0 && FAILED(DirectDrawEnumeration::Enumerate(AcceptAnyDirectDrawDevice))) {
|
|
return result;
|
|
}
|
|
|
|
if (deviceIndex >= DirectDrawEnumeration::DeviceCount()) {
|
|
return result;
|
|
}
|
|
|
|
const auto& record = DirectDrawEnumeration::Devices()[deviceIndex];
|
|
|
|
for (unsigned index = 0; index < record.modeCount; ++index) {
|
|
const auto& mode = record.modes[index];
|
|
const unsigned width = mode.dwWidth;
|
|
const unsigned height = mode.dwHeight;
|
|
const unsigned bits = mode.ddpfPixelFormat.dwRGBBitCount;
|
|
|
|
if (height < 664 || width > 2048 || height > 1440) {
|
|
continue;
|
|
}
|
|
|
|
if (IsWindows8OrGreater()) {
|
|
if (bits == 32) {
|
|
result.push_back({width, height, bits, std::format("{} x {}", width, height)});
|
|
}
|
|
} else if (bits == 16 || bits == 32) {
|
|
result.push_back({width, height, bits, std::format("{} x {} x {}", width, height, bits)});
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|