source: trunk/src/ddraw/new/OS2DDRAW.H@ 5280

Last change on this file since 5280 was 3345, checked in by mike, 25 years ago

Experimental fullscreen DDraw

File size: 10.6 KB
Line 
1/* $Id: OS2DDRAW.H,v 1.1 2000-04-07 18:21:04 mike Exp $ */
2
3/*
4 * DX Draw base class definition
5 *
6 * Copyright 1998 Sander va Leeuwen
7 * Copyright 1999 Markus Montkowski
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12
13#ifndef __OS2DDRAW_HPP__
14 #define __OS2DDRAW_HPP__
15
16#include <ddraw.h>
17#include <d3d.h>
18#undef APIENTRY
19#define APIENTRY _System
20#include "divewrap.h"
21//#define DEBUG 1
22#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
23 ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
24 ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
25#include <fourcc.h>
26#undef THIS
27#define THIS VOID*
28class OS2IDirectDraw
29{
30 public:
31 //this one has to go first!
32 IDirectDraw4Vtbl *lpVtbl;
33 IDirectDraw4Vtbl *lpVtbl2; // 2nd Vtable pointer An other MS assumtion see below
34 DWORD *pdwUnknownData; // MS DDCAPS (DX6 SDK bin\tools )program makes an assumtion that after the
35 // VTable comes a pointer to some data
36 // to avoid crashes we do it a favor and alloc a buffer
37 // with 255 DWORDS
38 // Known data in the buffer Height(offset 235),
39 // Height (236), Bits (241)
40 // ToDO :
41 // debug into DirectDrawCreate and se what MS is doing !
42 IDirectDraw2Vtbl Vtbl;
43 // MS did it again with direct/X 6 they changed the behavior of the directdraw component
44 // So we now need 2 Virt. Tables one for the old and one for the new so we return the
45 // right interface if one creates a DX6 directdraw object but wants a DX2,3,5 interface
46 IDirectDraw4Vtbl Vtbl4;
47 IDirect3DVtbl Vtbl3D;
48
49 OS2IDirectDraw(GUID *lpGUID);
50 ~OS2IDirectDraw();
51 // Simple management for Surfaces should be good enougth for now
52 inline BOOL HasPrimarySurface() { return PrimaryExists;}
53 void SetPrimarySurface(BOOL NewStatus){PrimaryExists = NewStatus;}
54 int Referenced;
55 inline HRESULT GetLastError() { return lastError; }
56 inline HDIVE GetDiveInstance() { return hDive; }
57 inline HDIVE GetCCDiveInstance() { return hDiveColorConv;}
58 inline char * GetFrameBuffer() { return pFrameBuffer; }
59 inline int GetScreenWidth() { return screenwidth; }
60 inline int GetScreenHeight() { return screenheight; }
61 inline int GetScreenBpp() { return screenbpp;}
62 FOURCC GetScreenFourCC();
63 // We should be able to use any mode with less or same bits and same or
64 // smaller size to be able to report all supported mode in the enum
65 // functions we need the physical screen size. Other information is later
66 // also needed so get all the info we can get
67 DIVE_CAPS dCaps;
68 VOID *pPrimSurf;
69
70 private:
71 VOID SwitchDisplay(HWND hwnd);
72
73
74 protected:
75
76 HRESULT lastError;
77 HDIVE hDive; // Handle to Screen DIVE instance
78 HDIVE hDiveColorConv; // Handle to Offscreen DIVE instance for Color conversion
79 char *pFrameBuffer;
80 HWND hwndClient;
81 DWORD dwCoopMode;
82 int screenwidth, screenheight, screenbpp;
83 int oldwidth, oldheight, oldbpp, oldscanlines;
84 BOOL PrimaryExists;
85 BOOL bPMILoaded;
86 BOOL bInFullScreen;
87 BOOL bScale;
88
89 // Linked list management
90 OS2IDirectDraw* next; // Next OS2IDirectDraw
91 static OS2IDirectDraw* ddraw; // List of OS2IDirectDraw
92
93 friend HRESULT __stdcall DrawQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
94 friend ULONG __stdcall DrawAddRef(THIS);
95 friend ULONG __stdcall DrawRelease(THIS);
96 friend HRESULT __stdcall DrawCompact(THIS);
97 friend HRESULT __stdcall DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown * );
98 friend HRESULT __stdcall DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown * );
99 friend HRESULT __stdcall DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE *, IUnknown *);
100 friend HRESULT __stdcall DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4 *, IUnknown *);
101 friend HRESULT __stdcall DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE * );
102 friend HRESULT __stdcall DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 * );
103 friend HRESULT __stdcall DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
104 friend HRESULT __stdcall DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
105 friend HRESULT __stdcall DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
106 friend HRESULT __stdcall DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
107 friend HRESULT __stdcall DrawFlipToGDISurface(THIS);
108 friend HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
109 friend HRESULT __stdcall DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
110 friend HRESULT __stdcall DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
111 friend HRESULT __stdcall DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE *);
112 friend HRESULT __stdcall DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4 *);
113 friend HRESULT __stdcall DrawGetMonitorFrequency(THIS, LPDWORD);
114 friend HRESULT __stdcall DrawGetScanLine(THIS, LPDWORD);
115 friend HRESULT __stdcall DrawGetVerticalBlankStatus(THIS, LPBOOL);
116 friend HRESULT __stdcall DrawInitialize(THIS, GUID *);
117 friend HRESULT __stdcall DrawRestoreDisplayMode(THIS);
118 friend HRESULT __stdcall DrawSetCooperativeLevel(THIS, HWND, DWORD);
119 friend HRESULT __stdcall DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
120 friend HRESULT __stdcall DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
121 friend HRESULT __stdcall DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
122 // V2 Interface
123 friend HRESULT __stdcall DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
124 friend HRESULT __stdcall DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
125 // V4 Interface
126 friend HRESULT __stdcall GetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
127 friend HRESULT __stdcall RestoreAllSurfaces(THIS) ;
128 friend HRESULT __stdcall TestCooperativeLevel(THIS) ;
129 friend HRESULT __stdcall GetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
130 /*** IDirect3D methods ***/
131 friend HRESULT __stdcall D3DQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
132 friend ULONG __stdcall D3DAddRef(THIS);
133 friend ULONG __stdcall D3DRelease(THIS);
134 friend HRESULT __stdcall D3DInitialize(THIS, REFIID);
135 friend HRESULT __stdcall D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
136 friend HRESULT __stdcall D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
137 friend HRESULT __stdcall D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
138 friend HRESULT __stdcall D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
139 friend HRESULT __stdcall D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
140
141};
142
143//******************************************************************************
144HRESULT __stdcall DrawQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
145ULONG __stdcall DrawAddRef(THIS);
146ULONG __stdcall DrawRelease(THIS);
147HRESULT __stdcall DrawCompact(THIS);
148HRESULT __stdcall DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown * );
149HRESULT __stdcall DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown * );
150HRESULT __stdcall DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE *, IUnknown *);
151HRESULT __stdcall DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE * );
152HRESULT __stdcall DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
153HRESULT __stdcall DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
154HRESULT __stdcall DrawFlipToGDISurface(THIS);
155HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
156HRESULT __stdcall DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
157HRESULT __stdcall DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
158HRESULT __stdcall DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE *);
159HRESULT __stdcall DrawGetMonitorFrequency(THIS, LPDWORD);
160HRESULT __stdcall DrawGetScanLine(THIS, LPDWORD);
161HRESULT __stdcall DrawGetVerticalBlankStatus(THIS, LPBOOL);
162HRESULT __stdcall DrawInitialize(THIS, GUID *);
163HRESULT __stdcall DrawRestoreDisplayMode(THIS);
164HRESULT __stdcall DrawSetCooperativeLevel(THIS, HWND, DWORD);
165HRESULT __stdcall DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
166HRESULT __stdcall DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
167HRESULT __stdcall DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
168// V2
169HRESULT __stdcall DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
170// V4
171HRESULT __stdcall DrawGetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
172HRESULT __stdcall DrawRestoreAllSurfaces(THIS) ;
173HRESULT __stdcall DrawTestCooperativeLevel(THIS) ;
174HRESULT __stdcall DrawGetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
175// functions which ifaces are changed in DirectX6 after all MS uses COM where an programmer
176// isn't allowd to change a function iface after he published the iface (See MS COM docs!)
177HRESULT __stdcall DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4 *, IUnknown *);
178HRESULT __stdcall DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 * );
179HRESULT __stdcall DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
180HRESULT __stdcall DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
181HRESULT __stdcall DrawGetDisplayMode4(THIS, LPDDSURFACEDESC2);
182HRESULT __stdcall DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4 *);
183HRESULT __stdcall DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
184
185/*** IDirect3D methods ***/
186HRESULT __stdcall D3DQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
187ULONG __stdcall D3DAddRef(THIS);
188ULONG __stdcall D3DRelease(THIS);
189HRESULT __stdcall D3DInitialize(THIS, REFIID);
190HRESULT __stdcall D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
191HRESULT __stdcall D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
192HRESULT __stdcall D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
193HRESULT __stdcall D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
194HRESULT __stdcall D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
195
196#endif
Note: See TracBrowser for help on using the repository browser.