Subversion Repositories Games.Chess Giants

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  4. //
  5. //  File:       d3dx9xof.h
  6. //  Content:    D3DX .X File types and functions
  7. //
  8. ///////////////////////////////////////////////////////////////////////////
  9.  
  10. #include "d3dx9.h"
  11.  
  12. #if !defined( __D3DX9XOF_H__ )
  13. #define __D3DX9XOF_H__
  14.  
  15. #if defined( __cplusplus )
  16. extern "C" {
  17. #endif // defined( __cplusplus )
  18.  
  19. //----------------------------------------------------------------------------
  20. // D3DXF_FILEFORMAT
  21. //   This flag is used to specify what file type to use when saving to disk.
  22. //   _BINARY, and _TEXT are mutually exclusive, while
  23. //   _COMPRESSED is an optional setting that works with all file types.
  24. //----------------------------------------------------------------------------
  25. typedef DWORD D3DXF_FILEFORMAT;
  26.  
  27. #define D3DXF_FILEFORMAT_BINARY          0
  28. #define D3DXF_FILEFORMAT_TEXT            1
  29. #define D3DXF_FILEFORMAT_COMPRESSED      2
  30.  
  31. //----------------------------------------------------------------------------
  32. // D3DXF_FILESAVEOPTIONS
  33. //   This flag is used to specify where to save the file to. Each flag is
  34. //   mutually exclusive, indicates the data location of the file, and also
  35. //   chooses which additional data will specify the location.
  36. //   _TOFILE is paired with a filename (LPCSTR)
  37. //   _TOWFILE is paired with a filename (LPWSTR)
  38. //----------------------------------------------------------------------------
  39. typedef DWORD D3DXF_FILESAVEOPTIONS;
  40.  
  41. #define D3DXF_FILESAVE_TOFILE     0x00L
  42. #define D3DXF_FILESAVE_TOWFILE    0x01L
  43.  
  44. //----------------------------------------------------------------------------
  45. // D3DXF_FILELOADOPTIONS
  46. //   This flag is used to specify where to load the file from. Each flag is
  47. //   mutually exclusive, indicates the data location of the file, and also
  48. //   chooses which additional data will specify the location.
  49. //   _FROMFILE is paired with a filename (LPCSTR)
  50. //   _FROMWFILE is paired with a filename (LPWSTR)
  51. //   _FROMRESOURCE is paired with a (D3DXF_FILELOADRESOUCE*) description.
  52. //   _FROMMEMORY is paired with a (D3DXF_FILELOADMEMORY*) description.
  53. //----------------------------------------------------------------------------
  54. typedef DWORD D3DXF_FILELOADOPTIONS;
  55.  
  56. #define D3DXF_FILELOAD_FROMFILE     0x00L
  57. #define D3DXF_FILELOAD_FROMWFILE    0x01L
  58. #define D3DXF_FILELOAD_FROMRESOURCE 0x02L
  59. #define D3DXF_FILELOAD_FROMMEMORY   0x03L
  60.  
  61. //----------------------------------------------------------------------------
  62. // D3DXF_FILELOADRESOURCE:
  63. //----------------------------------------------------------------------------
  64.  
  65. typedef struct _D3DXF_FILELOADRESOURCE
  66. {
  67.     HMODULE hModule; // Desc
  68.     LPCSTR lpName;  // Desc
  69.     LPCSTR lpType;  // Desc
  70. } D3DXF_FILELOADRESOURCE;
  71.  
  72. //----------------------------------------------------------------------------
  73. // D3DXF_FILELOADMEMORY:
  74. //----------------------------------------------------------------------------
  75.  
  76. typedef struct _D3DXF_FILELOADMEMORY
  77. {
  78.     LPCVOID lpMemory; // Desc
  79.     SIZE_T  dSize;     // Desc
  80. } D3DXF_FILELOADMEMORY;
  81.  
  82. #if defined( _WIN32 ) && !defined( _NO_COM )
  83.  
  84. // {cef08cf9-7b4f-4429-9624-2a690a933201}
  85. DEFINE_GUID( IID_ID3DXFile,
  86. 0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  87.  
  88. // {cef08cfa-7b4f-4429-9624-2a690a933201}
  89. DEFINE_GUID( IID_ID3DXFileSaveObject,
  90. 0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  91.  
  92. // {cef08cfb-7b4f-4429-9624-2a690a933201}
  93. DEFINE_GUID( IID_ID3DXFileSaveData,
  94. 0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  95.  
  96. // {cef08cfc-7b4f-4429-9624-2a690a933201}
  97. DEFINE_GUID( IID_ID3DXFileEnumObject,
  98. 0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  99.  
  100. // {cef08cfd-7b4f-4429-9624-2a690a933201}
  101. DEFINE_GUID( IID_ID3DXFileData,
  102. 0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  103.  
  104. #endif // defined( _WIN32 ) && !defined( _NO_COM )
  105.  
  106. #if defined( __cplusplus )
  107. #if !defined( DECLSPEC_UUID )
  108. #if _MSC_VER >= 1100
  109. #define DECLSPEC_UUID( x ) __declspec( uuid( x ) )
  110. #else // !( _MSC_VER >= 1100 )
  111. #define DECLSPEC_UUID( x )
  112. #endif // !( _MSC_VER >= 1100 )
  113. #endif // !defined( DECLSPEC_UUID )
  114.  
  115. interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" )
  116.     ID3DXFile;
  117. interface DECLSPEC_UUID( "cef08cfa-7b4f-4429-9624-2a690a933201" )
  118.     ID3DXFileSaveObject;
  119. interface DECLSPEC_UUID( "cef08cfb-7b4f-4429-9624-2a690a933201" )
  120.     ID3DXFileSaveData;
  121. interface DECLSPEC_UUID( "cef08cfc-7b4f-4429-9624-2a690a933201" )
  122.     ID3DXFileEnumObject;
  123. interface DECLSPEC_UUID( "cef08cfd-7b4f-4429-9624-2a690a933201" )
  124.     ID3DXFileData;
  125.  
  126. #if defined( _COM_SMARTPTR_TYPEDEF )
  127. _COM_SMARTPTR_TYPEDEF( ID3DXFile,
  128.     __uuidof( ID3DXFile ) );
  129. _COM_SMARTPTR_TYPEDEF( ID3DXFileSaveObject,
  130.     __uuidof( ID3DXFileSaveObject ) );
  131. _COM_SMARTPTR_TYPEDEF( ID3DXFileSaveData,
  132.     __uuidof( ID3DXFileSaveData ) );
  133. _COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject,
  134.     __uuidof( ID3DXFileEnumObject ) );
  135. _COM_SMARTPTR_TYPEDEF( ID3DXFileData,
  136.     __uuidof( ID3DXFileData ) );
  137. #endif // defined( _COM_SMARTPTR_TYPEDEF )
  138. #endif // defined( __cplusplus )
  139.  
  140. typedef interface ID3DXFile ID3DXFile;
  141. typedef interface ID3DXFileSaveObject ID3DXFileSaveObject;
  142. typedef interface ID3DXFileSaveData ID3DXFileSaveData;
  143. typedef interface ID3DXFileEnumObject ID3DXFileEnumObject;
  144. typedef interface ID3DXFileData ID3DXFileData;
  145.  
  146. //////////////////////////////////////////////////////////////////////////////
  147. // ID3DXFile /////////////////////////////////////////////////////////////////
  148. //////////////////////////////////////////////////////////////////////////////
  149.  
  150. #undef INTERFACE
  151. #define INTERFACE ID3DXFile
  152.  
  153. DECLARE_INTERFACE_( ID3DXFile, IUnknown )
  154. {
  155.     STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  156.     STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  157.     STDMETHOD_( ULONG, Release )( THIS ) PURE;
  158.    
  159.     STDMETHOD( CreateEnumObject )( THIS_ LPCVOID, D3DXF_FILELOADOPTIONS,
  160.         ID3DXFileEnumObject** ) PURE;
  161.     STDMETHOD( CreateSaveObject )( THIS_ LPCVOID, D3DXF_FILESAVEOPTIONS,
  162.         D3DXF_FILEFORMAT, ID3DXFileSaveObject** ) PURE;
  163.     STDMETHOD( RegisterTemplates )( THIS_ LPCVOID, SIZE_T ) PURE;
  164.     STDMETHOD( RegisterEnumTemplates )( THIS_ ID3DXFileEnumObject* ) PURE;
  165. };
  166.  
  167. //////////////////////////////////////////////////////////////////////////////
  168. // ID3DXFileSaveObject ///////////////////////////////////////////////////////
  169. //////////////////////////////////////////////////////////////////////////////
  170.  
  171. #undef INTERFACE
  172. #define INTERFACE ID3DXFileSaveObject
  173.  
  174. DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown )
  175. {
  176.     STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  177.     STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  178.     STDMETHOD_( ULONG, Release )( THIS ) PURE;
  179.    
  180.     STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE;
  181.     STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*,
  182.         SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE;
  183.     STDMETHOD( Save )( THIS ) PURE;
  184. };
  185.  
  186. //////////////////////////////////////////////////////////////////////////////
  187. // ID3DXFileSaveData /////////////////////////////////////////////////////////
  188. //////////////////////////////////////////////////////////////////////////////
  189.  
  190. #undef INTERFACE
  191. #define INTERFACE ID3DXFileSaveData
  192.  
  193. DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown )
  194. {
  195.     STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  196.     STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  197.     STDMETHOD_( ULONG, Release )( THIS ) PURE;
  198.    
  199.     STDMETHOD( GetSave )( THIS_ ID3DXFileSaveObject** ) PURE;
  200.     STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE;
  201.     STDMETHOD( GetId )( THIS_ LPGUID ) PURE;
  202.     STDMETHOD( GetType )( THIS_ GUID* ) PURE;
  203.     STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*,
  204.         SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE;
  205.     STDMETHOD( AddDataReference )( THIS_ LPCSTR, CONST GUID* ) PURE;
  206. };
  207.  
  208. //////////////////////////////////////////////////////////////////////////////
  209. // ID3DXFileEnumObject ///////////////////////////////////////////////////////
  210. //////////////////////////////////////////////////////////////////////////////
  211.  
  212. #undef INTERFACE
  213. #define INTERFACE ID3DXFileEnumObject
  214.  
  215. DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown )
  216. {
  217.     STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  218.     STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  219.     STDMETHOD_( ULONG, Release )( THIS ) PURE;
  220.    
  221.     STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE;
  222.     STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE;
  223.     STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE;
  224.     STDMETHOD( GetDataObjectById )( THIS_ REFGUID, ID3DXFileData** ) PURE;
  225.     STDMETHOD( GetDataObjectByName )( THIS_ LPCSTR, ID3DXFileData** ) PURE;
  226. };
  227.  
  228. //////////////////////////////////////////////////////////////////////////////
  229. // ID3DXFileData /////////////////////////////////////////////////////////////
  230. //////////////////////////////////////////////////////////////////////////////
  231.  
  232. #undef INTERFACE
  233. #define INTERFACE ID3DXFileData
  234.  
  235. DECLARE_INTERFACE_( ID3DXFileData, IUnknown )
  236. {
  237.     STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  238.     STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  239.     STDMETHOD_( ULONG, Release )( THIS ) PURE;
  240.    
  241.     STDMETHOD( GetEnum )( THIS_ ID3DXFileEnumObject** ) PURE;
  242.     STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE;
  243.     STDMETHOD( GetId )( THIS_ LPGUID ) PURE;
  244.     STDMETHOD( Lock )( THIS_ SIZE_T*, LPCVOID* ) PURE;
  245.     STDMETHOD( Unlock )( THIS ) PURE;
  246.     STDMETHOD( GetType )( THIS_ GUID* ) PURE;
  247.     STDMETHOD_( BOOL, IsReference )( THIS ) PURE;
  248.     STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE;
  249.     STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE;
  250. };
  251.  
  252. STDAPI D3DXFileCreate( ID3DXFile** lplpDirectXFile );
  253.  
  254. /*
  255.  * DirectX File errors.
  256.  */
  257.  
  258. #define _FACD3DXF 0x876
  259.  
  260. #define D3DXFERR_BADOBJECT              MAKE_HRESULT( 1, _FACD3DXF, 900 )
  261. #define D3DXFERR_BADVALUE               MAKE_HRESULT( 1, _FACD3DXF, 901 )
  262. #define D3DXFERR_BADTYPE                MAKE_HRESULT( 1, _FACD3DXF, 902 )
  263. #define D3DXFERR_NOTFOUND               MAKE_HRESULT( 1, _FACD3DXF, 903 )
  264. #define D3DXFERR_NOTDONEYET             MAKE_HRESULT( 1, _FACD3DXF, 904 )
  265. #define D3DXFERR_FILENOTFOUND           MAKE_HRESULT( 1, _FACD3DXF, 905 )
  266. #define D3DXFERR_RESOURCENOTFOUND       MAKE_HRESULT( 1, _FACD3DXF, 906 )
  267. #define D3DXFERR_BADRESOURCE            MAKE_HRESULT( 1, _FACD3DXF, 907 )
  268. #define D3DXFERR_BADFILETYPE            MAKE_HRESULT( 1, _FACD3DXF, 908 )
  269. #define D3DXFERR_BADFILEVERSION         MAKE_HRESULT( 1, _FACD3DXF, 909 )
  270. #define D3DXFERR_BADFILEFLOATSIZE       MAKE_HRESULT( 1, _FACD3DXF, 910 )
  271. #define D3DXFERR_BADFILE                MAKE_HRESULT( 1, _FACD3DXF, 911 )
  272. #define D3DXFERR_PARSEERROR             MAKE_HRESULT( 1, _FACD3DXF, 912 )
  273. #define D3DXFERR_BADARRAYSIZE           MAKE_HRESULT( 1, _FACD3DXF, 913 )
  274. #define D3DXFERR_BADDATAREFERENCE       MAKE_HRESULT( 1, _FACD3DXF, 914 )
  275. #define D3DXFERR_NOMOREOBJECTS          MAKE_HRESULT( 1, _FACD3DXF, 915 )
  276. #define D3DXFERR_NOMOREDATA             MAKE_HRESULT( 1, _FACD3DXF, 916 )
  277. #define D3DXFERR_BADCACHEFILE           MAKE_HRESULT( 1, _FACD3DXF, 917 )
  278.  
  279. /*
  280.  * DirectX File object types.
  281.  */
  282.  
  283. #ifndef WIN_TYPES
  284. #define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype
  285. #endif
  286.  
  287. WIN_TYPES(ID3DXFile,                 D3DXFILE);
  288. WIN_TYPES(ID3DXFileEnumObject,       D3DXFILEENUMOBJECT);
  289. WIN_TYPES(ID3DXFileSaveObject,       D3DXFILESAVEOBJECT);
  290. WIN_TYPES(ID3DXFileData,             D3DXFILEDATA);
  291. WIN_TYPES(ID3DXFileSaveData,         D3DXFILESAVEDATA);
  292.  
  293. #if defined( __cplusplus )
  294. } // extern "C"
  295. #endif // defined( __cplusplus )
  296.  
  297. #endif // !defined( __D3DX9XOF_H__ )
  298.  
  299.  
  300.