Browse Source

add ability to compile on vc6 w/o platformsdk

cxgeorge 24 years ago
parent
commit
678119f028

+ 4 - 4
panda/src/wgldisplay/Sources.pp

@@ -9,16 +9,16 @@
     glgsg display putil
     glgsg display putil
     
     
   #define COMBINED_SOURCES $[TARGET]_composite1.cxx 
   #define COMBINED_SOURCES $[TARGET]_composite1.cxx 
+  
+  #define INSTALL_HEADERS \
+     config_wgldisplay.h wglGraphicsPipe.h wglGraphicsWindow.h Win32Defs.h  
 
 
   #define SOURCES \
   #define SOURCES \
-    config_wgldisplay.h wglGraphicsPipe.h wglGraphicsWindow.cxx wglGraphicsWindow.h wglext.h
+    wglGraphicsWindow.cxx wglext.h $[INSTALL_HEADERS]
     
     
   #define INCLUDED_SOURCES \
   #define INCLUDED_SOURCES \
     config_wgldisplay.cxx wglGraphicsPipe.cxx
     config_wgldisplay.cxx wglGraphicsPipe.cxx
 
 
-  #define INSTALL_HEADERS \
-     config_wgldisplay.h wglGraphicsPipe.h wglGraphicsWindow.h
-
 #end lib_target
 #end lib_target
 
 
 #begin test_bin_target
 #begin test_bin_target

+ 33 - 0
panda/src/wgldisplay/Win32Defs.h

@@ -0,0 +1,33 @@
+
+// This file exists so OGL can compile with original VC6 headers 
+// without latest MS Platform SDK.  It simply reproduces all the
+// necessary defs here
+
+#ifndef DECLSPEC_SELECTANY
+#define DECLSPEC_SELECTANY  __declspec(selectany)
+#endif
+
+#ifndef SetClassLongPtr
+#define SetClassLongPtr SetClassLong
+#endif
+
+#ifndef GCLP_HCURSOR
+#define GCLP_HCURSOR GCL_HCURSOR
+#endif
+
+#ifndef SPI_GETMOUSEVANISH
+// from WinXP winuser.h
+#define SPI_GETMOUSEVANISH                  0x1020
+#define SPI_SETMOUSEVANISH                  0x1021
+#endif
+
+#ifndef SPI_GETCURSORSHADOW
+#define SPI_GETCURSORSHADOW                 0x101A
+#define SPI_SETCURSORSHADOW                 0x101B
+#endif
+
+#ifndef __int3264 
+#define LONG_PTR LONG
+#endif
+
+

+ 4 - 30
panda/src/wgldisplay/wglGraphicsWindow.cxx

@@ -32,6 +32,7 @@
 #include <throw_event.h>
 #include <throw_event.h>
 //#include <eventQueue.h>
 //#include <eventQueue.h>
 #include <string.h>
 #include <string.h>
+#include "Win32Defs.h"
 
 
 #define WGL_WGLEXT_PROTOTYPES
 #define WGL_WGLEXT_PROTOTYPES
 #include "wglext.h"
 #include "wglext.h"
