Changeset 210 for trunk/src/ddraw/ddraw.CPP
- Timestamp:
- Jun 26, 1999, 1:34:43 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/ddraw.CPP
r97 r210 1 /* $Id: ddraw.CPP,v 1.3 1999-06-10 17:10:57 phaller Exp $ */ 1 #include <memory.h> 2 2 3 /* 4 * DirectDraw exported APIs 5 * 6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) 7 * 8 * Project Odin Software License can be found in LICENSE.TXT 9 * 10 */ 11 12 /*@Const************************************************************************ 13 * Defined Constants * 14 *******************************************************************************/ 3 #include <builtin.h> 15 4 #define INITGUID 16 #define INCL_GUIDS17 #define WIN32SDK_NOPOSTWRAPPER18 19 /*@Header***********************************************************************20 * Header Files *21 *******************************************************************************/22 #include <os2win.h>23 #include <memory.h>24 #include <builtin.h>25 #include <dive.h>26 27 #include <w_windows.h>28 #include <ddraw.h>29 #include <d3d.h>30 #include <Win32SDKPostWrapper.h>31 32 5 #include "os2ddraw.h" 6 // define the following as we include winnt.h 7 #define _OS2WIN_H 8 #define FAR 33 9 #include "misc.h" 34 10 35 11 //****************************************************************************** 36 12 //****************************************************************************** 37 HRESULT WIN32API OS2DirectDrawCreate( GUID FAR *lpGUID,38 LPDIRECTDRAW FAR *lplpDD,39 IUnknown FAR *pUnkOuter)13 HRESULT WIN32API OS2DirectDrawCreate( GUID FAR *lpGUID, 14 LPDIRECTDRAW FAR *lplpDD, 15 IUnknown FAR *pUnkOuter) 40 16 { 41 OS2IDirectDraw *newdraw = new OS2IDirectDraw(lpGUID);;42 HRESULT rc;17 OS2IDirectDraw *newdraw; 18 HRESULT rc; 43 19 44 dprintf(("DirectDrawCreate %X %X %X\n", lpGUID, lplpDD, pUnkOuter)); 20 WriteLog("DirectDrawCreate %X %X %X\n", lpGUID, lplpDD, pUnkOuter); 21 newdraw = new OS2IDirectDraw(lpGUID); 45 22 46 if(newdraw == NULL) return(DDERR_NODIRECTDRAWHW); 23 if(newdraw == NULL) 24 return(DDERR_NODIRECTDRAWHW); 47 25 48 26 // newdraw->Vtbl.AddRef((IDirectDraw *)newdraw); 49 27 rc = newdraw->GetLastError(); 50 if(rc != DD_OK) { 28 if(rc != DD_OK) 29 { 51 30 *lplpDD = NULL; 52 31 delete newdraw; 53 32 } 54 else *lplpDD = (LPDIRECTDRAW)newdraw; 33 else 34 *lplpDD = (LPDIRECTDRAW)newdraw; 35 55 36 return(rc); 56 37 } 57 38 //****************************************************************************** 58 #if 0 //KSO Apr 19 1999: not needed any longer!59 39 typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKA)(GUID FAR *, LPSTR, LPSTR, LPVOID); 60 #endif61 40 //****************************************************************************** 62 41 HRESULT WIN32API OS2DirectDrawEnumerateA(LPDDENUMCALLBACKA lpCallback, 63 42 LPVOID lpContext) 64 43 { 65 dprintf(("DirectDrawEnumerateA\n"));44 WriteLog("DirectDrawEnumerateA\n Callback for DIVE\n"); 66 45 //call it twice for the DirectDraw & Direct3D classes 67 if(lpCallback(NULL, "DIVE DirectDraw for OS/2", 68 "DirectDraw/2 v0.1", lpContext) == DDENUMRET_CANCEL) { 46 if(lpCallback(NULL, "DIVE DirectDraw for OS/2", 47 "DirectDraw/2 v0.1", lpContext) == DDENUMRET_CANCEL) 48 { 49 WriteLog("Cancel Callback\n"); 69 50 return(DD_OK); 70 51 } 71 52 else //now for Direct3D 72 if(lpCallback((GUID *)&IID_IDirect3D, "3Dfx Voodoo Direct3D/2", 73 "Direct3D/2 v0.1", lpContext) == DDENUMRET_CANCEL) { 74 return(DD_OK); 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 } 75 61 } 62 WriteLog("Done Enumeration\n\n"); 63 76 64 return(DD_OK); 65 } 66 //****************************************************************************** 67 typedef struct 68 { 69 LPDDENUMCALLBACKEXA lpCallbackEx; 70 LPVOID lpContext; 71 } ENUMDATA, *PENUMDATA; 72 73 BOOL 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 //****************************************************************************** 95 HRESULT 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); 77 109 } 78 110 //****************************************************************************** … … 80 112 DWORD WIN32API DDHAL32_VidMemFree(DWORD address) 81 113 { 82 dprintf(("DDHAL32_VidMemFree, not supported\n"));114 WriteLog("DDHAL32_VidMemFree, not supported\n"); 83 115 return(0); 84 116 } … … 87 119 DWORD WIN32API DDHAL32_VidMemAlloc(DWORD size) 88 120 { 89 dprintf(("DDHAL32_VidMemAlloc, not supported\n"));121 WriteLog("DDHAL32_VidMemAlloc, not supported\n"); 90 122 return(0); 91 123 }
Note:
See TracChangeset
for help on using the changeset viewer.