1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-20 16:09:12 +01:00
cnc-ddraw/inc/main.h

135 lines
4.4 KiB
C
Raw Normal View History

2010-10-17 00:41:14 +03:00
/*
* Copyright (c) 2010 Toni Spets <toni.spets@iki.fi>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef MAIN_H
#define MAIN_H
#include <windows.h>
#include "ddraw.h"
2017-11-26 08:49:30 +01:00
#include "debug.h"
#include <GL/gl.h>
#include <GL/glu.h>
2010-10-17 00:41:14 +03:00
2018-03-23 03:21:16 +01:00
#define CUTSCENE_WIDTH 640
#define CUTSCENE_HEIGHT 400
struct IDirectDrawImpl;
struct IDirectDrawImplVtbl;
2010-11-13 10:49:46 +02:00
struct IDirectDrawSurfaceImpl;
2010-10-17 00:41:14 +03:00
extern struct IDirectDrawImpl *ddraw;
typedef struct IDirectDrawImpl
2010-10-17 00:41:14 +03:00
{
struct IDirectDrawImplVtbl *lpVtbl;
2010-10-17 00:41:14 +03:00
ULONG Ref;
DWORD width;
DWORD height;
DWORD bpp;
2010-10-27 20:13:32 +03:00
BOOL windowed;
2011-07-09 15:20:57 +03:00
BOOL border;
BOOL boxing;
2010-11-13 10:49:46 +02:00
BOOL windowed_init;
2010-11-12 19:50:00 +02:00
DEVMODE mode;
2010-11-13 10:49:46 +02:00
struct IDirectDrawSurfaceImpl *primary;
char title[128];
HMODULE real_dll;
2010-11-06 08:28:11 +02:00
/* real export from system32\ddraw.dll */
HRESULT WINAPI (*DirectDrawCreate)(GUID FAR*, LPDIRECTDRAW FAR*, IUnknown FAR*);
CRITICAL_SECTION cs;
2010-11-12 19:50:00 +02:00
struct
2010-11-06 08:28:11 +02:00
{
2010-11-06 21:30:48 +02:00
int maxfps;
int width;
int height;
int bpp;
2010-11-06 21:30:48 +02:00
int filter;
HDC hDC;
int *tex;
2010-11-06 08:28:11 +02:00
HANDLE thread;
BOOL run;
HANDLE ev;
HANDLE sem;
2010-11-12 19:50:00 +02:00
DEVMODE mode;
struct { int width; int height; int x; int y; } viewport;
2010-11-06 08:28:11 +02:00
2010-11-12 19:50:00 +02:00
} render;
2010-10-17 00:41:14 +03:00
HWND hWnd;
LRESULT CALLBACK (*WndProc)(HWND, UINT, WPARAM, LPARAM);
struct { float x; float y; } cursor;
BOOL locked;
2018-03-11 21:23:22 +01:00
BOOL adjmouse;
BOOL devmode;
BOOL vsync;
2011-03-24 19:41:36 +02:00
BOOL vhack;
BOOL isredalert;
2018-03-23 03:21:16 +01:00
BOOL iscnc1;
BOOL incutscene;
2011-04-02 21:18:14 +03:00
DWORD WINAPI (*renderer)(void);
2017-11-12 15:11:22 +01:00
char screenshotKey;
2017-11-16 22:21:13 +01:00
BOOL opengl_pbo;
2017-11-20 05:11:39 +01:00
BOOL fullscreen;
2018-03-14 14:02:04 +01:00
BOOL maintas;
BOOL fakecursorpos;
2018-03-19 02:27:55 +01:00
BOOL noactivateapp;
2017-11-12 14:57:27 +01:00
} IDirectDrawImpl;
typedef struct IDirectDrawImplVtbl IDirectDrawImplVtbl;
struct IDirectDrawImplVtbl
{
HRESULT(__stdcall *QueryInterface) (IDirectDrawImpl *, const IID* const riid, LPVOID * ppvObj);
ULONG(__stdcall *AddRef) (IDirectDrawImpl *);
ULONG(__stdcall *Release) (IDirectDrawImpl *);
HRESULT(__stdcall *Compact)(IDirectDrawImpl *);
HRESULT(__stdcall *CreateClipper)(IDirectDrawImpl *, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown *);
HRESULT(__stdcall *CreatePalette)(IDirectDrawImpl *, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown *);
HRESULT(__stdcall *CreateSurface)(IDirectDrawImpl *, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE *, IUnknown *);
HRESULT(__stdcall *DuplicateSurface)( IDirectDrawImpl *, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE *);
HRESULT(__stdcall *EnumDisplayModes)( IDirectDrawImpl *, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK);
HRESULT(__stdcall *EnumSurfaces)(IDirectDrawImpl *, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK);
HRESULT(__stdcall *FlipToGDISurface)(IDirectDrawImpl *);
HRESULT(__stdcall *GetCaps)(IDirectDrawImpl *, LPDDCAPS, LPDDCAPS);
HRESULT(__stdcall *GetDisplayMode)(IDirectDrawImpl *, LPDDSURFACEDESC);
HRESULT(__stdcall *GetFourCCCodes)(IDirectDrawImpl *, LPDWORD, LPDWORD);
HRESULT(__stdcall *GetGDISurface)(IDirectDrawImpl *, LPDIRECTDRAWSURFACE *);
HRESULT(__stdcall *GetMonitorFrequency)(IDirectDrawImpl *, LPDWORD);
HRESULT(__stdcall *GetScanLine)(IDirectDrawImpl *, LPDWORD);
HRESULT(__stdcall *GetVerticalBlankStatus)(IDirectDrawImpl *, LPBOOL);
HRESULT(__stdcall *Initialize)(IDirectDrawImpl *, GUID *);
HRESULT(__stdcall *RestoreDisplayMode)(IDirectDrawImpl *);
HRESULT(__stdcall *SetCooperativeLevel)(IDirectDrawImpl *, HWND, DWORD);
HRESULT(__stdcall *SetDisplayMode)(IDirectDrawImpl *, DWORD, DWORD,DWORD);
HRESULT(__stdcall *WaitForVerticalBlank)(IDirectDrawImpl *, DWORD, HANDLE);
};
2010-10-17 00:41:14 +03:00
2018-03-10 10:19:54 +01:00
typedef enum PROCESS_DPI_AWARENESS {
PROCESS_DPI_UNAWARE = 0,
PROCESS_SYSTEM_DPI_AWARE = 1,
PROCESS_PER_MONITOR_DPI_AWARE = 2
} PROCESS_DPI_AWARENESS;
2010-10-17 00:41:14 +03:00
#endif