Browse Source

Support for August 2009 DirectX SDK. New DTool configuration macros. Makepanda can now detect Window Framework 6.0A

gogg 16 years ago
parent
commit
d067be47f5

+ 1 - 1
dtool/Config.pp

@@ -732,7 +732,7 @@
 // Is DirectX9 available, and should we try to build with it?
 #define DX9_IPATH
 #define DX9_LPATH
-#define DX9_LIBS d3d9.lib d3dx9.lib dxerr9.lib
+#define DX9_LIBS d3d9.lib d3dx9.lib dxerr.lib
 #defer HAVE_DX9 $[libtest $[DX9_LPATH],$[DX9_LIBS]]
 
 // Is OpenCV installed, and where?

+ 16 - 0
dtool/src/dconfig/dconfig.h

@@ -51,9 +51,16 @@ PUBLISHED:
 // phased out in favor of a simpler interface that does not require
 // static init.
 
+// NOTE:
+// Having a macro called Configure proved to be problematic with some
+// DX9 headers. To avoid that in the future we provide a new family
+// of macros prefixed by DTool and deprecate the old ones, to be
+// removed from the codebase sometime in the future.
+
 // This macro should appear in the config_*.h file.
 
 #define ConfigureDecl(name, expcl, exptp)
+#define DToolConfigureDecl(name, expcl, exptp)
 
 // This macro defines the actual declaration of the object defined
 // above; it should appear in the config_*.cxx file.
@@ -64,11 +71,18 @@ PUBLISHED:
     StaticInitializer_ ## name(); \
   }; \
   static StaticInitializer_ ## name name;
+#define DToolConfigureDef(name) \
+  class StaticInitializer_ ## name { \
+  public: \
+    StaticInitializer_ ## name(); \
+  }; \
+  static StaticInitializer_ ## name name;
 
 // This macro can be used in lieu of the above two when the Configure
 // object does not need to be visible outside of the current C file.
 
 #define Configure(name) ConfigureDef(name)
+#define DToolConfigure(name) DToolConfigureDef(name)
 
 // This one defines a block of code that will be executed at static
 // init time.  It must always be defined (in the C file), even if no
@@ -76,5 +90,7 @@ PUBLISHED:
 
 #define ConfigureFn(name) \
   StaticInitializer_ ## name::StaticInitializer_ ## name()
+#define DToolConfigureFn(name) \
+  StaticInitializer_ ## name::StaticInitializer_ ## name()
 
 #endif /* __CONFIG_H__ */

+ 4 - 1
makepanda/makepanda.py

@@ -337,7 +337,10 @@ if (COMPILER=="MSVC"):
             LibDirectory(pkg, SDK[pkg] + '/lib')
             LibName(pkg, 'd3dVNUM.lib'.replace("VNUM", vnum))
             LibName(pkg, 'd3dxVNUM.lib'.replace("VNUM", vnum))
-            LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
+            if (vnum=="9"):
+                LibName(pkg, 'dxerr.lib')
+            else:
+                LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
             LibName(pkg, 'ddraw.lib')
             LibName(pkg, 'dxguid.lib')
     LibName("WINSOCK", "wsock32.lib")

+ 15 - 2
makepanda/makepandacore.py

@@ -1252,9 +1252,18 @@ def SdkLocateDirectX():
     if (sys.platform != "win32"): return
     GetSdkDir("directx8", "DX8")
     GetSdkDir("directx9", "DX9")
+    ## We first try to locate the August SDK in 64 bits, then 32.
+    if ("DX9" not in SDK):
+        dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")		
+        if (dir != 0):
+            SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
+    if ("DX9" not in SDK):
+        dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")		
+        if (dir != 0):
+            SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
     if ("DX9" not in SDK):
         ## 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")		
         if (dir != 0):
             SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
     archStr = "x86" 
@@ -1376,7 +1385,11 @@ def SdkLocateMSPlatform():
     if (platsdk == 0):
         platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.1","InstallationFolder")
         if (platsdk and not os.path.isdir(platsdk)): platsdk = 0
-    
+
+    if (platsdk == 0):
+        platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A","InstallationFolder")
+        if (platsdk and not os.path.isdir(platsdk)): platsdk = 0
+		
     if (platsdk == 0 and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2"))):
         if (platform.architecture()[0]!="64bit" or os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2", "Lib", "AMD64"))):
             platsdk = os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2")

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

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

+ 4 - 3
panda/src/dxgsg9/dxgsg9base.h

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