| 1 | /* $Id: ddraw.CPP,v 1.3 1999-06-10 17:10:57 phaller Exp $ */ | 
|---|
| 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 | *******************************************************************************/ | 
|---|
| 15 | #define INITGUID | 
|---|
| 16 | #define INCL_GUIDS | 
|---|
| 17 | #define WIN32SDK_NOPOSTWRAPPER | 
|---|
| 18 |  | 
|---|
| 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 | #include "os2ddraw.h" | 
|---|
| 33 | #include "misc.h" | 
|---|
| 34 |  | 
|---|
| 35 | //****************************************************************************** | 
|---|
| 36 | //****************************************************************************** | 
|---|
| 37 | HRESULT WIN32API OS2DirectDrawCreate(GUID FAR *lpGUID, | 
|---|
| 38 | LPDIRECTDRAW FAR *lplpDD, | 
|---|
| 39 | IUnknown FAR *pUnkOuter) | 
|---|
| 40 | { | 
|---|
| 41 | OS2IDirectDraw *newdraw = new OS2IDirectDraw(lpGUID);; | 
|---|
| 42 | HRESULT         rc; | 
|---|
| 43 |  | 
|---|
| 44 | dprintf(("DirectDrawCreate %X %X %X\n", lpGUID, lplpDD, pUnkOuter)); | 
|---|
| 45 |  | 
|---|
| 46 | if(newdraw == NULL)   return(DDERR_NODIRECTDRAWHW); | 
|---|
| 47 |  | 
|---|
| 48 | //  newdraw->Vtbl.AddRef((IDirectDraw *)newdraw); | 
|---|
| 49 | rc = newdraw->GetLastError(); | 
|---|
| 50 | if(rc != DD_OK) { | 
|---|
| 51 | *lplpDD = NULL; | 
|---|
| 52 | delete newdraw; | 
|---|
| 53 | } | 
|---|
| 54 | else  *lplpDD = (LPDIRECTDRAW)newdraw; | 
|---|
| 55 | return(rc); | 
|---|
| 56 | } | 
|---|
| 57 | //****************************************************************************** | 
|---|
| 58 | #if 0  //KSO Apr 19 1999: not needed any longer! | 
|---|
| 59 | typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKA)(GUID FAR *, LPSTR, LPSTR, LPVOID); | 
|---|
| 60 | #endif | 
|---|
| 61 | //****************************************************************************** | 
|---|
| 62 | HRESULT WIN32API OS2DirectDrawEnumerateA(LPDDENUMCALLBACKA lpCallback, | 
|---|
| 63 | LPVOID lpContext) | 
|---|
| 64 | { | 
|---|
| 65 | dprintf(("DirectDrawEnumerateA\n")); | 
|---|
| 66 | //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) { | 
|---|
| 69 | return(DD_OK); | 
|---|
| 70 | } | 
|---|
| 71 | 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); | 
|---|
| 75 | } | 
|---|
| 76 | return(DD_OK); | 
|---|
| 77 | } | 
|---|
| 78 | //****************************************************************************** | 
|---|
| 79 | //****************************************************************************** | 
|---|
| 80 | DWORD WIN32API DDHAL32_VidMemFree(DWORD address) | 
|---|
| 81 | { | 
|---|
| 82 | dprintf(("DDHAL32_VidMemFree, not supported\n")); | 
|---|
| 83 | return(0); | 
|---|
| 84 | } | 
|---|
| 85 | //****************************************************************************** | 
|---|
| 86 | //****************************************************************************** | 
|---|
| 87 | DWORD WIN32API DDHAL32_VidMemAlloc(DWORD size) | 
|---|
| 88 | { | 
|---|
| 89 | dprintf(("DDHAL32_VidMemAlloc, not supported\n")); | 
|---|
| 90 | return(0); | 
|---|
| 91 | } | 
|---|
| 92 | //****************************************************************************** | 
|---|
| 93 | //****************************************************************************** | 
|---|