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

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

Added ODIn lic header with ID to all files where missing

Cleaned up Surface handling by movefing colorfill and
colorconversion into own files and use functionpointers
setup during creation.

updated makefile to add files

removed inhertiance from IBASE in DDrectangle class

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