@@ -204,6 +205,7 @@ void AtExitFn() {
 #define MY_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
 #define MY_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
         EXTERN_C const GUID DECLSPEC_SELECTANY name \
         EXTERN_C const GUID DECLSPEC_SELECTANY name \
                 = { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
                 = { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
+                
 MY_DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 );
 MY_DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 );
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -261,7 +263,7 @@ static DWORD GetAvailVidMem(void) {
     // to figure out optimal mode using this estimate
     // to figure out optimal mode using this estimate
     DDSCAPS ddsCaps;
     DDSCAPS ddsCaps;
     DWORD dwTotal,dwFree;
     DWORD dwTotal,dwFree;
-    ZeroMemory(&ddsCaps,sizeof(DDSCAPS2));
+    ZeroMemory(&ddsCaps,sizeof(DDSCAPS));
     ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY; //set internally by DX anyway, dont think this any different than 0x0
     ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY; //set internally by DX anyway, dont think this any different than 0x0
 
 
     if(FAILED(hr = pDD2->GetAvailableVidMem(&ddsCaps,&dwTotal,&dwFree))) {
     if(FAILED(hr = pDD2->GetAvailableVidMem(&ddsCaps,&dwTotal,&dwFree))) {
@@ -2138,22 +2140,6 @@ extern char *ConvDDErrorToString(const HRESULT &error) {
         case DD_OK:
         case DD_OK:
             return "No error.\0";
             return "No error.\0";
 
 
-        case DDERR_NOSTEREOHARDWARE       : // ( 181 )
-            return "DDERR_NOSTEREOHARDWARE      ";//: // ( 181 )
-        case DDERR_NOSURFACELEFT              : // ( 182 )
-            return "DDERR_NOSURFACELEFT             ";//: // ( 182 )
-        case DDERR_DDSCAPSCOMPLEXREQUIRED            : // ( 542 )
-            return "DDERR_DDSCAPSCOMPLEXREQUIRED";//: // ( 542 )
-        case DDERR_NOTONMIPMAPSUBLEVEL               : // ( 603 )
-            return "DDERR_NOTONMIPMAPSUBLEVEL";//: // ( 603 )
-        case DDERR_TESTFINISHED                      : // ( 692 )
-            return "DDERR_TESTFINISHED";//: // ( 692 )
-        case DDERR_NEWMODE                           : // ( 693 )
-            return "DDERR_NEWMODE";//: // ( 693 )
-//#endif
-    //case D3DERR_COMMAND_UNPARSED              : // (3000)
-    /// return "case";//D3DERR_COMMAND_UNPARSED              : // (3000)
-
         case DDERR_ALREADYINITIALIZED     : // ( 5 )
         case DDERR_ALREADYINITIALIZED     : // ( 5 )
             return "DDERR_ALREADYINITIALIZED        ";//: // ( 5 )
             return "DDERR_ALREADYINITIALIZED        ";//: // ( 5 )
         case DDERR_CANNOTATTACHSURFACE        : // ( 10 )
         case DDERR_CANNOTATTACHSURFACE        : // ( 10 )
@@ -2209,9 +2195,7 @@ extern char *ConvDDErrorToString(const HRESULT &error) {
         case DDERR_NOTFOUND               : // ( 255 )
         case DDERR_NOTFOUND               : // ( 255 )
             return "DDERR_NOTFOUND              ";//: // ( 255 )
             return "DDERR_NOTFOUND              ";//: // ( 255 )
         case DDERR_NOOVERLAYHW            : // ( 260 )
         case DDERR_NOOVERLAYHW            : // ( 260 )
-            return "DDERR_NOOVERLAYHW           ";//: // ( 260 )
-        case DDERR_OVERLAPPINGRECTS           : // ( 270 )
-            return "DDERR_OVERLAPPINGRECTS          ";//: // ( 270 )
+        return "DDERR_NOOVERLAYHW           ";//: // ( 260 )
         case DDERR_NORASTEROPHW           : // ( 280 )
         case DDERR_NORASTEROPHW           : // ( 280 )
             return "DDERR_NORASTEROPHW          ";//: // ( 280 )
             return "DDERR_NORASTEROPHW          ";//: // ( 280 )
         case DDERR_NOROTATIONHW           : // ( 290 )
         case DDERR_NOROTATIONHW           : // ( 290 )
@@ -2268,8 +2252,6 @@ extern char *ConvDDErrorToString(const HRESULT &error) {
             return "DDERR_UNSUPPORTEDFORMAT         ";//: // ( 510 )
             return "DDERR_UNSUPPORTEDFORMAT         ";//: // ( 510 )
         case DDERR_UNSUPPORTEDMASK            : // ( 520 )
         case DDERR_UNSUPPORTEDMASK            : // ( 520 )
             return "DDERR_UNSUPPORTEDMASK           ";//: // ( 520 )
             return "DDERR_UNSUPPORTEDMASK           ";//: // ( 520 )
-        case DDERR_INVALIDSTREAM                     : // ( 521 )
-            return "DDERR_INVALIDSTREAM";//: // ( 521 )
         case DDERR_VERTICALBLANKINPROGRESS        : // ( 537 )
         case DDERR_VERTICALBLANKINPROGRESS        : // ( 537 )
             return "DDERR_VERTICALBLANKINPROGRESS       ";//: // ( 537 )
             return "DDERR_VERTICALBLANKINPROGRESS       ";//: // ( 537 )
         case DDERR_WASSTILLDRAWING            : // ( 540 )
         case DDERR_WASSTILLDRAWING            : // ( 540 )
@@ -2358,8 +2340,6 @@ extern char *ConvDDErrorToString(const HRESULT &error) {
             return "DDERR_NOTPAGELOCKED         ";//: // ( 680 )
             return "DDERR_NOTPAGELOCKED         ";//: // ( 680 )
         case DDERR_MOREDATA                   : // ( 690 )
         case DDERR_MOREDATA                   : // ( 690 )
             return "DDERR_MOREDATA                  ";//: // ( 690 )
             return "DDERR_MOREDATA                  ";//: // ( 690 )
-        case DDERR_EXPIRED                           : // ( 691 )
-            return "DDERR_EXPIRED";//: // ( 691 )
         case DDERR_VIDEONOTACTIVE             : // ( 695 )
         case DDERR_VIDEONOTACTIVE             : // ( 695 )
             return "DDERR_VIDEONOTACTIVE            ";//: // ( 695 )
             return "DDERR_VIDEONOTACTIVE            ";//: // ( 695 )
         case DDERR_DEVICEDOESNTOWNSURFACE         : // ( 699 )
         case DDERR_DEVICEDOESNTOWNSURFACE         : // ( 699 )
@@ -3414,12 +3394,6 @@ extern char *ConvDDErrorToString(const HRESULT &error) {
 static int iMouseTrails;
 static int iMouseTrails;
 static bool bCursorShadowOn,bMouseVanish;
 static bool bCursorShadowOn,bMouseVanish;
 
 
-#ifndef SPI_GETMOUSEVANISH
-// get of this when we upgrade to winxp winuser.h
-#define SPI_GETMOUSEVANISH                  0x1020
-#define SPI_SETMOUSEVANISH                  0x1021
-#endif
-
 void set_global_parameters(void) {
 void set_global_parameters(void) {
   // turn off mousetrails and cursor shadow and mouse cursor vanish
   // turn off mousetrails and cursor shadow and mouse cursor vanish
   // cursor shadow causes cursor blink and reduced frame rate due to lack of driver support for 
   // cursor shadow causes cursor blink and reduced frame rate due to lack of driver support for