Explorar el Código

Compatibility with DX SDK August 2009 that shouldn't break older SDKs. SECURE_SCL settings restored in makepanda.

gogg hace 16 años
padre
commit
fbbc5bb9e6

+ 9 - 1
makepanda/makepanda.py

@@ -46,6 +46,7 @@ RUNTIME=0
 DISTRIBUTOR=""
 DISTRIBUTOR=""
 VERSION=None
 VERSION=None
 OSXTARGET=None
 OSXTARGET=None
+
 if "MACOSX_DEPLOYMENT_TARGET" in os.environ:
 if "MACOSX_DEPLOYMENT_TARGET" in os.environ:
     OSXTARGET=os.environ["MACOSX_DEPLOYMENT_TARGET"]
     OSXTARGET=os.environ["MACOSX_DEPLOYMENT_TARGET"]
 
 
@@ -337,7 +338,7 @@ if (COMPILER=="MSVC"):
             LibDirectory(pkg, SDK[pkg] + '/lib')
             LibDirectory(pkg, SDK[pkg] + '/lib')
             LibName(pkg, 'd3dVNUM.lib'.replace("VNUM", vnum))
             LibName(pkg, 'd3dVNUM.lib'.replace("VNUM", vnum))
             LibName(pkg, 'd3dxVNUM.lib'.replace("VNUM", vnum))
             LibName(pkg, 'd3dxVNUM.lib'.replace("VNUM", vnum))
-            if (vnum=="9"):
+            if (vnum=="9" and "GENERIC_DXERR_LIBRARY" in SDK):
                 LibName(pkg, 'dxerr.lib')
                 LibName(pkg, 'dxerr.lib')
             else:
             else:
                 LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
                 LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
@@ -1338,6 +1339,8 @@ DTOOL_CONFIG=[
     ("HAVE_TINYXML",                   'UNDEF',                  'UNDEF'),
     ("HAVE_TINYXML",                   'UNDEF',                  'UNDEF'),
     ("HAVE_OPENAL_FRAMEWORK",          'UNDEF',                  'UNDEF'),
     ("HAVE_OPENAL_FRAMEWORK",          'UNDEF',                  'UNDEF'),
     ("PRC_SAVE_DESCRIPTIONS",          '1',                      '1'),
     ("PRC_SAVE_DESCRIPTIONS",          '1',                      '1'),
+    ("_SECURE_SCL",                    '1',                      'UNDEF'),	 
+    ("_SECURE_SCL_THROWS",             '0',                      'UNDEF'),
     ("HAVE_P3D_PLUGIN",                'UNDEF',                  'UNDEF'),
     ("HAVE_P3D_PLUGIN",                'UNDEF',                  'UNDEF'),
 ]
 ]
 
 
@@ -1453,6 +1456,11 @@ def WriteConfigSettings():
     if (RUNTIME):
     if (RUNTIME):
         dtool_config["HAVE_P3D_PLUGIN"] = '1'
         dtool_config["HAVE_P3D_PLUGIN"] = '1'
 
 
+    if ("GENERIC_DXERR_LIBRARY" in SDK):
+        dtool_config["USE_GENERIC_DXERR_LIBRARY"] = "1"
+    else:
+        dtool_config["USE_GENERIC_DXERR_LIBRARY"] = "UNDEF"
+
     conf = "/* prc_parameters.h.  Generated automatically by makepanda.py */\n"
     conf = "/* prc_parameters.h.  Generated automatically by makepanda.py */\n"
     for key in prc_parameters.keys():
     for key in prc_parameters.keys():
         if ((key == "DEFAULT_PRC_DIR") or (key[:4]=="PRC_")):
         if ((key == "DEFAULT_PRC_DIR") or (key[:4]=="PRC_")):

+ 2 - 0
makepanda/makepandacore.py

@@ -1257,10 +1257,12 @@ def SdkLocateDirectX():
         dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")		
         dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")		
         if (dir != 0):
         if (dir != 0):
             SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
             SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
