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

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

Changed dprintf to add DDRAW: at start of a entry
Also copied framebuffer for solid blits to the prinmary surface
Red Alert Map editor does work now ;)

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