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

Last change on this file since 4135 was 4135, checked in by sandervl, 25 years ago

misc fixes for dxview + powerdvd

File size: 10.7 KB
Line 
1/* $Id: OS2DDRAW.H,v 1.12 2000-08-31 12:48:41 sandervl 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 mmioFOURCC( ch0, ch1, ch2, ch3 ) \
22 ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
23 ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
24#include <fourcc.h>
25#undef THIS
26#define THIS VOID*
27
28#define MAX_FOURCC_CODES 3
29
30class OS2IDirectDraw
31{
32 public:
33 //this one has to go first!
34 IDirectDraw4Vtbl *lpVtbl;
35 IDirectDraw4Vtbl *lpVtbl2; // 2nd Vtable pointer An other MS assumtion see below
36 DWORD *pdwUnknownData; // MS DDCAPS (DX6 SDK bin\tools )program makes an assumtion that after the
37 // VTable comes a pointer to some data
38 // to avoid crashes we do it a favor and alloc a buffer
39 // with 255 DWORDS
40 // Known data in the buffer Height(offset 235),
41 // Height (236), Bits (241)
42 // ToDO :
43 // debug into DirectDrawCreate and se what MS is doing !
44 IDirectDrawVtbl Vtbl;
45 IDirectDraw2Vtbl Vtbl2;
46 // MS did it again with direct/X 6 they changed the behavior of the directdraw component
47 // So we now need 2 Virt. Tables one for the old and one for the new so we return the
48 // right interface if one creates a DX6 directdraw object but wants a DX2,3,5 interface
49 IDirectDraw4Vtbl Vtbl4;
50 IDirect3DVtbl Vtbl3D;
51
52 OS2IDirectDraw(GUID *lpGUID);
53 ~OS2IDirectDraw();
54 // Simple management for Surfaces should be good enougth for now
55 inline BOOL HasPrimarySurface() { return PrimaryExists;}
56 void SetPrimarySurface(BOOL NewStatus){PrimaryExists = NewStatus;}
57 int Referenced;
58 inline HRESULT GetLastError() { return lastError; }
59 inline HDIVE GetDiveInstance() { return hDive; }
60 inline HDIVE GetCCDiveInstance() { return hDiveColorConv;}
61 inline char * GetFrameBuffer() { return pFrameBuffer; }
62 inline int GetScreenWidth() { return screenwidth; }
63 inline int GetScreenHeight() { return screenheight; }
64 inline int GetScreenBpp() { return screenbpp;}
65 FOURCC GetScreenFourCC();
66 // We should be able to use any mode with less or same bits and same or
67 // smaller size to be able to report all supported mode in the enum
68 // functions we need the physical screen size. Other information is later
69 // also needed so get all the info we can get
70 DIVE_CAPS dCaps;
71 VOID *pPrimSurf;
72
73 private:
74 VOID SwitchDisplay(HWND hwnd);
75
76
77 protected:
78
79 HRESULT lastError;
80 HDIVE hDive; // Handle to Screen DIVE instance
81 HDIVE hDiveColorConv; // Handle to Offscreen DIVE instance for Color conversion
82 char *pFrameBuffer;
83 HWND hwndClient;
84 DWORD dwCoopMode;
85 int screenwidth, screenheight, screenbpp;
86 BOOL PrimaryExists;
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#define FOURCC_YUY2 mmioFOURCC( 'Y', 'U', 'Y', '2' )
197#define FOURCC_UYVY mmioFOURCC( 'U', 'Y', 'V', 'Y' )
198
199#endif
Note: See TracBrowser for help on using the repository browser.