#include "Render/DX7/DirectDrawEnumeration.h" #include "Render/DisplayMode.h" #include #include // OFFSET: 0x0056BDD0 // FUNCTION: fn_02331 std::vector EnumerateDisplayModesDX7(unsigned deviceIndex) { std::vector 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; }