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

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

Implemented new colorconversion routine and fixed bug in fastblt function.
Changed the palettehandling code

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#define DEBUG 1
10#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
11 ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
12 ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
13#include <fourcc.h>
14#undef THIS
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 VOID *pPrimSurf;
48
49 private:
50 VOID SwitchDisplay(HWND hwnd);
51
52
53 protected:
54
55 HRESULT lastError;
56 HDIVE hDive; // Handle to Screen DIVE instance
57 HDIVE hDiveColorConv; // Handle to Offscreen DIVE instance for Color conversion
58 char *pFrameBuffer;
59 HWND hwndClient;
60 int screenwidth, screenheight, screenbpp;
61 BOOL PrimaryExists;
62 BOOL bScale;
63
64 // Linked list management
65 OS2IDirectDraw* next; // Next OS2IDirectDraw
66 static OS2IDirectDraw* ddraw; // List of OS2IDirectDraw
67
68 friend HRESULT __stdcall DrawQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
69 friend ULONG __stdcall DrawAddRef(THIS);
70 friend ULONG __stdcall DrawRelease(THIS);
71 friend HRESULT __stdcall DrawCompact(THIS);
72 friend HRESULT __stdcall DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown * );
73 friend HRESULT __stdcall DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown * );
74 friend HRESULT __stdcall DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE *, IUnknown *);
75 friend HRESULT __stdcall DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4 *, IUnknown *);
76 friend HRESULT __stdcall DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE * );
77 friend HRESULT __stdcall DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 * );
78 friend HRESULT __stdcall DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
79 friend HRESULT __stdcall DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
80 friend HRESULT __stdcall DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
81 friend HRESULT __stdcall DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
82 friend HRESULT __stdcall DrawFlipToGDISurface(THIS);
83 friend HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
84 friend HRESULT __stdcall DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
85 friend HRESULT __stdcall DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
86 friend HRESULT __stdcall DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE *);
87 friend HRESULT __stdcall DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4 *);
88 friend HRESULT __stdcall DrawGetMonitorFrequency(THIS, LPDWORD);
89 friend HRESULT __stdcall DrawGetScanLine(THIS, LPDWORD);
90 friend HRESULT __stdcall DrawGetVerticalBlankStatus(THIS, LPBOOL);
91 friend HRESULT __stdcall DrawInitialize(THIS, GUID *);
92 friend HRESULT __stdcall DrawRestoreDisplayMode(THIS);
93 friend HRESULT __stdcall DrawSetCooperativeLevel(THIS, HWND, DWORD);
94 friend HRESULT __stdcall DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
95 friend HRESULT __stdcall DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
96 friend HRESULT __stdcall DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
97 // V2 Interface
98 friend HRESULT __stdcall DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
99 friend HRESULT __stdcall DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
100 // V4 Interface
101 friend HRESULT __stdcall GetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
102 friend HRESULT __stdcall RestoreAllSurfaces(THIS) ;
103 friend HRESULT __stdcall TestCooperativeLevel(THIS) ;
104 friend HRESULT __stdcall GetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
105 /*** IDirect3D methods ***/
106 friend HRESULT __stdcall D3DQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
107 friend ULONG __stdcall D3DAddRef(THIS);
108 friend ULONG __stdcall D3DRelease(THIS);
109 friend HRESULT __stdcall D3DInitialize(THIS, REFIID);
110 friend HRESULT __stdcall D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
111 friend HRESULT __stdcall D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
112 friend HRESULT __stdcall D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
113 friend HRESULT __stdcall D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
114 friend HRESULT __stdcall D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
115
116};
117
118//******************************************************************************
119HRESULT __stdcall DrawQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
120ULONG __stdcall DrawAddRef(THIS);
121ULONG __stdcall DrawRelease(THIS);
122HRESULT __stdcall DrawCompact(THIS);
123HRESULT __stdcall DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown * );
124HRESULT __stdcall DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown * );
125HRESULT __stdcall DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE *, IUnknown *);
126HRESULT __stdcall DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE * );
127HRESULT __stdcall DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
128HRESULT __stdcall DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
129HRESULT __stdcall DrawFlipToGDISurface(THIS);
130HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
131HRESULT __stdcall DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
132HRESULT __stdcall DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
133HRESULT __stdcall DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE *);
134HRESULT __stdcall DrawGetMonitorFrequency(THIS, LPDWORD);
135HRESULT __stdcall DrawGetScanLine(THIS, LPDWORD);
136HRESULT __stdcall DrawGetVerticalBlankStatus(THIS, LPBOOL);
137HRESULT __stdcall DrawInitialize(THIS, GUID *);
138HRESULT __stdcall DrawRestoreDisplayMode(THIS);
139HRESULT __stdcall DrawSetCooperativeLevel(THIS, HWND, DWORD);
140HRESULT __stdcall DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
141HRESULT __stdcall DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
142HRESULT __stdcall DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
143// V2
144HRESULT __stdcall DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
145// V4
146HRESULT __stdcall DrawGetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
147HRESULT __stdcall DrawRestoreAllSurfaces(THIS) ;
148HRESULT __stdcall DrawTestCooperativeLevel(THIS) ;
149HRESULT __stdcall DrawGetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
150// functions which ifaces are changed in DirectX6 after all MS uses COM where an programmer
151// isn't allowd to change a function iface after he published the iface (See MS COM docs!)
152HRESULT __stdcall DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4 *, IUnknown *);
153HRESULT __stdcall DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 * );
154HRESULT __stdcall DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
155HRESULT __stdcall DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
156HRESULT __stdcall DrawGetDisplayMode4(THIS, LPDDSURFACEDESC2);
157HRESULT __stdcall DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4 *);
158HRESULT __stdcall DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
159
160/*** IDirect3D methods ***/
161HRESULT __stdcall D3DQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
162ULONG __stdcall D3DAddRef(THIS);
163ULONG __stdcall D3DRelease(THIS);
164HRESULT __stdcall D3DInitialize(THIS, REFIID);
165HRESULT __stdcall D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
166HRESULT __stdcall D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
167HRESULT __stdcall D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
168HRESULT __stdcall D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
169HRESULT __stdcall D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
170
171#endif
Note: See TracBrowser for help on using the repository browser.