rodecomp/Source/Render/RenderAdapter.h
ragnarok-clanker 1006b49b22 Decompile 2 functions in Source/UI/GameSettings/GameSettingsUI.cpp, Source/Render/RenderAdapter.h, ...
Batch #9037 by ragnarok-clanker: 0 byte-identical, 2 confirmed by peer review.

- fn_15905 RenderAdapter::RenderAdapter: logic confirmed by peer review
- fn_02326 EnumerateAdaptersDX7: logic confirmed by peer review

Peer-reviewed-by: Lumen, Montyla, dori
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-01 00:03:54 +00:00

63 lines
2.2 KiB
C++

#ifndef RAGNAROK_SOURCE_RENDER_RENDERADAPTER_H
#define RAGNAROK_SOURCE_RENDER_RENDERADAPTER_H
#include <cstddef>
#include <string>
#include <vector>
#include <windows.h>
class DeviceOwnerDX9;
struct DeviceOptionsDX9;
struct RenderAdapter {
RenderAdapter();
// INLINED
RenderAdapter(int backend, UINT ordinal, const char* description, const GUID& drawGuid, const GUID& renderGuid)
: backend(backend), ordinal(ordinal), description(description), drawGuid(drawGuid), renderGuid(renderGuid), deviceGuid{} {
}
// INLINED
RenderAdapter(int backend, UINT ordinal, const char* description, GUID drawGuid, GUID renderGuid, const GUID& deviceGuid, const char* deviceName)
: backend(backend), ordinal(ordinal), description(description), drawGuid(drawGuid), renderGuid(renderGuid), deviceGuid(deviceGuid),
deviceName(deviceName) {
}
/* 0000 */ int backend;
/* 0004 */ UINT ordinal;
/* 0008 */ std::string description;
/* 0020 */ GUID drawGuid;
/* 0030 */ GUID renderGuid;
/* 0040 */ GUID deviceGuid;
/* 0050 */ std::string deviceName;
bool Matches(const RenderAdapter& selected) const;
};
struct AdapterConfiguration {
const int& backend;
const GUID& drawGuid;
const GUID& renderGuid;
const GUID& deviceGuid;
const char* deviceName;
};
RenderAdapter SelectedRenderAdapter(const AdapterConfiguration& configuration, bool serviceUsesDX7);
std::vector<RenderAdapter> EnumerateRenderAdapters(int backend);
std::vector<RenderAdapter> EnumerateAdaptersDX7();
std::vector<RenderAdapter> EnumerateAdaptersDX9();
HRESULT InitializeConfiguredDeviceDX9(
DeviceOwnerDX9& owner, HWND window, const DeviceOptionsDX9& options, const AdapterConfiguration& configuration, bool serviceUsesDX7
);
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(RenderAdapter) == 104);
static_assert(offsetof(RenderAdapter, ordinal) == 0x0004);
static_assert(offsetof(RenderAdapter, description) == 0x0008);
static_assert(offsetof(RenderAdapter, drawGuid) == 0x0020);
static_assert(offsetof(RenderAdapter, renderGuid) == 0x0030);
static_assert(offsetof(RenderAdapter, deviceGuid) == 0x0040);
static_assert(offsetof(RenderAdapter, deviceName) == 0x0050);
#endif
#endif