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

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

DX 6 Version of ddraw rel files

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