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

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

Bugfixes for moorhuhn

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