rodecomp/Source/Render/DeviceOwnerDX7.h
ragnarok-clanker b31bc5ec1f Decompile 11 functions in Source/Render/SurfaceDX7.cpp, Source/Render/DeviceOwnerDX7.h
Batch #118 by ragnarok-clanker: 11 byte-identical, 0 confirmed by peer review.

- fn_01788 DeviceOwnerDX7::BlueMask: byte-identical
- fn_01789 DeviceOwnerDX7::BlueExpansion: byte-identical
- fn_01790 DeviceOwnerDX7::BlueShift: byte-identical
- fn_01792 DeviceOwnerDX7::DirectDraw: byte-identical
- fn_01793 DeviceOwnerDX7::GreenMask: byte-identical
- fn_01794 DeviceOwnerDX7::GreenExpansion: byte-identical
- fn_01795 DeviceOwnerDX7::GreenShift: byte-identical
- fn_01797 DeviceOwnerDX7::RedMask: byte-identical
- fn_01798 DeviceOwnerDX7::RedExpansion: byte-identical
- fn_01799 DeviceOwnerDX7::RedShift: byte-identical
- fn_01800 DeviceOwnerDX7::RenderTarget: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-10-24 17:53:08 +00:00

129 lines
3.7 KiB
C++

#ifndef RAGNAROK_SOURCE_RENDER_DEVICEOWNERDX7_H
#define RAGNAROK_SOURCE_RENDER_DEVICEOWNERDX7_H
#include <cstddef>
#include <cstdint>
#include <d3d.h>
#include <ddraw.h>
struct DeviceOptionsDX7 {
const int& fullscreen;
const int& width;
const int& height;
const int& bitsPerPixel;
};
struct TextureDX7Context;
struct TextureAllocationDX7;
class CRenderSystemBase;
// Original nonpolymorphic device owner, 588 bytes on x86. Unwritten fields remain
// unwritten until their corresponding creation/capability operation publishes them.
class DeviceOwnerDX7 {
public:
DeviceOwnerDX7();
HRESULT Initialize(
HWND window,
GUID* drawIdentity,
const GUID* renderIdentity,
const DDSURFACEDESC2* mode,
DWORD flags,
HWND applicationWindow,
const RECT& monitor
);
HRESULT CreateDevice(
GUID* drawIdentity,
const GUID* renderIdentity,
const DDSURFACEDESC2* mode,
DWORD flags,
const RECT& monitor
);
HRESULT CreateSurfaces(const DDSURFACEDESC2* mode, DWORD flags, const RECT& monitor);
HRESULT Close();
HRESULT Clear(DWORD color);
HRESULT ClearDepth();
HRESULT Present(bool wait, const RECT& monitor);
bool RestoreLostSurfaces();
void MarkSurfacesLost();
void AdjustTextureDimensions(std::uint32_t& width, std::uint32_t& height) const;
bool SupportsTextureDimensions(std::uint32_t width, std::uint32_t height) const;
void CaptureBackBuffer();
void RestoreBackBuffer();
void PrepareErrorDialog();
void RestoreDisplayMode();
HRESULT RestoreAllSurfaces();
void SetDialogClipper(int enabled);
bool CalibrateTextureCoordinates(TextureDX7Context& context);
// Recovered capability-publication portion of the renderer factory. Host
// helper has no OFFSET: the full factory also constructs/calibrates a renderer.
int RefreshRendererCapabilities(
int mipmaps,
TextureAllocationDX7& allocation,
bool& multitexture,
CRenderSystemBase* renderSystem
);
std::uint16_t PackColor(int red, int green, int blue);
DWORD BlueMask();
DWORD BlueExpansion();
DWORD BlueShift();
IDirectDraw7* DirectDraw();
DWORD GreenMask();
DWORD GreenExpansion();
DWORD GreenShift();
DWORD RedMask();
DWORD RedExpansion();
DWORD RedShift();
IDirectDrawSurface7* RenderTarget();
HWND window;
DWORD width;
DWORD height;
RECT destination;
RECT source;
IDirectDrawSurface7* primary;
IDirectDrawSurface7* backBuffer;
IDirectDrawSurface7* renderTarget;
IDirectDrawSurface7* depthBuffer;
IDirectDraw7* draw;
IDirect3D7* direct3D;
IDirect3DDevice7* device;
D3DDEVICEDESC7 caps;
DWORD depthMemory;
DDPIXELFORMAT depthFormat;
DDSURFACEDESC2 primaryDescription;
DWORD fullscreen;
DWORD presentationOption;
DWORD desktopBitDepth;
IDirectDrawSurface7* captureSurface;
struct Channel {
DWORD shift;
DWORD expansion;
} red, green, blue, alpha;
DWORD bitDepth;
DWORD redMask;
DWORD greenMask;
DWORD blueMask;
DWORD alphaMask;
DWORD minTextureWidth;
DWORD minTextureHeight;
DWORD maxTextureWidth;
DWORD maxTextureHeight;
DWORD maxTextureAspectRatio;
bool colorKeySupported;
bool largeTextures;
std::uint8_t unknown_022E[26];
bool surfacesLost;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(DeviceOwnerDX7) == 588);
static_assert(offsetof(DeviceOwnerDX7, caps) == 72);
static_assert(offsetof(DeviceOwnerDX7, depthFormat) == 312);
static_assert(offsetof(DeviceOwnerDX7, primaryDescription) == 344);
static_assert(offsetof(DeviceOwnerDX7, fullscreen) == 468);
static_assert(offsetof(DeviceOwnerDX7, captureSurface) == 480);
static_assert(offsetof(DeviceOwnerDX7, minTextureWidth) == 536);
static_assert(offsetof(DeviceOwnerDX7, surfacesLost) == 584);
#endif
#endif