+            SDK["GENERIC_DXERR_LIBRARY"] = 1;
     if ("DX9" not in SDK):
     if ("DX9" not in SDK):
         dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")		
         dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")		
         if (dir != 0):
         if (dir != 0):
             SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
             SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
+            SDK["GENERIC_DXERR_LIBRARY"] = 1;
     if ("DX9" not in SDK):
     if ("DX9" not in SDK):
         ## Try to locate the key within the "new" March 2009 location in the registry (yecch):
         ## Try to locate the key within the "new" March 2009 location in the registry (yecch):
         dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (March 2009)", "InstallPath")		
         dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (March 2009)", "InstallPath")		

+ 1 - 1
panda/src/dxgsg9/config_dxgsg9.cxx

@@ -28,7 +28,7 @@
 
 
 #include "dconfig.h"
 #include "dconfig.h"
 
 
-Configure(config_dxgsg9);
+DToolConfigure(config_dxgsg9);
 NotifyCategoryDef(dxgsg9, ":display:gsg");
 NotifyCategoryDef(dxgsg9, ":display:gsg");
 NotifyCategoryDef(wdxdisplay9, "display");
 NotifyCategoryDef(wdxdisplay9, "display");
 
 

+ 14 - 2
panda/src/dxgsg9/dxgsg9base.h

@@ -29,9 +29,21 @@
 
 
 #define D3D_OVERLOADS   //  get D3DVECTOR '+' operator, etc from d3dtypes.h
 #define D3D_OVERLOADS   //  get D3DVECTOR '+' operator, etc from d3dtypes.h
 //#define D3D_DEBUG_INFO
 //#define D3D_DEBUG_INFO
+
+#undef Configure
 #include <d3d9.h>
 #include <d3d9.h>
 #include <d3dx9.h>
 #include <d3dx9.h>
+
+#ifdef USE_GENERIC_DXERR_LIBRARY
+#include <dxerr.h>
+#define DX_GET_ERROR_STRING_FUNC DXGetErrorString
+#define DX_GET_ERROR_DESCRIPTION_FUNC DXGetErrorDescription
+#else
 #include <dxerr9.h>
 #include <dxerr9.h>
+#define DX_GET_ERROR_STRING_FUNC DXGetErrorString9
+#define DX_GET_ERROR_DESCRIPTION_FUNC DXGetErrorDescription9
+#endif
+
 #undef WIN32_LEAN_AND_MEAN
 #undef WIN32_LEAN_AND_MEAN
 
 
 #if (D3D_SDK_VERSION & 0xffff) < 32
 #if (D3D_SDK_VERSION & 0xffff) < 32
@@ -40,9 +52,9 @@
 
 
 #ifndef D3DERRORSTRING
 #ifndef D3DERRORSTRING
 #ifdef NDEBUG
 #ifdef NDEBUG
-#define D3DERRORSTRING(HRESULT) " at (" << __FILE__ << ":" << __LINE__ << "), hr=" <<  DXGetErrorString9(HRESULT) << endl  // leave out descriptions to shrink release build
+#define D3DERRORSTRING(HRESULT) " at (" << __FILE__ << ":" << __LINE__ << "), hr=" <<  DX_GET_ERROR_STRING_FUNC(HRESULT) << endl  // leave out descriptions to shrink release build
 #else
 #else
-#define D3DERRORSTRING(HRESULT) " at (" << __FILE__ << ":" << __LINE__ << "), hr=" <<  DXGetErrorString9(HRESULT) << ": " << DXGetErrorDescription9(HRESULT) << endl
+#define D3DERRORSTRING(HRESULT) " at (" << __FILE__ << ":" << __LINE__ << "), hr=" <<  DX_GET_ERROR_STRING_FUNC(HRESULT) << ": " << DX_GET_ERROR_DESCRIPTION_FUNC(HRESULT) << endl
 #endif
 #endif
 #endif
 #endif