Changeset 21875 for branches/gcc-kmk/src


Ignore:
Timestamp:
Dec 9, 2011, 9:23:34 PM (14 years ago)
Author:
dmik
Message:

Port DDRAW to GCC/kBuild.

Location:
branches/gcc-kmk/src
Files:
1 added
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/gcc-kmk/src/Makefile.kmk

    r21874 r21875  
    3636include $(PATH_SUB_CURRENT)/winspool/Makefile.kmk
    3737include $(PATH_SUB_CURRENT)/comdlg32/Makefile.kmk
     38include $(PATH_SUB_CURRENT)/ddraw/Makefile.kmk
    3839include $(PATH_SUB_CURRENT)/crypt32/Makefile.kmk
    3940include $(PATH_SUB_CURRENT)/ctl3d32/Makefile.kmk
  • branches/gcc-kmk/src/ddraw/ddmain.cpp

    r21494 r21875  
    7979  dprintf(("DDRAW: DirectDrawEnumerateA\n Callback for DIVE"));
    8080  //call it twice for the DirectDraw & Direct3D classes
    81  if(lpCallback(NULL, "DIVE DirectDraw for OS/2",
    82                 "DirectDraw/2 v0.4", lpContext) == DDENUMRET_CANCEL)
     81 if(lpCallback(NULL, (LPSTR)"DIVE DirectDraw for OS/2",
     82                (LPSTR)"DirectDraw/2 v0.4", lpContext) == DDENUMRET_CANCEL)
    8383  {
    8484    dprintf(("DDRAW: Cancel Callback"));
     
    9191  {
    9292    dprintf(("DDRAW: Callback for 3Dfx Voodoo"));
    93     if(lpCallback((GUID *)&IID_IDirect3D, "3Dfx Voodoo Direct3D/2",
    94       "Direct3D/2 v0.2", lpContext) == DDENUMRET_CANCEL)
     93    if(lpCallback((GUID *)&IID_IDirect3D, (LPSTR)"3Dfx Voodoo Direct3D/2",
     94      (LPSTR)"Direct3D/2 v0.2", lpContext) == DDENUMRET_CANCEL)
    9595    {
    9696      dprintf(("DDRAW: Cancel Callback"));
  • branches/gcc-kmk/src/ddraw/ddraw.def

    r21692 r21875  
    1717; D3DParseUnknownCommand    @2
    1818; DDGetAttachedSurfaceLcl   @3
    19  DDHAL32_VidMemFree  = _DDHAL32_VidMemFree@4                    @4
    20  DDHAL32_VidMemAlloc = _DDHAL32_VidMemAlloc@4                   @5
     19 DDHAL32_VidMemFree  = "_DDHAL32_VidMemFree@4"                  @4
     20 DDHAL32_VidMemAlloc = "_DDHAL32_VidMemAlloc@4"                 @5
    2121; DDInternalLock            @6
    2222; DDInternalUnlock          @7
    2323; DSoundHelp                @8
    24  DirectDrawCreate         = _OS2DirectDrawCreate@12             @9
    25  DirectDrawCreateClipper  = _OS2DirectDrawCreateClipper@12      @10
    26  DirectDrawCreateEx       = _DirectDrawCreateEx@16              @11
    27  DirectDrawEnumerateA     = _OS2DirectDrawEnumerateA@8          @12
    28  DirectDrawEnumerateExA   = _OS2DirectDrawEnumerateExA@12       @13
     24 DirectDrawCreate         = "_OS2DirectDrawCreate@12"           @9
     25 DirectDrawCreateClipper  = "_OS2DirectDrawCreateClipper@12"    @10
     26 DirectDrawCreateEx       = "_DirectDrawCreateEx@16"            @11
     27 DirectDrawEnumerateA     = "_OS2DirectDrawEnumerateA@8"        @12
     28 DirectDrawEnumerateExA   = "_OS2DirectDrawEnumerateExA@12"     @13
    2929; DirectDrawEnumerateExW          @14
    3030; DirectDrawEnumerateW            @15
    31 DllCanUnloadNow   = _DDrawDllCanUnloadNow@0                     @16
    32 DllGetClassObject = _DDrawDllGetClassObject@12                  @17
     31DllCanUnloadNow   = "_DDrawDllCanUnloadNow@0"                   @16
     32DllGetClassObject = "_DDrawDllGetClassObject@12"                @17
    3333; GetAliasedVidMem          @18
    3434; GetDDSurfaceLocal         @19
  • branches/gcc-kmk/src/ddraw/ddraw2d.cpp

    r21494 r21875  
    130130
    131131  pdwUnknownData = (DWORD*) malloc (255*sizeof(DWORD));
    132   for(int i= 0 ;i<255;i++)
     132  int i;
     133  for(i= 0 ;i<255;i++)
    133134    pdwUnknownData[i] = 0;
    134135
  • branches/gcc-kmk/src/ddraw/ddraw2d.h

    r9560 r21875  
    163163};
    164164
     165#ifdef __GNUC__
     166// abuse the real address instead of NULL to supress GCC warnings
     167// (note that it will not work right if OS2IDirectDraw gets virtual methods etc.)
     168#define OFFSET_D3DVTABLE        (LONG)(&((OS2IDirectDraw *)1)->lpVtbl3D-1)
     169#else
    165170#define OFFSET_D3DVTABLE        (LONG)(&((OS2IDirectDraw *)NULL)->lpVtbl3D)
     171#endif
    166172#define DDraw3D_GetThisPtr(a)   (OS2IDirectDraw *)((ULONG)a-OFFSET_D3DVTABLE)
    167173
  • branches/gcc-kmk/src/ddraw/initterm.cpp

    r21842 r21875  
    1 /* $Id: initddraw.cpp,v 1.2 2003-02-07 13:58:17 sandervl Exp $
     1/* $Id: initterm.cpp,v 1.20 2003-01-21 11:20:35 sandervl Exp $
    22 *
    3  * DLL entry point
     3 * DDRAW DLL entry point
    44 *
    55 * Copyright 1998 Sander van Leeuwen
    66 * Copyright 1998 Peter Fitzsimmons
    77 *
    8  *
    98 * Project Odin Software License can be found in LICENSE.TXT
    10  *
    119 */
    1210
    13 /*-------------------------------------------------------------*/
    14 /* INITERM.C -- Source for a custom dynamic link library       */
    15 /*              initialization and termination (_DLL_InitTerm) */
    16 /*              function.                                      */
    17 /*                                                             */
    18 /* When called to perform initialization, this sample function */
    19 /* gets storage for an array of integers, and initializes its  */
    20 /* elements with random integers.  At termination time, it     */
    21 /* frees the array.  Substitute your own special processing.   */
    22 /*-------------------------------------------------------------*/
    23 
    24 
    25 /* Include files */
    2611#define  INCL_DOSMODULEMGR
    2712#define  INCL_DOSPROCESS
     
    3520#include <odinlx.h>
    3621#include <dbglog.h>
     22#include <exitlist.h>
     23#include <misc.h>       /*PLF Wed  98-03-18 23:18:15*/
     24#include <initdll.h>
     25
     26#ifdef FULLSCREEN_DDRAW
     27#include "os2fsdd.h"    // For RestorePM()
     28#endif
    3729#include "divewrap.h"
    3830
    39 extern "C" {
    40  //Win32 resource table (produced by wrc)
    41  extern DWORD ddraw_PEResTab;
    42 }
     31// Win32 resource table (produced by wrc)
     32extern DWORD ddraw_PEResTab;
    4333
    4434char ddrawPath[CCHMAXPATH] = "";
    4535static HMODULE dllHandle = 0;
    4636
    47 static void APIENTRY cleanup(ULONG ulReason);
     37#if 0 // not currently needed
     38BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
     39{
     40    switch (fdwReason)
     41    {
     42    case DLL_PROCESS_ATTACH:
     43        return TRUE;
    4844
    49 /****************************************************************************/
    50 /* _DLL_InitTerm is the function that gets called by the operating system   */
    51 /* loader when it loads and frees this DLL for each process that accesses   */
    52 /* this DLL.  However, it only gets called the first time the DLL is loaded */
    53 /* and the last time it is freed for a particular process.  The system      */
    54 /* linkage convention MUST be used because the operating system loader is   */
    55 /* calling this function.                                                   */
    56 /****************************************************************************/
    57 ULONG APIENTRY inittermDDraw(ULONG hModule, ULONG ulFlag)
     45    case DLL_THREAD_ATTACH:
     46    case DLL_THREAD_DETACH:
     47        return TRUE;
     48
     49    case DLL_PROCESS_DETACH:
     50        return TRUE;
     51    }
     52    return FALSE;
     53}
     54#endif
     55
     56ULONG SYSTEM DLL_InitDDraw(ULONG hModule)
    5857{
    59    /*-------------------------------------------------------------------------*/
    60    /* If ulFlag is zero then the DLL is being loaded so initialization should */
    61    /* be performed.  If ulFlag is 1 then the DLL is being freed so            */
    62    /* termination should be performed.                                        */
    63    /*-------------------------------------------------------------------------*/
     58    APIRET rc;
    6459
    65    switch (ulFlag) {
    66       case 0 :
    67       {
    68          APIRET rc;
     60    DosQueryModuleName(hModule, CCHMAXPATH, ddrawPath);
     61    char *endofpath = strrchr(ddrawPath, '\\');
     62    if (endofpath)
     63       *(endofpath+1) = '\0';
    6964
    70          DosQueryModuleName(hModule, CCHMAXPATH, ddrawPath);
    71          char *endofpath = strrchr(ddrawPath, '\\');
    72          if (endofpath)
    73             *(endofpath+1) = '\0';
     65    CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    7466
    75          CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
     67    dllHandle = RegisterLxDll(hModule, NULL, (PVOID)&ddraw_PEResTab,
     68                              DDRAW_MAJORIMAGE_VERSION, DDRAW_MINORIMAGE_VERSION,
     69                              IMAGE_SUBSYSTEM_WINDOWS_GUI);
     70    if (dllHandle == 0)
     71       return -1;
    7672
    77          dllHandle = RegisterLxDll(hModule, NULL, (PVOID)&ddraw_PEResTab,
    78                                    DDRAW_MAJORIMAGE_VERSION, DDRAW_MINORIMAGE_VERSION,
    79                                    IMAGE_SUBSYSTEM_WINDOWS_GUI);
    80          if (dllHandle == 0)
    81             return 0UL;
     73    DiveLoad();
    8274
    83          DiveLoad();
    84          break;
    85       }
    86       case 1 :
    87          DiveUnload();
    88          if(dllHandle) {
    89             UnregisterLxDll(dllHandle);
    90          }
    91          break;
    92       default  :
    93          return 0UL;
    94    }
     75#ifdef FULLSCREEN_DDRAW
     76    return EXITLIST_NONCOREDLL;
     77#else
     78    return 0;
     79#endif
     80}
    9581
    96    /***********************************************************/
    97    /* A non-zero value must be returned to indicate success.  */
    98    /***********************************************************/
    99    return 1UL;
     82void SYSTEM DLL_TermDDraw(ULONG hModule)
     83{
     84#ifdef FULLSCREEN_DDRAW
     85    dprintf(("DDRAW processing exitlist"));
     86    RestorePM();
     87    dprintf(("DDRAW exitlist done"));
     88#endif
     89
     90    DiveUnload();
     91
     92    if (dllHandle)
     93       UnregisterLxDll(dllHandle);
    10094}
    101 //******************************************************************************
    102 //******************************************************************************
     95
     96ULONG SYSTEM DLL_Init(ULONG hModule)
     97{
     98    if (DLL_InitDefault(hModule) == -1)
     99        return -1;
     100    return DLL_InitDDraw(hModule);
     101}
     102
     103void SYSTEM DLL_Term(ULONG hModule)
     104{
     105    DLL_TermDDraw(hModule);
     106    DLL_TermDefault(hModule);
     107}
  • branches/gcc-kmk/src/ddraw/os2fsdd.cpp

    r6646 r21875  
    1515#include <misc.h>
    1616
    17 #include <svgadefs.h>
     17#include "svgadefs.h"
    1818
    1919#include "os2fsdd.h"
     
    5353static ULONG ulTotalModes;
    5454
    55 static bIsInFS = FALSE;
     55static BOOL bIsInFS = FALSE;
    5656
    5757/*
  • branches/gcc-kmk/src/ddraw/surface.cpp

    r21494 r21875  
    4444#include "wndproc.h"
    4545
    46 #ifndef __WATCOMC__
     46#ifdef __IBMC__
    4747  #include <builtin.h>
    4848#endif
  • branches/gcc-kmk/src/ddraw/surfacehlp.cpp

    r21494 r21875  
    314314  const struct {
    315315    DWORD  mask;
    316     char  *name;
     316    const char  *name;
    317317  } flags[] = {
    318318#define FE(x) { x, #x},
     
    339339  const struct {
    340340    DWORD  mask;
    341     char  *name;
     341    const char  *name;
    342342  } flags[] = {
    343343#define FE(x) { x, #x},
     
    357357  const struct {
    358358    DWORD  mask;
    359     char  *name;
     359    const char  *name;
    360360  } flags[] = {
    361361#define FE(x) { x, #x},
     
    397397  const struct {
    398398    DWORD  mask;
    399     char  *name;
     399    const char  *name;
    400400  } flags[] = {
    401401#define FE(x) { x, #x},
     
    441441  const struct {
    442442    DWORD  mask;
    443     char  *name;
     443    const char  *name;
    444444  } flags[] = {
    445445#define FE(x) { x, #x},
     
    462462  const struct {
    463463    DWORD  mask;
    464     char  *name;
     464    const char  *name;
    465465  } flags[] = {
    466466    FE(DDSD_CAPS)
     
    492492  const struct {
    493493    DWORD  mask;
    494     char  *name;
     494    const char  *name;
    495495  } flags[] = {
    496496#define FE(x) { x, #x},
     
    511511  const struct {
    512512    DWORD  mask;
    513     char  *name;
     513    const char  *name;
    514514  } flags[] = {
    515515#define FE(x) { x, #x},
  • branches/gcc-kmk/src/ddraw/surfblit.cpp

    r21494 r21875  
    4646#include "divewrap.h"
    4747
    48 #ifndef __WATCOMC__
     48#ifdef __IBMC__
    4949  #include <builtin.h>
    5050#endif
  • branches/gcc-kmk/src/ddraw/surfoverlay.cpp

    r21494 r21875  
    4545#include "wndproc.h"
    4646
    47 #ifndef __WATCOMC__
     47#ifdef __IBMC__
    4848  #include <builtin.h>
    4949#endif
  • branches/gcc-kmk/src/ddraw/svgadefs.h

    r21692 r21875  
    8282/* NOINC */
    8383
    84 #include <svgapmi.h>
     84#include "svgapmi.h"
    8585
    8686/* INC */
  • branches/gcc-kmk/src/ddraw/wndproc.c

    r9459 r21875  
    107107                           "WINE_DDRAW", "DirectDraw",
    108108                           WS_POPUP, 0, 0, dwWidth, dwHeight,
    109                            GetDesktopWindow(), 0, 0, hwndOwner);
     109                           GetDesktopWindow(), 0, 0, (LPVOID)hwndOwner);
    110110
    111111    SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
Note: See TracChangeset for help on using the changeset viewer.