Skip to content

Commit

Permalink
Move some structs to headers
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Jan 24, 2025
1 parent 08e41ae commit 16527b8
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 87 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 7458
#define BUILD_NUMBER 7459
8 changes: 8 additions & 0 deletions ddraw/IDirect3DTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ typedef struct {
FLOAT tu, tv;
} D3DLVERTEX9, *LPD3DLVERTEX9;

// Custom vertex
const DWORD TLVERTEXFVF = (D3DFVF_XYZRHW | D3DFVF_TEX1);
struct TLVERTEX
{
float x, y, z, rhw;
float u, v;
};

typedef enum _D3DSURFACETYPE {
D3DTYPE_NONE = 0,
D3DTYPE_OFFPLAINSURFACE = 1,
Expand Down
80 changes: 80 additions & 0 deletions ddraw/IDirectDrawTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <ddraw.h>

class m_IDirectDrawX;

constexpr DWORD MaxVidMemory = 512 * 1024 * 1024; // 512 MBs
constexpr DWORD MinUsedVidMemory = 8 * 1024; // 8 KBs

Expand Down Expand Up @@ -98,6 +100,84 @@ typedef struct {
BYTE bdata[];
} DDS_BUFFER;

// Mouse hook
struct MOUSEHOOK
{
HANDLE ghWriteEvent = nullptr;
HANDLE threadID = nullptr;
HHOOK m_hook = nullptr;
bool bChange = false;
POINT Pos = {};
};

struct DRAWSTATEBACKUP
{
DWORD ssMagFilter = 0;
DWORD ss1addressU = 0;
DWORD ss1addressV = 0;
DWORD tsColorOP = 0;
DWORD tsColorArg1 = 0;
DWORD tsColorArg2 = 0;
DWORD tsAlphaOP = 0;
DWORD rsLighting = 0;
DWORD rsAlphaBlendEnable = 0;
DWORD rsAlphaTestEnable = 0;
DWORD rsFogEnable = 0;
DWORD rsZEnable = 0;
DWORD rsZWriteEnable = 0;
DWORD rsStencilEnable = 0;
DWORD rsCullMode = 0;
DWORD rsClipping = 0;
D3DVIEWPORT9 ViewPort = {};
D3DMATRIX WorldMatrix = {};
D3DMATRIX ViewMatrix = {};
D3DMATRIX ProjectionMatrix = {};
};

struct DISPLAYSETTINGS
{
HWND hWnd;
HDC DC;
m_IDirectDrawX* SetBy;
DWORD Width;
DWORD Height;
DWORD BPP;
DWORD RefreshRate;
};

struct DEVICESETTINGS
{
bool IsWindowed;
bool AntiAliasing;
bool AllowModeX;
bool MultiThreaded;
bool FPUPreserve;
bool NoWindowChanges;
DWORD Width;
DWORD Height;
DWORD RefreshRate;
};

struct HIGHRESCOUNTER
{
LARGE_INTEGER Frequency = {};
LARGE_INTEGER LastPresentTime = {};
LONGLONG LastFrameTime = 0;
DWORD FrameCounter = 0;
DWORD FrameSkipCounter = 0;
double PerFrameMS = 1000.0 / 60.0;
};

struct PRESENTTHREAD
{
bool IsInitialized = false;
CRITICAL_SECTION ddpt = {};
HANDLE workerEvent = {};
HANDLE workerThread = {};
LARGE_INTEGER LastPresentTime = {};
bool EnableThreadFlag = false;
};

// Used for 24-bit surfaces
struct TRIBYTE
{
Expand Down
86 changes: 0 additions & 86 deletions ddraw/IDirectDrawX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,92 +41,6 @@ DWORD ScaleDDCurrentHeight = 0;
DWORD ScaleDDPadX = 0;
DWORD ScaleDDPadY = 0;

struct DRAWSTATEBACKUP
{
DWORD ssMagFilter = 0;
DWORD ss1addressU = 0;
DWORD ss1addressV = 0;
DWORD tsColorOP = 0;
DWORD tsColorArg1 = 0;
DWORD tsColorArg2 = 0;
DWORD tsAlphaOP = 0;
DWORD rsLighting = 0;
DWORD rsAlphaBlendEnable = 0;
DWORD rsAlphaTestEnable = 0;
DWORD rsFogEnable = 0;
DWORD rsZEnable = 0;
DWORD rsZWriteEnable = 0;
DWORD rsStencilEnable = 0;
DWORD rsCullMode = 0;
DWORD rsClipping = 0;
D3DVIEWPORT9 ViewPort = {};
D3DMATRIX WorldMatrix = {};
D3DMATRIX ViewMatrix = {};
D3DMATRIX ProjectionMatrix = {};
};

// Mouse hook
struct MOUSEHOOK
{
HANDLE ghWriteEvent = nullptr;
HANDLE threadID = nullptr;
HHOOK m_hook = nullptr;
bool bChange = false;
POINT Pos = {};
};

// Custom vertex
const DWORD TLVERTEXFVF = (D3DFVF_XYZRHW | D3DFVF_TEX1);
struct TLVERTEX
{
float x, y, z, rhw;
float u, v;
};

struct DISPLAYSETTINGS
{
HWND hWnd;
HDC DC;
m_IDirectDrawX* SetBy;
DWORD Width;
DWORD Height;
DWORD BPP;
DWORD RefreshRate;
};

struct DEVICESETTINGS
{
bool IsWindowed;
bool AntiAliasing;
bool AllowModeX;
bool MultiThreaded;
bool FPUPreserve;
bool NoWindowChanges;
DWORD Width;
DWORD Height;
DWORD RefreshRate;
};

struct HIGHRESCOUNTER
{
LARGE_INTEGER Frequency = {};
LARGE_INTEGER LastPresentTime = {};
LONGLONG LastFrameTime = 0;
DWORD FrameCounter = 0;
DWORD FrameSkipCounter = 0;
double PerFrameMS = 1000.0 / 60.0;
};

struct PRESENTTHREAD
{
bool IsInitialized = false;
CRITICAL_SECTION ddpt = {};
HANDLE workerEvent = {};
HANDLE workerThread = {};
LARGE_INTEGER LastPresentTime = {};
bool EnableThreadFlag = false;
};

// Store a list of ddraw devices
std::vector<m_IDirectDrawX*> DDrawVector;

Expand Down

0 comments on commit 16527b8

Please sign in to comment.