Batch #1060 by ragnarok-clanker: no function's compiled code changes; checked with 188 compiled unit(s), including every includer of Source/Render/DX7/DeviceOwnerDX7.h, Source/Render/DX7/DirectDrawEnumeration.h, Source/Render/DX7/RenderSystemDX7.h, Source/Render/DX7/RendererFogDX7.h, Source/Render/DX7/SurfaceDX7.h, Source/Render/DX9/DeviceOwnerDX9.h, Source/Render/DX9/DeviceStateDX9.h, Source/Render/DX9/RendererFogDX9.h, Source/Render/DeviceContext/DCSurface.h, Source/Render/DisplayMode.h, Source/Render/Primitives/LightmappedPrimitive.h, Source/Render/Primitives/RenderCommandPool.h, Source/Render/Primitives/RenderPrimitive.h, Source/Render/Primitives/RenderPrimitivePool.h, Source/Render/Primitives/RenderQueues.h, Source/Render/Primitives/RenderVertexPool.h, Source/Render/Projection/RendererViewport.h, Source/Render/RenderAdapter.h, Source/Render/Renderer.h, Source/Render/RendererBackBuffer.h, Source/Render/Text/TextContext.h, Source/Render/Textures/BitmapTextureCache.h, Source/Render/Textures/SpriteAtlas.h, Source/Render/Textures/Surface.h.
62 lines
2.1 KiB
C++
62 lines
2.1 KiB
C++
#ifndef RAGNAROK_SOURCE_RENDER_DX7_DIRECTDRAWENUMERATION_H
|
|
#define RAGNAROK_SOURCE_RENDER_DX7_DIRECTDRAWENUMERATION_H
|
|
|
|
#include <array>
|
|
#include <cstddef>
|
|
#include <d3d.h>
|
|
#include <ddraw.h>
|
|
|
|
struct DirectDrawDeviceRecord {
|
|
/* 0000 */ char description[40];
|
|
/* 0028 */ GUID* renderGuid;
|
|
/* 002C */ D3DDEVICEDESC7 device;
|
|
/* 0118 */ DWORD hardware;
|
|
/* 011C */ GUID* drawGuid;
|
|
/* 0120 */ DDCAPS driverCaps;
|
|
/* 029C */ DDCAPS emulationCaps;
|
|
/* 0418 */ DDSURFACEDESC2 selectedMode;
|
|
/* 0494 */ DWORD primary;
|
|
/* 0498 */ DWORD unknown_0498;
|
|
/* 049C */ GUID renderIdentity;
|
|
/* 04AC */ GUID drawIdentity;
|
|
/* 04BC */ DDSURFACEDESC2* modes;
|
|
/* 04C0 */ unsigned modeCount;
|
|
/* 04C4 */ unsigned selectedIndex;
|
|
/* 04C8 */ DWORD primaryAdapter;
|
|
/* 04CC */ DWORD hasStereoMode;
|
|
};
|
|
|
|
class DirectDrawEnumeration {
|
|
public:
|
|
using Filter = HRESULT(__cdecl*)(const DDCAPS*, const D3DDEVICEDESC7*);
|
|
DirectDrawEnumeration(const GUID& selectedDraw, RECT& monitor);
|
|
HRESULT Enumerate(Filter filter);
|
|
void ClearModes();
|
|
|
|
std::array<DirectDrawDeviceRecord, 20> devices{};
|
|
unsigned devicesSeen = 0;
|
|
unsigned deviceCount = 0;
|
|
|
|
private:
|
|
struct AdapterContext;
|
|
const GUID& m_selectedDraw;
|
|
RECT& m_monitor;
|
|
Filter m_filter = nullptr;
|
|
static BOOL WINAPI Adapter(GUID* guid, char* description, char* name, void* context, HMONITOR monitor);
|
|
static HRESULT CALLBACK Mode(DDSURFACEDESC2* mode, void* context);
|
|
static HRESULT CALLBACK Device(char* description, char* name, D3DDEVICEDESC7* device, void* context);
|
|
static int __cdecl CompareModes(const void* left, const void* right);
|
|
};
|
|
|
|
#if defined(_WIN32) && !defined(_WIN64)
|
|
static_assert(sizeof(DDCAPS) == 380);
|
|
static_assert(sizeof(D3DDEVICEDESC7) == 236);
|
|
static_assert(sizeof(DirectDrawDeviceRecord) == 1232);
|
|
static_assert(offsetof(DirectDrawDeviceRecord, modes) == 1212);
|
|
static_assert(offsetof(DirectDrawDeviceRecord, driverCaps) == 0x0120);
|
|
static_assert(offsetof(DirectDrawDeviceRecord, selectedMode) == 0x0418);
|
|
static_assert(offsetof(DirectDrawDeviceRecord, renderIdentity) == 0x049C);
|
|
static_assert(offsetof(DirectDrawDeviceRecord, hasStereoMode) == 0x04CC);
|
|
#endif
|
|
|
|
#endif
|