Maintenance: Add mandatory field offset markers /* XXXX */ and assertions to Render headers (DX7, DX9, Primitives, Text, Textures)
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.
This commit is contained in:
parent
48e41cae16
commit
cbbf28e4de
24 changed files with 322 additions and 222 deletions
|
|
@ -54,44 +54,48 @@ public:
|
|||
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;
|
||||
/* 0000 */ HWND window;
|
||||
/* 0004 */ DWORD width;
|
||||
/* 0008 */ DWORD height;
|
||||
/* 000C */ RECT destination;
|
||||
/* 001C */ RECT source;
|
||||
/* 002C */ IDirectDrawSurface7* primary;
|
||||
/* 0030 */ IDirectDrawSurface7* backBuffer;
|
||||
/* 0034 */ IDirectDrawSurface7* renderTarget;
|
||||
/* 0038 */ IDirectDrawSurface7* depthBuffer;
|
||||
/* 003C */ IDirectDraw7* draw;
|
||||
/* 0040 */ IDirect3D7* direct3D;
|
||||
/* 0044 */ IDirect3DDevice7* device;
|
||||
/* 0048 */ D3DDEVICEDESC7 caps;
|
||||
/* 0134 */ DWORD depthMemory;
|
||||
/* 0138 */ DDPIXELFORMAT depthFormat;
|
||||
/* 0158 */ DDSURFACEDESC2 primaryDescription;
|
||||
/* 01D4 */ DWORD fullscreen;
|
||||
/* 01D8 */ DWORD presentationOption;
|
||||
/* 01DC */ DWORD desktopBitDepth;
|
||||
/* 01E0 */ 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;
|
||||
/* 0000 */ DWORD shift;
|
||||
/* 0004 */ DWORD expansion;
|
||||
};
|
||||
/* 01E4 */ Channel red;
|
||||
/* 01EC */ Channel green;
|
||||
/* 01F4 */ Channel blue;
|
||||
/* 01FC */ Channel alpha;
|
||||
/* 0204 */ DWORD bitDepth;
|
||||
/* 0208 */ DWORD redMask;
|
||||
/* 020C */ DWORD greenMask;
|
||||
/* 0210 */ DWORD blueMask;
|
||||
/* 0214 */ DWORD alphaMask;
|
||||
/* 0218 */ DWORD minTextureWidth;
|
||||
/* 021C */ DWORD minTextureHeight;
|
||||
/* 0220 */ DWORD maxTextureWidth;
|
||||
/* 0224 */ DWORD maxTextureHeight;
|
||||
/* 0228 */ DWORD maxTextureAspectRatio;
|
||||
/* 022C */ bool colorKeySupported;
|
||||
/* 022D */ bool largeTextures;
|
||||
/* 022E */ std::uint8_t unknown_022E[26];
|
||||
/* 0248 */ bool surfacesLost;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
|
|
@ -103,6 +107,10 @@ static_assert(offsetof(DeviceOwnerDX7, fullscreen) == 468);
|
|||
static_assert(offsetof(DeviceOwnerDX7, captureSurface) == 480);
|
||||
static_assert(offsetof(DeviceOwnerDX7, minTextureWidth) == 536);
|
||||
static_assert(offsetof(DeviceOwnerDX7, surfacesLost) == 584);
|
||||
static_assert(sizeof(DeviceOwnerDX7::Channel) == 8);
|
||||
static_assert(offsetof(DeviceOwnerDX7::Channel, expansion) == 4);
|
||||
static_assert(offsetof(DeviceOwnerDX7, red) == 0x01E4);
|
||||
static_assert(offsetof(DeviceOwnerDX7, alpha) == 0x01FC);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -7,23 +7,23 @@
|
|||
#include <ddraw.h>
|
||||
|
||||
struct DirectDrawDeviceRecord {
|
||||
char description[40];
|
||||
GUID* renderGuid;
|
||||
D3DDEVICEDESC7 device;
|
||||
DWORD hardware;
|
||||
GUID* drawGuid;
|
||||
DDCAPS driverCaps;
|
||||
DDCAPS emulationCaps;
|
||||
DDSURFACEDESC2 selectedMode;
|
||||
DWORD primary;
|
||||
DWORD unknown_0498;
|
||||
GUID renderIdentity;
|
||||
GUID drawIdentity;
|
||||
DDSURFACEDESC2* modes;
|
||||
unsigned modeCount;
|
||||
unsigned selectedIndex;
|
||||
DWORD primaryAdapter;
|
||||
DWORD hasStereoMode;
|
||||
/* 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 {
|
||||
|
|
@ -53,6 +53,10 @@ 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
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
DeviceOwnerDX7* m_device;
|
||||
CTextureDX7* m_defaultTexture;
|
||||
std::shared_ptr<CSurface> m_backBuffer;
|
||||
/* 0004 */ DeviceOwnerDX7* m_device;
|
||||
/* 0008 */ CTextureDX7* m_defaultTexture;
|
||||
/* 000C */ std::shared_ptr<CSurface> m_backBuffer;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ class CRenderSystemBase;
|
|||
HRESULT PerspectiveMatrixDX7(D3DMATRIX& matrix, float fov, float aspect, float nearPlane, float farPlane);
|
||||
|
||||
struct RendererFogDX7 {
|
||||
int enabled;
|
||||
int dirty;
|
||||
int supported;
|
||||
/* 0150 */ int enabled;
|
||||
/* 0154 */ int dirty;
|
||||
/* 0158 */ int supported;
|
||||
|
||||
void Set(int value, IDirect3DDevice7* device, const D3DDEVICEDESC7& caps, FogConfiguration& configuration);
|
||||
void Apply(IDirect3DDevice7* device, const D3DDEVICEDESC7& caps, float aspect, const FogConfiguration& configuration, CRenderSystemBase* renderSystem);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ public:
|
|||
void Stretch(int x, int y, int width, int height) override;
|
||||
|
||||
protected:
|
||||
DeviceOwnerDX7* m_owner;
|
||||
IDirectDrawSurface7* m_surface;
|
||||
std::uint32_t m_width;
|
||||
std::uint32_t m_height;
|
||||
/* 0004 */ DeviceOwnerDX7* m_owner;
|
||||
/* 0008 */ IDirectDrawSurface7* m_surface;
|
||||
/* 000C */ std::uint32_t m_width;
|
||||
/* 0010 */ std::uint32_t m_height;
|
||||
};
|
||||
|
||||
class CSurfaceWallpaperDX7 : public CSurfaceDX7 {
|
||||
|
|
|
|||
|
|
@ -46,12 +46,16 @@ public:
|
|||
/* 0680 */ IDirect3DSurface9* backBuffer;
|
||||
/* 0684 */ IDirect3DSurface9* capturedBackBuffer;
|
||||
/* 0688 */ bool dynamicTextures;
|
||||
unsigned char unknown_0689[3];
|
||||
/* 0689 */ unsigned char unknown_0689[3];
|
||||
/* 068C */ HRESULT lastPresent;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(DeviceOwnerDX9) == 0x690);
|
||||
static_assert(offsetof(DeviceOwnerDX9, state) == 0x000C);
|
||||
static_assert(offsetof(DeviceOwnerDX9, dynamicTextures) == 0x0688);
|
||||
static_assert(offsetof(DeviceOwnerDX9, unknown_0689) == 0x0689);
|
||||
static_assert(offsetof(DeviceOwnerDX9, lastPresent) == 0x068C);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
#ifndef RAGNAROK_SOURCE_RENDER_DX9_DEVICESTATEDX9_H
|
||||
#define RAGNAROK_SOURCE_RENDER_DX9_DEVICESTATEDX9_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <d3d9.h>
|
||||
|
||||
struct DeviceStateDX9 {
|
||||
IDirect3DDevice9* device;
|
||||
DWORD fvf;
|
||||
DWORD render[210];
|
||||
DWORD textureStage[2][33];
|
||||
DWORD sampler[2][14];
|
||||
IDirect3DBaseTexture9* textures[2];
|
||||
/* 0000 */ IDirect3DDevice9* device;
|
||||
/* 0004 */ DWORD fvf;
|
||||
/* 0008 */ DWORD render[210];
|
||||
/* 0350 */ DWORD textureStage[2][33];
|
||||
/* 0458 */ DWORD sampler[2][14];
|
||||
/* 04C8 */ IDirect3DBaseTexture9* textures[2];
|
||||
|
||||
DeviceStateDX9();
|
||||
void Initialize(IDirect3DDevice9* device);
|
||||
|
|
@ -31,14 +32,20 @@ public:
|
|||
ScopedDeviceStateDX9& operator=(const ScopedDeviceStateDX9&) = delete;
|
||||
|
||||
private:
|
||||
DeviceStateDX9* m_state;
|
||||
DWORD m_render[210];
|
||||
DWORD m_textureStage[2][33];
|
||||
DWORD m_sampler[2][14];
|
||||
/* 0000 */ DeviceStateDX9* m_state;
|
||||
/* 0004 */ DWORD m_render[210];
|
||||
/* 034C */ DWORD m_textureStage[2][33];
|
||||
/* 0454 */ DWORD m_sampler[2][14];
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(DeviceStateDX9) == 1232);
|
||||
static_assert(offsetof(DeviceStateDX9, device) == 0x0000);
|
||||
static_assert(offsetof(DeviceStateDX9, fvf) == 0x0004);
|
||||
static_assert(offsetof(DeviceStateDX9, render) == 0x0008);
|
||||
static_assert(offsetof(DeviceStateDX9, textureStage) == 0x0350);
|
||||
static_assert(offsetof(DeviceStateDX9, sampler) == 0x0458);
|
||||
static_assert(offsetof(DeviceStateDX9, textures) == 0x04C8);
|
||||
static_assert(sizeof(ScopedDeviceStateDX9) == 1220);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "Render/FogConfiguration.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <d3d9.h>
|
||||
|
||||
class D3DX9Runtime;
|
||||
|
|
@ -10,9 +11,9 @@ struct TextureDX9Context;
|
|||
struct DeviceStateDX9;
|
||||
|
||||
struct RendererFogDX9 {
|
||||
int enabled;
|
||||
int dirty;
|
||||
int supported;
|
||||
/* 0150 */ int enabled;
|
||||
/* 0154 */ int dirty;
|
||||
/* 0158 */ int supported;
|
||||
|
||||
void Set(int enabled, const D3DCAPS9& caps, FogConfiguration& configuration);
|
||||
void Apply(const TextureDX9Context& context, DeviceStateDX9& state, D3DX9Runtime& d3dx, const float& aspect, const FogConfiguration& configuration);
|
||||
|
|
@ -20,4 +21,10 @@ struct RendererFogDX9 {
|
|||
|
||||
static_assert(sizeof(RendererFogDX9) == 12);
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(offsetof(RendererFogDX9, enabled) == 0x0150 - 0x0150);
|
||||
static_assert(offsetof(RendererFogDX9, dirty) == 0x0154 - 0x0150);
|
||||
static_assert(offsetof(RendererFogDX9, supported) == 0x0158 - 0x0150);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public:
|
|||
void Dim(int x, int y, int width, int height, int percent) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<CSurface> m_surface;
|
||||
/* 0004 */ std::shared_ptr<CSurface> m_surface;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
#ifndef RAGNAROK_SOURCE_RENDER_DISPLAYMODE_H
|
||||
#define RAGNAROK_SOURCE_RENDER_DISPLAYMODE_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <windows.h>
|
||||
|
||||
struct DisplayMode {
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned bitsPerPixel;
|
||||
std::string description;
|
||||
/* 0000 */ unsigned width;
|
||||
/* 0004 */ unsigned height;
|
||||
/* 0008 */ unsigned bitsPerPixel;
|
||||
/* 000C */ std::string description;
|
||||
};
|
||||
|
||||
class DirectDrawEnumeration;
|
||||
|
|
@ -22,6 +23,9 @@ std::vector<DisplayMode> EnumerateDisplayModesDX9(UINT adapter);
|
|||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(DisplayMode) == 36);
|
||||
static_assert(offsetof(DisplayMode, height) == 0x0004);
|
||||
static_assert(offsetof(DisplayMode, bitsPerPixel) == 0x0008);
|
||||
static_assert(offsetof(DisplayMode, description) == 0x000C);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef RAGNAROK_SOURCE_RENDER_PRIMITIVES_LIGHTMAPPEDPRIMITIVE_H
|
||||
#define RAGNAROK_SOURCE_RENDER_PRIMITIVES_LIGHTMAPPEDPRIMITIVE_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
|
@ -8,41 +9,41 @@
|
|||
class CTexture;
|
||||
|
||||
struct LightmappedVertex {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float rhw;
|
||||
std::uint32_t diffuse;
|
||||
std::uint32_t specular;
|
||||
float u;
|
||||
float v;
|
||||
float lightU;
|
||||
float lightV;
|
||||
/* 0000 */ float x;
|
||||
/* 0004 */ float y;
|
||||
/* 0008 */ float z;
|
||||
/* 000C */ float rhw;
|
||||
/* 0010 */ std::uint32_t diffuse;
|
||||
/* 0014 */ std::uint32_t specular;
|
||||
/* 0018 */ float u;
|
||||
/* 001C */ float v;
|
||||
/* 0020 */ float lightU;
|
||||
/* 0024 */ float lightV;
|
||||
};
|
||||
struct LightmappedCommand {
|
||||
LightmappedCommand();
|
||||
|
||||
LightmappedVertex* vertices;
|
||||
std::int32_t vertexCount;
|
||||
std::uint16_t* indices;
|
||||
std::uint32_t indexCount;
|
||||
CTexture* texture;
|
||||
CTexture* lightmap;
|
||||
std::uint32_t primitiveType;
|
||||
/* 0000 */ LightmappedVertex* vertices;
|
||||
/* 0004 */ std::int32_t vertexCount;
|
||||
/* 0008 */ std::uint16_t* indices;
|
||||
/* 000C */ std::uint32_t indexCount;
|
||||
/* 0010 */ CTexture* texture;
|
||||
/* 0014 */ CTexture* lightmap;
|
||||
/* 0018 */ std::uint32_t primitiveType;
|
||||
};
|
||||
|
||||
struct LightmappedPrimitive {
|
||||
LightmappedPrimitive();
|
||||
LightmappedPrimitive(const LightmappedPrimitive& other);
|
||||
|
||||
LightmappedVertex* vertices;
|
||||
std::int32_t vertexCount;
|
||||
std::uint16_t* indices;
|
||||
std::uint32_t indexCount;
|
||||
CTexture* texture;
|
||||
CTexture* lightmap;
|
||||
std::uint32_t primitiveType;
|
||||
LightmappedVertex quad[4];
|
||||
/* 0000 */ LightmappedVertex* vertices;
|
||||
/* 0004 */ std::int32_t vertexCount;
|
||||
/* 0008 */ std::uint16_t* indices;
|
||||
/* 000C */ std::uint32_t indexCount;
|
||||
/* 0010 */ CTexture* texture;
|
||||
/* 0014 */ CTexture* lightmap;
|
||||
/* 0018 */ std::uint32_t primitiveType;
|
||||
/* 001C */ LightmappedVertex quad[4];
|
||||
};
|
||||
|
||||
class LightmappedPrimitivePool {
|
||||
|
|
@ -52,13 +53,13 @@ public:
|
|||
void Rewind();
|
||||
|
||||
private:
|
||||
std::deque<LightmappedPrimitive> m_commands;
|
||||
std::deque<LightmappedPrimitive>::iterator m_current;
|
||||
/* 0090 */ std::deque<LightmappedPrimitive> m_commands;
|
||||
/* 00A4 */ std::deque<LightmappedPrimitive>::iterator m_current;
|
||||
};
|
||||
|
||||
struct LightmappedQueues {
|
||||
std::vector<LightmappedPrimitive*> first;
|
||||
std::vector<LightmappedPrimitive*> second;
|
||||
/* 01F8 */ std::vector<LightmappedPrimitive*> first;
|
||||
/* 0204 */ std::vector<LightmappedPrimitive*> second;
|
||||
void Submit(LightmappedPrimitive* primitive, int queue, bool depthAlpha, float depthStart, float depthEnd);
|
||||
void Clear();
|
||||
};
|
||||
|
|
@ -67,6 +68,14 @@ static_assert(sizeof(LightmappedVertex) == 40);
|
|||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(LightmappedPrimitive) == 188);
|
||||
static_assert(sizeof(LightmappedCommand) == 28);
|
||||
static_assert(sizeof(LightmappedPrimitivePool) == 0x20);
|
||||
static_assert(sizeof(LightmappedQueues) == 0x18);
|
||||
static_assert(offsetof(LightmappedVertex, lightU) == 0x0020);
|
||||
static_assert(offsetof(LightmappedVertex, lightV) == 0x0024);
|
||||
static_assert(offsetof(LightmappedCommand, primitiveType) == 0x0018);
|
||||
static_assert(offsetof(LightmappedPrimitive, quad) == 0x001C);
|
||||
static_assert(offsetof(LightmappedQueues, first) + 0x01F8 == 0x01F8);
|
||||
static_assert(offsetof(LightmappedQueues, second) + 0x01F8 == 0x0204);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ public:
|
|||
void Rewind();
|
||||
|
||||
private:
|
||||
std::deque<RenderCommand> m_commands;
|
||||
std::deque<RenderCommand>::iterator m_current;
|
||||
/* 0050 */ std::deque<RenderCommand> m_commands;
|
||||
/* 0064 */ std::deque<RenderCommand>::iterator m_current;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
|
|
|
|||
|
|
@ -7,39 +7,39 @@
|
|||
class CTexture;
|
||||
|
||||
struct RenderVertex {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float rhw;
|
||||
std::uint32_t diffuse;
|
||||
std::uint32_t specular;
|
||||
float u;
|
||||
float v;
|
||||
/* 0000 */ float x;
|
||||
/* 0004 */ float y;
|
||||
/* 0008 */ float z;
|
||||
/* 000C */ float rhw;
|
||||
/* 0010 */ std::uint32_t diffuse;
|
||||
/* 0014 */ std::uint32_t specular;
|
||||
/* 0018 */ float u;
|
||||
/* 001C */ float v;
|
||||
|
||||
RenderVertex* Reset();
|
||||
};
|
||||
|
||||
struct RenderTriangle {
|
||||
RenderVertex vertices[3];
|
||||
CTexture* texture;
|
||||
std::uint32_t unknown_0064;
|
||||
std::uint32_t unknown_0068;
|
||||
/* 0000 */ RenderVertex vertices[3];
|
||||
/* 0060 */ CTexture* texture;
|
||||
/* 0064 */ std::uint32_t unknown_0064;
|
||||
/* 0068 */ std::uint32_t unknown_0068;
|
||||
|
||||
bool Visible() const;
|
||||
};
|
||||
|
||||
struct RenderCommand {
|
||||
RenderVertex* vertices;
|
||||
std::int32_t vertexCount;
|
||||
CTexture* texture;
|
||||
std::uint16_t* indices;
|
||||
std::uint32_t indexCount;
|
||||
std::uint16_t unknown_0014;
|
||||
std::uint16_t unknown_0016;
|
||||
std::uint32_t unknown_0018;
|
||||
std::uint32_t unknown_001C;
|
||||
std::uint32_t unknown_0020;
|
||||
std::uint32_t primitiveType;
|
||||
/* 0000 */ RenderVertex* vertices;
|
||||
/* 0004 */ std::int32_t vertexCount;
|
||||
/* 0008 */ CTexture* texture;
|
||||
/* 000C */ std::uint16_t* indices;
|
||||
/* 0010 */ std::uint32_t indexCount;
|
||||
/* 0014 */ std::uint16_t unknown_0014;
|
||||
/* 0016 */ std::uint16_t unknown_0016;
|
||||
/* 0018 */ std::uint32_t unknown_0018;
|
||||
/* 001C */ std::uint32_t unknown_001C;
|
||||
/* 0020 */ std::uint32_t unknown_0020;
|
||||
/* 0024 */ std::uint32_t primitiveType;
|
||||
|
||||
RenderCommand();
|
||||
RenderCommand* FreeVertices();
|
||||
|
|
@ -49,7 +49,7 @@ struct RenderCommand {
|
|||
};
|
||||
|
||||
struct RenderPrimitive : RenderCommand {
|
||||
RenderVertex quad[4];
|
||||
/* 0028 */ RenderVertex quad[4];
|
||||
|
||||
RenderPrimitive();
|
||||
RenderPrimitive(const RenderPrimitive& other);
|
||||
|
|
@ -61,6 +61,15 @@ static_assert(sizeof(RenderVertex) == 32);
|
|||
static_assert(sizeof(RenderCommand) == 40);
|
||||
static_assert(sizeof(RenderTriangle) == 108);
|
||||
static_assert(sizeof(RenderPrimitive) == 168);
|
||||
static_assert(offsetof(RenderVertex, rhw) == 0x000C);
|
||||
static_assert(offsetof(RenderVertex, specular) == 0x0014);
|
||||
static_assert(offsetof(RenderVertex, u) == 0x0018);
|
||||
static_assert(offsetof(RenderVertex, v) == 0x001C);
|
||||
static_assert(offsetof(RenderTriangle, texture) == 0x0060);
|
||||
static_assert(offsetof(RenderTriangle, unknown_0068) == 0x0068);
|
||||
static_assert(offsetof(RenderCommand, unknown_0016) == 0x0016);
|
||||
static_assert(offsetof(RenderCommand, primitiveType) == 0x0024);
|
||||
static_assert(offsetof(RenderPrimitive, quad) == 0x0028);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ public:
|
|||
void Rewind();
|
||||
|
||||
protected:
|
||||
std::deque<RenderPrimitive> m_commands;
|
||||
std::deque<RenderPrimitive>::iterator m_current;
|
||||
/* 0070 */ std::deque<RenderPrimitive> m_commands;
|
||||
/* 0084 */ std::deque<RenderPrimitive>::iterator m_current;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
|
|
|
|||
|
|
@ -7,30 +7,30 @@
|
|||
#include <vector>
|
||||
|
||||
struct DepthPrimitive {
|
||||
float depth;
|
||||
RenderCommand* primitive;
|
||||
/* 0000 */ float depth;
|
||||
/* 0004 */ RenderCommand* primitive;
|
||||
};
|
||||
|
||||
struct RenderQueues {
|
||||
std::vector<RenderCommand*> queue_015C;
|
||||
std::vector<RenderCommand*> queue_0168;
|
||||
std::vector<RenderCommand*> queue_0174;
|
||||
std::vector<DepthPrimitive> queue_0180;
|
||||
std::vector<DepthPrimitive> queue_018C;
|
||||
std::vector<DepthPrimitive> queue_0198;
|
||||
std::vector<DepthPrimitive> queue_01A4;
|
||||
std::vector<RenderCommand*> queue_01B0;
|
||||
std::vector<DepthPrimitive> queue_01BC;
|
||||
std::vector<DepthPrimitive> queue_01C8;
|
||||
std::vector<DepthPrimitive> queue_01D4;
|
||||
std::vector<DepthPrimitive> queue_01E0;
|
||||
std::vector<RenderCommand*> queue_01EC;
|
||||
LightmappedQueues lightmapped;
|
||||
std::vector<RenderCommand*> queue_0210;
|
||||
std::vector<DepthPrimitive> queue_021C;
|
||||
std::vector<DepthPrimitive> queue_0228;
|
||||
std::vector<DepthPrimitive> queue_0234;
|
||||
std::vector<LightmappedPrimitive*> queue_0240;
|
||||
/* 015C */ std::vector<RenderCommand*> queue_015C;
|
||||
/* 0168 */ std::vector<RenderCommand*> queue_0168;
|
||||
/* 0174 */ std::vector<RenderCommand*> queue_0174;
|
||||
/* 0180 */ std::vector<DepthPrimitive> queue_0180;
|
||||
/* 018C */ std::vector<DepthPrimitive> queue_018C;
|
||||
/* 0198 */ std::vector<DepthPrimitive> queue_0198;
|
||||
/* 01A4 */ std::vector<DepthPrimitive> queue_01A4;
|
||||
/* 01B0 */ std::vector<RenderCommand*> queue_01B0;
|
||||
/* 01BC */ std::vector<DepthPrimitive> queue_01BC;
|
||||
/* 01C8 */ std::vector<DepthPrimitive> queue_01C8;
|
||||
/* 01D4 */ std::vector<DepthPrimitive> queue_01D4;
|
||||
/* 01E0 */ std::vector<DepthPrimitive> queue_01E0;
|
||||
/* 01EC */ std::vector<RenderCommand*> queue_01EC;
|
||||
/* 01F8 */ LightmappedQueues lightmapped;
|
||||
/* 0210 */ std::vector<RenderCommand*> queue_0210;
|
||||
/* 021C */ std::vector<DepthPrimitive> queue_021C;
|
||||
/* 0228 */ std::vector<DepthPrimitive> queue_0228;
|
||||
/* 0234 */ std::vector<DepthPrimitive> queue_0234;
|
||||
/* 0240 */ std::vector<LightmappedPrimitive*> queue_0240;
|
||||
|
||||
RenderQueues();
|
||||
void Submit(RenderCommand* primitive, std::uint16_t flags, bool depthAlpha, float depthStart, float depthEnd);
|
||||
|
|
@ -41,6 +41,9 @@ struct RenderQueues {
|
|||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(DepthPrimitive) == 8);
|
||||
static_assert(sizeof(RenderQueues) == 240);
|
||||
static_assert(offsetof(DepthPrimitive, primitive) == 0x0004);
|
||||
static_assert(offsetof(RenderQueues, lightmapped) + 0x015C == 0x01F8);
|
||||
static_assert(offsetof(RenderQueues, queue_0240) + 0x015C == 0x0240);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ public:
|
|||
|
||||
private:
|
||||
using Block = std::vector<RenderVertex>;
|
||||
unsigned m_minimum;
|
||||
unsigned m_used;
|
||||
std::forward_list<std::unique_ptr<Block>> m_active;
|
||||
std::forward_list<std::unique_ptr<Block>> m_unused;
|
||||
/* 00B0 */ unsigned m_minimum;
|
||||
/* 00B4 */ unsigned m_used;
|
||||
/* 00B8 */ std::forward_list<std::unique_ptr<Block>> m_active;
|
||||
/* 00BC */ std::forward_list<std::unique_ptr<Block>> m_unused;
|
||||
Block& Activate(unsigned capacity);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,32 @@
|
|||
#ifndef RAGNAROK_SOURCE_RENDER_PROJECTION_RENDERERVIEWPORT_H
|
||||
#define RAGNAROK_SOURCE_RENDER_PROJECTION_RENDERERVIEWPORT_H
|
||||
|
||||
#include <cstddef>
|
||||
#include "Render/Projection/RenderProjection.h"
|
||||
|
||||
struct RendererViewport {
|
||||
float scaleX;
|
||||
float scaleY;
|
||||
float horizontal;
|
||||
float vertical;
|
||||
float aspect;
|
||||
float uiScaleX;
|
||||
float uiScaleY;
|
||||
int clipCenterX;
|
||||
int clipCenterY;
|
||||
int width;
|
||||
int height;
|
||||
int centerX;
|
||||
int centerY;
|
||||
/* 0004 */ float scaleX;
|
||||
/* 0008 */ float scaleY;
|
||||
/* 000C */ float horizontal;
|
||||
/* 0010 */ float vertical;
|
||||
/* 0014 */ float aspect;
|
||||
/* 0018 */ float uiScaleX;
|
||||
/* 001C */ float uiScaleY;
|
||||
/* 0020 */ int clipCenterX;
|
||||
/* 0024 */ int clipCenterY;
|
||||
/* 0028 */ int width;
|
||||
/* 002C */ int height;
|
||||
/* 0030 */ int centerX;
|
||||
/* 0034 */ int centerY;
|
||||
|
||||
void SetSize(int width, int height, const float& projectionScale, float& heightScale, float& tangent, float& cotangent);
|
||||
RenderProjection Projection() const;
|
||||
};
|
||||
|
||||
static_assert(sizeof(RendererViewport) == 52);
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(offsetof(RendererViewport, width) == 0x24);
|
||||
static_assert(offsetof(RendererViewport, centerY) == 0x30);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef RAGNAROK_SOURCE_RENDER_RENDERADAPTER_H
|
||||
#define RAGNAROK_SOURCE_RENDER_RENDERADAPTER_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <windows.h>
|
||||
|
|
@ -10,13 +11,13 @@ class DirectDrawEnumeration;
|
|||
struct DeviceOptionsDX9;
|
||||
|
||||
struct RenderAdapter {
|
||||
int backend;
|
||||
UINT ordinal;
|
||||
std::string description;
|
||||
GUID drawGuid;
|
||||
GUID renderGuid;
|
||||
GUID deviceGuid;
|
||||
std::string 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;
|
||||
};
|
||||
|
|
@ -39,6 +40,12 @@ HRESULT InitializeConfiguredDeviceDX9(
|
|||
|
||||
#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
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public:
|
|||
/* 0040 */ int unknown_0040;
|
||||
/* 0044 */ int unknown_0044;
|
||||
/* 0048 */ unsigned char twoPass;
|
||||
unsigned char unknown_0049[3];
|
||||
/* 0049 */ unsigned char unknown_0049[3];
|
||||
/* 004C */ int unknown_004C;
|
||||
/* 0050 */ RenderCommandPool commands;
|
||||
/* 0070 */ RenderPrimitivePool primitives;
|
||||
|
|
@ -70,6 +70,15 @@ public:
|
|||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(CRenderer) == 0x25C);
|
||||
static_assert(offsetof(CRenderer, unknown_0049) == 0x0049);
|
||||
static_assert(offsetof(CRenderer, commands) == 0x0050);
|
||||
static_assert(offsetof(CRenderer, primitives) == 0x0070);
|
||||
static_assert(offsetof(CRenderer, lightmapped) == 0x0090);
|
||||
static_assert(offsetof(CRenderer, vertices) == 0x00B0);
|
||||
static_assert(offsetof(CRenderer, atlas) == 0x00C0);
|
||||
static_assert(offsetof(CRenderer, fog) == 0x0150);
|
||||
static_assert(offsetof(CRenderer, queues) == 0x015C);
|
||||
static_assert(offsetof(CRenderer, backBuffer) == 0x0250);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
#ifndef RAGNAROK_SOURCE_RENDER_RENDERERBACKBUFFER_H
|
||||
#define RAGNAROK_SOURCE_RENDER_RENDERERBACKBUFFER_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <windows.h>
|
||||
|
||||
class DeviceOwnerDX7;
|
||||
|
||||
struct RendererBackBuffer {
|
||||
void* pixels;
|
||||
int pitch;
|
||||
int bitsPerPixel;
|
||||
/* 0250 */ void* pixels;
|
||||
/* 0254 */ int pitch;
|
||||
/* 0258 */ int bitsPerPixel;
|
||||
|
||||
bool Lock(const DeviceOwnerDX7& owner);
|
||||
HRESULT Unlock(const DeviceOwnerDX7& owner);
|
||||
|
|
@ -16,6 +17,9 @@ struct RendererBackBuffer {
|
|||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(RendererBackBuffer) == 12);
|
||||
static_assert(offsetof(RendererBackBuffer, pixels) + 0x0250 == 0x0250);
|
||||
static_assert(offsetof(RendererBackBuffer, pitch) + 0x0250 == 0x0254);
|
||||
static_assert(offsetof(RendererBackBuffer, bitsPerPixel) + 0x0250 == 0x0258);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ public:
|
|||
static unsigned Marker(const char* text, unsigned bytes, bool enabled);
|
||||
|
||||
private:
|
||||
HDC m_dc;
|
||||
HGDIOBJ m_previous;
|
||||
CDC* m_surface;
|
||||
/* 0000 */ HDC m_dc;
|
||||
/* 0004 */ HGDIOBJ m_previous;
|
||||
/* 0008 */ CDC* m_surface;
|
||||
FontCache* m_fonts;
|
||||
const TextLocale* m_locale;
|
||||
int m_family;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ public:
|
|||
|
||||
protected:
|
||||
friend class CDCBitmap;
|
||||
std::list<CTexture*> m_textures;
|
||||
bool m_alpha;
|
||||
/* 0020 */ std::list<CTexture*> m_textures;
|
||||
/* 0028 */ bool m_alpha;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "Render/Textures/SpritePixels.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
|
@ -12,24 +13,24 @@ class CRenderSystemBase;
|
|||
struct SpriteAtlasPage;
|
||||
|
||||
struct SpriteAtlasRecord {
|
||||
const SpriteRleImage* image;
|
||||
const std::uint32_t* palette;
|
||||
std::uint32_t lastUsed;
|
||||
float u0;
|
||||
float v0;
|
||||
float u1;
|
||||
float v1;
|
||||
std::uint32_t x;
|
||||
std::uint32_t y;
|
||||
SpriteAtlasPage* page;
|
||||
/* 0000 */ const SpriteRleImage* image;
|
||||
/* 0004 */ const std::uint32_t* palette;
|
||||
/* 0008 */ std::uint32_t lastUsed;
|
||||
/* 000C */ float u0;
|
||||
/* 0010 */ float v0;
|
||||
/* 0014 */ float u1;
|
||||
/* 0018 */ float v1;
|
||||
/* 001C */ std::uint32_t x;
|
||||
/* 0020 */ std::uint32_t y;
|
||||
/* 0024 */ SpriteAtlasPage* page;
|
||||
};
|
||||
|
||||
struct SpriteAtlasPage {
|
||||
CTexture* texture;
|
||||
std::uint32_t cellWidth;
|
||||
std::uint32_t cellHeight;
|
||||
std::vector<SpriteAtlasRecord> records;
|
||||
std::uint32_t lastUsed;
|
||||
/* 0000 */ CTexture* texture;
|
||||
/* 0004 */ std::uint32_t cellWidth;
|
||||
/* 0008 */ std::uint32_t cellHeight;
|
||||
/* 000C */ std::vector<SpriteAtlasRecord> records;
|
||||
/* 0018 */ std::uint32_t lastUsed;
|
||||
};
|
||||
|
||||
class SpriteAtlas {
|
||||
|
|
@ -45,12 +46,12 @@ public:
|
|||
|
||||
private:
|
||||
struct Node {
|
||||
Node* next;
|
||||
SpriteAtlasPage page;
|
||||
/* 0000 */ Node* next;
|
||||
/* 0004 */ SpriteAtlasPage page;
|
||||
};
|
||||
struct Key {
|
||||
const SpriteRleImage* image;
|
||||
const std::uint32_t* palette;
|
||||
/* 0000 */ const SpriteRleImage* image;
|
||||
/* 0004 */ const std::uint32_t* palette;
|
||||
bool operator==(const Key&) const = default;
|
||||
};
|
||||
struct Hash {
|
||||
|
|
@ -58,14 +59,27 @@ private:
|
|||
};
|
||||
SpriteAtlasPage* Allocate(CRenderSystemBase& system, unsigned category, unsigned width, unsigned height);
|
||||
void ClearSpare();
|
||||
Node* m_classes[25];
|
||||
std::unordered_map<Key, SpriteAtlasRecord*, Hash> m_lookup;
|
||||
std::vector<CTexture*> m_spare;
|
||||
/* 0000 */ Node* m_classes[25];
|
||||
/* 0064 */ std::unordered_map<Key, SpriteAtlasRecord*, Hash> m_lookup;
|
||||
/* 0084 */ std::vector<CTexture*> m_spare;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(SpriteAtlasRecord) == 40);
|
||||
static_assert(offsetof(SpriteAtlasRecord, palette) == 0x04);
|
||||
static_assert(offsetof(SpriteAtlasRecord, lastUsed) == 0x08);
|
||||
static_assert(offsetof(SpriteAtlasRecord, u0) == 0x0C);
|
||||
static_assert(offsetof(SpriteAtlasRecord, v0) == 0x10);
|
||||
static_assert(offsetof(SpriteAtlasRecord, u1) == 0x14);
|
||||
static_assert(offsetof(SpriteAtlasRecord, v1) == 0x18);
|
||||
static_assert(offsetof(SpriteAtlasRecord, x) == 0x1C);
|
||||
static_assert(offsetof(SpriteAtlasRecord, y) == 0x20);
|
||||
static_assert(offsetof(SpriteAtlasRecord, page) == 0x24);
|
||||
static_assert(sizeof(SpriteAtlasPage) == 28);
|
||||
static_assert(offsetof(SpriteAtlasPage, cellWidth) == 0x04);
|
||||
static_assert(offsetof(SpriteAtlasPage, cellHeight) == 0x08);
|
||||
static_assert(offsetof(SpriteAtlasPage, records) == 0x0C);
|
||||
static_assert(offsetof(SpriteAtlasPage, lastUsed) == 0x18);
|
||||
static_assert(sizeof(SpriteAtlas) == 144);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
#ifndef RAGNAROK_SOURCE_RENDER_TEXTURES_SURFACE_H
|
||||
#define RAGNAROK_SOURCE_RENDER_TEXTURES_SURFACE_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <windows.h>
|
||||
|
||||
struct SurfaceLock {
|
||||
bool success;
|
||||
void* pixels;
|
||||
int pitch;
|
||||
std::uint32_t width;
|
||||
std::uint32_t height;
|
||||
int bitsPerPixel;
|
||||
/* 0000 */ bool success;
|
||||
/* 0004 */ void* pixels;
|
||||
/* 0008 */ int pitch;
|
||||
/* 000C */ std::uint32_t width;
|
||||
/* 0010 */ std::uint32_t height;
|
||||
/* 0014 */ int bitsPerPixel;
|
||||
};
|
||||
|
||||
class CSurface {
|
||||
|
|
@ -32,6 +33,11 @@ public:
|
|||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(CSurface) == 4);
|
||||
static_assert(sizeof(SurfaceLock) == 24);
|
||||
static_assert(offsetof(SurfaceLock, pixels) == 0x04);
|
||||
static_assert(offsetof(SurfaceLock, pitch) == 0x08);
|
||||
static_assert(offsetof(SurfaceLock, width) == 0x0C);
|
||||
static_assert(offsetof(SurfaceLock, height) == 0x10);
|
||||
static_assert(offsetof(SurfaceLock, bitsPerPixel) == 0x14);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue