source: trunk/src/ddraw/ddraw.CPP@ 1036

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

Fixed bug in pageflipping, constructor colorfill

File size: 3.8 KB
Line 
1#include <memory.h>
2
3#include <builtin.h>
4#define INITGUID
5#include "os2ddraw.h"
6// define the following as we include winnt.h
7#define _OS2WIN_H
8#define FAR
9#include "misc.h"
10
11//******************************************************************************
12//******************************************************************************
13HRESULT WIN32API OS2DirectDrawCreate( GUID FAR *lpGUID,
14 LPDIRECTDRAW FAR *lplpDD,
15 IUnknown FAR *pUnkOuter)
16{
17 OS2IDirectDraw *newdraw;
18 HRESULT rc;
19
20 WriteLog("DirectDrawCreate %X %X %X\n", lpGUID, lplpDD, pUnkOuter);
21
22 newdraw = new OS2IDirectDraw(lpGUID);
23
24 if(newdraw == NULL)
25 {
26 rc = DDERR_NODIRECTDRAWHW;
27 }
28 else
29 {
30 // newdraw->Vtbl.AddRef((IDirectDraw *)newdraw);
31 rc = newdraw->GetLastError();
32 if(rc != DD_OK)
33 {
34 *lplpDD = NULL;
35
36 delete newdraw;
37 }
38 else
39 *lplpDD = (LPDIRECTDRAW)newdraw;
40 }
41 return(rc);
42}
43//******************************************************************************
44typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKA)(GUID FAR *, LPSTR, LPSTR, LPVOID);
45//******************************************************************************
46HRESULT WIN32API OS2DirectDrawEnumerateA(LPDDENUMCALLBACKA lpCallback,
47 LPVOID lpContext)
48{
49 WriteLog("DirectDrawEnumerateA\n Callback for DIVE\n");
50 //call it twice for the DirectDraw & Direct3D classes
51 if(lpCallback(NULL, "DIVE DirectDraw for OS/2",
52 "DirectDraw/2 v0.2", lpContext) == DDENUMRET_CANCEL)
53 {
54 WriteLog("Cancel Callback\n");
55 return(DD_OK);
56 }
57 else //now for Direct3D
58 {
59 WriteLog("Callback for 3Dfx Voodoo");
60 if(lpCallback((GUID *)&IID_IDirect3D, "3Dfx Voodoo Direct3D/2",
61 "Direct3D/2 v0.2", lpContext) == DDENUMRET_CANCEL)
62 {
63 WriteLog("Cancel Callback\n");
64 return(DD_OK);
65 }
66 }
67 WriteLog("Done Enumeration\n\n");
68
69 return(DD_OK);
70}
71
72//******************************************************************************
73typedef struct
74{
75 LPDDENUMCALLBACKEXA lpCallbackEx;
76 LPVOID lpContext;
77} ENUMDATA, *PENUMDATA;
78
79BOOL FAR PASCAL SimpleEnum ( GUID FAR *lpGUID,
80 LPSTR lpDriverDescription,
81 LPSTR lpDriverName,
82 LPVOID lpContext)
83{
84 BOOL rc;
85 PENUMDATA pData;
86
87 WriteLog("SimpleEnum\n");
88
89 pData = (PENUMDATA)lpContext;
90 rc = pData->lpCallbackEx( lpGUID,
91 lpDriverDescription,
92 lpDriverName,
93 pData->lpContext,
94 NULL);
95
96 WriteLog("Callback returned\n");
97 return rc;
98}
99
100//******************************************************************************
101HRESULT WIN32API OS2DirectDrawEnumerateExA( LPDDENUMCALLBACKEXA lpCallbackEx,
102 LPVOID lpContext,
103 DWORD dwFlags)
104{
105 ENUMDATA data;
106
107 WriteLog("DirectDrawEnumerateExA\n");
108
109 data.lpCallbackEx = lpCallbackEx;
110 data.lpContext = lpContext;
111
112 OS2DirectDrawEnumerateA( SimpleEnum,
113 &data);
114 return (DD_OK);
115}
116//******************************************************************************
117//******************************************************************************
118DWORD WIN32API DDHAL32_VidMemFree(DWORD address)
119{
120 WriteLog("DDHAL32_VidMemFree, not supported\n");
121 return(0);
122}
123//******************************************************************************
124//******************************************************************************
125DWORD WIN32API DDHAL32_VidMemAlloc(DWORD size)
126{
127 WriteLog("DDHAL32_VidMemAlloc, not supported\n");
128 return(0);
129}
130//******************************************************************************
131//******************************************************************************
Note: See TracBrowser for help on using the repository browser.