Ignore:
Timestamp:
Jun 26, 1999, 1:34:43 PM (26 years ago)
Author:
hugh
Message:

DX 6 Version of ddraw rel files

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>
    22
    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>
    154#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 
    325#include "os2ddraw.h"
     6// define the following as we include winnt.h
     7#define _OS2WIN_H
     8#define FAR
    339#include "misc.h"
    3410
    3511//******************************************************************************
    3612//******************************************************************************
    37 HRESULT WIN32API OS2DirectDrawCreate(GUID FAR *lpGUID,
    38                                  LPDIRECTDRAW FAR *lplpDD,
    39                              IUnknown FAR *pUnkOuter)
     13HRESULT WIN32API OS2DirectDrawCreate( GUID FAR *lpGUID,
     14                                      LPDIRECTDRAW FAR *lplpDD,
     15                                      IUnknown FAR *pUnkOuter)
    4016{
    41  OS2IDirectDraw *newdraw = new OS2IDirectDraw(lpGUID);;
    42  HRESULT         rc;
     17  OS2IDirectDraw *newdraw;
     18  HRESULT         rc;
    4319
    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);
    4522
    46   if(newdraw == NULL)   return(DDERR_NODIRECTDRAWHW);
     23  if(newdraw == NULL)
     24    return(DDERR_NODIRECTDRAWHW);
    4725
    4826//  newdraw->Vtbl.AddRef((IDirectDraw *)newdraw);
    4927  rc = newdraw->GetLastError();
    50   if(rc != DD_OK) {
     28  if(rc != DD_OK)
     29  {
    5130    *lplpDD = NULL;
    5231    delete newdraw;
    5332  }
    54   else  *lplpDD = (LPDIRECTDRAW)newdraw;
     33  else
     34    *lplpDD = (LPDIRECTDRAW)newdraw;
     35
    5536  return(rc);
    5637}
    5738//******************************************************************************
    58 #if 0  //KSO Apr 19 1999: not needed any longer!
    5939typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKA)(GUID FAR *, LPSTR, LPSTR, LPVOID);
    60 #endif
    6140//******************************************************************************
    6241HRESULT WIN32API OS2DirectDrawEnumerateA(LPDDENUMCALLBACKA lpCallback,
    63                              LPVOID lpContext)
     42               LPVOID lpContext)
    6443{
    65   dprintf(("DirectDrawEnumerateA\n"));
     44  WriteLog("DirectDrawEnumerateA\n Callback for DIVE\n");
    6645  //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");
    6950    return(DD_OK);
    7051  }
    7152  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    }
    7561  }
     62  WriteLog("Done Enumeration\n\n");
     63
    7664  return(DD_OK);
     65}
     66//******************************************************************************
     67typedef struct
     68{
     69  LPDDENUMCALLBACKEXA lpCallbackEx;
     70  LPVOID lpContext;
     71} ENUMDATA, *PENUMDATA;
     72
     73BOOL 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//******************************************************************************
     95HRESULT 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);
    77109}
    78110//******************************************************************************
     
    80112DWORD WIN32API DDHAL32_VidMemFree(DWORD address)
    81113{
    82   dprintf(("DDHAL32_VidMemFree, not supported\n"));
     114  WriteLog("DDHAL32_VidMemFree, not supported\n");
    83115  return(0);
    84116}
     
    87119DWORD WIN32API DDHAL32_VidMemAlloc(DWORD size)
    88120{
    89   dprintf(("DDHAL32_VidMemAlloc, not supported\n"));
     121  WriteLog("DDHAL32_VidMemAlloc, not supported\n");
    90122  return(0);
    91123}
Note: See TracChangeset for help on using the changeset viewer.