Batch #1484 by ragnarok-clanker: 0 byte-identical, 12 confirmed by peer review. - fn_09780 DirectDrawEnumeration::Devices: logic confirmed by peer review - fn_09781 DirectDrawEnumeration::DeviceCount: logic confirmed by peer review - fn_09782 DirectDrawEnumeration::DevicesSeen: logic confirmed by peer review - fn_09777 DirectDrawEnumeration::Enumerate: logic confirmed by peer review - fn_09778 DirectDrawEnumeration::Device: logic confirmed by peer review - fn_09779 DirectDrawEnumeration::Adapter: logic confirmed by peer review - fn_09783 DirectDrawEnumeration::Mode: logic confirmed by peer review - fn_09785 DirectDrawEnumeration::ClearModes: logic confirmed by peer review - fn_02331 EnumerateDisplayModesDX7: logic confirmed by peer review - fn_02326 EnumerateAdaptersDX7: logic confirmed by peer review - fn_02291 EnumerateDisplayModes: logic confirmed by peer review - fn_02283 EnumerateRenderAdapters: logic confirmed by peer review Reviewed-by: ragnarok-clanker
55 lines
1.7 KiB
C++
55 lines
1.7 KiB
C++
#include "Render/DX7/DirectDrawEnumeration.h"
|
|
#include "Render/DisplayMode.h"
|
|
|
|
#include <utility>
|
|
|
|
// OFFSET: 0x0056BDD0
|
|
// FUNCTION: fn_02331
|
|
std::vector<DisplayMode> EnumerateDisplayModesDX7(unsigned deviceIndex) {
|
|
std::vector<DisplayMode> result;
|
|
|
|
if (DirectDrawEnumeration::DevicesSeen() == 0 && FAILED(DirectDrawEnumeration::Enumerate(nullptr))) {
|
|
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;
|
|
}
|
|
|
|
OSVERSIONINFOEXW version{};
|
|
version.dwOSVersionInfoSize = sizeof(version);
|
|
version.dwMajorVersion = 6;
|
|
version.dwMinorVersion = 2;
|
|
DWORDLONG mask = VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
|
mask = VerSetConditionMask(mask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
|
mask = VerSetConditionMask(mask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
|
const bool modern = VerifyVersionInfoW(&version, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, mask) != FALSE;
|
|
|
|
if (modern ? bits != 32 : (bits != 16 && bits != 32)) {
|
|
continue;
|
|
}
|
|
|
|
std::string description = std::to_string(width) + " x " + std::to_string(height);
|
|
|
|
if (!modern) {
|
|
description += " x ";
|
|
description += std::to_string(bits);
|
|
}
|
|
|
|
result.push_back({width, height, bits, std::move(description)});
|
|
}
|
|
|
|
return result;
|
|
}
|