2020-10-13 09:20:52 +02:00
|
|
|
#ifndef DD_H
|
|
|
|
#define DD_H
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
2021-06-14 09:57:26 +02:00
|
|
|
#include "ddraw.h"
|
2020-10-13 09:20:52 +02:00
|
|
|
|
2023-08-04 07:18:29 +02:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define __try
|
|
|
|
#define __except(x) if (0)
|
|
|
|
#endif
|
2020-10-13 09:20:52 +02:00
|
|
|
|
2021-05-08 23:42:29 +02:00
|
|
|
typedef HRESULT(WINAPI* DIRECTDRAWCREATEPROC)(GUID FAR*, LPDIRECTDRAW FAR*, IUnknown FAR*);
|
|
|
|
|
2020-10-13 09:20:52 +02:00
|
|
|
ULONG dd_AddRef();
|
|
|
|
ULONG dd_Release();
|
2021-06-14 09:57:26 +02:00
|
|
|
HRESULT dd_EnumDisplayModes(DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback);
|
2021-06-11 20:30:43 +02:00
|
|
|
HRESULT dd_WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent);
|
2021-07-03 18:07:38 +02:00
|
|
|
HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFlags);
|
2020-10-13 09:20:52 +02:00
|
|
|
HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags);
|
|
|
|
HRESULT dd_RestoreDisplayMode();
|
2021-06-14 09:18:14 +02:00
|
|
|
HRESULT dd_GetCaps(LPDDCAPS_DX1 lpDDDriverCaps, LPDDCAPS_DX1 lpDDEmulCaps);
|
2021-06-14 09:57:26 +02:00
|
|
|
HRESULT dd_GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc);
|
2020-10-13 22:55:49 +02:00
|
|
|
HRESULT dd_GetMonitorFrequency(LPDWORD lpdwFreq);
|
2021-06-14 09:57:26 +02:00
|
|
|
HRESULT dd_GetAvailableVidMem(LPDDSCAPS lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree);
|
2020-10-13 09:20:52 +02:00
|
|
|
HRESULT dd_GetVerticalBlankStatus(LPBOOL lpbIsInVB);
|
2021-09-02 22:22:48 +02:00
|
|
|
HRESULT dd_GetDeviceIdentifier(LPDDDEVICEIDENTIFIER pDDDI, DWORD dwFlags, REFIID riid);
|
2020-10-15 05:13:37 +02:00
|
|
|
HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOuter);
|
2020-10-13 09:20:52 +02:00
|
|
|
|
2021-08-10 14:12:06 +02:00
|
|
|
#define FIX_CHILDS_DISABLED 0
|
|
|
|
#define FIX_CHILDS_DETECT 1
|
|
|
|
#define FIX_CHILDS_DETECT_PAINT 2
|
2021-08-10 16:45:40 +02:00
|
|
|
#define FIX_CHILDS_DETECT_HIDE 3
|
2021-08-10 14:12:06 +02:00
|
|
|
|
2021-06-10 03:48:26 +02:00
|
|
|
#define RESLIST_NORMAL 0
|
|
|
|
#define RESLIST_MINI 1
|
|
|
|
#define RESLIST_FULL 2
|
|
|
|
|
2023-07-04 20:13:49 +02:00
|
|
|
#define FILTER_NEAREST 0
|
|
|
|
#define FILTER_LINEAR 1
|
|
|
|
#define FILTER_CUBIC 2
|
|
|
|
|
2021-07-03 18:07:38 +02:00
|
|
|
#define SDM_MODE_SET_BY_GAME 0x00000001l
|
|
|
|
#define SDM_LEAVE_WINDOWED 0x00000002l
|
|
|
|
#define SDM_LEAVE_FULLSCREEN 0x00000004l
|
|
|
|
|
2021-06-11 20:30:43 +02:00
|
|
|
typedef struct SPEEDLIMITER
|
2020-10-13 09:20:52 +02:00
|
|
|
{
|
|
|
|
DWORD tick_length;
|
|
|
|
LONGLONG tick_length_ns;
|
|
|
|
HANDLE htimer;
|
|
|
|
LARGE_INTEGER due_time;
|
|
|
|
BOOL use_blt_or_flip;
|
2021-06-11 20:30:43 +02:00
|
|
|
} SPEEDLIMITER;
|
2020-10-13 09:20:52 +02:00
|
|
|
|
|
|
|
struct IDirectDrawSurfaceImpl;
|
|
|
|
|
2021-06-11 20:30:43 +02:00
|
|
|
extern struct CNCDDRAW* g_ddraw;
|
2020-10-13 09:20:52 +02:00
|
|
|
|
2021-06-11 20:30:43 +02:00
|
|
|
typedef struct CNCDDRAW
|
2020-10-13 09:20:52 +02:00
|
|
|
{
|
|
|
|
ULONG ref;
|
|
|
|
|
|
|
|
DWORD width;
|
|
|
|
DWORD height;
|
|
|
|
DWORD bpp;
|
|
|
|
BOOL windowed;
|
|
|
|
BOOL border;
|
|
|
|
BOOL boxing;
|
|
|
|
DEVMODE mode;
|
2021-06-11 20:30:43 +02:00
|
|
|
struct IDirectDrawSurfaceImpl* primary;
|
2020-10-13 09:20:52 +02:00
|
|
|
char title[128];
|
2021-12-17 03:16:08 +01:00
|
|
|
char screenshot_dir[MAX_PATH];
|
2021-05-08 23:42:29 +02:00
|
|
|
CRITICAL_SECTION cs;
|
2020-10-13 09:20:52 +02:00
|
|
|
|
|
|
|
/* real export from system32\ddraw.dll */
|
2021-05-08 23:42:29 +02:00
|
|
|
HMODULE real_dll;
|
|
|
|
DIRECTDRAWCREATEPROC DirectDrawCreate;
|
2021-05-29 20:52:57 +02:00
|
|
|
LPDIRECTDRAW real_dd;
|
2020-10-13 09:20:52 +02:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int maxfps;
|
2020-10-18 02:40:45 +02:00
|
|
|
int minfps;
|
|
|
|
DWORD minfps_tick_len;
|
2020-10-13 09:20:52 +02:00
|
|
|
int width;
|
|
|
|
int height;
|
2023-07-07 01:24:16 +02:00
|
|
|
int opengl_y_align;
|
2020-10-13 09:20:52 +02:00
|
|
|
|
|
|
|
HDC hdc;
|
2021-06-11 20:30:43 +02:00
|
|
|
int* tex;
|
2020-10-13 09:20:52 +02:00
|
|
|
|
|
|
|
HANDLE thread;
|
|
|
|
BOOL run;
|
|
|
|
HANDLE sem;
|
|
|
|
DEVMODE mode;
|
|
|
|
struct { int width; int height; int x; int y; } viewport;
|
|
|
|
|
|
|
|
LONG palette_updated;
|
|
|
|
LONG surface_updated;
|
2021-08-05 00:26:29 +02:00
|
|
|
LONG clear_screen;
|
2020-10-13 09:20:52 +02:00
|
|
|
|
|
|
|
float scale_w;
|
|
|
|
float scale_h;
|
|
|
|
float unscale_w;
|
|
|
|
float unscale_h;
|
|
|
|
} render;
|
|
|
|
|
2021-09-19 03:04:45 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int y_adjust;
|
|
|
|
int x_adjust;
|
|
|
|
RECT rc;
|
|
|
|
} mouse;
|
|
|
|
|
2021-09-29 12:55:20 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int toggle_fullscreen;
|
|
|
|
int toggle_maximize;
|
|
|
|
int unlock_cursor1;
|
|
|
|
int unlock_cursor2;
|
|
|
|
int screenshot;
|
|
|
|
} hotkeys;
|
|
|
|
|
2020-10-13 09:20:52 +02:00
|
|
|
HWND hwnd;
|
2021-03-02 22:50:06 +01:00
|
|
|
WNDPROC wndproc;
|
2021-05-10 04:00:45 +02:00
|
|
|
struct { DWORD x; DWORD y; } cursor;
|
2020-10-13 09:20:52 +02:00
|
|
|
BOOL adjmouse;
|
|
|
|
BOOL devmode;
|
|
|
|
BOOL vsync;
|
|
|
|
BOOL vhack;
|
2021-05-15 00:41:50 +02:00
|
|
|
int upscale_hack_width;
|
|
|
|
int upscale_hack_height;
|
2020-10-13 10:53:30 +02:00
|
|
|
BOOL isredalert;
|
|
|
|
BOOL iscnc1;
|
2021-05-15 00:41:50 +02:00
|
|
|
BOOL iskkndx;
|
2021-05-15 02:58:07 +02:00
|
|
|
LONG upscale_hack_active;
|
2021-06-11 20:30:43 +02:00
|
|
|
DWORD(WINAPI* renderer)(void);
|
2020-10-13 09:20:52 +02:00
|
|
|
BOOL fullscreen;
|
|
|
|
BOOL maintas;
|
|
|
|
BOOL noactivateapp;
|
|
|
|
char shader[MAX_PATH];
|
|
|
|
BOOL wine;
|
2021-06-12 05:45:28 +02:00
|
|
|
HCURSOR old_cursor;
|
2021-06-17 04:12:05 +02:00
|
|
|
int show_cursor_count;
|
2022-09-05 09:08:59 +02:00
|
|
|
BOOL allow_wmactivate;
|
2022-09-24 01:41:18 +02:00
|
|
|
BOOL opengl_core;
|
2020-10-13 09:20:52 +02:00
|
|
|
BOOL resizable;
|
2023-07-03 05:13:47 +02:00
|
|
|
BOOL toggle_borderless;
|
2020-10-13 09:20:52 +02:00
|
|
|
BOOL nonexclusive;
|
2021-08-10 14:12:06 +02:00
|
|
|
int fixchilds;
|
2023-01-17 04:46:24 +01:00
|
|
|
BOOL fixnotresponding;
|
2022-09-13 07:41:01 +02:00
|
|
|
BOOL flipclear;
|
2022-09-17 13:46:45 +02:00
|
|
|
BOOL lock_surfaces;
|
2023-07-04 20:13:49 +02:00
|
|
|
int d3d9_filter;
|
2022-09-20 11:21:32 +02:00
|
|
|
BOOL d3d9on12;
|
2022-09-29 21:52:07 +02:00
|
|
|
int guard_lines;
|
2021-06-10 03:48:26 +02:00
|
|
|
int resolutions;
|
2022-10-11 23:13:04 +02:00
|
|
|
int max_resolutions;
|
2022-10-31 02:54:40 +01:00
|
|
|
BOOL limit_bltfast;
|
2021-06-09 07:24:17 +02:00
|
|
|
BOOL armadahack;
|
2021-06-18 12:18:35 +02:00
|
|
|
BOOL tshack;
|
2022-02-05 04:03:00 +01:00
|
|
|
BOOL infantryhack;
|
2021-02-19 03:24:11 +01:00
|
|
|
int maxgameticks;
|
2021-03-20 06:15:53 +01:00
|
|
|
BOOL alt_key_down;
|
2021-09-16 01:57:44 +02:00
|
|
|
BOOL releasealt;
|
2020-10-13 09:20:52 +02:00
|
|
|
BOOL bnet_active;
|
|
|
|
BOOL bnet_was_fullscreen;
|
|
|
|
BOOL bnet_was_upscaled;
|
|
|
|
RECT bnet_win_rect;
|
|
|
|
POINT bnet_pos;
|
2021-06-11 20:30:43 +02:00
|
|
|
void* last_freed_palette; /* Dungeon Keeper hack */
|
2020-10-13 09:20:52 +02:00
|
|
|
BOOL child_window_exists;
|
2021-06-16 05:57:19 +02:00
|
|
|
BOOL got_child_windows;
|
2021-06-11 20:30:43 +02:00
|
|
|
DWORD last_set_window_pos_tick; /* WINE hack */
|
2020-10-13 09:20:52 +02:00
|
|
|
BOOL show_driver_warning;
|
2021-06-11 20:30:43 +02:00
|
|
|
SPEEDLIMITER ticks_limiter;
|
|
|
|
SPEEDLIMITER flip_limiter;
|
2022-10-20 03:13:09 +02:00
|
|
|
DWORD gui_thread_id;
|
2023-02-16 16:24:43 -08:00
|
|
|
BOOL rgb555;
|
2023-02-27 18:25:28 +01:00
|
|
|
BOOL hook_peekmessage;
|
2021-06-11 20:30:43 +02:00
|
|
|
|
|
|
|
} CNCDDRAW;
|
2020-10-13 09:20:52 +02:00
|
|
|
|
|
|
|
#endif
|