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

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

Created DIVEWRAp.h to presewrve FS selector

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