Skip to content

Commit d067be4

Browse files
author
gogg
committed
Support for August 2009 DirectX SDK. New DTool configuration macros. Makepanda can now detect Window Framework 6.0A
1 parent 8d085f0 commit d067be4

File tree

6 files changed

+41
-8
lines changed

6 files changed

+41
-8
lines changed

dtool/Config.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@
732732
// Is DirectX9 available, and should we try to build with it?
733733
#define DX9_IPATH
734734
#define DX9_LPATH
735-
#define DX9_LIBS d3d9.lib d3dx9.lib dxerr9.lib
735+
#define DX9_LIBS d3d9.lib d3dx9.lib dxerr.lib
736736
#defer HAVE_DX9 $[libtest $[DX9_LPATH],$[DX9_LIBS]]
737737

738738
// Is OpenCV installed, and where?

dtool/src/dconfig/dconfig.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,16 @@ class EXPCL_DTOOLCONFIG DConfig {
5151
// phased out in favor of a simpler interface that does not require
5252
// static init.
5353

54+
// NOTE:
55+
// Having a macro called Configure proved to be problematic with some
56+
// DX9 headers. To avoid that in the future we provide a new family
57+
// of macros prefixed by DTool and deprecate the old ones, to be
58+
// removed from the codebase sometime in the future.
59+
5460
// This macro should appear in the config_*.h file.
5561

5662
#define ConfigureDecl(name, expcl, exptp)
63+
#define DToolConfigureDecl(name, expcl, exptp)
5764

5865
// This macro defines the actual declaration of the object defined
5966
// above; it should appear in the config_*.cxx file.
@@ -64,17 +71,26 @@ class EXPCL_DTOOLCONFIG DConfig {
6471
StaticInitializer_ ## name(); \
6572
}; \
6673
static StaticInitializer_ ## name name;
74+
#define DToolConfigureDef(name) \
75+
class StaticInitializer_ ## name { \
76+
public: \
77+
StaticInitializer_ ## name(); \
78+
}; \
79+
static StaticInitializer_ ## name name;
6780

6881
// This macro can be used in lieu of the above two when the Configure
6982
// object does not need to be visible outside of the current C file.
7083

7184
#define Configure(name) ConfigureDef(name)
85+
#define DToolConfigure(name) DToolConfigureDef(name)
7286

7387
// This one defines a block of code that will be executed at static
7488
// init time. It must always be defined (in the C file), even if no
7589
// code is to be executed.
7690

7791
#define ConfigureFn(name) \
7892
StaticInitializer_ ## name::StaticInitializer_ ## name()
93+
#define DToolConfigureFn(name) \
94+
StaticInitializer_ ## name::StaticInitializer_ ## name()
7995

8096
#endif /* __CONFIG_H__ */

makepanda/makepanda.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ def parseopts(args):
337337
LibDirectory(pkg, SDK[pkg] + '/lib')
338338
LibName(pkg, 'd3dVNUM.lib'.replace("VNUM", vnum))
339339
LibName(pkg, 'd3dxVNUM.lib'.replace("VNUM", vnum))
340-
LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
340+
if (vnum=="9"):
341+
LibName(pkg, 'dxerr.lib')
342+
else:
343+
LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
341344
LibName(pkg, 'ddraw.lib')
342345
LibName(pkg, 'dxguid.lib')
343346
LibName("WINSOCK", "wsock32.lib")

makepanda/makepandacore.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,9 +1252,18 @@ def SdkLocateDirectX():
12521252
if (sys.platform != "win32"): return
12531253
GetSdkDir("directx8", "DX8")
12541254
GetSdkDir("directx9", "DX9")
1255+
## We first try to locate the August SDK in 64 bits, then 32.
1256+
if ("DX9" not in SDK):
1257+
dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")
1258+
if (dir != 0):
1259+
SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
1260+
if ("DX9" not in SDK):
1261+
dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")
1262+
if (dir != 0):
1263+
SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
12551264
if ("DX9" not in SDK):
12561265
## Try to locate the key within the "new" March 2009 location in the registry (yecch):
1257-
dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (March 2009)", "InstallPath")
1266+
dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (March 2009)", "InstallPath")
12581267
if (dir != 0):
12591268
SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
12601269
archStr = "x86"
@@ -1376,7 +1385,11 @@ def SdkLocateMSPlatform():
13761385
if (platsdk == 0):
13771386
platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.1","InstallationFolder")
13781387
if (platsdk and not os.path.isdir(platsdk)): platsdk = 0
1379-
1388+
1389+
if (platsdk == 0):
1390+
platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A","InstallationFolder")
1391+
if (platsdk and not os.path.isdir(platsdk)): platsdk = 0
1392+
13801393
if (platsdk == 0 and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2"))):
13811394
if (platform.architecture()[0]!="64bit" or os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2", "Lib", "AMD64"))):
13821395
platsdk = os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2")

panda/src/dxgsg9/config_dxgsg9.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#include "dconfig.h"
3030

31-
Configure(config_dxgsg9);
31+
DToolConfigure(config_dxgsg9);
3232
NotifyCategoryDef(dxgsg9, ":display:gsg");
3333
NotifyCategoryDef(wdxdisplay9, "display");
3434

panda/src/dxgsg9/dxgsg9base.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929

3030
#define D3D_OVERLOADS // get D3DVECTOR '+' operator, etc from d3dtypes.h
3131
//#define D3D_DEBUG_INFO
32+
#undef Configure
3233
#include <d3d9.h>
3334
#include <d3dx9.h>
34-
#include <dxerr9.h>
35+
#include <dxerr.h>
3536
#undef WIN32_LEAN_AND_MEAN
3637

3738
#if (D3D_SDK_VERSION & 0xffff) < 32
@@ -40,9 +41,9 @@
4041

4142
#ifndef D3DERRORSTRING
4243
#ifdef NDEBUG
43-
#define D3DERRORSTRING(HRESULT) " at (" << __FILE__ << ":" << __LINE__ << "), hr=" << DXGetErrorString9(HRESULT) << endl // leave out descriptions to shrink release build
44+
#define D3DERRORSTRING(HRESULT) " at (" << __FILE__ << ":" << __LINE__ << "), hr=" << DXGetErrorString(HRESULT) << endl // leave out descriptions to shrink release build
4445
#else
45-
#define D3DERRORSTRING(HRESULT) " at (" << __FILE__ << ":" << __LINE__ << "), hr=" << DXGetErrorString9(HRESULT) << ": " << DXGetErrorDescription9(HRESULT) << endl
46+
#define D3DERRORSTRING(HRESULT) " at (" << __FILE__ << ":" << __LINE__ << "), hr=" << DXGetErrorString(HRESULT) << ": " << DXGetErrorDescription(HRESULT) << endl
4647
#endif
4748
#endif
4849

0 commit comments

Comments
 (0)