source: trunk/src/ddraw/OS2DDRAW.H@ 211

Last change on this file since 211 was 211, checked in by hugh, 26 years ago

Include for DX6 verion of ddraw

File size: 9.5 KB
Line 
1#ifndef __OS2DDRAW_HPP__
2 #define __OS2DDRAW_HPP__
3
4#include <ddraw.h>
5#include <d3d.h>
6#include <dive.h>
7
8#define DEBUG 1
9#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
10 ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
11 ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
12#include <fourcc.h>
13#define THIS VOID*
14class OS2IDirectDraw
15{
16 public:
17 //this one has to go first!
18 IDirectDraw4Vtbl *lpVtbl;
19 IDirectDraw2Vtbl Vtbl;
20 // MS did it again with direct/X 6 they changed the behavior of the directdraw component
21 // So we now need 2 Virt. Tables one for the old and one for the new so we return the
22 // right interface if one creates a DX6 directdraw object but wants a DX2,3,5 interface
23 IDirectDraw4Vtbl Vtbl4;
24 IDirect3DVtbl Vtbl3D;
25
26 OS2IDirectDraw(GUID *lpGUID);
27 ~OS2IDirectDraw();
28 // Simple management for Surfaces should be good enougth for now
29 inline BOOL HasPrimarySurface() { return PrimaryExists;}
30 void SetPrimarySurface(BOOL NewStatus){PrimaryExists = NewStatus;}
31 int Referenced;
32 inline HRESULT GetLastError() { return lastError; }
33 inline HDIVE GetDiveInstance() { return hDive; }
34 inline HDIVE GetCCDiveInstance() { return hDiveColorConv;}
35 inline char * GetFrameBuffer() { return pFrameBuffer; }
36 inline int GetScreenWidth() { return screenwidth; }
37 inline int GetScreenHeight() { return screenheight; }
38 inline int GetScreenBpp() { return screenbpp;}
39 FOURCC GetScreenFourCC();
40 // We should be able to use any mode with less or same bits and same or
41 // smaller size to be able to report all supported mode in the enum
42 // functions we need the physical screen size. Other information is later
43 // also needed so get all the info we can get
44 DIVE_CAPS dCaps;
45
46 private:
47 VOID SwitchDisplay(HWND hwnd);
48
49
50 protected:
51
52 HRESULT lastError;
53 HDIVE hDive; // Handle to Screen DIVE instance
54 HDIVE hDiveColorConv; // Handle to Offscreen DIVE instance for Color conversion
55 char *pFrameBuffer;
56 HWND hwndClient;
57 int screenwidth, screenheight, screenbpp;
58 BOOL PrimaryExists;
59 BOOL bScale;
60
61 // Linked list management
62 OS2IDirectDraw* next; // Next OS2IDirectDraw
63 static OS2IDirectDraw* ddraw; // List of OS2IDirectDraw
64
65 friend HRESULT __stdcall DrawQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
66 friend ULONG __stdcall DrawAddRef(THIS);
67 friend ULONG __stdcall DrawRelease(THIS);
68 friend HRESULT __stdcall DrawCompact(THIS);
69 friend HRESULT __stdcall DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown * );
70 friend HRESULT __stdcall DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown * );
71 friend HRESULT __stdcall DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE *, IUnknown *);
72 friend HRESULT __stdcall DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4 *, IUnknown *);
73 friend HRESULT __stdcall DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE * );
74 friend HRESULT __stdcall DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 * );
75 friend HRESULT __stdcall DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
76 friend HRESULT __stdcall DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
77 friend HRESULT __stdcall DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
78 friend HRESULT __stdcall DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
79 friend HRESULT __stdcall DrawFlipToGDISurface(THIS);
80 friend HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
81 friend HRESULT __stdcall DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
82 friend HRESULT __stdcall DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
83 friend HRESULT __stdcall DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE *);
84 friend HRESULT __stdcall DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4 *);
85 friend HRESULT __stdcall DrawGetMonitorFrequency(THIS, LPDWORD);
86 friend HRESULT __stdcall DrawGetScanLine(THIS, LPDWORD);
87 friend HRESULT __stdcall DrawGetVerticalBlankStatus(THIS, LPBOOL);
88 friend HRESULT __stdcall DrawInitialize(THIS, GUID *);
89 friend HRESULT __stdcall DrawRestoreDisplayMode(THIS);
90 friend HRESULT __stdcall DrawSetCooperativeLevel(THIS, HWND, DWORD);
91 friend HRESULT __stdcall DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
92 friend HRESULT __stdcall DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
93 friend HRESULT __stdcall DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
94 // V2 Interface
95 friend HRESULT __stdcall DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
96 friend HRESULT __stdcall DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
97 // V4 Interface
98 friend HRESULT __stdcall GetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
99 friend HRESULT __stdcall RestoreAllSurfaces(THIS) ;
100 friend HRESULT __stdcall TestCooperativeLevel(THIS) ;
101 friend HRESULT __stdcall GetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
102 /*** IDirect3D methods ***/
103 friend HRESULT __stdcall D3DQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
104 friend ULONG __stdcall D3DAddRef(THIS);
105 friend ULONG __stdcall D3DRelease(THIS);
106 friend HRESULT __stdcall D3DInitialize(THIS, REFIID);
107 friend HRESULT __stdcall D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
108 friend HRESULT __stdcall D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
109 friend HRESULT __stdcall D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
110 friend HRESULT __stdcall D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
111 friend HRESULT __stdcall D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
112
113};
114
115//******************************************************************************
116HRESULT __stdcall DrawQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
117ULONG __stdcall DrawAddRef(THIS);
118ULONG __stdcall DrawRelease(THIS);
119HRESULT __stdcall DrawCompact(THIS);
120HRESULT __stdcall DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown * );
121HRESULT __stdcall DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown * );
122HRESULT __stdcall DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE *, IUnknown *);
123HRESULT __stdcall DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE * );
124HRESULT __stdcall DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
125HRESULT __stdcall DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
126HRESULT __stdcall DrawFlipToGDISurface(THIS);
127HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
128HRESULT __stdcall DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
129HRESULT __stdcall DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
130HRESULT __stdcall DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE *);
131HRESULT __stdcall DrawGetMonitorFrequency(THIS, LPDWORD);
132HRESULT __stdcall DrawGetScanLine(THIS, LPDWORD);
133HRESULT __stdcall DrawGetVerticalBlankStatus(THIS, LPBOOL);
134HRESULT __stdcall DrawInitialize(THIS, GUID *);
135HRESULT __stdcall DrawRestoreDisplayMode(THIS);
136HRESULT __stdcall DrawSetCooperativeLevel(THIS, HWND, DWORD);
137HRESULT __stdcall DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
138HRESULT __stdcall DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
139HRESULT __stdcall DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
140// V2
141HRESULT __stdcall DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
142// V4
143HRESULT __stdcall DrawGetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
144HRESULT __stdcall DrawRestoreAllSurfaces(THIS) ;
145HRESULT __stdcall DrawTestCooperativeLevel(THIS) ;
146HRESULT __stdcall DrawGetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
147// functions which ifaces are changed in DirectX6 after all MS uses COM where an programmer
148// isn't allowd to change a function iface after he published the iface (See MS COM docs!)
149HRESULT __stdcall DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4 *, IUnknown *);
150HRESULT __stdcall DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 * );
151HRESULT __stdcall DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
152HRESULT __stdcall DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
153HRESULT __stdcall DrawGetDisplayMode4(THIS, LPDDSURFACEDESC2);
154HRESULT __stdcall DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4 *);
155HRESULT __stdcall DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
156
157/*** IDirect3D methods ***/
158HRESULT __stdcall D3DQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
159ULONG __stdcall D3DAddRef(THIS);
160ULONG __stdcall D3DRelease(THIS);
161HRESULT __stdcall D3DInitialize(THIS, REFIID);
162HRESULT __stdcall D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
163HRESULT __stdcall D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
164HRESULT __stdcall D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
165HRESULT __stdcall D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
166HRESULT __stdcall D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
167
168#endif
Note: See TracBrowser for help on using the repository browser.