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