initial
This commit is contained in:
907
common/CegClient.h
Normal file
907
common/CegClient.h
Normal file
@@ -0,0 +1,907 @@
|
||||
// Copyright © 2008-, Valve LLC, All rigStahts reserved.
|
||||
//
|
||||
// cegclient.h
|
||||
//
|
||||
// This file is to be imported by client applications that wish to link with our DRM library !
|
||||
//
|
||||
// Performance Note :
|
||||
//
|
||||
// There are several points within cegclient.h where we'll place a 'Performance Note' to indicate
|
||||
// the potential performance consequences of particular CEG functions.
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// CEG Initialization -
|
||||
//
|
||||
// The first and last functions within the CEG SDK that must be called are :
|
||||
// Steamworks_InitCEGLibrary()
|
||||
// Steamworks_TermCEGLibrary()
|
||||
//
|
||||
// There are alternate versions of these functions, for people who restrict their usage of the
|
||||
// CEG SDK to a subset of the available API's (more on the subset later). These functions are :
|
||||
//
|
||||
// Steamworks_MinimumInitCEGLibrary()
|
||||
// Steamworks_MinimumTermCEGLibrary().
|
||||
//
|
||||
// In the event that the CEG library is initialized through Steamworks_InitCEGLibrary(), then the
|
||||
// following functions must also be called, on each thread on which CEG code may execute, before any
|
||||
// other CEG code code executes on the thread (these functions are not necessary if Steamworks_MinimumInitCEGLibrary() is called).
|
||||
//
|
||||
// Steamworks_RegisterThread()
|
||||
// Steamworks_UnRegisterThread().
|
||||
//
|
||||
// The only function which can be called before Steamworks_RegisterThread() is Steamworks_InitCEGLibrary().
|
||||
// Steamworks_RegisterThread() must be called on the thread that calls Steamworks_InitCEGLibrary(), if it calls any
|
||||
// other CEG functions.
|
||||
// For example, your main() will probably look like :
|
||||
//
|
||||
// int main( int argc, char* argv[] )
|
||||
// {
|
||||
// Steamworks_InitCEGLibrary();
|
||||
// Steamworks_RegisterThread();
|
||||
//
|
||||
// /* Real work here */
|
||||
//
|
||||
// Steamworks_UnRegisterThread();
|
||||
// Steamworks_TermCEGLibrary();
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// CEG Minimum API :
|
||||
//
|
||||
// Steamworks_SimpleCheck()
|
||||
//
|
||||
// This API is provided for people who are trying to combine CEG with other DRM technology.
|
||||
// This function does a very basic check that the machine is executing on the machine it was produced for.
|
||||
// This function doesn't conceal any of the data it is using to evaluate the machine, and therefore should not be
|
||||
// used with the full CEG SDK. It it not necessary to call Steamworks_RegisterThread()/Steamworks_UnRegisterThread()
|
||||
// if CEG API usage is restricted to this function.
|
||||
//
|
||||
// CEG Full API's :
|
||||
//
|
||||
// The full set of CEG API's takes the form of direct function calls, who's performance impacts may be easily analyzed
|
||||
// versus macros, which cause sophisticated manipulations of your .obj files before the final executable is linked.
|
||||
//
|
||||
//
|
||||
// Direct Functions Calls -
|
||||
// Steamworks_TestSecret()
|
||||
// Steamworks_TestSecretAlways(),
|
||||
// Steamorks_SelfCheck().
|
||||
//
|
||||
// Steamworks_TestSecret() and Steamworks_TestSecretAlways() are focused on evaluating the current
|
||||
// computer to determine whether it is the machine the binary was produced for.
|
||||
// Because a hacker may be 'tracing' all windows API calls with a tool such as sysinternal's Process Monitor
|
||||
// ( http://technet.microsoft.com/en-us/sysinternals/bb896645 ), Steamworks_TestSecret() will not always
|
||||
// evaluate it's secret. The intention is to make it harder to record CEG activity.
|
||||
// Steamworks_TestSecretAlways() will always evaluate it's portion of secret data.
|
||||
//
|
||||
// Steamworks_SelfCheck() - this function is focused on determining whether the executable has been modified.
|
||||
//
|
||||
//
|
||||
// Macro Mechanisms:
|
||||
//
|
||||
// CEG's macro mechanisms attempt to entwine machine specific information into the correct operation of the game
|
||||
// product. As a result, unlike CEG function calls (which a hacker can simply stub out), a hacker must
|
||||
// take the time to determine how the CEG code is entwined within the product, and make a more significant effort
|
||||
// to modify the game.
|
||||
//
|
||||
// Specific Macro Mechanisms:
|
||||
//
|
||||
// CEG_EncryptFunction()
|
||||
//
|
||||
// The function which contains this macro will be modified, so that the opcodes comprising the function
|
||||
// are encrypted within the executable file. The decryption key is derived from machine specific data.
|
||||
// If decryption of the code fails, the function will not be executed, and the game will to continue to run.
|
||||
// Whether the executable immediately terminates or not depends on what the encrypted function does for the game,
|
||||
// as well as calling convention and architecture issues, as the CEG code may not clean up the stack correctly
|
||||
// when the function fails to execute.
|
||||
// (Please note : Many CEG functions are themselves encrypted using this mechanism).
|
||||
//
|
||||
// This mechanism can be used an unlimited number of times - the following macros have restrictions on
|
||||
// the number of times they can be used within your executable.
|
||||
//
|
||||
// Performance Note :
|
||||
// Every time a function containing CEG_EncryptFunction() macro is invoked, CEG code must execute to
|
||||
// produce the function in a ready to run form in temporarily allocated memory.
|
||||
// CEG will keep a cached version of the function for up to 10 seconds, so that the full cost of decryption
|
||||
// is not paid on every invocation. However, every invocation does incur some CEG overhead to
|
||||
// either decrypt or locate the cached form and to properly martial the call to the decrypted form of the function.
|
||||
//
|
||||
//-----------------------------------------
|
||||
// CEG_ProtectFunction()
|
||||
//
|
||||
// The function which contains this macro will be modified, so that it's address must be computed
|
||||
// by every caller of the function. The address computation will involve machine specific data,
|
||||
// as well as checksum computations which verify that the executable has not been modified.
|
||||
//
|
||||
// This mechanism cannot be used (in conjunction with CEG_Define_Constant_Function) more then 130 times.
|
||||
//
|
||||
// Performance Note:
|
||||
//
|
||||
// The full cost of the CEG_ProtectFunction() will be paid on every call of the target function.
|
||||
// Because this mechanism involves computing checksums of the executable image, this will be more
|
||||
// expensive then CEG_EncryptFunction(). However, this mechanism is much more likely to cause problems
|
||||
// for somebody who is attacking the executable with a debugger, as the checksums are likely to find
|
||||
// the breakpoints being used by the debugger.
|
||||
//
|
||||
//----------------------------------------
|
||||
// CEG_Define_Constant_Function( name, value )
|
||||
// CEG_Declare_Constant_Function( name )
|
||||
// CEG_GetConstantValue( name )
|
||||
//
|
||||
// These macros create and declare a functions that the game can use to get interesting constants
|
||||
// for game play. (i.e. Field Of View angle, maximum player velocity etc...)
|
||||
//
|
||||
// Computation of CEG_GetConstantValue() involves machine specific information as well as checksums
|
||||
// of the executing binary (same as CEG_ProtectFunction).
|
||||
// If the machine is different, or the executable has been modified, then the results returned
|
||||
// by CEG_GetConstantValue() will be different. The results in the game will depend on how
|
||||
// the constant is used.
|
||||
//
|
||||
// The same Performance Note as for CEG_ProtectFunction() apply to this mechanism.
|
||||
//
|
||||
//
|
||||
// Some General Notes on CEG's macro mechanisms:
|
||||
//
|
||||
// The Compiler can eliminate CEG_ProtectFunction() and CEG_EncryptFunction() if it chooses to
|
||||
// inline your function !!! In general, it's better to use these macros only in function which appear in
|
||||
// .cpp files (not in inline functions which appear in header files). It's also better if the function
|
||||
// in which CEG_ProtectFunction() or CEG_EncryptFunction() is placed is not called from within the same file!
|
||||
//
|
||||
// C++ Constructors and Destructors :
|
||||
//
|
||||
// You can use CEG_ProtectFunction() and CEG_EncryptFunction() within your C++ constructors.
|
||||
// HOWEVER - if there is a global variable that invokes the constructor, you will be invoking
|
||||
// the CEG mechanisms before you have executed Steamworks_InitCEGLibrary() - and this will probably crash your game.
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#ifndef _CEGCLIENT_H_
|
||||
#define _CEGCLIENT_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
//
|
||||
// Many of the CEG functions implement below compute CRC's over the executing image
|
||||
// of the game when invoked. This results in their performance impact varying with
|
||||
// the size of the game executable file.
|
||||
// A typical result for Steamworks_SelfCheck() and CEG_Protect_Member_Function() is
|
||||
// 3ms of overhead in a 6MB executable. (Measured in L4D2).
|
||||
//
|
||||
// In order to allow more fine grain control of which part of the executable is covered
|
||||
// by CEG CRC's this macro is provided.
|
||||
//
|
||||
// Executable code that is placed in this section WILL NOT have any CRC's covering the code.
|
||||
// To place code in this section on an entire source file basis use '#pragma code_seg( NO_CEG_SECTION )'
|
||||
// This places all of the code following the pragma into the NO_CEG_SECTION of the executable.
|
||||
//
|
||||
// Care should be taken that the marked code cannot be modified to prevent execution of CEG checks.
|
||||
// Do not put direct CEG call sites into this section, or most of the call stack leading to a CEG call site.
|
||||
// This can be used to improve the performance of the Steamwork_SelfCheck() and CEG_Protect_Member_Function() mechanisms
|
||||
// as they will operate on a smaller portion of the game image.
|
||||
// Do not overuse, as placing all code into such sections would mean that the hackers could easily
|
||||
// identify CEG library code - which would be the code not in NO_CEG_SECTION.
|
||||
//
|
||||
#define NO_CEG_SECTION ".textnc"
|
||||
|
||||
//
|
||||
// This is the result code the DRM library passes to ExitProcess() when it terminates
|
||||
// a process that requires DRM processing.
|
||||
//
|
||||
#define STEAM_PROCESS_TERMINATE_DRM_REQUIRED 0x8000DEAD
|
||||
|
||||
//
|
||||
// This function should be called exactly once by a client application.
|
||||
// The Steamworks_InitCEGLibrary() and Steamworks_TermCEGLibrary() will let steam know that a game was
|
||||
// running no matter what mechanism the user used to start the game.
|
||||
//
|
||||
extern bool __cdecl Steamworks_InitCEGLibrary() ;
|
||||
|
||||
//
|
||||
// This function should be called exactly once by a client application -
|
||||
// A client application should call only one of Steamworks_InitCEGLibrary or Steamworks_MinimumInitCEGLibrary() - NOT BOTH!
|
||||
//
|
||||
// This function is provided for those applications incorporating additional DRM mechanisms into their application.
|
||||
// In those cases it may be appropriate to use Steamworks_MinimumInitCEGLibrary().
|
||||
// Otherwise, Steamworks_InitCEGLibrary() is the interface that should be used.
|
||||
//
|
||||
extern bool __cdecl Steamworks_MinimumInitCEGLibrary();
|
||||
|
||||
//
|
||||
// This function should be called exactly once by a client application, immediately
|
||||
// before it is going to exit the game.
|
||||
//
|
||||
extern bool __cdecl Steamworks_TermCEGLibrary() ;
|
||||
//
|
||||
// This function pairs with Steamworks_MinimumInitCEGLibrary().
|
||||
//
|
||||
extern bool __cdecl Steamworks_MinimumTermCEGLibrary();
|
||||
|
||||
//
|
||||
// This pair of functions must be called on each thread that uses any CEG mechanism.
|
||||
// Steamworks_RegisterThread() must be called before any CEG mechanism executes on
|
||||
// the thread, including all of the CEG_Protect_Member* macros.
|
||||
// Steamworks_UnRegisterThread() must be called AFTER all CEG mechanisms have been
|
||||
// executed on a particular thread.
|
||||
//
|
||||
// IMPORTANT NOTE REGARDING CEG IN MULTIPLE COMPONENTS -
|
||||
// This Comment ONLY applies if you are using CEG in multiple DLL's (or a .DLL and .EXE)
|
||||
// which are loaded in the same process.
|
||||
// If Steamworks_RegisterThread() is called in DLL A, which invokes DLL B which also
|
||||
// contains CEG code, then DLL B must call Steamworks_RegisterThread() before any CEG
|
||||
// function within DLL B is executed, and must call Steamworks_UnRegisterThread() before
|
||||
// it returns to DLL A.
|
||||
//
|
||||
// If a thread executes exclusively in DLL A without calling DLL B, then Steamworks_RegisterThread()
|
||||
// only needs to be called in DLL A.
|
||||
//
|
||||
extern bool __cdecl Steamworks_RegisterThread() ;
|
||||
extern bool __cdecl Steamworks_UnRegisterThread() ;
|
||||
|
||||
//
|
||||
// This function performs the most basic CEG checks for ownership, and makes no attempt
|
||||
// to conceal it's inner workings, unlike the remaining API's
|
||||
//
|
||||
// If bTerminateIfUnowned is non zero then the CEG will crash the process
|
||||
// and attempt to return STEAM_PROCESS_TERMINATE_DRM_REQUIRED to the steam client.
|
||||
// The caller may pass zero (false) to the function, and take responsibility for terminating the game.
|
||||
// This allows the caller to separate the legitimacy test from the enforcement.
|
||||
// It is very important that the process have an exit code of STEAM_PROCESS_TERMINATE_DRM_REQUIRED
|
||||
// if this is done - the Steam Client will use that to report CEG errors to Steam
|
||||
// and to repair a customer installation. This may arise if the customer
|
||||
// has upgraded their Operating System, in which case the first time the game
|
||||
// is launched after the upgrade, CEG may fail to identify the system and cause the game to exit.
|
||||
// In this situation, the steam client will repair the customer's installation before
|
||||
// the game is launched again.
|
||||
//
|
||||
// The variable argument list to the function is ignored by the steam client,
|
||||
// but may be used to mask the signature of the function.
|
||||
//
|
||||
extern bool __cdecl Steamworks_SimpleCheck( DWORD bTerminateIfUnowned, ... );
|
||||
//
|
||||
// This function checks to see whether an application has been 'stolen' - it does
|
||||
// so by examining properties of the system on which we are running and checking if
|
||||
// those properties match those expected through the encoding we've done into the binary !
|
||||
//
|
||||
// IMPORTANT NOTE : This function has internal metering, it does not always perform its
|
||||
// full check. The goal is to make it more difficult to discover for hackers to locate
|
||||
// all of these checks.
|
||||
//
|
||||
extern bool __cdecl Steamworks_TestSecret() ;
|
||||
|
||||
//
|
||||
// This function performs the same type of checks as Steamworks_TestSecret(), however
|
||||
// it has no internal metering - it will always perform a check.
|
||||
//
|
||||
extern bool __cdecl Steamworks_TestSecretAlways() ;
|
||||
|
||||
//
|
||||
// This function checks to see whether an application has been 'stolen' - it does
|
||||
// so by examining the PE file (.dll or .exe) in which the DRM library has been linked
|
||||
// and determines whether the PE file has been modified.
|
||||
//
|
||||
extern bool __cdecl Steamworks_SelfCheck() ;
|
||||
|
||||
//
|
||||
// This function takes an interface pointer returned from a steam dll, and verifies
|
||||
// that it actually references a legitimate steam client.
|
||||
//
|
||||
extern bool __cdecl Steamworks_ValidateComponentInterface(void** lpv) ;
|
||||
|
||||
//
|
||||
// By default - we use WinCrypt API's to do signature validation -
|
||||
// if somebody desires, they can provide their own implementation.
|
||||
//
|
||||
class ISignatureImplementation {
|
||||
public :
|
||||
virtual bool
|
||||
VerifyHash(
|
||||
//
|
||||
// First - we specify the data structure which has been 'signed' -
|
||||
// We sign our signature using Wincrypt's PROV_RSA_FULL provider
|
||||
// with the CALG_SHA1 algorithm.
|
||||
//
|
||||
LPBYTE lpbSignedData,
|
||||
DWORD cbSignedData,
|
||||
//
|
||||
// The signature block is generated using
|
||||
// CryptCreateHash( RSA FULL PROVIDER, CALG_SHA1 ) and CryptHashData().
|
||||
// The Hash is then signed using CryptSignHash( Hash(), AT_SIGNATURE, .... )
|
||||
// generating the specified SignatureBlock !
|
||||
//
|
||||
LPBYTE lpbSignatureBlock,
|
||||
DWORD cbSignatureBlock,
|
||||
//
|
||||
// The public key associated with the private key that signed the Hash data !
|
||||
//
|
||||
LPBYTE lpbPublicKey,
|
||||
DWORD cbPublicKey
|
||||
) = 0 ;
|
||||
} ;
|
||||
|
||||
//
|
||||
// This function checks a signature of all the read-only portions of the executing image.
|
||||
// Unlike other CEG mechanisms, this uses cryptographic mechanisms that are not easily concealed from reverse engineering.
|
||||
// Additionally, this is a higher cost mechanism as it involves the entire executing image.
|
||||
// This check can be used at game launch, (before any user interface is displayed) where it will serve as a stalking horse,
|
||||
// and occasionally throughout execution.
|
||||
//
|
||||
// Additionally, neither of Steamworks_ValidateComponentInterface() or Steamworks_SelfValidate() provide multiple implementations.
|
||||
// Steamworks_TestSecret(), Steamworks_TestSecretAlways(), Steamworks_SelfCheck() will all be multi-plexed across many distinct
|
||||
// implementations (this is done by mingle.exe). Additional call sites for Steamworks_SelfValidate() are not as valuable as
|
||||
// additional call sites for the previously mentioned CEG functions.
|
||||
//
|
||||
extern bool __cdecl Steamworks_SelfValidate(ISignatureImplementation* pISignatureImplementation) ;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT CALL THIS FUNCTION !
|
||||
// This is referenced only through the CEG_Define_Constant_Function
|
||||
//
|
||||
typedef DWORD (*PFNSteamworks_ComputeDwordValue)();
|
||||
extern DWORD __cdecl Steamworks_ComputeDwordValue() ;
|
||||
//
|
||||
// DO NOT DO NOT CALL THIS FUNCTION !
|
||||
//
|
||||
// This is only referenced indirectly through the CEG_Protect_Virtual_Function macro !
|
||||
//
|
||||
extern void* __cdecl Steamworks_ProtectFunction( void*, void* ) ;
|
||||
//
|
||||
// DO NOT CALL THIS FUNCTION !
|
||||
//
|
||||
// This declaration is used within CEG Concealed function mechanisms to incorporate
|
||||
// machine specific data into the function concealment mechanism. It's not to be
|
||||
// directly called.
|
||||
//
|
||||
extern void __cdecl Steamworks_GetSecretData( unsigned __int32 /* 32bit unsigned int - all platforms.*/, union _16BYTES_U& );
|
||||
//
|
||||
// DO NOT DO NOT CALL THIS FUNCTION !
|
||||
//
|
||||
// This function should only be referenced through the CEG_EncryptFunction macro !
|
||||
//
|
||||
extern bool __cdecl Steamworks_EncryptedFunctionLoad();
|
||||
//
|
||||
// DO NOT DO NOT CALL THIS FUNCTION !
|
||||
//
|
||||
// This symbol exists for the benefit of mingle.exe when it processes your .obj files
|
||||
// and should only appear in the initializers of a CEGProtectedFunction structure !
|
||||
//
|
||||
extern void __cdecl Steamworks_InvalidReference() ;
|
||||
//
|
||||
// DO NOT CALL THIS FUNCTION - Exists solely for use in macros defined below !
|
||||
//
|
||||
// This function exists so we can force optimizing compilers to emit all the CEG
|
||||
// relevant data, as otherwise the compiler would discard them as unreferenced.
|
||||
//
|
||||
extern void __cdecl CEG_ForceReference(const struct CEG_Protection_Thunk&, const char* ) ;
|
||||
//
|
||||
// This class is defined purely so we can create derived classes in the CEG_Protect_Member_Function() macro.
|
||||
// Because that macro must be used within a function, defining a class allows us to generate the necessary
|
||||
// compiler references to ensure that the compiler does not optimize out CEG functions and symbols.
|
||||
//
|
||||
class I_CEG_ForceReference_Interface
|
||||
{
|
||||
virtual const CEG_Protection_Thunk* ReferencingFunction(unsigned index) = 0 ;
|
||||
} ;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// DO NOT CALL THIS FUNCTION - Exists solely for use in macros defined below !
|
||||
//
|
||||
// Together with the I_CEG_ForceReference_Interface allows us to force compilation
|
||||
// of some of our fancy CEG symbols !
|
||||
//
|
||||
extern int __cdecl CEG_ForceReference( class I_CEG_ForceReference_Interface* p ) ;
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CEG Internal Macros -
|
||||
//
|
||||
// The following are not intended for direct use, but will be instantiated
|
||||
// by CEG_EncryptFunction()/CEG_ProtectFunction()/CEG_GetConstantValue().
|
||||
//
|
||||
//
|
||||
// These handy macros help to generate unique variable names, as well as messages
|
||||
// through __pragma( message() ) !
|
||||
//
|
||||
#define CEG_UNIQNAME2(x,y) x##y
|
||||
#define CEG_UNIQNAME1(x,y) CEG_UNIQNAME2(x,y)
|
||||
#define CEG_UNIQNAME(x) CEG_UNIQNAME1(x,__COUNTER__)
|
||||
#define CEG_STRING(z) #z
|
||||
#define CEG_LINE_NUMBER(x) CEG_STRING(x)
|
||||
#if defined( _M_X64 )
|
||||
#define CEG_UNIQNAME3(x, y) CEG_STRING( x##y )
|
||||
#else
|
||||
#define CEG_UNIQNAME3(x, y) CEG_STRING( _##x##y )
|
||||
#endif
|
||||
|
||||
//
|
||||
// Too bad there's no hexadecimal 'G', F+1 will do
|
||||
//
|
||||
#define CEG_PROTECT_SIGNATURE 0xCEF1CEF1
|
||||
#define CEG_PROTECT_VIRTUAL_SIGNATURE 0xCEF10000
|
||||
|
||||
//
|
||||
// Define various strings used by CEG as section names through __pragma() directives.
|
||||
//
|
||||
#if !defined(CEG_PUBLIC_SECTION_STRINGS)
|
||||
#define CEG_PUBLIC_SECTION_STRINGS
|
||||
//
|
||||
// These macros correspond to section names used by CEG.
|
||||
//
|
||||
// The following macros will use C++ pragma's to allocate objects into these
|
||||
// various sections. No direct reference to these macros should be necessary.
|
||||
//
|
||||
#define CEG_META_GRAPH_START ".cegm$ga"
|
||||
#define CEG_META_GRAPH_END ".cegm$gz"
|
||||
//
|
||||
// This section will contain the signature tested by the Steamworks_ValidateSelf() interface
|
||||
//
|
||||
#define CEG_SIGNATURE_SECTION ".crsig"
|
||||
|
||||
//
|
||||
// This section will contain the data CEG uses to generate the Constant Function mechanisms !
|
||||
//
|
||||
#define CEG_EXTERNAL_VALUE ".cegi$d"
|
||||
#endif
|
||||
|
||||
extern DWORD __cdecl Steamworks_RevealFunction( DWORD_PTR, DWORD_PTR );
|
||||
extern void __cdecl Steamworks_ForceRef( struct CEG_SwapStruct* );
|
||||
|
||||
//
|
||||
// We use this macro to generate identifiers that Mingle may modify.
|
||||
// In some .obj manipulations, Mingle will change identifiers in the .obj file -
|
||||
// And will expect the identifiers to be produced by this macro!
|
||||
//
|
||||
// NOTE that the __XXXXXXXX will be turned into digits (essentially a counter)
|
||||
// by mingle !
|
||||
//
|
||||
#define Steamworks_CEG_MingleModifiableName_Prefix Steamworks_CEGIdentifier_
|
||||
#define Steamworks_CEG_MingleModifiableName_Suffix __XXXXXXXX
|
||||
#define Steamworks_CEG_MingleModifiableName(name) Steamworks_CEGIdentifier_ ## name ## __XXXXXXXX
|
||||
|
||||
#define CEG_TEMPLATE_USE_START_SECTION ".cegtu$a"
|
||||
#define CEG_TEMPLATE_USE_SECTION ".cegtu$m"
|
||||
#define CEG_TEMPLATE_USE_END_SECTION ".cegtu$z"
|
||||
|
||||
//
|
||||
// Reserve scratch space for the CEG Implementation to cache results!
|
||||
//
|
||||
//
|
||||
struct Steamworks_ThunkFunction_Scratch
|
||||
{
|
||||
DWORD m_rgdw[16] ;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Identify the version number of the CEG_SwapStruct structure.
|
||||
//
|
||||
#define Steamworks_CEG_SwapVersion 1
|
||||
//
|
||||
// This mask specifies that the function specified by CEG_SwapStruct should be prepped by mingle
|
||||
// to have runtime encryption operations applied to it.
|
||||
//
|
||||
#define Steamworks_CEG_EncryptSectionMask 1
|
||||
//
|
||||
// This mask specifies that the function specified by CEG_SwapStruct should be marked as COMDAT Select
|
||||
// Associative to the specification section. The select associative option is only used if
|
||||
// the original section was already COMDAT Select Any (common for templates and inline functions).
|
||||
// This flag is used by code within the CEG library implementing various secrets - where we want to
|
||||
// ensure that the target executable file links the absolute minimum amount of stuff, and does not
|
||||
// pull in any un-necessary objects.
|
||||
//
|
||||
#define Steamworks_CEG_SelectAssocMask 2
|
||||
|
||||
|
||||
//
|
||||
// This is the macro we use to cause the 'consumption' of a template !
|
||||
//
|
||||
#define Steamworks_CEG_InvokeTemplate( arg, flags ) \
|
||||
static char CEG_SwapName_Local[] = __FUNCDNAME__ ; \
|
||||
__pragma( section(CEG_TEMPLATE_USE_SECTION, read, write) ) \
|
||||
static CEG_SwapStruct __declspec(align(1)) __declspec(allocate(CEG_TEMPLATE_USE_SECTION)) \
|
||||
LocalSwap = { \
|
||||
Steamworks_CEG_SwapVersion, \
|
||||
CEG_SwapName_Local, \
|
||||
Steamworks_CEG_MingleModifiableName( arg ), \
|
||||
flags, NULL, 0, 0 \
|
||||
} ; \
|
||||
Steamworks_ForceRef(&LocalSwap)
|
||||
|
||||
#define Steamworks_DeclareCEGTemplate( arg ) \
|
||||
extern DWORD_PTR __cdecl Steamworks_CEG_MingleModifiableName( arg )( DWORD_PTR )
|
||||
|
||||
Steamworks_DeclareCEGTemplate( CacheConcealThunk );
|
||||
Steamworks_DeclareCEGTemplate( ProtectFunction );
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
#if !defined(CEG_LINKOBJECT_DEFINED)
|
||||
#define CEG_LINKOBJECT_DEFINED
|
||||
//
|
||||
// The 'ID' of an object identified by mingle - this
|
||||
// is large enough to be a GUID or an MD5 computation !
|
||||
//
|
||||
struct LinkObjectId
|
||||
{
|
||||
BYTE m_rgb[16];
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
struct CEG_SwapStruct {
|
||||
//
|
||||
// Tell Mingle what version of this structure the file was compiled with !
|
||||
//
|
||||
DWORD_PTR m_Version;
|
||||
//
|
||||
// This field is the decorated name of the function that is being manipulated.
|
||||
// This is generated through the __FUNCDNAME__ preprocessor directive of Visual Studio.
|
||||
//
|
||||
char* m_szDecoratedName;
|
||||
//
|
||||
// This points to the function that will 'replace' the specified function.
|
||||
//
|
||||
void* m_pfnOriginal;
|
||||
//
|
||||
// Reserve space in the structure for communication with mingle.exe and
|
||||
// cegdll.dll regarding the details of what happens to the swapped code !
|
||||
//
|
||||
DWORD_PTR m_SectionOptions;
|
||||
//
|
||||
// Based on the Section Options, these fields will be interpreted by Mingle and the CEG runtime.
|
||||
//
|
||||
void* m_Reserved1;
|
||||
DWORD_PTR m_Reserved2;
|
||||
//
|
||||
// Mingle will give us the size of the Swap Target function, in bytes !
|
||||
//
|
||||
DWORD_PTR m_cbTarget;
|
||||
//
|
||||
// This is a mingle generated identifier, that will be used by cegdll.dll and drmpe.exe
|
||||
// to identify the template used and it's associated metadata !
|
||||
//
|
||||
LinkObjectId m_LinkObjectId;
|
||||
};
|
||||
|
||||
//
|
||||
// This structure must have the exact same size as CEG_SwapStruct, and will be the runtime interpretation
|
||||
// of the structure ! Mingle will modify relocation records so that the final linked form stores 'distances'
|
||||
// to the actual referenced items instead of pointers. We do this to reduce relocation records in the final
|
||||
// target executable, which we believe give data structure feedback to hackers.
|
||||
//
|
||||
struct CEG_Runtime_SwapStruct {
|
||||
//
|
||||
// This field carries the version of the structure.
|
||||
//
|
||||
DWORD_PTR m_Version;
|
||||
//
|
||||
// This is the 'distance' to the function that Mingle placed into the .obj file.
|
||||
// This function is called directly instead of the original 'TargetFunction'
|
||||
//
|
||||
// Note that 'distances' are stored by mingle.exe using a relocation type that is appropriate for code.
|
||||
// That means that distances on both 32 and 64bit platforms are 32 bit signed integers -
|
||||
// However, this field is 64bits on a 64bit platform. The linker will have stored a 32 bit signed
|
||||
// integer into the field, so we must do appropriate casting, because we don't have a genuine 64 bit signed integer in here.
|
||||
// When manipulating the structures, we will at a time turn this field into a full 'pointer like' value
|
||||
// (i.e. during the CEG process) - so it is convenient for us that it can hold that.
|
||||
//
|
||||
INT_PTR m_OffsetSubstitute;
|
||||
//
|
||||
// NOTE : All the same comments that apply to m_OffsetSubstitute apply to this field !
|
||||
//
|
||||
// This is the distance to the 'Target' function - the function containing the Steamworks_CEG_InvokeTemplate macro
|
||||
// This TargetFunction may be in an encrypted form, depending on the flags specified in m_SectionOptions!
|
||||
//
|
||||
INT_PTR m_OffsetOriginal;
|
||||
//
|
||||
// These options specify manipulations that mingle will perform on the 'Original' function
|
||||
// before it is linked. In particular, it may be turned into a 'Concealed' function - which
|
||||
// is a self-contained data structure containing the functions op-codes and metadata that can
|
||||
// be encrypted during the CEG process.
|
||||
//
|
||||
DWORD_PTR m_SectionOptions;
|
||||
//
|
||||
// We allow the macro to request what Encryption thunk is used in the event that the
|
||||
// Section Options specify
|
||||
//
|
||||
DWORD_PTR m_SectionThunk;
|
||||
//
|
||||
// For future use ....
|
||||
//
|
||||
DWORD_PTR m_Reserved2;
|
||||
//
|
||||
// Mingle will give us the size of the Substitute function, in bytes !
|
||||
// It is usefull to know the Substitute function size - as during runtime we may
|
||||
// need to 'search' for it.
|
||||
//
|
||||
DWORD_PTR m_cbTarget;
|
||||
//
|
||||
// This is a mingle generated identifier, that will be used by cegdll.dll and drmpe.exe
|
||||
// to identify the template used and it's associated metadata !
|
||||
//
|
||||
LinkObjectId m_LinkObjectId;
|
||||
|
||||
void* GetOriginalFunction() const
|
||||
{
|
||||
return reinterpret_cast<void*>(reinterpret_cast<INT_PTR>(&m_OffsetOriginal)+static_cast<INT32>(m_OffsetOriginal)+sizeof(INT32));
|
||||
}
|
||||
void* GetSubstituteFunction() const
|
||||
{
|
||||
return reinterpret_cast<void*>(reinterpret_cast<INT_PTR>(&m_OffsetSubstitute)+static_cast<INT32>(m_OffsetSubstitute)+sizeof(INT32));
|
||||
}
|
||||
};
|
||||
#pragma pack(pop)
|
||||
//
|
||||
// End of CEG Internal Macros -
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
// The flowing three macros :
|
||||
// CEG_Define_Constant_Function( name, value ),
|
||||
// CEG_Declare_Constant_Function( name ),
|
||||
// CEG_GetConstantValue( name )
|
||||
//
|
||||
// Operate together to provide another CEG mechanism for protecting your binary.
|
||||
//
|
||||
// Example usage :
|
||||
//
|
||||
// header.h :
|
||||
// /* macro is at File Scope !*/
|
||||
// CEG_Declare_Constant_Function( ZombiesPerSecond ) ;
|
||||
//
|
||||
// main.cpp :
|
||||
// /* macro is at File Scope !*/
|
||||
// CEG_Define_Constant_Function( ZombiesPerSecond, 17 ) ;
|
||||
//
|
||||
// zombies.cpp :
|
||||
// /* CEG_GetConstantValue( ZombiesPerSecond ) must be used within a function !*/
|
||||
//
|
||||
// void
|
||||
// ClockTick()
|
||||
// {
|
||||
// if( ElapsedTime > 1 ) /* Has 1 second passed ? */
|
||||
// {
|
||||
// DWORD cZombies = CEG_GetConstantValue( ZombiesPerSecond ) ;
|
||||
// for( DWORD i=0; i<cZombies; ++i )
|
||||
// {
|
||||
// /* Create a Zombie !*/
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Explanation :
|
||||
//
|
||||
// CEG_Define_Constant_Fucntion( ZombiesPerSecond, 17 ) defines a function
|
||||
// that will return 17 (as a DWORD) every time it is called, IF your executable
|
||||
// has not been tampered with, or copied. This function must NOT be inlined,
|
||||
// when your game is CEG'd, the code bytes of the function will be modified.
|
||||
// Putting the Definition in the same file as the usage may allow aggressive compiler
|
||||
// settings to inline some usages of the function - we recommend that the definition
|
||||
// never appear with the usage.
|
||||
//
|
||||
// CEG_Declare_Constant_Function( ZombiesPerSecond ) generates an extern declaration
|
||||
// of this function.
|
||||
//
|
||||
// CEG_GetConstantValue( ZombiesPerSecond ) calls the function defined by
|
||||
// CEG_Define_Constant_Function() and declared by CEG_Declare_Constant_Function().
|
||||
//
|
||||
// How it Works :
|
||||
//
|
||||
// This mechanism is very similar to that provided by CEG_Protect_Member_Function()
|
||||
// The CEG code will compute checksums over your executing image, and these checksums
|
||||
// will come to the result specified in the CEG_Declare_Constant_Function() if the
|
||||
// image has not been tampered with. If a hacker has tampered, this will return a
|
||||
// random number. By choosing appropriate constants, your game may be rendered
|
||||
// unplayable, although CEG will not crash the game.
|
||||
//
|
||||
// Recommendation :
|
||||
//
|
||||
// This CEG functionality degrades the game when the game is tampered with.
|
||||
// It should be used in conjunction with all the other CEG mechanisms.
|
||||
// The other CEG mechanisms will immediately crash the game when tampered,
|
||||
// which makes these mechanisms easy to identify in support calls, online forums etc...
|
||||
//
|
||||
// Make sure you include a small number of Steamworks_TestSecretAlways() call
|
||||
// during the start/load of the game. These will catch Casual Piracy.
|
||||
// The game degradation caused through this the CEG_Define_Constant_Function() is
|
||||
// directed at sophisticated pirates, who will have a hard time tracking
|
||||
// down the results of their modifications of the game image.
|
||||
//
|
||||
// IMPORTANT NOTE ABOUT THE VALUE ZERO !
|
||||
//
|
||||
// Don't use :
|
||||
// CEG_Define_Constant_Function( Zero, 0 )
|
||||
// or :
|
||||
// CEG_Define_ConstantFloat_Function( FloatZero, 0.0f )
|
||||
//
|
||||
// The .obj and .exe parsing mechanisms assume 0 (also known as NULL) is an unbound
|
||||
// usage - and the resulting calls to CEG_GetConstantValue() will not return 0 (zero)
|
||||
// (The string 'zero' is fine, of course).
|
||||
//
|
||||
//
|
||||
|
||||
#define CEG_GetConstantValue( name ) \
|
||||
CEG_UNIQNAME1( CEG_ConstantValue_, name )()
|
||||
|
||||
#define CEG_Declare_ConstantFloat_Function( name ) \
|
||||
extern float __cdecl CEG_UNIQNAME1( CEG_ConstantValue_, name )()
|
||||
|
||||
#define Steamworks_CEG_ValueBind_Signature 0xCEF1DDEE
|
||||
|
||||
#define CEG_Define_Constant_Function( name, value ) \
|
||||
extern "C" { \
|
||||
__pragma( section(CEG_EXTERNAL_VALUE, read, write) ) \
|
||||
Steamworks_CEG_ValueBinding __declspec(align(8)) __declspec(allocate(CEG_EXTERNAL_VALUE)) \
|
||||
CEG_UNIQNAME1( Steamworks_CEG_ValueBinding_, name ) = { \
|
||||
Steamworks_CEG_ValueBind_Signature, \
|
||||
0, \
|
||||
value, \
|
||||
reinterpret_cast<DWORD_PTR>( Steamworks_ComputeDwordValue ) , \
|
||||
} ; \
|
||||
__pragma( comment( linker, "/INCLUDE:" CEG_UNIQNAME3( Steamworks_CEG_ValueBinding_, name ) ) ) \
|
||||
}; \
|
||||
extern DWORD CEG_UNIQNAME1( CEG_ConstantValue_, name )( void ); \
|
||||
DWORD CEG_UNIQNAME1( CEG_ConstantValue_, name )( void ) \
|
||||
{ \
|
||||
INT32* pOffset = reinterpret_cast<INT32*>( & CEG_UNIQNAME1( Steamworks_CEG_ValueBinding_, name ).m_ImplementationFunction ) ; \
|
||||
PFNSteamworks_ComputeDwordValue pfn = reinterpret_cast<PFNSteamworks_ComputeDwordValue>( reinterpret_cast<BYTE*>(pOffset+1) + *pOffset ); \
|
||||
return (*pfn)(); \
|
||||
}
|
||||
|
||||
#define CEG_Declare_Constant_Function( name ) \
|
||||
extern DWORD CEG_UNIQNAME1( CEG_ConstantValue_, name )()
|
||||
|
||||
//
|
||||
// These forms of CEG_Define_Constant_Function() appeared in older CEG SDK's, but are no longer available !
|
||||
//
|
||||
//
|
||||
#define CEG_Define_Constant_Function2( name, value ) \
|
||||
__pragma( message( __FILE__ "(" CEG_LINE_NUMBER(__LINE__) ") : CEG_Defined_Constant_Function2 has been retired and can no longer be used! - use CEG_Define_Constant_Function!") )
|
||||
|
||||
#define CEG_Define_ConstantFloat_Function( name, value ) \
|
||||
__pragma( message( __FILE__ "(" CEG_LINE_NUMBER(__LINE__) ") : CEG_Defined_ConstantFloat_Function has been retired and can no longer be used! - use CEG_Define_Constant_Function!") )
|
||||
|
||||
#define CEG_Define_ConstantFloat_Function2( name, value ) \
|
||||
__pragma( message( __FILE__ "(" CEG_LINE_NUMBER(__LINE__) ") : CEG_Defined_ConstantFloat_Function2 has been retired and can no longer be used! - use CEG_Define_Constant_Function!") )
|
||||
|
||||
|
||||
|
||||
/***************************************************
|
||||
****************************************************
|
||||
|
||||
CEG_ProtectFunction and CEG_EncryptFunction
|
||||
|
||||
These macros must be placed within the body of a function.
|
||||
Here is a small example, which describes how CEG_ProtectFunction() operates :
|
||||
|
||||
|
||||
class CMyClass {
|
||||
virtual void MyVirtualFunction( int SomeArg ) ;
|
||||
} ;
|
||||
|
||||
__declspec(noinline) // This is necessary to prevent compiler optimizations from eliminating CEG check.
|
||||
void
|
||||
CMyClass::MyVirtualFunction( int SomeArg ) {
|
||||
CEG_ProtectFunction();
|
||||
|
||||
//
|
||||
// Now do the real work !
|
||||
//
|
||||
}
|
||||
|
||||
Void ExampleCall(CMyClass * p )
|
||||
{
|
||||
p->MyVirtualFunction( EXAMPLE_CONSTANT ) ; }
|
||||
}
|
||||
|
||||
|
||||
Now what happens to your binary is the following :
|
||||
|
||||
The vtable for CMyClass has been changed to reference a CEG function. When ExampleCall() is executed,
|
||||
It will actually end up calling CEG code through the vtable. This CEG code preserves the state of the stack
|
||||
and arguments in a fashion similar to the CRT setjmp() function.
|
||||
|
||||
The CEG code will then compute a checksum that incorporates machine identifying information into the checksum.
|
||||
|
||||
If nobody has modified the executable (by setting breakpoints, or by changing the executable file) and the executable
|
||||
is running on the machine it was produced for, then the checksum results in the address of CMyClass::MyVirtualFunction().
|
||||
|
||||
In this case, CEG will patch the CONTEXT it got from it's setjmp() operation and longjmp() to CMyClass::MyVirtualFunction().
|
||||
The setjmp()/longjmp() manipulations allow CEG to do it's work, without having to understand the calling convention
|
||||
between ExampleCall() and CMyClass::MyVirtualFunction().
|
||||
|
||||
Before the CEG code invokes longjmp(), it checks that the address it computed is correct, by computing an MD5 of the
|
||||
address, and comparing this to a stored MD5. If this comparison fail, CEG terminates the process directly.
|
||||
|
||||
You can use CEG_ProtectFunction()/CEG_EncryptFunction() in any kind of function -
|
||||
C++ member functions, C++ static member functions etc....
|
||||
|
||||
|
||||
*******************************************************
|
||||
******************************************************/
|
||||
|
||||
|
||||
|
||||
#define CEG_ProtectFunction( ) \
|
||||
Steamworks_CEG_InvokeTemplate( ProtectFunction, 0 )
|
||||
|
||||
|
||||
#define CEG_EncryptFunction( ) \
|
||||
Steamworks_CEG_InvokeTemplate( CacheConcealThunk, Steamworks_CEG_EncryptSectionMask )
|
||||
|
||||
|
||||
//
|
||||
// These are previus forms of CEG_ProtectFunction() that appeared in older SDK's - and should be replaced by either CEG_ProtectFunction()
|
||||
// or CEG_EncryptFunction().
|
||||
//
|
||||
#define CEG_Protect_Function(x) \
|
||||
__pragma( message( __FILE__ "(" CEG_LINE_NUMBER(__LINE__) ") : CEG_Protect_Function has been retired and can no longer be used! - use CEG_ProtectFunction!") )
|
||||
|
||||
#define CEG_Protect_StaticMemberFunction(x, y) \
|
||||
__pragma( message( __FILE__ "(" CEG_LINE_NUMBER(__LINE__) ") : CEG_Protect_StaticMemberFunction has been retired and can no longer be used! - use CEG_ProtectFunction!") )
|
||||
|
||||
#define CEG_Protect_Virtual_Function3( name ) \
|
||||
__pragma( message( __FILE__ "(" CEG_LINE_NUMBER(__LINE__) ") : CEG_Protect_Virtual_Function3 has been retired and can no longer be used! - use CEG_ProtectFunction!") )
|
||||
|
||||
#define CEG_Protect_Member_Function( name ) \
|
||||
__pragma( message( __FILE__ "(" CEG_LINE_NUMBER(__LINE__) ") : CEG_Protect_Member_Function has been retired and can no longer be used! - use CEG_ProtectFunction!") )
|
||||
|
||||
#define CEG_Protect_Member_Function2( name ) \
|
||||
__pragma( message( __FILE__ "(" CEG_LINE_NUMBER(__LINE__) ") : CEG_Protect_Member_Function2 has been retired and can no longer be used! - use CEG_ProtectFunction!") )
|
||||
|
||||
|
||||
//
|
||||
// This structure is declared to be a platform invariant size !
|
||||
//
|
||||
struct Steamworks_CEG_ValueBinding
|
||||
{
|
||||
DWORD32 m_Signature;
|
||||
DWORD32 m_BindingUse;
|
||||
DWORD64 m_DesiredResult;
|
||||
DWORD64 m_ImplementationFunction;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Reference Macros !
|
||||
//
|
||||
// These macro's instantiate several CEG data structures as the CEG tools
|
||||
// (mingle.exe and drmpe.exe) will see them in .obj and .exe files.
|
||||
//
|
||||
//
|
||||
|
||||
#define CEG_PROTECT_START_SIGNATURE 0xCCEEFF11
|
||||
#define CEG_PROTECT_END_SIGNATURE 0x11ffeeCC
|
||||
|
||||
//
|
||||
// DO NOT REFERENCE
|
||||
//
|
||||
// We specify these symbols here so that the linker will properly
|
||||
// concatenate the CEG sections together in the final image.
|
||||
//
|
||||
// These symbols are only for use by internal code of the CEG library !
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#endif // _CEGCLIENT_H_
|
||||
46
common/CegClientWrapper.cpp
Normal file
46
common/CegClientWrapper.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "CegClientWrapper.h"
|
||||
|
||||
#if defined( CLIENT_DLL ) || defined( GAME_DLL ) // shared
|
||||
#include "cbase.h" // prerequisite for more than one of the below headers
|
||||
#include "bspflags.h" // defines SURF_NOPORTAL and SURF_NOPAINT
|
||||
|
||||
#if defined ( CSTRIKE15 )
|
||||
|
||||
#endif // defined CSTRIKE15
|
||||
|
||||
#endif // defined CLIENT_DLL or GAME_DLL
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#if defined( PROFILE_CEG )
|
||||
|
||||
CAverageCycleCounter allCEG;
|
||||
CAverageCycleCounter allTestSecret;
|
||||
CAverageCycleCounter allSelfCheck;
|
||||
CAverageCycleCounter allProtectMember;
|
||||
CAverageCycleCounter allProtectVirtual;
|
||||
|
||||
#endif // defined( PROFILE_CEG )
|
||||
|
||||
#if defined( CLIENT_DLL ) // client-side only
|
||||
|
||||
void Init_GCVs()
|
||||
{
|
||||
// function calls to prime statics and ensure CEG init hitches happen before game is interactive
|
||||
InitHudAllowTextChatFlag();
|
||||
InitUiAllowProperTintFlag();
|
||||
}
|
||||
|
||||
CEG_DEFINE_CONSTANT_FUNCTION( HudAllowTextChatFlag, ALLOW_TEXTCHAT_FLAG );
|
||||
CEG_DEFINE_CONSTANT_FUNCTION( UiAllowProperTintFlag, ALLOW_PROPER_TINT_FLAG );
|
||||
|
||||
|
||||
#elif defined( GAME_DLL ) // server-side only
|
||||
|
||||
void Init_GCVs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif // defined( GAME_DLL )
|
||||
301
common/CegClientWrapper.h
Normal file
301
common/CegClientWrapper.h
Normal file
@@ -0,0 +1,301 @@
|
||||
#ifndef _CEGCLIENTWRAPPER_H_
|
||||
#define _CEGCLIENTWRAPPER_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "xbox/xboxstubs.h" // defines DWORD, DWORD_PTR, etc.
|
||||
|
||||
// required by cegclient.h, but no need to pull in all of windef.h
|
||||
#if defined( PLATFORM_64BITS )
|
||||
typedef int64 INT_PTR;
|
||||
#else
|
||||
typedef int32 INT_PTR;
|
||||
#endif
|
||||
|
||||
typedef unsigned char BYTE;
|
||||
typedef BYTE *LPBYTE;
|
||||
typedef int32 INT32;
|
||||
typedef uint32 DWORD32;
|
||||
typedef uint64 DWORD64;
|
||||
|
||||
|
||||
#define CEG_GET_CONSTANT_VALUE_AVOID_CEG( fn_name ) fn_name() // makes it easy for us to turn off CEG checks if one of the CEG'ed functions has a bigger impact on perf than expected
|
||||
|
||||
// To disable CEG in your build for one or more modules, add "/NO_CEG" to your VPC parameters
|
||||
#if (!defined( USE_CEG ) || ( !defined( CLIENT_DLL ) && !defined( GAME_DLL ) ) )
|
||||
|
||||
#define CEG_NOINLINE
|
||||
|
||||
// Stub out functions if CEG is disabled
|
||||
#define STEAMWORKS_REGISTERTHREAD() (true)
|
||||
#define STEAMWORKS_UNREGISTERTHREAD() (true)
|
||||
#define STEAMWORKS_INITCEGLIBRARY() (true)
|
||||
#define STEAMWORKS_TERMCEGLIBRARY() (true)
|
||||
#define STEAMWORKS_TESTSECRET()
|
||||
#define STEAMWORKS_TESTSECRETALWAYS()
|
||||
#define STEAMWORKS_SELFCHECK()
|
||||
#define STEAMWORKS_TESTSECRET_AMORTIZE( period )
|
||||
#define STEAMWORKS_TESTSECRETALWAYS_AMORTIZE( period )
|
||||
#define STEAMWORKS_SELFCHECK_AMORTIZE( period )
|
||||
#define RANDOM_CEG_TEST_SECRET()
|
||||
#define RANDOM_CEG_TEST_SECRET_PERIOD( testPeriod, checkPeriod )
|
||||
#define RANDOM_CEG_TEST_SECRET_LINE_PERIOD( testPeriod, testLinePeriod, checkPeriod, checkLinePeriod )
|
||||
#define CEG_PROTECT_FUNCTION( unquotedSymbolHelper )
|
||||
#define CEG_ENCRYPT_FUNCTION( unquotedSymbolHelper )
|
||||
#define CEG_PROTECT_MEMBER_FUNCTION( unquotedSymbolHelper )
|
||||
#define CEG_PROTECT_VIRTUAL_FUNCTION( unquotedSymbolHelper )
|
||||
#define CEG_PROTECT_STATIC_MEMBER_FUNCTION( unquotedSymbolHelper, fn_name )
|
||||
#define CEG_DECLARE_CONSTANT_FUNCTION( fn_name ) extern DWORD __cdecl fn_name();
|
||||
#define CEG_DECLARE_CONSTANT_FLOAT_FUNCTION( fn_name ) extern float __cdecl fn_name();
|
||||
#define CEG_DEFINE_CONSTANT_FUNCTION( fn_name, val ) DWORD __cdecl fn_name() { return val; }
|
||||
#define CEG_DEFINE_CONSTANT_FLOAT_FUNCTION( fn_name, val ) float __cdecl fn_name() { return val; }
|
||||
#define CEG_GET_CONSTANT_VALUE( fn_name ) fn_name()
|
||||
#define CEG_GCV_PRE()
|
||||
#define CEG_GCV_POST()
|
||||
|
||||
#else // CEG is enabled
|
||||
|
||||
#if defined( _GAMECONSOLE ) || defined( POSIX ) || defined( NO_STEAM )
|
||||
#error
|
||||
#endif
|
||||
|
||||
#include "cegclient.h"
|
||||
|
||||
// use this on any functions where we use CEG_PROTECT to ensure they don't get inlined in the CEG build
|
||||
#define CEG_NOINLINE __declspec(noinline)
|
||||
|
||||
// wrapping CEG calls in macros allows us to hide interface changes and centrally add checks and perf instrumentation
|
||||
#define STEAMWORKS_REGISTERTHREAD() Steamworks_RegisterThread()
|
||||
#define STEAMWORKS_UNREGISTERTHREAD() Steamworks_UnRegisterThread()
|
||||
#define STEAMWORKS_INITCEGLIBRARY() Steamworks_InitCEGLibrary()
|
||||
#define STEAMWORKS_TERMCEGLIBRARY() Steamworks_TermCEGLibrary()
|
||||
#define CEG_DECLARE_CONSTANT_FUNCTION( fn_name ) CEG_Declare_Constant_Function( fn_name )
|
||||
#define CEG_DECLARE_CONSTANT_FLOAT_FUNCTION( fn_name ) CEG_Declare_ConstantFloat_Function( fn_name )
|
||||
#define CEG_DEFINE_CONSTANT_FUNCTION( fn_name, val ) CEG_Define_Constant_Function( fn_name, val )
|
||||
#define CEG_DEFINE_CONSTANT_FLOAT_FUNCTION( fn_name, val ) CEG_Define_ConstantFloat_Function2( fn_name, val )
|
||||
#define CEG_GET_CONSTANT_VALUE( fn_name ) CEG_GetConstantValue( fn_name )
|
||||
|
||||
// seeded with large primes at frequencies that lead to approximately one check every 30 seconds
|
||||
#define RANDOM_CEG_TEST_SECRET() \
|
||||
RANDOM_CEG_TEST_SECRET_LINE_PERIOD( 128449, 19, 1102441, 397 )
|
||||
|
||||
#define RANDOM_CEG_TEST_SECRET_PERIOD( testPeriod, checkPeriod ) \
|
||||
RANDOM_CEG_TEST_SECRET_LINE_PERIOD( testPeriod, 0, checkPeriod, 0 )
|
||||
|
||||
// uncomment here to enable dev messages per CEG call, including CEG performance numbers
|
||||
//#define PROFILE_CEG
|
||||
#if !defined( PROFILE_CEG )
|
||||
|
||||
#define CEG_PROFILE_DECL
|
||||
#define CEG_PROFILE_BLOCK( fn_name, fn_type, identifier ) fn_name;
|
||||
#define CEG_GCV_PRE()
|
||||
#define CEG_GCV_POST()
|
||||
|
||||
#else // defined( PROFILE_CEG )
|
||||
|
||||
#include "tier0\fasttimer.h"
|
||||
|
||||
extern CAverageCycleCounter allCEG;
|
||||
extern CAverageCycleCounter allTestSecret;
|
||||
extern CAverageCycleCounter allSelfCheck;
|
||||
extern CAverageCycleCounter allProtectMember;
|
||||
extern CAverageCycleCounter allProtectVirtual;
|
||||
|
||||
#if !defined( MEMOVERRIDE_MODULE )
|
||||
#define MEMOVERRIDE_MODULE UNKNOWN_MODULE
|
||||
#endif
|
||||
|
||||
#define _MKSTRING(arg) #arg
|
||||
#define MKSTRING(arg) _MKSTRING(arg)
|
||||
|
||||
#define CEG_PROFILE_BLOCK( fn_name, fn_type, identifier ) \
|
||||
static unsigned long s_##fn_type##Hits = 0; \
|
||||
s_##fn_type##Hits++; \
|
||||
static CAverageCycleCounter this##fn_type; \
|
||||
{ \
|
||||
CAverageTimeMarker this##fn_type##Marker( &this##fn_type ); \
|
||||
CAverageTimeMarker all##fn_type##Marker( &all##fn_type ); \
|
||||
CAverageTimeMarker allCEGMarker( &allCEG ); \
|
||||
fn_name; \
|
||||
} \
|
||||
DevMsg( "%s: %s%s %s:%d - %.2fms avg (%.2fms total, %.2fms peak, %d iters), %lu/%lu = %.5f%% hit rate.\n" \
|
||||
"Avg CEG %s Cost: %.2fms Avg CEG Cost: %.2fms\n", \
|
||||
MKSTRING(MEMOVERRIDE_MODULE), identifier, #fn_type, __FILE__, __LINE__, \
|
||||
this##fn_type.GetAverageMilliseconds(), this##fn_type.GetTotalMilliseconds(), this##fn_type.GetPeakMilliseconds(), this##fn_type.GetIters(), \
|
||||
s_##fn_type##Hits, s_tests, \
|
||||
float( s_##fn_type##Hits * 100 ) / float( s_tests ), \
|
||||
#fn_type, \
|
||||
all##fn_type.GetAverageMilliseconds(), \
|
||||
allCEG.GetAverageMilliseconds() );
|
||||
|
||||
#define CEG_PROFILE_DECL \
|
||||
static unsigned long int s_tests = 0; \
|
||||
s_tests++;
|
||||
|
||||
#define CEG_GCV_PRE() \
|
||||
CFastTimer __FUNCTION__##Timer; \
|
||||
__FUNCTION__##Timer.Start();
|
||||
|
||||
#define CEG_GCV_POST() \
|
||||
__FUNCTION__##Timer.End(); \
|
||||
if( __FUNCTION__##Timer.GetDuration().GetMillisecondsF() > 0.5f ) \
|
||||
{ \
|
||||
DevMsg( "%s: GetConstantValue in %s : %.2fms\n", \
|
||||
MKSTRING(MEMOVERRIDE_MODULE), __FUNCTION__, __FUNCTION__##Timer.GetDuration().GetMillisecondsF() ); \
|
||||
}
|
||||
|
||||
#endif // PROFILE_CEG off/on
|
||||
|
||||
// the below macros allow us to turn profiling on or off with a single #ifdef, using the same underlying implementation in each case
|
||||
#define RANDOM_CEG_TEST_SECRET_LINE_PERIOD( testPeriod, testLinePeriod, checkPeriod, checkLinePeriod ) \
|
||||
do { \
|
||||
const unsigned long tp = testPeriod + testLinePeriod * __LINE__; \
|
||||
const unsigned long cp = checkPeriod + checkLinePeriod * __LINE__; \
|
||||
static unsigned long s_nCegCounter = __LINE__ ^ __COUNTER__ ^ reinterpret_cast<int>( &s_nCegCounter ); \
|
||||
++s_nCegCounter; \
|
||||
CEG_PROFILE_DECL; \
|
||||
if ( !( ( s_nCegCounter ) % ( tp ) ) ) \
|
||||
{ \
|
||||
CEG_PROFILE_BLOCK( Steamworks_TestSecretAlways(), TestSecret, "Random " ); \
|
||||
} \
|
||||
else if ( !( ( s_nCegCounter ) % ( cp ) ) ) \
|
||||
{ \
|
||||
CEG_PROFILE_BLOCK( Steamworks_SelfCheck(), SelfCheck, "Random " ); \
|
||||
} \
|
||||
} \
|
||||
while( 0 );
|
||||
|
||||
//
|
||||
// Can't grab metrics - although this is placed within the scope a function -
|
||||
// The effect is to change calls to the function to first execute some CEG code,
|
||||
// and this CEG code is not available within this scope.
|
||||
// The CEG code computes the address of the containing function, and jumps to it.
|
||||
//
|
||||
#define CEG_PROTECT_FUNCTION( unquotedSymbolHelper ) \
|
||||
CEG_ProtectFunction( );
|
||||
|
||||
//
|
||||
// Can't grab metrics - although this is placed within the scope a function -
|
||||
// The effect is to change calls to the function to first execute some CEG code,
|
||||
// and this CEG code is not available within this scope.
|
||||
//
|
||||
// The body of the function that contains this macro is encrypted, and the CEG code
|
||||
// decrypts the opcodes and places them in executable memory, and then executes it.
|
||||
// Upon return, the executable memory is released.
|
||||
//
|
||||
#define CEG_ENCRYPT_FUNCTION( unquotedSymbolHelper ) \
|
||||
CEG_EncryptFunction( );
|
||||
|
||||
#define CEG_PROTECT_MEMBER_FUNCTION( unquotedSymbolHelper ) \
|
||||
do { \
|
||||
CEG_PROFILE_DECL; \
|
||||
CEG_PROFILE_BLOCK( CEG_ProtectFunction( ), ProtectMember, "" ); \
|
||||
} \
|
||||
while( 0 );
|
||||
|
||||
#define CEG_PROTECT_VIRTUAL_FUNCTION( unquotedSymbolHelper ) \
|
||||
do { \
|
||||
CEG_PROFILE_DECL; \
|
||||
CEG_PROFILE_BLOCK( CEG_ProtectFunction( ), ProtectVirtual, "" ); \
|
||||
} while( 0 );
|
||||
|
||||
// defined outside the scope of a function, so can't trivially grab metrics
|
||||
#define CEG_PROTECT_STATIC_MEMBER_FUNCTION( unquotedSymbolHelper, fn_name ) \
|
||||
CEG_Protect_StaticMemberFunction( unquotedSymbolHelper, fn_name );
|
||||
|
||||
#define STEAMWORKS_TESTSECRET() \
|
||||
do { \
|
||||
CEG_PROFILE_DECL; \
|
||||
CEG_PROFILE_BLOCK( Steamworks_TestSecret(), TestSecret, "" ); \
|
||||
} while( 0 );
|
||||
|
||||
#define STEAMWORKS_TESTSECRETALWAYS() \
|
||||
do { \
|
||||
CEG_PROFILE_DECL; \
|
||||
CEG_PROFILE_BLOCK( Steamworks_TestSecretAlways(), TestSecret, "" ); \
|
||||
} while( 0 );
|
||||
|
||||
#define STEAMWORKS_SELFCHECK() \
|
||||
do { \
|
||||
CEG_PROFILE_DECL; \
|
||||
CEG_PROFILE_BLOCK( Steamworks_SelfCheck(), SelfCheck, "" ); \
|
||||
} while( 0 );
|
||||
|
||||
// AMORTIZED
|
||||
|
||||
#define STEAMWORKS_TESTSECRET_AMORTIZE( period ) \
|
||||
do { \
|
||||
const unsigned long tp = period; \
|
||||
static unsigned long s_nCegCounter = __LINE__ ^ __COUNTER__ ^ reinterpret_cast<int>( &s_nCegCounter ); \
|
||||
++s_nCegCounter; \
|
||||
CEG_PROFILE_DECL; \
|
||||
if ( !( ( s_nCegCounter ) % ( tp ) ) ) \
|
||||
{ \
|
||||
CEG_PROFILE_BLOCK( Steamworks_TestSecret(), TestSecret, "Amortized " ); \
|
||||
} \
|
||||
} while( 0 );
|
||||
|
||||
#define STEAMWORKS_TESTSECRETALWAYS_AMORTIZE( period ) \
|
||||
do { \
|
||||
const unsigned long tp = period; \
|
||||
static unsigned long s_nCegCounter = __LINE__ ^ __COUNTER__ ^ reinterpret_cast<int>( &s_nCegCounter ); \
|
||||
++s_nCegCounter; \
|
||||
CEG_PROFILE_DECL; \
|
||||
if ( !( ( s_nCegCounter ) % ( tp ) ) ) \
|
||||
{ \
|
||||
CEG_PROFILE_BLOCK( Steamworks_TestSecretAlways(), TestSecret, "Amortized " ); \
|
||||
} \
|
||||
} while( 0 );
|
||||
|
||||
#define STEAMWORKS_SELFCHECK_AMORTIZE( period ) \
|
||||
do { \
|
||||
const unsigned long tp = period; \
|
||||
static unsigned long s_nCegCounter = __LINE__ ^ __COUNTER__ ^ reinterpret_cast<int>( &s_nCegCounter ); \
|
||||
++s_nCegCounter; \
|
||||
CEG_PROFILE_DECL; \
|
||||
if ( !( ( s_nCegCounter ) % ( tp ) ) ) \
|
||||
{ \
|
||||
CEG_PROFILE_BLOCK( Steamworks_SelfCheck(), TestSecret, "Amortized " ); \
|
||||
} \
|
||||
} while( 0 );
|
||||
|
||||
|
||||
#endif // CEG disabled/enabled
|
||||
|
||||
#if defined( CLIENT_DLL ) // client-only
|
||||
|
||||
void Init_GCVs();
|
||||
|
||||
CEG_DECLARE_CONSTANT_FUNCTION( HudAllowTextChatFlag );
|
||||
CEG_DECLARE_CONSTANT_FUNCTION( HudAllowBuyMenuFlag );
|
||||
CEG_DECLARE_CONSTANT_FUNCTION( UiAllowProperTintFlag );
|
||||
|
||||
#elif defined( GAME_DLL ) // server-only
|
||||
|
||||
void Init_GCVs();
|
||||
|
||||
#endif // defined( GAME_DLL )
|
||||
|
||||
// Worst-case, if you need to debug CEG calls or CEG perf, and CEG profiling isn't doing the trick (it doesn't cover everything), you can
|
||||
// do a binary search on one or all of the below calls by restoring part of the #if 0 block below. You'll get a duplicate definition warning,
|
||||
// but anything redefined below will be a no-op in the build, allowing you to rule it out as a potential perf issue.
|
||||
// Remember that CEG builds neeed to be rebuilds (CEG'ed dlls only), but the /MP flag should make it about 60 seconds per rebuild.
|
||||
#if 0
|
||||
#define STEAMWORKS_TESTSECRET()
|
||||
#define STEAMWORKS_TESTSECRETALWAYS()
|
||||
#define STEAMWORKS_SELFCHECK()
|
||||
#define RANDOM_CEG_TEST_SECRET()
|
||||
#define RANDOM_CEG_TEST_SECRET_PERIOD( testPeriod, checkPeriod )
|
||||
#define RANDOM_CEG_TEST_SECRET_LINE_PERIOD( testPeriod, testLinePeriod, checkPeriod, checkLinePeriod )
|
||||
#define CEG_PROTECT_FUNCTION( unquotedSymbolHelper )
|
||||
#define CEG_PROTECT_MEMBER_FUNCTION( unquotedSymbolHelper )
|
||||
#define CEG_PROTECT_VIRTUAL_FUNCTION( unquotedSymbolHelper )
|
||||
#define CEG_PROTECT_STATIC_MEMBER_FUNCTION( unquotedSymbolHelper, fn_name )
|
||||
#define CEG_DECLARE_CONSTANT_FUNCTION( fn_name ) extern DWORD __cdecl fn_name();
|
||||
#define CEG_DECLARE_CONSTANT_FLOAT_FUNCTION( fn_name ) extern float __cdecl fn_name();
|
||||
#define CEG_DEFINE_CONSTANT_FUNCTION( fn_name, val ) DWORD __cdecl fn_name() { return val; }
|
||||
#define CEG_DEFINE_CONSTANT_FLOAT_FUNCTION( fn_name, val ) float __cdecl fn_name() { return val; }
|
||||
#define CEG_GET_CONSTANT_VALUE( fn_name ) fn_name()
|
||||
#endif
|
||||
|
||||
#endif //_CEGCLIENTWRAPPER_H_
|
||||
977
common/ConfigManager.cpp
Normal file
977
common/ConfigManager.cpp
Normal file
@@ -0,0 +1,977 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include <windows.h>
|
||||
#include "interface.h"
|
||||
#include "tier0/icommandline.h"
|
||||
#include "filesystem_tools.h"
|
||||
#include "KeyValues.h"
|
||||
#include "UtlBuffer.h"
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include "ConfigManager.h"
|
||||
#include "SourceAppInfo.h"
|
||||
#include "steam/steam_api.h"
|
||||
|
||||
extern CSteamAPIContext *steamapicontext;
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include <tier0/memdbgon.h>
|
||||
|
||||
#define GAME_CONFIG_FILENAME "GameConfig.txt"
|
||||
#define TOKEN_SDK_VERSION "SDKVersion"
|
||||
|
||||
// Version history:
|
||||
// 0 - Initial release
|
||||
// 1 - Versioning added, DoD configuration added
|
||||
// 2 - Ep1 added
|
||||
// 3 - Ep2, TF2, and Portal added
|
||||
// 4 - Portal 2 added
|
||||
// 5 - CSS 1.5
|
||||
|
||||
#define SDK_LAUNCHER_VERSION 5
|
||||
|
||||
// Half-Life 2
|
||||
defaultConfigInfo_t HL2Info =
|
||||
{
|
||||
"Half-Life 2",
|
||||
"hl2",
|
||||
"halflife2.fgd",
|
||||
"half-life 2",
|
||||
"info_player_start",
|
||||
"hl2.exe",
|
||||
GetAppSteamAppId( k_App_HL2 )
|
||||
};
|
||||
|
||||
// Counter-Strike: Source
|
||||
defaultConfigInfo_t CStrikeInfo =
|
||||
{
|
||||
"Counter-Strike: Source",
|
||||
"cstrike",
|
||||
"cstrike.fgd",
|
||||
"counter-strike source",
|
||||
"info_player_terrorist",
|
||||
"hl2.exe",
|
||||
GetAppSteamAppId( k_App_CSS )
|
||||
};
|
||||
|
||||
// Counter-Strike: Source
|
||||
defaultConfigInfo_t CStrike15Info =
|
||||
{
|
||||
"Counter-Strike: Global Offensive",
|
||||
"csgo",
|
||||
"csgo.fgd",
|
||||
"counter-strike global offensive",
|
||||
"info_player_terrorist",
|
||||
"csgo.exe",
|
||||
GetAppSteamAppId( k_App_CSS15 )
|
||||
};
|
||||
|
||||
//Half-Life 2: Deathmatch
|
||||
defaultConfigInfo_t HL2DMInfo =
|
||||
{
|
||||
"Half-Life 2: Deathmatch",
|
||||
"hl2mp",
|
||||
"hl2mp.fgd",
|
||||
"half-life 2 deathmatch",
|
||||
"info_player_deathmatch",
|
||||
"hl2.exe",
|
||||
GetAppSteamAppId( k_App_HL2MP )
|
||||
};
|
||||
|
||||
// Day of Defeat: Source
|
||||
defaultConfigInfo_t DODInfo =
|
||||
{
|
||||
"Day of Defeat: Source",
|
||||
"dod",
|
||||
"dod.fgd",
|
||||
"day of defeat source",
|
||||
"info_player_allies",
|
||||
"hl2.exe",
|
||||
GetAppSteamAppId( k_App_DODS )
|
||||
};
|
||||
|
||||
// Half-Life 2 Episode 1
|
||||
defaultConfigInfo_t Episode1Info =
|
||||
{
|
||||
"Half-Life 2: Episode One",
|
||||
"episodic",
|
||||
"halflife2.fgd",
|
||||
"half-life 2 episode one",
|
||||
"info_player_start",
|
||||
"hl2.exe",
|
||||
GetAppSteamAppId( k_App_HL2_EP1 )
|
||||
};
|
||||
|
||||
// Half-Life 2 Episode 2
|
||||
defaultConfigInfo_t Episode2Info =
|
||||
{
|
||||
"Half-Life 2: Episode Two",
|
||||
"ep2",
|
||||
"halflife2.fgd",
|
||||
"half-life 2 episode two",
|
||||
"info_player_start",
|
||||
"hl2.exe",
|
||||
GetAppSteamAppId( k_App_HL2_EP2 )
|
||||
};
|
||||
|
||||
// Team Fortress 2
|
||||
defaultConfigInfo_t TF2Info =
|
||||
{
|
||||
"Team Fortress 2",
|
||||
"tf",
|
||||
"tf.fgd",
|
||||
"team fortress 2",
|
||||
"info_player_teamspawn",
|
||||
"hl2.exe",
|
||||
GetAppSteamAppId( k_App_TF2 )
|
||||
};
|
||||
|
||||
// Portal
|
||||
defaultConfigInfo_t PortalInfo =
|
||||
{
|
||||
"Portal",
|
||||
"portal",
|
||||
"portal.fgd",
|
||||
"portal",
|
||||
"info_player_start",
|
||||
"hl2.exe",
|
||||
GetAppSteamAppId( k_App_PORTAL )
|
||||
};
|
||||
|
||||
// Portal 2
|
||||
defaultConfigInfo_t Portal2Info =
|
||||
{
|
||||
"Portal 2",
|
||||
"portal2",
|
||||
"portal2.fgd",
|
||||
"portal 2",
|
||||
"info_player_start",
|
||||
"portal2.exe",
|
||||
GetAppSteamAppId( k_App_PORTAL2 )
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//-----------------------------------------------------------------------------
|
||||
CGameConfigManager::CGameConfigManager( void ) : m_pData( NULL ), m_LoadStatus( LOADSTATUS_NONE )
|
||||
{
|
||||
// Start with default directory
|
||||
GetModuleFileName( ( HINSTANCE )GetModuleHandle( NULL ), m_szBaseDirectory, sizeof( m_szBaseDirectory ) );
|
||||
Q_StripLastDir( m_szBaseDirectory, sizeof( m_szBaseDirectory ) ); // Get rid of the filename.
|
||||
Q_StripTrailingSlash( m_szBaseDirectory );
|
||||
m_eSDKEpoch = (eSDKEpochs) SDK_LAUNCHER_VERSION;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Destructor
|
||||
//-----------------------------------------------------------------------------
|
||||
CGameConfigManager::~CGameConfigManager( void )
|
||||
{
|
||||
// Release the keyvalues
|
||||
if ( m_pData != NULL )
|
||||
{
|
||||
m_pData->deleteThis();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Config loading interface
|
||||
// Input : *baseDir - base directory for our file
|
||||
// Output : Returns true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::LoadConfigs( const char *baseDir )
|
||||
{
|
||||
return LoadConfigsInternal( baseDir, false );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Loads a file into the given utlbuffer.
|
||||
// Output : Returns true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ReadUtlBufferFromFile( CUtlBuffer &buffer, const char *szPath )
|
||||
{
|
||||
struct _stat fileInfo;
|
||||
if ( _stat( szPath, &fileInfo ) == -1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
buffer.EnsureCapacity( fileInfo.st_size );
|
||||
|
||||
int nFile = _open( szPath, _O_BINARY | _O_RDONLY );
|
||||
if ( nFile == -1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( _read( nFile, buffer.Base(), fileInfo.st_size ) != fileInfo.st_size )
|
||||
{
|
||||
_close( nFile );
|
||||
return false;
|
||||
}
|
||||
|
||||
_close( nFile );
|
||||
buffer.SeekPut( CUtlBuffer::SEEK_HEAD, fileInfo.st_size );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Loads a file into the given utlbuffer.
|
||||
// Output : Returns true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool SaveUtlBufferToFile( CUtlBuffer &buffer, const char *szPath )
|
||||
{
|
||||
int nFile = _open( szPath, _O_TEXT | _O_CREAT | _O_TRUNC | _O_RDWR, _S_IWRITE );
|
||||
if ( nFile == -1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int nSize = buffer.TellMaxPut();
|
||||
|
||||
if ( _write( nFile, buffer.Base(), nSize ) < nSize )
|
||||
{
|
||||
_close( nFile );
|
||||
return false;
|
||||
}
|
||||
|
||||
_close( nFile );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Load a game configuration file (with fail-safes)
|
||||
// Output : Returns true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::LoadConfigsInternal( const char *baseDir, bool bRecursiveCall )
|
||||
{
|
||||
// Init the config if it doesn't exist
|
||||
if ( !IsLoaded() )
|
||||
{
|
||||
m_pData = new KeyValues( GAME_CONFIG_FILENAME );
|
||||
|
||||
if ( !IsLoaded() )
|
||||
{
|
||||
m_LoadStatus = LOADSTATUS_ERROR;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear it out
|
||||
m_pData->Clear();
|
||||
|
||||
// Build our default directory
|
||||
if ( baseDir != NULL && baseDir[0] != NULL )
|
||||
{
|
||||
SetBaseDirectory( baseDir );
|
||||
}
|
||||
|
||||
// Make a full path name
|
||||
char szPath[MAX_PATH];
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), GAME_CONFIG_FILENAME );
|
||||
|
||||
bool bLoaded = false;
|
||||
|
||||
CUtlBuffer buffer( 0, 0, CUtlBuffer::TEXT_BUFFER );
|
||||
if ( ReadUtlBufferFromFile( buffer, szPath ) )
|
||||
{
|
||||
bLoaded = m_pData->LoadFromBuffer( szPath, buffer, NULL, NULL );
|
||||
}
|
||||
|
||||
if ( !bLoaded )
|
||||
{
|
||||
// Attempt to re-create the configs
|
||||
if ( CreateAllDefaultConfigs() )
|
||||
{
|
||||
// Only allow this once
|
||||
if ( !bRecursiveCall )
|
||||
return LoadConfigsInternal( baseDir, true );
|
||||
|
||||
// Version the config.
|
||||
VersionConfig();
|
||||
}
|
||||
|
||||
m_LoadStatus = LOADSTATUS_ERROR;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check to see if the gameconfig.txt is up to date.
|
||||
UpdateConfigsInternal();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Add to the current config.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CGameConfigManager::UpdateConfigsInternal( void )
|
||||
{
|
||||
// Check to a valid gameconfig.txt file buffer.
|
||||
if ( !IsLoaded() )
|
||||
return;
|
||||
|
||||
// Check for version first. If the version is up to date, it is assumed to be accurate
|
||||
if ( IsConfigCurrent() )
|
||||
return;
|
||||
|
||||
KeyValues *pGameBlock = GetGameBlock();
|
||||
if ( !pGameBlock )
|
||||
{
|
||||
// If we don't have a game block, reset the config file.
|
||||
ResetConfigs();
|
||||
return;
|
||||
}
|
||||
|
||||
KeyValues *pDefaultBlock = new KeyValues( "DefaultConfigs" );
|
||||
if ( pDefaultBlock != NULL )
|
||||
{
|
||||
// Compile our default configurations
|
||||
GetDefaultGameBlock( pDefaultBlock );
|
||||
|
||||
// Compare our default block to our current configs
|
||||
KeyValues *pNextSubKey = pDefaultBlock->GetFirstTrueSubKey();
|
||||
while ( pNextSubKey != NULL )
|
||||
{
|
||||
// If we already have the name, we don't care about it
|
||||
if ( pGameBlock->FindKey( pNextSubKey->GetName() ) )
|
||||
{
|
||||
// Advance by one key
|
||||
pNextSubKey = pNextSubKey->GetNextTrueSubKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Copy the data through to our game block
|
||||
KeyValues *pKeyCopy = pNextSubKey->MakeCopy();
|
||||
pGameBlock->AddSubKey( pKeyCopy );
|
||||
|
||||
// Advance by one key
|
||||
pNextSubKey = pNextSubKey->GetNextTrueSubKey();
|
||||
}
|
||||
|
||||
// All done
|
||||
pDefaultBlock->deleteThis();
|
||||
}
|
||||
|
||||
// Save the new config.
|
||||
SaveConfigs();
|
||||
|
||||
// Add the new version as we have been updated.
|
||||
VersionConfig();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Update the gameconfig.txt version number.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CGameConfigManager::VersionConfig( void )
|
||||
{
|
||||
// Check to a valid gameconfig.txt file buffer.
|
||||
if ( !IsLoaded() )
|
||||
return;
|
||||
|
||||
// Look for the a version key value pair and update it.
|
||||
KeyValues *pKeyVersion = m_pData->FindKey( TOKEN_SDK_VERSION );
|
||||
|
||||
// Update the already existing version key value pair.
|
||||
if ( pKeyVersion )
|
||||
{
|
||||
if ( pKeyVersion->GetInt() == m_eSDKEpoch )
|
||||
return;
|
||||
|
||||
m_pData->SetInt( TOKEN_SDK_VERSION, m_eSDKEpoch );
|
||||
}
|
||||
// Create a new version key value pair.
|
||||
else
|
||||
{
|
||||
m_pData->SetInt( TOKEN_SDK_VERSION, m_eSDKEpoch );
|
||||
}
|
||||
|
||||
// Save the configuration.
|
||||
SaveConfigs();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Check to see if the version of the gameconfig.txt is up to date.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::IsConfigCurrent( void )
|
||||
{
|
||||
// Check to a valid gameconfig.txt file buffer.
|
||||
if ( !IsLoaded() )
|
||||
return false;
|
||||
|
||||
KeyValues *pKeyValue = m_pData->FindKey( TOKEN_SDK_VERSION );
|
||||
if ( !pKeyValue )
|
||||
return false;
|
||||
|
||||
int nVersion = pKeyValue->GetInt();
|
||||
if ( nVersion == m_eSDKEpoch )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Get the base path for a default config's install (handling steam's paths)
|
||||
//-----------------------------------------------------------------------------
|
||||
void CGameConfigManager::GetRootGameDirectory( char *out, size_t outLen, const char *rootDir, const char *steamDir )
|
||||
{
|
||||
// NOTE: This has since been depricated due to Steam filesystem changes -- jdw
|
||||
Q_strncpy( out, rootDir, outLen );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Get the base path for a default config's content sources (handling steam's paths)
|
||||
//-----------------------------------------------------------------------------
|
||||
void CGameConfigManager::GetRootContentDirectory( char *out, size_t outLen, const char *rootDir )
|
||||
{
|
||||
// Steam install is different
|
||||
if ( IsSDKDeployment() )
|
||||
{
|
||||
Q_snprintf( out, outLen, "%s\\sdk_content", rootDir );
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_snprintf( out, outLen, "%s\\content", rootDir );
|
||||
}
|
||||
}
|
||||
|
||||
// Default game configuration template
|
||||
const char szDefaultConfigText[] =
|
||||
"\"%gamename%\"\
|
||||
{\
|
||||
\"GameDir\" \"%gamedir%\"\
|
||||
\"Hammer\"\
|
||||
{\
|
||||
\"TextureFormat\" \"5\"\
|
||||
\"MapFormat\" \"4\"\
|
||||
\"DefaultTextureScale\" \"0.250000\"\
|
||||
\"DefaultLightmapScale\" \"16\"\
|
||||
\"DefaultSolidEntity\" \"func_detail\"\
|
||||
\"DefaultPointEntity\" \"%defaultpointentity%\"\
|
||||
\"GameExeDir\" \"%gameexe%\"\
|
||||
\"MapDir\" \"%gamemaps%\"\
|
||||
\"CordonTexture\" \"tools\\toolsskybox\"\
|
||||
\"MaterialExcludeCount\" \"0\"\
|
||||
\"GameExe\" \"%gameEXE%\"\
|
||||
\"BSP\" \"%bspdir%\"\
|
||||
\"Vis\" \"%visdir%\"\
|
||||
\"Light\" \"%lightdir%\"\
|
||||
}}";
|
||||
|
||||
// NOTE: This function could use some re-write, it can't handle non-retail paths well
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Add a templated default configuration with proper paths
|
||||
// Output : Returns true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::AddDefaultConfig( const defaultConfigInfo_t &info, KeyValues *out, const char *rootDirectory, const char *gameExeDir )
|
||||
{
|
||||
// NOTE: Freed by head keyvalue
|
||||
KeyValues *newConfig = new KeyValues( info.gameName );
|
||||
|
||||
// Set this up to autodelete until we know we're actually going to use it
|
||||
KeyValues::AutoDelete autodelete_key( newConfig );
|
||||
|
||||
if ( newConfig->LoadFromBuffer( "defaultcfg.txt", szDefaultConfigText ) == false )
|
||||
return false;
|
||||
|
||||
newConfig->SetName( info.gameName );
|
||||
|
||||
// Game's root directory (with special steam name handling)
|
||||
char rootGameDir[MAX_PATH];
|
||||
GetRootGameDirectory( rootGameDir, sizeof( rootGameDir ), rootDirectory, info.steamPath );
|
||||
|
||||
// Game's content directory
|
||||
char contentRootDir[MAX_PATH];
|
||||
GetRootContentDirectory( contentRootDir, sizeof( contentRootDir ), rootDirectory );
|
||||
|
||||
char szPath[MAX_PATH];
|
||||
|
||||
// Game directory
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", rootGameDir, info.gameDir );
|
||||
newConfig->SetString( "GameDir", szPath );
|
||||
|
||||
// Create the Hammer portion of this block
|
||||
KeyValues *hammerBlock = newConfig->FindKey( "Hammer" );
|
||||
|
||||
if ( hammerBlock == NULL )
|
||||
return false;
|
||||
|
||||
hammerBlock->SetString( "GameExeDir", gameExeDir );
|
||||
|
||||
// Fill in the proper default point entity
|
||||
hammerBlock->SetString( "DefaultPointEntity", info.defaultPointEntity );
|
||||
|
||||
// Fill in the default VMF directory
|
||||
char contentMapDir[MAX_PATH];
|
||||
Q_snprintf( contentMapDir, sizeof( contentMapDir ), "%s\\maps", contentRootDir );
|
||||
hammerBlock->SetString( "MapDir", contentMapDir );
|
||||
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s\\maps", rootGameDir, info.gameDir );
|
||||
hammerBlock->SetString( "BSPDir", szPath );
|
||||
|
||||
// Fill in the game executable
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", gameExeDir, info.exeName );
|
||||
hammerBlock->SetString( "GameEXE", szPath );
|
||||
|
||||
//Fill in game FGDs
|
||||
if ( info.FGD[0] != '\0' )
|
||||
{
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), info.FGD );
|
||||
hammerBlock->SetString( "GameData0", szPath );
|
||||
}
|
||||
|
||||
// Fill in the tools path
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\vbsp.exe", GetBaseDirectory() );
|
||||
hammerBlock->SetString( "BSP", szPath );
|
||||
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\vvis.exe", GetBaseDirectory() );
|
||||
hammerBlock->SetString( "Vis", szPath );
|
||||
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\vrad.exe", GetBaseDirectory() );
|
||||
hammerBlock->SetString( "Light", szPath );
|
||||
|
||||
// Get our insertion point
|
||||
KeyValues *insertSpot = out->GetFirstTrueSubKey();
|
||||
|
||||
// detach the autodelete pointer
|
||||
autodelete_key.Assign(NULL);
|
||||
// Set this as the sub key if there's nothing already there
|
||||
if ( insertSpot == NULL )
|
||||
{
|
||||
out->AddSubKey( newConfig );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find the last subkey
|
||||
while ( insertSpot->GetNextTrueSubKey() )
|
||||
{
|
||||
insertSpot = insertSpot->GetNextTrueSubKey();
|
||||
}
|
||||
|
||||
// Become a peer to it
|
||||
insertSpot->SetNextKey( newConfig );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Determines whether the requested appID is installed on this computer
|
||||
// Input : nAppID - ID to verify
|
||||
// Output : Returns true if installed, false if not.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::IsAppSubscribed( int nAppID )
|
||||
{
|
||||
bool bIsSubscribed = false;
|
||||
|
||||
if ( g_pFullFileSystem != NULL && g_pFullFileSystem->IsSteam() )
|
||||
{
|
||||
if ( steamapicontext->SteamApps() )
|
||||
{
|
||||
// See if specified app is installed
|
||||
bIsSubscribed = steamapicontext->SteamApps()->BIsSubscribedApp( nAppID );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we aren't running FileSystem Steam then we must be doing internal development. Give everything.
|
||||
bIsSubscribed = true;
|
||||
}
|
||||
|
||||
return bIsSubscribed;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Create default configurations for all Valve retail applications
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::CreateAllDefaultConfigs( void )
|
||||
{
|
||||
bool bRetVal = true;
|
||||
|
||||
// Start our new block
|
||||
KeyValues *configBlock = new KeyValues( "Configs" );
|
||||
KeyValues *gameBlock = configBlock->CreateNewKey();
|
||||
gameBlock->SetName( "Games" );
|
||||
|
||||
GetDefaultGameBlock( gameBlock );
|
||||
|
||||
bRetVal = !gameBlock->IsEmpty();
|
||||
|
||||
// Make a full path name
|
||||
char szPath[MAX_PATH];
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), GAME_CONFIG_FILENAME );
|
||||
|
||||
CUtlBuffer buffer;
|
||||
configBlock->RecursiveSaveToFile( buffer, 0 );
|
||||
SaveUtlBufferToFile( buffer, szPath );
|
||||
|
||||
configBlock->deleteThis();
|
||||
|
||||
m_LoadStatus = LOADSTATUS_CREATED;
|
||||
|
||||
return bRetVal;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Load game information from an INI file
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::ConvertGameConfigsINI( void )
|
||||
{
|
||||
const char *iniFilePath = GetIniFilePath();
|
||||
|
||||
// Load our INI file
|
||||
int nNumConfigs = GetPrivateProfileInt( "Configs", "NumConfigs", 0, iniFilePath );
|
||||
if ( nNumConfigs <= 0 )
|
||||
return false;
|
||||
|
||||
// Build a new keyvalue file
|
||||
KeyValues *headBlock = new KeyValues( "Configs" );
|
||||
|
||||
// Create the block for games
|
||||
KeyValues *gamesBlock = headBlock->CreateNewKey( );
|
||||
gamesBlock->SetName( "Games" );
|
||||
|
||||
int i;
|
||||
int nStrlen;
|
||||
char szSectionName[MAX_PATH];
|
||||
char textBuffer[MAX_PATH];
|
||||
|
||||
// Parse all the configs
|
||||
for ( int nConfig = 0; nConfig < nNumConfigs; nConfig++ )
|
||||
{
|
||||
// Each came configuration is stored in a different section, named "GameConfig0..GameConfigN".
|
||||
// If the "Name" key exists in this section, try to load the configuration from this section.
|
||||
sprintf(szSectionName, "GameConfig%d", nConfig);
|
||||
|
||||
int nCount = GetPrivateProfileString(szSectionName, "Name", "", textBuffer, sizeof(textBuffer), iniFilePath);
|
||||
if (nCount > 0)
|
||||
{
|
||||
// Make a new section
|
||||
KeyValues *subGame = gamesBlock->CreateNewKey();
|
||||
subGame->SetName( textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "ModDir", "", textBuffer, sizeof(textBuffer), iniFilePath);
|
||||
|
||||
// Add the mod dir
|
||||
subGame->SetString( "GameDir", textBuffer );
|
||||
|
||||
// Start a block for Hammer settings
|
||||
KeyValues *hammerBlock = subGame->CreateNewKey();
|
||||
hammerBlock->SetName( "Hammer" );
|
||||
|
||||
i = 0;
|
||||
|
||||
// Get all FGDs
|
||||
do
|
||||
{
|
||||
char szGameData[MAX_PATH];
|
||||
|
||||
sprintf( szGameData, "GameData%d", i );
|
||||
nStrlen = GetPrivateProfileString( szSectionName, szGameData, "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
|
||||
if ( nStrlen > 0 )
|
||||
{
|
||||
hammerBlock->SetString( szGameData, textBuffer );
|
||||
i++;
|
||||
}
|
||||
} while ( nStrlen > 0 );
|
||||
|
||||
hammerBlock->SetInt( "TextureFormat", GetPrivateProfileInt( szSectionName, "TextureFormat", 5 /*FIXME: tfVMT*/, iniFilePath ) );
|
||||
hammerBlock->SetInt( "MapFormat", GetPrivateProfileInt( szSectionName, "MapFormat", 4 /*FIXME: mfHalfLife2*/, iniFilePath ) );
|
||||
|
||||
// Default texture scale
|
||||
GetPrivateProfileString( szSectionName, "DefaultTextureScale", "1", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
float defaultTextureScale = (float) atof( textBuffer );
|
||||
if ( defaultTextureScale == 0 )
|
||||
{
|
||||
defaultTextureScale = 1.0f;
|
||||
}
|
||||
|
||||
hammerBlock->SetFloat( "DefaultTextureScale", defaultTextureScale );
|
||||
|
||||
hammerBlock->SetInt( "DefaultLightmapScale", GetPrivateProfileInt( szSectionName, "DefaultLightmapScale", 16 /*FIXME: DEFAULT_LIGHTMAP_SCALE*/, iniFilePath ) );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "GameExe", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "GameExe", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "DefaultSolidEntity", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "DefaultSolidEntity", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "DefaultPointEntity", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "DefaultPointEntity", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "BSP", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "BSP", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "Vis", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "Vis", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "Light", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "Light", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "GameExeDir", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "GameExeDir", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "MapDir", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "MapDir", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "BSPDir", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "BSPDir", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "CordonTexture", "", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
hammerBlock->SetString( "CordonTexture", textBuffer );
|
||||
|
||||
GetPrivateProfileString( szSectionName, "MaterialExcludeCount", "0", textBuffer, sizeof(textBuffer), iniFilePath );
|
||||
int materialExcludeCount = atoi( textBuffer );
|
||||
hammerBlock->SetInt( "MaterialExcludeCount", materialExcludeCount );
|
||||
|
||||
char excludeDir[MAX_PATH];
|
||||
|
||||
// Write out all excluded directories
|
||||
for( i = 0; i < materialExcludeCount; i++ )
|
||||
{
|
||||
sprintf( &excludeDir[0], "-MaterialExcludeDir%d", i );
|
||||
GetPrivateProfileString( szSectionName, excludeDir, "", textBuffer, sizeof( textBuffer ), iniFilePath );
|
||||
hammerBlock->SetString( excludeDir, textBuffer );
|
||||
}
|
||||
}
|
||||
}
|
||||
// Make a full path name
|
||||
char szPath[MAX_PATH];
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), GAME_CONFIG_FILENAME );
|
||||
|
||||
CUtlBuffer buffer;
|
||||
headBlock->RecursiveSaveToFile( buffer, 0 );
|
||||
SaveUtlBufferToFile( buffer, szPath );
|
||||
|
||||
// Rename the old INI file
|
||||
char newFilePath[MAX_PATH];
|
||||
Q_snprintf( newFilePath, sizeof( newFilePath ), "%s.OLD", iniFilePath );
|
||||
|
||||
rename( iniFilePath, newFilePath );
|
||||
|
||||
// Notify that we were converted
|
||||
m_LoadStatus = LOADSTATUS_CONVERTED;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Write out a game configuration file
|
||||
// Output : Returns true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::SaveConfigs( const char *baseDir )
|
||||
{
|
||||
if ( !IsLoaded() )
|
||||
return false;
|
||||
|
||||
// Build our default directory
|
||||
if ( baseDir != NULL && baseDir[0] != NULL )
|
||||
{
|
||||
SetBaseDirectory( baseDir );
|
||||
}
|
||||
|
||||
// Make a full path name
|
||||
char szPath[MAX_PATH];
|
||||
Q_strncpy( szPath, GetBaseDirectory(), sizeof(szPath) );
|
||||
Q_AppendSlash( szPath, sizeof(szPath) );
|
||||
Q_strncat( szPath, GAME_CONFIG_FILENAME, sizeof( szPath ), COPY_ALL_CHARACTERS );
|
||||
|
||||
CUtlBuffer buffer;
|
||||
m_pData->RecursiveSaveToFile( buffer, 0 );
|
||||
|
||||
return SaveUtlBufferToFile( buffer, szPath );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Find the directory our .exe is based out of
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CGameConfigManager::GetBaseDirectory( void )
|
||||
{
|
||||
return m_szBaseDirectory;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Find the root directory
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CGameConfigManager::GetRootDirectory( void )
|
||||
{
|
||||
static char path[MAX_PATH] = {0};
|
||||
if ( path[0] == 0 )
|
||||
{
|
||||
Q_strncpy( path, GetBaseDirectory(), sizeof( path ) );
|
||||
Q_StripLastDir( path, sizeof( path ) ); // Get rid of the 'bin' directory
|
||||
Q_StripTrailingSlash( path );
|
||||
|
||||
if ( g_pFullFileSystem && g_pFullFileSystem->IsSteam() )
|
||||
{
|
||||
Q_StripLastDir( path, sizeof( path ) ); // // Get rid of the 'orangebox' directory
|
||||
Q_StripTrailingSlash( path );
|
||||
Q_StripLastDir( path, sizeof( path ) ); // Get rid of the 'bin' directory
|
||||
Q_StripTrailingSlash( path );
|
||||
Q_StripLastDir( path, sizeof( path ) ); // Get rid of the 'sourcesdk' directory
|
||||
Q_StripTrailingSlash( path );
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Returns the game configuation block
|
||||
//-----------------------------------------------------------------------------
|
||||
KeyValues *CGameConfigManager::GetGameBlock( void )
|
||||
{
|
||||
if ( !IsLoaded() )
|
||||
return NULL;
|
||||
|
||||
return ( m_pData->FindKey( TOKEN_GAMES ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Returns a piece of the game configuation block of the given name
|
||||
// Input : *keyName - name of the block to return
|
||||
//-----------------------------------------------------------------------------
|
||||
KeyValues *CGameConfigManager::GetGameSubBlock( const char *keyName )
|
||||
{
|
||||
if ( !IsLoaded() )
|
||||
return NULL;
|
||||
|
||||
KeyValues *pGameBlock = GetGameBlock();
|
||||
if ( pGameBlock == NULL )
|
||||
return NULL;
|
||||
|
||||
// Return the data
|
||||
KeyValues *pSubBlock = pGameBlock->FindKey( keyName );
|
||||
|
||||
return pSubBlock;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Get the gamecfg.ini file for conversion
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CGameConfigManager::GetIniFilePath( void )
|
||||
{
|
||||
static char iniFilePath[MAX_PATH] = {0};
|
||||
if ( iniFilePath[0] == 0 )
|
||||
{
|
||||
Q_strncpy( iniFilePath, GetBaseDirectory(), sizeof( iniFilePath ) );
|
||||
Q_strncat( iniFilePath, "\\gamecfg.ini", sizeof( iniFilePath ), COPY_ALL_CHARACTERS );
|
||||
}
|
||||
|
||||
return iniFilePath;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Deletes the current config and recreates it with default values
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::ResetConfigs( const char *baseDir /*= NULL*/ )
|
||||
{
|
||||
// Build our default directory
|
||||
if ( baseDir != NULL && baseDir[0] != NULL )
|
||||
{
|
||||
SetBaseDirectory( baseDir );
|
||||
}
|
||||
|
||||
// Make a full path name
|
||||
char szPath[MAX_PATH];
|
||||
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), GAME_CONFIG_FILENAME );
|
||||
|
||||
// Delete the file
|
||||
if ( unlink( szPath ) )
|
||||
return false;
|
||||
|
||||
// Load the file again (causes defaults to be created)
|
||||
if ( LoadConfigsInternal( baseDir, false ) == false )
|
||||
return false;
|
||||
|
||||
// Save it out
|
||||
return SaveConfigs( baseDir );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CGameConfigManager::SetBaseDirectory( const char *pDirectory )
|
||||
{
|
||||
// Clear it
|
||||
if ( pDirectory == NULL || pDirectory[0] == '\0' )
|
||||
{
|
||||
m_szBaseDirectory[0] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy it
|
||||
Q_strncpy( m_szBaseDirectory, pDirectory, sizeof( m_szBaseDirectory ) );
|
||||
Q_StripTrailingSlash( m_szBaseDirectory );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Create a block of keyvalues containing our default configurations
|
||||
// Output : A block of keyvalues
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameConfigManager::GetDefaultGameBlock( KeyValues *pIn )
|
||||
{
|
||||
CUtlVector<defaultConfigInfo_t> defaultConfigs;
|
||||
|
||||
// Add HL2 games to list
|
||||
if ( m_eSDKEpoch == SDK_EPOCH_HL2 || m_eSDKEpoch == SDK_EPOCH_EP1 )
|
||||
{
|
||||
defaultConfigs.AddToTail( HL2Info );
|
||||
defaultConfigs.AddToTail( CStrikeInfo );
|
||||
defaultConfigs.AddToTail( HL2DMInfo );
|
||||
}
|
||||
// Add EP1 game to list
|
||||
if ( m_eSDKEpoch == SDK_EPOCH_EP1 )
|
||||
{
|
||||
defaultConfigs.AddToTail( Episode1Info );
|
||||
}
|
||||
|
||||
// Add EP2 games to list
|
||||
if ( m_eSDKEpoch == SDK_EPOCH_EP2 )
|
||||
{
|
||||
defaultConfigs.AddToTail( Episode2Info );
|
||||
}
|
||||
|
||||
if ( m_eSDKEpoch == SDK_EPOCH_PORTAL2 )
|
||||
{
|
||||
defaultConfigs.AddToTail( Portal2Info );
|
||||
}
|
||||
|
||||
// CSS 1.5
|
||||
if ( m_eSDKEpoch == SDK_EPOCH_CSS15 )
|
||||
{
|
||||
defaultConfigs.AddToTail( CStrike15Info );
|
||||
}
|
||||
|
||||
if ( pIn == NULL )
|
||||
return false;
|
||||
|
||||
char szPath[MAX_PATH];
|
||||
|
||||
// Add all default configs
|
||||
int nNumConfigs = defaultConfigs.Count();
|
||||
for ( int i = 0; i < nNumConfigs; i++ )
|
||||
{
|
||||
// If it's installed, add it
|
||||
if ( IsAppSubscribed( defaultConfigs[i].steamAppID ) )
|
||||
{
|
||||
GetRootGameDirectory( szPath, sizeof( szPath ), GetRootDirectory(), defaultConfigs[i].steamPath );
|
||||
AddDefaultConfig( defaultConfigs[i], pIn, GetRootDirectory(), szPath );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
135
common/ConfigManager.h
Normal file
135
common/ConfigManager.h
Normal file
@@ -0,0 +1,135 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef CONFIGMANAGER_H
|
||||
#define CONFIGMANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "keyvalues.h"
|
||||
#include "utlvector.h"
|
||||
#include "filesystem_init.h"
|
||||
|
||||
|
||||
// See filesystem_init for the vconfig registry values.
|
||||
|
||||
|
||||
#define TOKEN_GAMES "Games"
|
||||
#define TOKEN_GAME_DIRECTORY "GameDir"
|
||||
#define TOKEN_TOOLS "Tools"
|
||||
|
||||
// STEAM CLOUD FLAGS
|
||||
#define STEAMREMOTESTORAGE_CLOUD_CONFIG (1<<0)
|
||||
|
||||
#define STEAMREMOTESTORAGE_CLOUD_ALL 0x7fff // all bits set, so any new items added will be on by default
|
||||
|
||||
struct defaultConfigInfo_t
|
||||
{
|
||||
char gameName[MAX_PATH];
|
||||
char gameDir[MAX_PATH];
|
||||
char FGD[MAX_PATH];
|
||||
char steamPath[MAX_PATH];
|
||||
char defaultPointEntity[MAX_PATH];
|
||||
char exeName[MAX_PATH];
|
||||
int steamAppID;
|
||||
};
|
||||
|
||||
enum eSDKEpochs
|
||||
{
|
||||
SDK_EPOCH_HL2 = 1,
|
||||
SDK_EPOCH_EP1 = 2,
|
||||
SDK_EPOCH_EP2 = 3,
|
||||
SDK_EPOCH_PORTAL2 = 4,
|
||||
SDK_EPOCH_CSS15 = 5,
|
||||
};
|
||||
|
||||
extern defaultConfigInfo_t *gDefaultConfigs[];
|
||||
|
||||
class CGameConfigManager
|
||||
{
|
||||
public:
|
||||
|
||||
enum loadStatus_t
|
||||
{
|
||||
LOADSTATUS_NONE = 0, // Configs were loaded with no error
|
||||
LOADSTATUS_CONVERTED, // GameConfig.txt did not exist and was created by converting GameCfg.INI
|
||||
LOADSTATUS_CREATED, // GameCfg.INI was not found, the system created the default configuration based on found GameInfo.txt resources
|
||||
LOADSTATUS_ERROR, // File was not loaded and was unable to perform the above fail-safe procedures
|
||||
};
|
||||
|
||||
CGameConfigManager( void );
|
||||
CGameConfigManager( const char *fileName );
|
||||
|
||||
~CGameConfigManager( void );
|
||||
|
||||
bool LoadConfigs( const char *baseDir = NULL );
|
||||
bool SaveConfigs( const char *baseDir = NULL );
|
||||
bool ResetConfigs( const char *baseDir = NULL );
|
||||
|
||||
int GetNumConfigs( void );
|
||||
|
||||
KeyValues *GetGameBlock( void );
|
||||
KeyValues *GetGameSubBlock( const char *keyName );
|
||||
bool GetDefaultGameBlock( KeyValues *pIn );
|
||||
|
||||
bool IsLoaded( void ) const { return m_pData != NULL; }
|
||||
|
||||
bool WasConvertedOnLoad( void ) const { return m_LoadStatus == LOADSTATUS_CONVERTED; }
|
||||
bool WasCreatedOnLoad( void ) const { return m_LoadStatus == LOADSTATUS_CREATED; }
|
||||
|
||||
bool AddDefaultConfig( const defaultConfigInfo_t &info, KeyValues *out, const char *rootDirectory, const char *gameExeDir );
|
||||
|
||||
void SetBaseDirectory( const char *pDirectory );
|
||||
|
||||
void GetRootGameDirectory( char *out, size_t outLen, const char *rootDir, const char *steamDir );
|
||||
|
||||
const char *GetRootDirectory( void );
|
||||
void SetSDKEpoch( eSDKEpochs epoch ) { m_eSDKEpoch = epoch; };
|
||||
|
||||
static bool IsSDKDeployment()
|
||||
{
|
||||
static bool bRetVal = false;
|
||||
static bool bInitialized = false;
|
||||
|
||||
if ( g_pFullFileSystem && !bInitialized )
|
||||
{
|
||||
char szBaseDirectory[MAX_PATH];
|
||||
|
||||
// Check to see whether 'steamapps/common' is part of the path to this EXE
|
||||
g_pFullFileSystem->GetCurrentDirectory( szBaseDirectory, sizeof( szBaseDirectory ) );
|
||||
V_FixSlashes( szBaseDirectory, '/' );
|
||||
bRetVal = ( V_stristr( szBaseDirectory, "steamapps/common" ) != NULL );
|
||||
bInitialized = true;
|
||||
}
|
||||
|
||||
return ( bRetVal );
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
void GetRootContentDirectory( char *out, size_t outLen, const char *rootDir );
|
||||
|
||||
const char *GetBaseDirectory( void );
|
||||
const char *GetIniFilePath( void );
|
||||
|
||||
bool LoadConfigsInternal( const char *baseDir, bool bRecursiveCall );
|
||||
void UpdateConfigsInternal( void );
|
||||
void VersionConfig( void );
|
||||
bool IsConfigCurrent( void );
|
||||
|
||||
bool ConvertGameConfigsINI( void );
|
||||
bool CreateAllDefaultConfigs( void );
|
||||
bool IsAppSubscribed( int nAppID );
|
||||
|
||||
loadStatus_t m_LoadStatus; // Holds various state about what occured while loading
|
||||
KeyValues *m_pData; // Data as read from configuration file
|
||||
char m_szBaseDirectory[MAX_PATH]; // Default directory
|
||||
eSDKEpochs m_eSDKEpoch; // Holds the "working version" of the SDK for times when we need to create an older set of game configurations.
|
||||
// This is required now that the SDK is deploying the tools for both the latest and previous versions of the engine.
|
||||
};
|
||||
|
||||
#endif // CONFIGMANAGER_H
|
||||
94
common/FindSteamServers.h
Normal file
94
common/FindSteamServers.h
Normal file
@@ -0,0 +1,94 @@
|
||||
//*********** (C) Copyright 2003 Valve Corporation All rights reserved. ***********
|
||||
//
|
||||
// The copyright to the contents herein is the property of Valve, L.L.C.
|
||||
// The contents may be used and/or copied only with the written permission of
|
||||
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
|
||||
// the agreement/contract under which the contents have been supplied.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Contents:
|
||||
//
|
||||
//
|
||||
//
|
||||
// Authors: Taylor Sherman
|
||||
//
|
||||
// Target restrictions:
|
||||
//
|
||||
// Tool restrictions:
|
||||
//
|
||||
// Things to do:
|
||||
//
|
||||
//
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#ifndef INCLUDED_STEAM_FINDSTEAMSERVERS_H
|
||||
#define INCLUDED_STEAM_FINDSTEAMSERVERS_H
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef STEAM_FINDSERVERS_STATIC_LIB
|
||||
|
||||
#define STEAM_FSS_CALL
|
||||
#define STEAM_FSS_API
|
||||
|
||||
#else
|
||||
|
||||
#ifndef STEAM_API
|
||||
#ifdef STEAM_EXPORTS
|
||||
#define STEAM_API __declspec(dllexport)
|
||||
#else
|
||||
#define STEAM_API __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef STEAM_CALL
|
||||
#define STEAM_CALL __cdecl
|
||||
#endif
|
||||
|
||||
#define STEAM_FSS_CALL STEAM_CALL
|
||||
#define STEAM_FSS_API STEAM_API
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include "SteamCommon.h"
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Types
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
eSteamFindSteamServersLibraryError = -1,
|
||||
eSteamFindSteamServersLibraryBusy = -2
|
||||
};
|
||||
|
||||
// returns number of IP addresses returned by the GDS for this server type
|
||||
// negative return means error
|
||||
STEAM_FSS_API int STEAM_FSS_CALL SteamFindServersNumServers(ESteamServerType eServerType);
|
||||
|
||||
// Get nth ipaddr:port for this server type
|
||||
// buffer needs to be 22 chars long: aaa.bbb.ccc.ddd:12345 plus null
|
||||
//
|
||||
// returns 0 if succsessful, negative is error
|
||||
STEAM_FSS_API int STEAM_FSS_CALL SteamFindServersIterateServer(ESteamServerType eServerType, unsigned int nServer, char *szIpAddrPort, int szIpAddrPortLen);
|
||||
|
||||
STEAM_FSS_API const char * STEAM_FSS_CALL SteamFindServersGetErrorString();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef INCLUDED_STEAM2_USERID_STRUCTS */
|
||||
44
common/GameUI/IGameConsole.h
Normal file
44
common/GameUI/IGameConsole.h
Normal file
@@ -0,0 +1,44 @@
|
||||
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef IGAMECONSOLE_H
|
||||
#define IGAMECONSOLE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier1/interface.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: interface to game/dev console
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IGameConsole : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
// activates the console, makes it visible and brings it to the foreground
|
||||
virtual void Activate() = 0;
|
||||
|
||||
virtual void Initialize() = 0;
|
||||
|
||||
// hides the console
|
||||
virtual void Hide() = 0;
|
||||
|
||||
// clears the console
|
||||
virtual void Clear() = 0;
|
||||
|
||||
// return true if the console has focus
|
||||
virtual bool IsConsoleVisible() = 0;
|
||||
|
||||
virtual void SetParent( int parent ) = 0;
|
||||
|
||||
// hides and deletes panel
|
||||
virtual void Shutdown( void ) = 0;
|
||||
};
|
||||
|
||||
#define GAMECONSOLE_INTERFACE_VERSION "GameConsole004"
|
||||
|
||||
#endif // IGAMECONSOLE_H
|
||||
141
common/GameUI/IGameUI.h
Normal file
141
common/GameUI/IGameUI.h
Normal file
@@ -0,0 +1,141 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IGAMEUI_H
|
||||
#define IGAMEUI_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "vgui/IPanel.h"
|
||||
|
||||
#if !defined( _X360 )
|
||||
#include "xbox/xboxstubs.h"
|
||||
#endif
|
||||
|
||||
class CCommand;
|
||||
|
||||
// reasons why the user can't connect to a game server
|
||||
enum ESteamLoginFailure
|
||||
{
|
||||
STEAMLOGINFAILURE_NONE,
|
||||
STEAMLOGINFAILURE_BADTICKET,
|
||||
STEAMLOGINFAILURE_NOSTEAMLOGIN,
|
||||
STEAMLOGINFAILURE_VACBANNED,
|
||||
STEAMLOGINFAILURE_LOGGED_IN_ELSEWHERE
|
||||
};
|
||||
|
||||
enum ESystemNotify
|
||||
{
|
||||
SYSTEMNOTIFY_STORAGEDEVICES_CHANGED,
|
||||
SYSTEMNOTIFY_USER_SIGNEDIN,
|
||||
SYSTEMNOTIFY_USER_SIGNEDOUT,
|
||||
SYSTEMNOTIFY_XLIVE_LOGON_ESTABLISHED, // we are logged into live service
|
||||
SYSTEMNOTIFY_XLIVE_LOGON_CLOSED, // no longer logged into live - either from natural (signed out) or unnatural (e.g. severed net connection) causes
|
||||
SYSTEMNOTIFY_XUIOPENING,
|
||||
SYSTEMNOTIFY_XUICLOSED,
|
||||
SYSTEMNOTIFY_INVITE_SHUTDOWN, // Cross-game invite is causing us to shutdown
|
||||
SYSTEMNOTIFY_MUTECHANGED, // Player changed mute settings
|
||||
SYSTEMNOTIFY_INPUTDEVICESCHANGED, // Input device has changed (used for controller disconnection)
|
||||
SYSTEMNOTIFY_PROFILE_UNAVAILABLE, // Profile failed to read or write
|
||||
};
|
||||
|
||||
// these are used to show the modal message box on different slots
|
||||
enum ECommandMsgBoxSlot
|
||||
{
|
||||
CMB_SLOT_FULL_SCREEN = -1,
|
||||
CMB_SLOT_PLAYER_0,
|
||||
CMB_SLOT_PLAYER_1,
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: contains all the functions that the GameUI dll exports
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IGameUI
|
||||
{
|
||||
public:
|
||||
// initialization/shutdown
|
||||
virtual void Initialize( CreateInterfaceFn appFactory ) = 0;
|
||||
virtual void PostInit() = 0;
|
||||
|
||||
// connect to other interfaces at the same level (gameui.dll/server.dll/client.dll)
|
||||
virtual void Connect( CreateInterfaceFn gameFactory ) = 0;
|
||||
|
||||
virtual void Start() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual void RunFrame() = 0;
|
||||
|
||||
// notifications
|
||||
virtual void OnGameUIActivated() = 0;
|
||||
virtual void OnGameUIHidden() = 0;
|
||||
|
||||
// OLD: Use OnConnectToServer2
|
||||
virtual void OLD_OnConnectToServer(const char *game, int IP, int port) = 0;
|
||||
|
||||
virtual void OnDisconnectFromServer_OLD( uint8 eSteamLoginFailure, const char *username ) = 0;
|
||||
virtual void OnLevelLoadingStarted( const char *levelName, bool bShowProgressDialog ) = 0;
|
||||
virtual void OnLevelLoadingFinished(bool bError, const char *failureReason, const char *extendedReason) = 0;
|
||||
virtual void StartLoadingScreenForCommand( const char* command ) = 0;
|
||||
virtual void StartLoadingScreenForKeyValues( KeyValues* keyValues ) = 0;
|
||||
|
||||
// level loading progress, returns true if the screen needs updating
|
||||
virtual bool UpdateProgressBar(float progress, const char *statusText, bool showDialog = true ) = 0;
|
||||
// Shows progress desc, returns previous setting... (used with custom progress bars )
|
||||
virtual bool SetShowProgressText( bool show ) = 0;
|
||||
virtual bool UpdateSecondaryProgressBar(float progress, const wchar_t *desc ) = 0;
|
||||
|
||||
// !!!!!!!!!members added after "GameUI011" initial release!!!!!!!!!!!!!!!!!!!
|
||||
// Allows the level loading progress to show map-specific info
|
||||
virtual void SetProgressLevelName( const char *levelName ) = 0;
|
||||
|
||||
// Xbox 360
|
||||
virtual void ShowMessageDialog( const uint nType, vgui::Panel *pOwner ) = 0;
|
||||
virtual void ShowMessageDialog( const char* messageID, const char* titleID ) = 0;
|
||||
|
||||
virtual void CreateCommandMsgBox( const char* pszTitle, const char* pszMessage, bool showOk = true, bool showCancel = false, const char* okCommand = NULL, const char* cancelCommand = NULL, const char* closedCommand = NULL, const char* pszLegend = NULL ) = 0;
|
||||
virtual void CreateCommandMsgBoxInSlot( ECommandMsgBoxSlot slot, const char* pszTitle, const char* pszMessage, bool showOk = true, bool showCancel = false, const char* okCommand = NULL, const char* cancelCommand = NULL, const char* closedCommand = NULL, const char* pszLegend = NULL ) = 0;
|
||||
|
||||
// inserts specified panel as background for level load dialog
|
||||
virtual void SetLoadingBackgroundDialog( vgui::VPANEL panel ) = 0;
|
||||
|
||||
virtual void OnConnectToServer2(const char *game, int IP, int connectionPort, int queryPort) = 0;
|
||||
|
||||
virtual void SetProgressOnStart() = 0;
|
||||
virtual void OnDisconnectFromServer( uint8 eSteamLoginFailure ) = 0;
|
||||
/*
|
||||
virtual void OnConfirmQuit( void ) = 0;
|
||||
|
||||
virtual bool IsMainMenuVisible( void ) = 0;
|
||||
|
||||
// Client DLL is providing us with a panel that it wants to replace the main menu with
|
||||
virtual void SetMainMenuOverride( vgui::VPANEL panel ) = 0;
|
||||
|
||||
// Client DLL is telling us that a main menu command was issued, probably from its custom main menu panel
|
||||
virtual void SendMainMenuCommand( const char *pszCommand ) = 0;
|
||||
*/
|
||||
virtual void NeedConnectionProblemWaitScreen() = 0;
|
||||
virtual void ShowPasswordUI( char const *pchCurrentPW ) = 0;
|
||||
|
||||
#if defined( _X360 ) && defined( _DEMO )
|
||||
virtual void OnDemoTimeout( void ) = 0;
|
||||
#endif
|
||||
|
||||
virtual bool LoadingProgressWantsIsolatedRender( bool bContextValid ) = 0;
|
||||
|
||||
virtual bool IsPlayingFullScreenVideo() = 0;
|
||||
|
||||
virtual bool IsTransitionEffectEnabled() = 0;
|
||||
|
||||
virtual bool IsInLevel() = 0;
|
||||
|
||||
virtual void RestoreTopLevelMenu() = 0;
|
||||
};
|
||||
|
||||
#define GAMEUI_INTERFACE_VERSION "GameUI011"
|
||||
|
||||
#endif // IGAMEUI_H
|
||||
247
common/GameUI/ObjectList.cpp
Normal file
247
common/GameUI/ObjectList.cpp
Normal file
@@ -0,0 +1,247 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
#include <stdio.h>
|
||||
// dgoodenough - malloc.h doesn't exist on PS3
|
||||
// PS3_BUILDFIX
|
||||
#if !defined( _PS3 )
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include "ObjectList.h"
|
||||
#include "tier1/strtools.h"
|
||||
|
||||
//#include "port.h"
|
||||
//#include "mem.h"
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include <tier0/memdbgon.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
ObjectList::ObjectList()
|
||||
{
|
||||
head = tail = current = NULL;
|
||||
number = 0;
|
||||
}
|
||||
|
||||
ObjectList::~ObjectList()
|
||||
{
|
||||
Clear( false );
|
||||
}
|
||||
|
||||
bool ObjectList::AddHead(void * newObject)
|
||||
{
|
||||
// create new element
|
||||
element_t * newElement = (element_t *) calloc(1, sizeof(element_t));
|
||||
|
||||
if (newElement == NULL )
|
||||
return false; // out of memory
|
||||
|
||||
// insert element
|
||||
newElement->object = newObject;
|
||||
|
||||
if (head)
|
||||
{
|
||||
newElement->next = head;
|
||||
head->prev = newElement;
|
||||
};
|
||||
|
||||
head = newElement;
|
||||
|
||||
// if list was empty set new tail
|
||||
if (tail==NULL) tail = head;
|
||||
|
||||
number++;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void * ObjectList::RemoveHead()
|
||||
{
|
||||
void * retObj;
|
||||
|
||||
// check head is present
|
||||
if (head)
|
||||
{
|
||||
retObj = head->object;
|
||||
element_t * newHead = head->next;
|
||||
if (newHead) newHead->prev = NULL;
|
||||
|
||||
// if only one element is in list also update tail
|
||||
// if we remove this prev element
|
||||
if (tail==head) tail = NULL;
|
||||
|
||||
free(head);
|
||||
head = newHead;
|
||||
|
||||
number--;
|
||||
|
||||
} else
|
||||
retObj = NULL;
|
||||
|
||||
return retObj;
|
||||
}
|
||||
|
||||
bool ObjectList::AddTail(void * newObject)
|
||||
{
|
||||
element_t * newElement = (element_t *) calloc(1, sizeof(element_t));
|
||||
|
||||
if (newElement == NULL)
|
||||
return false; // out of memory;
|
||||
|
||||
newElement->object = newObject;
|
||||
|
||||
if (tail)
|
||||
{
|
||||
newElement->prev = tail;
|
||||
tail->next = newElement;
|
||||
}
|
||||
|
||||
tail = newElement;
|
||||
|
||||
// if list was empty set new head
|
||||
if (head==NULL) head = tail;
|
||||
|
||||
number++;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void * ObjectList::RemoveTail()
|
||||
{
|
||||
void * retObj;
|
||||
|
||||
// check tail is present
|
||||
if (tail)
|
||||
{
|
||||
retObj = tail->object;
|
||||
element_t * newTail = tail->prev;
|
||||
if (newTail) newTail->next = NULL;
|
||||
|
||||
// if only one element is in list also update tail
|
||||
// if we remove this prev element
|
||||
if (head==tail) head = NULL;
|
||||
|
||||
free(tail);
|
||||
tail = newTail;
|
||||
|
||||
number--;
|
||||
|
||||
} else
|
||||
retObj = NULL;
|
||||
|
||||
return retObj;
|
||||
}
|
||||
|
||||
bool ObjectList::IsEmpty()
|
||||
{
|
||||
return ( head == NULL );
|
||||
}
|
||||
|
||||
int ObjectList::CountElements()
|
||||
{
|
||||
return number;
|
||||
}
|
||||
|
||||
bool ObjectList::Contains(void * object)
|
||||
{
|
||||
element_t * e = head;
|
||||
|
||||
while(e && e->object!=object) { e = e->next;}
|
||||
|
||||
if ( e )
|
||||
{
|
||||
current = e;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectList::Clear( bool freeElementsMemory )
|
||||
{
|
||||
element_t * ne;
|
||||
|
||||
element_t * e = head;
|
||||
while(e)
|
||||
{
|
||||
ne = e->next;
|
||||
|
||||
if ( freeElementsMemory && e->object )
|
||||
free( e->object );
|
||||
|
||||
free(e);
|
||||
e = ne;
|
||||
}
|
||||
|
||||
head = tail = current = NULL;
|
||||
number = 0;
|
||||
|
||||
}
|
||||
|
||||
bool ObjectList::Remove( void * object )
|
||||
{
|
||||
element_t * e = head;
|
||||
|
||||
while(e && e->object!=object) { e = e->next;}
|
||||
|
||||
if (e!=NULL)
|
||||
{
|
||||
if (e->prev) e->prev->next = e->next;
|
||||
if (e->next) e->next->prev = e->prev;
|
||||
if (head==e) head = e->next;
|
||||
if (tail==e) tail = e->prev;
|
||||
if (current == e) current= e->next;
|
||||
free(e);
|
||||
number--;
|
||||
}
|
||||
|
||||
return (e!=NULL);
|
||||
}
|
||||
|
||||
void ObjectList::Init()
|
||||
{
|
||||
head = tail = current = NULL;
|
||||
number = 0;
|
||||
}
|
||||
|
||||
void * ObjectList::GetFirst()
|
||||
{
|
||||
if (head)
|
||||
{
|
||||
current = head->next;
|
||||
return head->object;
|
||||
}
|
||||
else
|
||||
{
|
||||
current = NULL;
|
||||
return NULL;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void * ObjectList::GetNext()
|
||||
{
|
||||
void * retObj = NULL;
|
||||
if (current)
|
||||
{
|
||||
retObj = current->object;
|
||||
current = current->next;
|
||||
}
|
||||
return retObj;
|
||||
}
|
||||
|
||||
bool ObjectList::Add(void *newObject)
|
||||
{
|
||||
return AddTail( newObject );
|
||||
}
|
||||
|
||||
58
common/GameUI/ObjectList.h
Normal file
58
common/GameUI/ObjectList.h
Normal file
@@ -0,0 +1,58 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
// ObjectList.h: interface for the ObjectList class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef OBJECTLIST_H
|
||||
#define OBJECTLIST_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "IObjectContainer.h" // Added by ClassView
|
||||
|
||||
class ObjectList : public IObjectContainer
|
||||
{
|
||||
public:
|
||||
void Init();
|
||||
bool Add( void * newObject );
|
||||
void * GetFirst();
|
||||
void * GetNext();
|
||||
|
||||
|
||||
|
||||
ObjectList();
|
||||
virtual ~ObjectList();
|
||||
|
||||
void Clear( bool freeElementsMemory );
|
||||
int CountElements();
|
||||
void * RemoveTail();
|
||||
void * RemoveHead();
|
||||
|
||||
bool AddTail(void * newObject);
|
||||
bool AddHead(void * newObject);
|
||||
bool Remove(void * object);
|
||||
bool Contains(void * object);
|
||||
bool IsEmpty();
|
||||
|
||||
typedef struct element_s {
|
||||
element_s * prev; // pointer to the last element or NULL
|
||||
element_s * next; // pointer to the next elemnet or NULL
|
||||
void * object; // the element's object
|
||||
} element_t;
|
||||
|
||||
protected:
|
||||
|
||||
element_t * head; // first element in list
|
||||
element_t * tail; // last element in list
|
||||
element_t * current; // current element in list
|
||||
int number;
|
||||
|
||||
};
|
||||
|
||||
#endif // !defined
|
||||
129
common/GameUI/Random.cpp
Normal file
129
common/GameUI/Random.cpp
Normal file
@@ -0,0 +1,129 @@
|
||||
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose: Basic random number generator
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#include "Random.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#define IA 16807
|
||||
#define IM 2147483647
|
||||
#define IQ 127773
|
||||
#define IR 2836
|
||||
#define NTAB 32
|
||||
#define NDIV (1+(IM-1)/NTAB)
|
||||
|
||||
static long idum = 0;
|
||||
|
||||
void SeedRandomNumberGenerator(long lSeed)
|
||||
{
|
||||
if (lSeed)
|
||||
{
|
||||
idum = lSeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
idum = -time(NULL);
|
||||
}
|
||||
if (1000 < idum)
|
||||
{
|
||||
idum = -idum;
|
||||
}
|
||||
else if (-1000 < idum)
|
||||
{
|
||||
idum -= 22261048;
|
||||
}
|
||||
}
|
||||
|
||||
long ran1(void)
|
||||
{
|
||||
int j;
|
||||
long k;
|
||||
static long iy=0;
|
||||
static long iv[NTAB];
|
||||
|
||||
if (idum <= 0 || !iy)
|
||||
{
|
||||
if (-(idum) < 1) idum=1;
|
||||
else idum = -(idum);
|
||||
for (j=NTAB+7;j>=0;j--)
|
||||
{
|
||||
k=(idum)/IQ;
|
||||
idum=IA*(idum-k*IQ)-IR*k;
|
||||
if (idum < 0) idum += IM;
|
||||
if (j < NTAB) iv[j] = idum;
|
||||
}
|
||||
iy=iv[0];
|
||||
}
|
||||
k=(idum)/IQ;
|
||||
idum=IA*(idum-k*IQ)-IR*k;
|
||||
if (idum < 0) idum += IM;
|
||||
j=iy/NDIV;
|
||||
iy=iv[j];
|
||||
iv[j] = idum;
|
||||
|
||||
return iy;
|
||||
}
|
||||
|
||||
// fran1 -- return a random floating-point number on the interval [0,1)
|
||||
//
|
||||
#define AM (1.0/IM)
|
||||
#define EPS 1.2e-7
|
||||
#define RNMX (1.0-EPS)
|
||||
float fran1(void)
|
||||
{
|
||||
float temp = (float)AM*ran1();
|
||||
if (temp > RNMX) return (float)RNMX;
|
||||
else return temp;
|
||||
}
|
||||
|
||||
float RandomFloat( float flLow, float flHigh )
|
||||
{
|
||||
if (idum == 0)
|
||||
{
|
||||
SeedRandomNumberGenerator(0);
|
||||
}
|
||||
|
||||
float fl = fran1(); // float in [0,1)
|
||||
return (fl * (flHigh-flLow)) + flLow; // float in [low,high)
|
||||
}
|
||||
|
||||
long RandomLong( long lLow, long lHigh )
|
||||
{
|
||||
if (idum == 0)
|
||||
{
|
||||
SeedRandomNumberGenerator(0);
|
||||
}
|
||||
|
||||
unsigned long maxAcceptable;
|
||||
unsigned long x = lHigh-lLow+1;
|
||||
unsigned long n;
|
||||
if (x <= 0 || MAX_RANDOM_RANGE < x-1)
|
||||
{
|
||||
return lLow;
|
||||
}
|
||||
|
||||
// The following maps a uniform distribution on the interval [0,MAX_RANDOM_RANGE]
|
||||
// to a smaller, client-specified range of [0,x-1] in a way that doesn't bias
|
||||
// the uniform distribution unfavorably. Even for a worst case x, the loop is
|
||||
// guaranteed to be taken no more than half the time, so for that worst case x,
|
||||
// the average number of times through the loop is 2. For cases where x is
|
||||
// much smaller than MAX_RANDOM_RANGE, the average number of times through the
|
||||
// loop is very close to 1.
|
||||
//
|
||||
maxAcceptable = MAX_RANDOM_RANGE - ((MAX_RANDOM_RANGE+1) % x );
|
||||
do
|
||||
{
|
||||
n = ran1();
|
||||
} while (n > maxAcceptable);
|
||||
|
||||
return lLow + (n % x);
|
||||
}
|
||||
|
||||
|
||||
30
common/GameUI/Random.h
Normal file
30
common/GameUI/Random.h
Normal file
@@ -0,0 +1,30 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Generalized 32-bit random number generator
|
||||
// Range is 0x00000000 - 0x7FFFFFFF
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef RANDOM_H
|
||||
#define RANDOM_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// the random number seeding is automatic
|
||||
|
||||
#define MAX_RANDOM_RANGE 0x7FFFFFFFUL
|
||||
|
||||
// restarts random generator
|
||||
// setting lSeed to 0 causes the current time to be used as the seed
|
||||
// random number generator will automatically seed itself on first use with current time if this is not called
|
||||
extern void SeedRandomNumberGenerator(long lSeed = 0);
|
||||
|
||||
// returns a random integer of range [low, high]
|
||||
extern long RandomLong( long lLow, long lHigh );
|
||||
|
||||
// returns a random float of range [low, high)
|
||||
extern float RandomFloat( float flLow, float flHigh );
|
||||
|
||||
#endif // RANDOM_H
|
||||
43
common/IAdminServer.h
Normal file
43
common/IAdminServer.h
Normal file
@@ -0,0 +1,43 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IADMINSERVER_H
|
||||
#define IADMINSERVER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
// handle to a game window
|
||||
typedef unsigned int ManageServerUIHandle_t;
|
||||
class IManageServer;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Interface to server administration functions
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IAdminServer : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
// opens a manage server dialog for a local server
|
||||
virtual ManageServerUIHandle_t OpenManageServerDialog(const char *serverName, const char *gameDir) = 0;
|
||||
|
||||
// opens a manage server dialog to a remote server
|
||||
virtual ManageServerUIHandle_t OpenManageServerDialog(unsigned int gameIP, unsigned int gamePort, const char *password) = 0;
|
||||
|
||||
// forces the game info dialog closed
|
||||
virtual void CloseManageServerDialog(ManageServerUIHandle_t gameDialog) = 0;
|
||||
|
||||
// Gets a handle to the interface
|
||||
virtual IManageServer *GetManageServerInterface(ManageServerUIHandle_t handle) = 0;
|
||||
};
|
||||
|
||||
#define ADMINSERVER_INTERFACE_VERSION "AdminServer002"
|
||||
|
||||
|
||||
|
||||
#endif // IAdminServer_H
|
||||
51
common/IFileSystemOpenDialog.h
Normal file
51
common/IFileSystemOpenDialog.h
Normal file
@@ -0,0 +1,51 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IFILESYSTEMOPENDIALOG_H
|
||||
#define IFILESYSTEMOPENDIALOG_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define FILESYSTEMOPENDIALOG_VERSION "FileSystemOpenDlg003"
|
||||
|
||||
|
||||
class IFileSystem;
|
||||
|
||||
|
||||
abstract_class IFileSystemOpenDialog
|
||||
{
|
||||
public:
|
||||
// You must call this first to set the hwnd.
|
||||
virtual void Init( CreateInterfaceFn factory, void *parentHwnd ) = 0;
|
||||
|
||||
// Call this to free the dialog.
|
||||
virtual void Release() = 0;
|
||||
|
||||
// Use these to configure the dialog.
|
||||
virtual void AddFileMask( const char *pMask ) = 0;
|
||||
virtual void SetInitialDir( const char *pDir, const char *pPathID = NULL ) = 0;
|
||||
virtual void SetFilterMdlAndJpgFiles( bool bFilter ) = 0;
|
||||
virtual void GetFilename( char *pOut, int outLen ) const = 0; // Get the filename they chose.
|
||||
|
||||
// Call this to make the dialog itself. Returns true if they clicked OK and false
|
||||
// if they canceled it.
|
||||
virtual bool DoModal() = 0;
|
||||
|
||||
// This uses the standard windows file open dialog.
|
||||
virtual bool DoModal_WindowsDialog() = 0;
|
||||
|
||||
// Mark the dialog as allowing us to multi-select
|
||||
virtual void AllowMultiSelect( bool bAllow ) = 0;
|
||||
|
||||
// Request the length of the buffer sufficient enough to hold the entire filename result
|
||||
virtual int GetFilenameBufferSize() const = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // IFILESYSTEMOPENDIALOG_H
|
||||
34
common/IManageServer.h
Normal file
34
common/IManageServer.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IMANAGESERVER_H
|
||||
#define IMANAGESERVER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <interface.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: basic callback interface for the manage server list, to update status text et al
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IManageServer : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
// activates the manage page
|
||||
virtual void ShowPage() = 0;
|
||||
|
||||
// sets whether or not the server is remote
|
||||
virtual void SetAsRemoteServer(bool remote) = 0;
|
||||
|
||||
// prints text to the console
|
||||
virtual void AddToConsole(const char *msg) = 0;
|
||||
};
|
||||
|
||||
#define IMANAGESERVER_INTERFACE_VERSION "IManageServer002"
|
||||
|
||||
#endif // IMANAGESERVER_H
|
||||
32
common/IObjectContainer.h
Normal file
32
common/IObjectContainer.h
Normal file
@@ -0,0 +1,32 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: IObjectContainer.h: interface for the ObjectContainer class.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IOBJECTCONTAINER_H
|
||||
#define IOBJECTCONTAINER_H
|
||||
|
||||
#pragma once
|
||||
|
||||
class IObjectContainer
|
||||
{
|
||||
public:
|
||||
virtual ~IObjectContainer() {};
|
||||
|
||||
virtual void Init() = 0;
|
||||
|
||||
virtual bool Add(void * newObject) = 0;
|
||||
virtual bool Remove(void * object) = 0;
|
||||
virtual void Clear(bool freeElementsMemory) = 0;
|
||||
|
||||
virtual void * GetFirst() = 0;
|
||||
virtual void * GetNext() = 0;
|
||||
|
||||
virtual int CountElements() = 0;;
|
||||
virtual bool Contains(void * object) = 0;
|
||||
virtual bool IsEmpty() = 0;
|
||||
};
|
||||
|
||||
#endif // !defined IOBJECTCONTAINER_H
|
||||
81
common/IRunGameEngine.h
Normal file
81
common/IRunGameEngine.h
Normal file
@@ -0,0 +1,81 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#ifndef IRUNGAMEENGINE_H
|
||||
#define IRUNGAMEENGINE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
#ifdef GetUserName
|
||||
#undef GetUserName
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Interface to running the game engine
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IRunGameEngine : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
// Returns true if the engine is running, false otherwise.
|
||||
virtual bool IsRunning() = 0;
|
||||
|
||||
// Adds text to the engine command buffer. Only works if IsRunning()
|
||||
// returns true on success, false on failure
|
||||
virtual bool AddTextCommand(const char *text) = 0;
|
||||
|
||||
// runs the engine with the specified command line parameters. Only works if !IsRunning()
|
||||
// returns true on success, false on failure
|
||||
virtual bool RunEngine(const char *gameDir, const char *commandLineParams) = 0;
|
||||
|
||||
// returns true if the player is currently connected to a game server
|
||||
virtual bool IsInGame() = 0;
|
||||
|
||||
// gets information about the server the engine is currently connected to
|
||||
// returns true on success, false on failure
|
||||
virtual bool GetGameInfo(char *infoBuffer, int bufferSize) = 0;
|
||||
|
||||
// tells the engine our userID
|
||||
virtual void SetTrackerUserID(int trackerID, const char *trackerName) = 0;
|
||||
|
||||
// this next section could probably moved to another interface
|
||||
// iterates users
|
||||
// returns the number of user
|
||||
virtual int GetPlayerCount() = 0;
|
||||
|
||||
// returns a playerID for a player
|
||||
// playerIndex is in the range [0, GetPlayerCount)
|
||||
virtual unsigned int GetPlayerFriendsID(int playerIndex) = 0;
|
||||
|
||||
// gets the in-game name of another user, returns NULL if that user doesn't exists
|
||||
virtual const char *GetPlayerName(int friendsID) = 0;
|
||||
|
||||
// gets the friends name of a player
|
||||
virtual const char *GetPlayerFriendsName(int friendsID) = 0;
|
||||
|
||||
// returns the engine build number and mod version string for server versioning
|
||||
virtual unsigned int GetEngineBuildNumber() = 0;
|
||||
virtual const char *GetProductVersionString() = 0;
|
||||
|
||||
// new interface to RunEngine (done so we don't have to roll the interface version)
|
||||
virtual bool RunEngine2(const char *gameDir, const char *commandLineParams, bool isSourceGame) = 0;
|
||||
|
||||
enum ERunResult
|
||||
{
|
||||
k_ERunResultOkay = 0,
|
||||
k_ERunResultModNotInstalled = 1,
|
||||
k_ERunResultAppNotFound = 2,
|
||||
k_ERunResultNotInitialized = 3,
|
||||
};
|
||||
virtual ERunResult RunEngine( int iAppID, const char *gameDir, const char *commandLineParams ) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define RUNGAMEENGINE_INTERFACE_VERSION "RunGameEngine005"
|
||||
|
||||
#endif // IRUNGAMEENGINE_H
|
||||
33
common/IVGuiModuleLoader.h
Normal file
33
common/IVGuiModuleLoader.h
Normal file
@@ -0,0 +1,33 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IVGUIMODULELOADER_H
|
||||
#define IVGUIMODULELOADER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: interface to accessing all loaded modules
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IVGuiModuleLoader : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual int GetModuleCount() = 0;
|
||||
virtual const char *GetModuleLabel(int moduleIndex) = 0;
|
||||
virtual CreateInterfaceFn GetModuleFactory(int moduleIndex) = 0;
|
||||
virtual bool ActivateModule(int moduleIndex) = 0;
|
||||
virtual bool ActivateModule(const char *moduleName) = 0;
|
||||
virtual void SetPlatformToRestart() = 0;
|
||||
};
|
||||
|
||||
#define VGUIMODULELOADER_INTERFACE_VERSION "VGuiModuleLoader003"
|
||||
|
||||
|
||||
#endif // IVGUIMODULELOADER_H
|
||||
64
common/IVguiModule.h
Normal file
64
common/IVguiModule.h
Normal file
@@ -0,0 +1,64 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IVGUIMODULE_H
|
||||
#define IVGUIMODULE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include <vgui/vgui.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Standard interface to loading vgui modules
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IVGuiModule : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
// called first to setup the module with the vgui
|
||||
// returns true on success, false on failure
|
||||
virtual bool Initialize(CreateInterfaceFn *vguiFactories, int factoryCount) = 0;
|
||||
|
||||
// called after all the modules have been initialized
|
||||
// modules should use this time to link to all the other module interfaces
|
||||
virtual bool PostInitialize(CreateInterfaceFn *modules, int factoryCount) = 0;
|
||||
|
||||
// called when the module is selected from the menu or otherwise activated
|
||||
virtual bool Activate() = 0;
|
||||
|
||||
// returns true if the module is successfully initialized and available
|
||||
virtual bool IsValid() = 0;
|
||||
|
||||
// requests that the UI is temporarily disabled and all data files saved
|
||||
virtual void Deactivate() = 0;
|
||||
|
||||
// restart from a Deactivate()
|
||||
virtual void Reactivate() = 0;
|
||||
|
||||
// called when the module is about to be shutdown
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
// returns a handle to the main module panel
|
||||
virtual vgui::VPANEL GetPanel() = 0;
|
||||
|
||||
// sets the parent of the main module panel
|
||||
virtual void SetParent(vgui::VPANEL parent) = 0;
|
||||
|
||||
// messages sent through through the panel returned by GetPanel():
|
||||
//
|
||||
// "ConnectedToGame" "ip" "port" "gamedir"
|
||||
// "DisconnectedFromGame"
|
||||
// "ActiveGameName" "name"
|
||||
// "LoadingStarted" "type" "name"
|
||||
// "LoadingFinished" "type" "name"
|
||||
};
|
||||
|
||||
#define VGUIMODULE_INTERFACE_VERSION "VGuiModule002"
|
||||
|
||||
|
||||
#endif // IVGUIMODULE_H
|
||||
45
common/ServerBrowser/IServerBrowser.h
Normal file
45
common/ServerBrowser/IServerBrowser.h
Normal file
@@ -0,0 +1,45 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef ISERVERBROWSER_H
|
||||
#define ISERVERBROWSER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Interface to server browser module
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IServerBrowser
|
||||
{
|
||||
public:
|
||||
// activates the server browser window, brings it to the foreground
|
||||
virtual bool Activate() = 0;
|
||||
|
||||
// joins a game directly
|
||||
virtual bool JoinGame( uint32 unGameIP, uint16 usGamePort ) = 0;
|
||||
|
||||
// joins a specified game - game info dialog will only be opened if the server is fully or passworded
|
||||
virtual bool JoinGame( uint64 ulSteamIDFriend ) = 0;
|
||||
|
||||
// opens a game info dialog to watch the specified server; associated with the friend 'userName'
|
||||
virtual bool OpenGameInfoDialog( uint64 ulSteamIDFriend ) = 0;
|
||||
|
||||
// forces the game info dialog closed
|
||||
virtual void CloseGameInfoDialog( uint64 ulSteamIDFriend ) = 0;
|
||||
|
||||
// closes all the game info dialogs
|
||||
virtual void CloseAllGameInfoDialogs() = 0;
|
||||
};
|
||||
|
||||
#define SERVERBROWSER_INTERFACE_VERSION "ServerBrowser003"
|
||||
|
||||
|
||||
|
||||
#endif // ISERVERBROWSER_H
|
||||
92
common/SourceAppInfo.cpp
Normal file
92
common/SourceAppInfo.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: languages definition
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#include "SourceAppInfo.h"
|
||||
#include "tier0/dbg.h"
|
||||
|
||||
// NOTE: This has to be the last file included!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
struct SourceAppInfo_t
|
||||
{
|
||||
char *m_pchFullName;
|
||||
char *m_pchModName;
|
||||
int m_nSteamAppId;
|
||||
ESourceApp m_ESourceApp;
|
||||
};
|
||||
|
||||
|
||||
static SourceAppInfo_t s_SteamAppInfo[] =
|
||||
{
|
||||
{ "Source SDK Base", "sourcetest", 215, k_App_SDK_BASE },
|
||||
{ "Half-Life 2", "hl2", 220, k_App_HL2 } ,
|
||||
{ "Counter-Strike: Source", "cstrike", 240, k_App_CSS } ,
|
||||
{ "Day of Defeat: Source", "dod", 300, k_App_DODS } ,
|
||||
{ "Half-Life 2: Deathmatch", "hl2mp", 320, k_App_HL2MP } ,
|
||||
{ "Half-Life 2: Lost Coast", "lostcoast", 340, k_App_LOST_COAST } ,
|
||||
{ "Half-Life Deathmatch: Source", "hl1mp", 360, k_App_HL1DM } ,
|
||||
{ "Half-Life 2: Episode One", "episodic", 380, k_App_HL2_EP1 },
|
||||
{ "Portal", "portal", 400, k_App_PORTAL } ,
|
||||
{ "Half-Life 2: Episode Two", "ep2", 420, k_App_HL2_EP2 } ,
|
||||
{ "Team Fortress 2", "tf", 440, k_App_TF2 } ,
|
||||
#ifdef _DEMO
|
||||
{ "Left 4 Dead Demo", "left4dead", 530, k_App_L4D } ,
|
||||
#else
|
||||
{ "Left 4 Dead", "left4dead", 500, k_App_L4D } ,
|
||||
#endif
|
||||
{ "Portal 2", "portal2", 620, k_App_PORTAL2 } ,
|
||||
{ "Counter-Strike: Global Offensive Dev", "csgo", 710, k_App_CSS15_DEV } ,
|
||||
{ "Counter-Strike: Global Offensive", "csgo", 730, k_App_CSS15 } ,
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: return the short string name used for this language by SteamUI
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *GetAppFullName( ESourceApp eSourceApp )
|
||||
{
|
||||
Assert( Q_ARRAYSIZE(s_SteamAppInfo) == k_App_MAX );
|
||||
if ( s_SteamAppInfo[ eSourceApp ].m_ESourceApp == eSourceApp )
|
||||
{
|
||||
return s_SteamAppInfo[ eSourceApp ].m_pchFullName;
|
||||
}
|
||||
|
||||
Assert( !"enum ESourceApp order mismatched from AppInfo_t s_SteamAppInfo, fix it!" );
|
||||
return s_SteamAppInfo[0].m_pchFullName;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: return the short string name used for this language by SteamUI
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *GetAppModName( ESourceApp eSourceApp )
|
||||
{
|
||||
Assert( Q_ARRAYSIZE(s_SteamAppInfo) >= k_App_MAX ); // the last entry is duplicated
|
||||
if ( s_SteamAppInfo[ eSourceApp ].m_ESourceApp == eSourceApp )
|
||||
{
|
||||
return s_SteamAppInfo[ eSourceApp ].m_pchModName;
|
||||
}
|
||||
|
||||
Assert( !"enum ESourceApp order mismatched from AppInfo_t s_SteamAppInfo, fix it!" );
|
||||
return s_SteamAppInfo[0].m_pchModName;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: return the short string name used for this language by SteamUI
|
||||
//-----------------------------------------------------------------------------
|
||||
const int GetAppSteamAppId( ESourceApp eSourceApp )
|
||||
{
|
||||
Assert( Q_ARRAYSIZE( s_SteamAppInfo ) >= k_App_MAX ); // the last entry is duplicated
|
||||
if ( s_SteamAppInfo[ eSourceApp ].m_ESourceApp == eSourceApp )
|
||||
{
|
||||
return s_SteamAppInfo[ eSourceApp ].m_nSteamAppId;
|
||||
}
|
||||
|
||||
Assert( !"enum ESourceApp order mismatched from AppInfo_t s_SteamAppInfo, fix it!" );
|
||||
return s_SteamAppInfo[0].m_nSteamAppId;
|
||||
}
|
||||
|
||||
31
common/SourceAppInfo.h
Normal file
31
common/SourceAppInfo.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef SOURCE_APP_INFO_H
|
||||
#define SOURCE_APP_INFO_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
enum ESourceApp
|
||||
{
|
||||
k_App_SDK_BASE = 0,
|
||||
k_App_HL2,
|
||||
k_App_CSS,
|
||||
k_App_DODS,
|
||||
k_App_HL2MP,
|
||||
k_App_LOST_COAST,
|
||||
k_App_HL1DM,
|
||||
k_App_HL2_EP1,
|
||||
k_App_PORTAL,
|
||||
k_App_HL2_EP2,
|
||||
k_App_TF2,
|
||||
k_App_L4D,
|
||||
k_App_PORTAL2,
|
||||
k_App_CSS15_DEV,
|
||||
k_App_CSS15,
|
||||
k_App_MAX
|
||||
};
|
||||
|
||||
const int GetAppSteamAppId( ESourceApp eSourceApp );
|
||||
const char *GetAppModName( ESourceApp eSourceApp );
|
||||
const char *GetAppFullName( ESourceApp eSourceApp );
|
||||
|
||||
#endif
|
||||
218
common/Steam.h
Normal file
218
common/Steam.h
Normal file
@@ -0,0 +1,218 @@
|
||||
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
/**
|
||||
** Contents:
|
||||
**
|
||||
** This file provides the public interface to the Steam service. This
|
||||
** interface is described in the SDK documentation.
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef INCLUDED_STEAM_H
|
||||
#define INCLUDED_STEAM_H
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDED_STEAM2_USERID_STRUCTS
|
||||
#include "SteamCommon.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Exported function prototypes
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
** Engine control
|
||||
**
|
||||
** It is the responsibility of the Steam Bootstrapper (Steam.exe) to start
|
||||
** and stop the Steam Engine at the appropriate times.
|
||||
**
|
||||
** However, to properly handle some operating-system messages, the UI may need
|
||||
** to call a Shutdown. For instance, WM_ENDSESSION will terminate the process after
|
||||
** being handled -- so we should do as much cleanup as possible first.
|
||||
*/
|
||||
|
||||
STEAM_API int STEAM_CALL SteamStartEngine(TSteamError *pError);
|
||||
STEAM_API int STEAM_CALL SteamShutdownEngine(TSteamError *pError);
|
||||
|
||||
|
||||
/*
|
||||
** Initialization and misc
|
||||
*/
|
||||
|
||||
STEAM_API int STEAM_CALL SteamStartup( unsigned int uUsingMask, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamCleanup( TSteamError *pError );
|
||||
STEAM_API unsigned int STEAM_CALL SteamNumAppsRunning( TSteamError *pError );
|
||||
STEAM_API void STEAM_CALL SteamClearError( TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetVersion( char *szVersion, unsigned int uVersionBufSize );
|
||||
|
||||
|
||||
/*
|
||||
** Offline status
|
||||
*/
|
||||
|
||||
STEAM_API int STEAM_CALL SteamGetOfflineStatus( TSteamOfflineStatus *pStatus, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamChangeOfflineStatus( TSteamOfflineStatus *pStatus, TSteamError *pError );
|
||||
|
||||
|
||||
/*
|
||||
** Asynchrounous call handling
|
||||
*/
|
||||
|
||||
STEAM_API int STEAM_CALL SteamProcessCall( SteamCallHandle_t handle, TSteamProgress *pProgress, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamAbortCall( SteamCallHandle_t handle, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamBlockingCall( SteamCallHandle_t handle, unsigned int uiProcessTickMS, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamSetMaxStallCount( unsigned int uNumStalls, TSteamError *pError );
|
||||
|
||||
/*
|
||||
** Filesystem
|
||||
*/
|
||||
|
||||
STEAM_API int STEAM_CALL SteamMountAppFilesystem( TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamUnmountAppFilesystem( TSteamError *pError );
|
||||
STEAM_API SteamHandle_t STEAM_CALL SteamMountFilesystem( unsigned int uAppId, const char *szMountPath, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamUnmountFilesystem( SteamHandle_t hFs, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamStat( const char *cszName, TSteamElemInfo *pInfo, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamSetvBuf( SteamHandle_t hFile, void* pBuf, ESteamBufferMethod eMethod, unsigned int uBytes, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamFlushFile( SteamHandle_t hFile, TSteamError *pError );
|
||||
STEAM_API SteamHandle_t STEAM_CALL SteamOpenFile( const char *cszName, const char *cszMode, TSteamError *pError );
|
||||
STEAM_API SteamHandle_t STEAM_CALL SteamOpenFileEx( const char *cszName, const char *cszMode, unsigned int *puFileSize, TSteamError *pError );
|
||||
STEAM_API SteamHandle_t STEAM_CALL SteamOpenTmpFile( TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamCloseFile( SteamHandle_t hFile, TSteamError *pError );
|
||||
STEAM_API unsigned int STEAM_CALL SteamReadFile( void *pBuf, unsigned int uSize, unsigned int uCount, SteamHandle_t hFile, TSteamError *pError );
|
||||
STEAM_API unsigned int STEAM_CALL SteamWriteFile( const void *pBuf, unsigned int uSize, unsigned int uCount, SteamHandle_t hFile, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetc( SteamHandle_t hFile, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamPutc( int cChar, SteamHandle_t hFile, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamPrintFile( SteamHandle_t hFile, TSteamError *pError, const char *cszFormat, ... );
|
||||
STEAM_API int STEAM_CALL SteamSeekFile( SteamHandle_t hFile, long lOffset, ESteamSeekMethod, TSteamError *pError );
|
||||
STEAM_API long STEAM_CALL SteamTellFile( SteamHandle_t hFile, TSteamError *pError );
|
||||
STEAM_API long STEAM_CALL SteamSizeFile( SteamHandle_t hFile, TSteamError *pError );
|
||||
STEAM_API SteamHandle_t STEAM_CALL SteamFindFirst( const char *cszPattern, ESteamFindFilter eFilter, TSteamElemInfo *pFindInfo, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamFindNext( SteamHandle_t hDirectory, TSteamElemInfo *pFindInfo, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamFindClose( SteamHandle_t hDirectory, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetLocalFileCopy( const char *cszName, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamIsFileImmediatelyAvailable( const char *cszName, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamHintResourceNeed( const char *cszMasterList, int bForgetEverything, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamForgetAllHints( TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamPauseCachePreloading( TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamResumeCachePreloading( TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamWaitForResources( const char *cszMasterList, TSteamError *pError );
|
||||
|
||||
/*
|
||||
** Logging
|
||||
*/
|
||||
|
||||
STEAM_API SteamHandle_t STEAM_CALL SteamCreateLogContext( const char *cszName );
|
||||
STEAM_API int STEAM_CALL SteamLog( SteamHandle_t hContext, const char *cszMsg );
|
||||
STEAM_API void STEAM_CALL SteamLogResourceLoadStarted( const char *cszMsg );
|
||||
STEAM_API void STEAM_CALL SteamLogResourceLoadFinished( const char *cszMsg );
|
||||
|
||||
/*
|
||||
** Account
|
||||
*/
|
||||
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamCreateAccount( const char *cszUser, const char *cszEmailAddress, const char *cszPassphrase, const char *cszCreationKey, const char *cszPersonalQuestion, const char *cszAnswerToQuestion, int *pbCreated, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamIsAccountNameInUse( const char *cszAccountName, int *pbIsUsed, TSteamError *pError);
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamGenerateSuggestedAccountNames( const char *cszAccountNameToSelectMasterAS, const char *cszGenerateNamesLikeAccountName, char *pSuggestedNamesBuf, unsigned int uBufSize, unsigned int *puNumSuggestedChars, TSteamError *pError);
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamDeleteAccount( TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamIsLoggedIn( int *pbIsLoggedIn, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamSetUser( const char *cszUser, int *pbUserSet, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetUser( char *szUser, unsigned int uBufSize, unsigned int *puUserChars, TSteamGlobalUserID *pOptionalReceiveUserID, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamLogin( const char *cszUser, const char *cszPassphrase, int bIsSecureComputer, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamLogout( TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamCreateCachePreloaders( TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamIsSecureComputer( int *pbIsSecure, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamRefreshLogin( const char *cszPassphrase, int bIsSecureComputer, TSteamError * pError );
|
||||
STEAM_API int STEAM_CALL SteamVerifyPassword( const char *cszPassphrase, int *pbCorrect, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetUserType( unsigned int *puUserTypeFlags, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetAccountStatus( unsigned int *puAccountStatusFlags, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamRefreshAccountInfo( TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamSubscribe( unsigned int uSubscriptionId, const TSteamSubscriptionBillingInfo *pSubscriptionBillingInfo, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamUnsubscribe( unsigned int uSubscriptionId, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetSubscriptionReceipt( unsigned int uSubscriptionId, TSteamSubscriptionReceipt *pSubscriptionReceipt, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamAckSubscriptionReceipt( unsigned int uSubscriptionId, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamIsSubscribed( unsigned int uSubscriptionId, int *pbIsSubscribed, int *pbIsSubscriptionPending, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamIsAppSubscribed( unsigned int uAppId, int *pbIsAppSubscribed, int *pbIsSubscriptionPending, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetSubscriptionStats( TSteamSubscriptionStats *pSubscriptionStats, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetSubscriptionIds( unsigned int *puIds, unsigned int uMaxIds, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamEnumerateSubscription( unsigned int uId, TSteamSubscription *pSubscription, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamEnumerateSubscriptionDiscount( unsigned int uSubscriptionId, unsigned int uDiscountIndex, TSteamSubscriptionDiscount *pDiscount, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamEnumerateSubscriptionDiscountQualifier( unsigned int uSubscriptionId, unsigned int uDiscountIndex, unsigned int uQualifierIndex, TSteamDiscountQualifier *pDiscountQualifier, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetAppStats( TSteamAppStats *pAppStats, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetAppIds( unsigned int *puIds, unsigned int uMaxIds, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamEnumerateApp( unsigned int uId, TSteamApp *pApp, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamEnumerateAppLaunchOption( unsigned int uAppId, unsigned int uLaunchOptionIndex, TSteamAppLaunchOption *pLaunchOption, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamEnumerateAppIcon( unsigned int uAppId, unsigned int uIconIndex, unsigned char *pIconData, unsigned int uIconDataBufSize, unsigned int *puSizeOfIconData, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamEnumerateAppVersion( unsigned int uAppId, unsigned int uVersionIndex, TSteamAppVersion *pAppVersion, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamEnumerateAppDependency( unsigned int uAppId, unsigned int uIndex, TSteamAppDependencyInfo *pDependencyInfo, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamInsertAppDependency( unsigned int uAppId, unsigned int uIndex, TSteamAppDependencyInfo *pDependencyInfo, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamRemoveAppDependency( unsigned int uAppId, unsigned int uIndex, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamFindApp( const char *cszAppName, unsigned int *puAppId, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetAppDependencies( unsigned int uAppId, unsigned int *puCacheIds, unsigned int uMaxIds, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetAppUserDefinedInfo( unsigned int uAppId, const char *cszKey, char *szValueBuf, unsigned int uValueBufLen, unsigned int *puValueLen, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamWaitForAppReadyToLaunch( unsigned int uAppId, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamLaunchApp( unsigned int uAppId, unsigned int uLaunchOption, const char *cszArgs, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamIsCacheLoadingEnabled( unsigned int uAppId, int *pbIsLoading, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetCacheFilePath( unsigned int uCacheId, char *szPathBuf, unsigned int uBufSize, unsigned int *puPathChars, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamStartLoadingCache( unsigned int uAppId, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamStopLoadingCache( unsigned int uAppId, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamFlushCache( unsigned int uCacheId, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamRepairOrDecryptCaches( unsigned int uAppId, int bForceValidation, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamLoadCacheFromDir( unsigned int uAppId, const char *szPath, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetCacheDefaultDirectory( char *szPath, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamSetCacheDefaultDirectory( const char *szPath, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetAppDir( unsigned int uAppId, char *szPath, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamMoveApp( unsigned int uAppId, const char *szPath, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamGetAppCacheSize( unsigned int uCacheId, unsigned int *pCacheSizeInMb, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamSetAppCacheSize( unsigned int uCacheId, unsigned int nCacheSizeInMb, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamSetAppVersion( unsigned int uAppId, unsigned int uAppVersionId, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamUninstall( TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamSetNotificationCallback( SteamNotificationCallback_t pCallbackFunction, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamChangeForgottenPassword( const char *cszUser, const char *cszAnswerToQuestion, const char *cszEmailVerificationKey, const char *cszNewPassphrase, int *pbChanged, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamRequestForgottenPasswordEmail( const char *cszUser, SteamPersonalQuestion_t ReceivePersonalQuestion, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamRequestAccountsByEmailAddressEmail( const char *cszEmailAddress, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamRequestAccountsByCdKeyEmail( const char *cszCdKey, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamGetNumAccountsWithEmailAddress( const char *cszEmailAddress, unsigned int *puNumAccounts, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamChangePassword( const char *cszCurrentPassphrase, const char *cszNewPassphrase, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamChangePersonalQA( const char *cszCurrentPassphrase, const char *cszNewPersonalQuestion, const char *cszNewAnswerToQuestion, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetCurrentEmailAddress( char *szEmailAddress, unsigned int uBufSize, unsigned int *puEmailChars, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamChangeEmailAddress( const char *cszNewEmailAddress, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamVerifyEmailAddress( const char *cszEmailVerificationKey, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamRequestEmailAddressVerificationEmail( TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamChangeAccountName( const char *cszCurrentPassphrase, const char *cszNewAccountName, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamUpdateAccountBillingInfo( const TSteamPaymentCardInfo *pPaymentCardInfo, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamUpdateSubscriptionBillingInfo( unsigned int uSubscriptionId, const TSteamSubscriptionBillingInfo *pSubscriptionBillingInfo, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetSponsorUrl( unsigned int uAppId, char *szUrl, unsigned int uBufSize, unsigned int *pUrlChars, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetContentServerInfo( unsigned int uAppId, unsigned int *puServerId, unsigned int *puServerIpAddress, TSteamError *pError );
|
||||
STEAM_API SteamCallHandle_t STEAM_CALL SteamGetAppUpdateStats( unsigned int uAppOrCacheId, ESteamAppUpdateStatsQueryType eQueryType, TSteamUpdateStats *pUpdateStats, TSteamError *pError );
|
||||
STEAM_API int STEAM_CALL SteamGetTotalUpdateStats( TSteamUpdateStats *pUpdateStats, TSteamError *pError );
|
||||
|
||||
/*
|
||||
** User ID exported functions are in SteamUserIdValidation.h
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef INCLUDED_STEAM_H */
|
||||
198
common/SteamAppStartup.cpp
Normal file
198
common/SteamAppStartup.cpp
Normal file
@@ -0,0 +1,198 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "SteamAppStartup.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <assert.h>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <direct.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define STEAM_PARM "-steam"
|
||||
|
||||
void LaunchSelfViaSteam(const char *params);
|
||||
|
||||
bool FileExists(const char *fileName)
|
||||
{
|
||||
struct _stat statbuf;
|
||||
return (_stat(fileName, &statbuf) == 0);
|
||||
}
|
||||
inline bool V_isspace(int c)
|
||||
{
|
||||
// The standard white-space characters are the following: space, tab, carriage-return, newline, vertical tab, and form-feed. In the C locale, V_isspace() returns true only for the standard white-space characters.
|
||||
return c == ' ' || c == 9 /*horizontal tab*/ || c == '\r' || c == '\n' || c == 11 /*vertical tab*/ || c == '\f';
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Launches steam if necessary
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ShouldLaunchAppViaSteam(const char *lpCmdLine, const char *steamFilesystemDllName, const char *stdioFilesystemDllName)
|
||||
{
|
||||
// see if steam is on the command line
|
||||
const char *steamStr = strstr(lpCmdLine, STEAM_PARM);
|
||||
|
||||
// check the character following it is a whitespace or null
|
||||
if (steamStr)
|
||||
{
|
||||
const char *postChar = steamStr + strlen(STEAM_PARM);
|
||||
if (*postChar == 0 || V_isspace(*postChar))
|
||||
{
|
||||
// we're running under steam already, let the app continue
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// we're not running under steam, see which filesystems are available
|
||||
if (FileExists(stdioFilesystemDllName))
|
||||
{
|
||||
// we're being run with a stdio filesystem, so we can continue without steam
|
||||
return false;
|
||||
}
|
||||
|
||||
// make sure we have a steam filesystem available
|
||||
if (!FileExists(steamFilesystemDllName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// we have the steam filesystem, and no stdio filesystem, so we must need to be run under steam
|
||||
// launch steam
|
||||
LaunchSelfViaSteam(lpCmdLine);
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Handles launching the game indirectly via steam
|
||||
//-----------------------------------------------------------------------------
|
||||
void LaunchSelfViaSteam(const char *params)
|
||||
{
|
||||
// calculate the details of our launch
|
||||
char appPath[MAX_PATH];
|
||||
::GetModuleFileName((HINSTANCE)GetModuleHandle(NULL), appPath, sizeof(appPath));
|
||||
|
||||
// strip out the exe name
|
||||
char *slash = strrchr(appPath, '\\');
|
||||
if (slash)
|
||||
{
|
||||
*slash = 0;
|
||||
}
|
||||
|
||||
// save out our details to the registry
|
||||
HKEY hKey;
|
||||
if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, "Software\\Valve\\Steam", &hKey))
|
||||
{
|
||||
DWORD dwType = REG_SZ;
|
||||
DWORD dwSize = static_cast<DWORD>( strlen(appPath) + 1 );
|
||||
RegSetValueEx(hKey, "TempAppPath", NULL, dwType, (LPBYTE)appPath, dwSize);
|
||||
dwSize = static_cast<DWORD>( strlen(params) + 1 );
|
||||
RegSetValueEx(hKey, "TempAppCmdLine", NULL, dwType, (LPBYTE)params, dwSize);
|
||||
// clear out the appID (since we don't know it yet)
|
||||
dwType = REG_DWORD;
|
||||
int appID = -1;
|
||||
RegSetValueEx(hKey, "TempAppID", NULL, dwType, (LPBYTE)&appID, sizeof(appID));
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
// search for an active steam instance
|
||||
HWND hwnd = ::FindWindow("Valve_SteamIPC_Class", "Hidden Window");
|
||||
if (hwnd)
|
||||
{
|
||||
::PostMessage(hwnd, WM_USER + 3, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// couldn't find steam, find and launch it
|
||||
|
||||
// first, search backwards through our current set of directories
|
||||
char steamExe[MAX_PATH];
|
||||
steamExe[0] = 0;
|
||||
char dir[MAX_PATH];
|
||||
if (::GetCurrentDirectoryA(sizeof(dir), dir))
|
||||
{
|
||||
char *slash = strrchr(dir, '\\');
|
||||
while (slash)
|
||||
{
|
||||
// see if steam_dev.exe is in the directory first
|
||||
slash[1] = 0;
|
||||
strcat(slash, "steam_dev.exe");
|
||||
FILE *f = fopen(dir, "rb");
|
||||
if (f)
|
||||
{
|
||||
// found it
|
||||
fclose(f);
|
||||
strcpy(steamExe, dir);
|
||||
break;
|
||||
}
|
||||
|
||||
// see if steam.exe is in the directory
|
||||
slash[1] = 0;
|
||||
strcat(slash, "steam.exe");
|
||||
f = fopen(dir, "rb");
|
||||
if (f)
|
||||
{
|
||||
// found it
|
||||
fclose(f);
|
||||
strcpy(steamExe, dir);
|
||||
break;
|
||||
}
|
||||
|
||||
// kill the string at the slash
|
||||
slash[0] = 0;
|
||||
|
||||
// move to the previous slash
|
||||
slash = strrchr(dir, '\\');
|
||||
}
|
||||
}
|
||||
|
||||
if (!steamExe[0])
|
||||
{
|
||||
// still not found, use the one in the registry
|
||||
HKEY hKey;
|
||||
if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, "Software\\Valve\\Steam", &hKey))
|
||||
{
|
||||
DWORD dwType;
|
||||
DWORD dwSize = sizeof(steamExe);
|
||||
RegQueryValueEx( hKey, "SteamExe", NULL, &dwType, (LPBYTE)steamExe, &dwSize);
|
||||
RegCloseKey( hKey );
|
||||
}
|
||||
}
|
||||
|
||||
if (!steamExe[0])
|
||||
{
|
||||
// still no path, error
|
||||
::MessageBox(NULL, "Error running game: could not find steam.exe to launch", "Fatal Error", MB_OK | MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// fix any slashes
|
||||
for (char *slash = steamExe; *slash; slash++)
|
||||
{
|
||||
if (*slash == '/')
|
||||
{
|
||||
*slash = '\\';
|
||||
}
|
||||
}
|
||||
|
||||
// change to the steam directory
|
||||
strcpy(dir, steamExe);
|
||||
char *delimiter = strrchr(dir, '\\');
|
||||
if (delimiter)
|
||||
{
|
||||
*delimiter = 0;
|
||||
_chdir(dir);
|
||||
}
|
||||
|
||||
// exec steam.exe, in silent mode, with the launch app param
|
||||
char *args[4] = { steamExe, "-silent", "-applaunch", NULL };
|
||||
_spawnv(_P_NOWAIT, steamExe, args);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _WIN32
|
||||
25
common/SteamAppStartup.h
Normal file
25
common/SteamAppStartup.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: used by all .exe's that run under steam and out,
|
||||
// so they can be launched indirectly by steam and launch steam themselves
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef STEAMAPPSTARTUP_H
|
||||
#define STEAMAPPSTARTUP_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Call this first thing at startup
|
||||
// Works out if the app is a steam app that is being ran outside of steam,
|
||||
// and if so, launches steam and tells it to run us as a steam app
|
||||
//
|
||||
// if it returns true, then exit
|
||||
// if it ruturns false, then continue with normal startup
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ShouldLaunchAppViaSteam(const char *cmdLine, const char *steamFilesystemDllName, const char *stdioFilesystemDllName);
|
||||
|
||||
|
||||
#endif // STEAMAPPSTARTUP_H
|
||||
162
common/SteamBootStrapper.h
Normal file
162
common/SteamBootStrapper.h
Normal file
@@ -0,0 +1,162 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
//*********** (C) Copyright 2000 Valve, L.L.C. All rights reserved. ***********
|
||||
//
|
||||
// The copyright to the contents herein is the property of Valve, L.L.C.
|
||||
// The contents may be used and/or copied only with the written permission of
|
||||
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
|
||||
// the agreement/contract under which the contents have been supplied.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Contents:
|
||||
//
|
||||
//
|
||||
//
|
||||
// Authors:
|
||||
//
|
||||
// Target restrictions:
|
||||
//
|
||||
// Tool restrictions:
|
||||
//
|
||||
// Things to do:
|
||||
//
|
||||
//
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#ifndef INCLUDED_STEAM_BOOTSTRAPPER_H
|
||||
#define INCLUDED_STEAM_BOOTSTRAPPER_H
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// 'Local' build control section.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#if (BUILD_MODE == BUILD_MODE_RELEASE_NORMAL) || (BUILD_MODE == BUILD_MODE_RELEASE_TEST)
|
||||
|
||||
|
||||
#elif BUILD_MODE == BUILD_MODE_DEBUG_NORMAL
|
||||
|
||||
|
||||
#else
|
||||
// 'Safe' default settings. This allows new build modes to be added to the
|
||||
// project without requiring the manual updating of all 'local build control'
|
||||
// sections in every module and header file.
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Include files required by this header.
|
||||
//
|
||||
// Note: Do NOT place any 'using' directives or declarations in header files -
|
||||
// put them at the top of the source files that require them.
|
||||
// Use fully-qualified names in header files.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Exported constants and macros.
|
||||
// - Wrap these definitions in a namespace whenever possible
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
// constant definitions here
|
||||
}
|
||||
|
||||
#define szSteamBootStrapperIconIdEnvVar "__STEAM_BOOTSTRAPPER_ICON_ID__"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Exported scalar type and enumerated type definitions.
|
||||
// - Wrap these definitions in a namespace whenever possible
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
// scalar and enumerated type definitions here
|
||||
}
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Exported class, structure, and complex type definitions.
|
||||
// - Wrap these definitions in a namespace whenever possible
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
// class, structure, and complex type definitions here
|
||||
}
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Exported function prototypes
|
||||
// - Wrap these definitions in a namespace whenever possible
|
||||
// - declared extern here, and defined without storage class in the source file.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
// function prototypes here
|
||||
}
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Exported variable and data declarations
|
||||
// - Wrap these definitions in a namespace whenever possible
|
||||
// - declared extern here, and defined without storage class in the source file.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
// variable and data declarations here
|
||||
}
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Inline function definitions.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
703
common/SteamCommon.h
Normal file
703
common/SteamCommon.h
Normal file
@@ -0,0 +1,703 @@
|
||||
|
||||
/************ (C) Copyright 2004 Valve Corporation, All rights reserved. ***********
|
||||
**
|
||||
** The copyright to the contents herein is the property of Valve Corporation.
|
||||
** The contents may be used and/or copied only with the written permission of
|
||||
** Valve, or in accordance with the terms and conditions stipulated in
|
||||
** the agreement/contract under which the contents have been supplied.
|
||||
**
|
||||
*******************************************************************************
|
||||
**
|
||||
** Contents:
|
||||
**
|
||||
** Common types used in the Steam DLL interface.
|
||||
**
|
||||
** This file is distributed to Steam application developers.
|
||||
**
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef INCLUDED_STEAM2_USERID_STRUCTS
|
||||
#define INCLUDED_STEAM2_USERID_STRUCTS
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Applications should not define STEAM_EXPORTS. */
|
||||
|
||||
#if defined ( _WIN32 )
|
||||
|
||||
#ifdef STEAM_EXPORTS
|
||||
#define STEAM_API __declspec(dllexport)
|
||||
#else
|
||||
#define STEAM_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define STEAM_CALL __cdecl
|
||||
|
||||
#else
|
||||
|
||||
#define STEAM_API /* */
|
||||
#define STEAM_CALL /* */
|
||||
|
||||
#endif
|
||||
|
||||
typedef void (STEAM_CALL *KeyValueIteratorCallback_t )(const char *Key, const char *Val, void *pvParam);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Exported macros and constants
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
/* DEPRECATED -- these are ignored now, all API access is granted on SteamStartup */
|
||||
#define STEAM_USING_FILESYSTEM (0x00000001)
|
||||
#define STEAM_USING_LOGGING (0x00000002)
|
||||
#define STEAM_USING_USERID (0x00000004)
|
||||
#define STEAM_USING_ACCOUNT (0x00000008)
|
||||
#define STEAM_USING_ALL (0x0000000f)
|
||||
/* END DEPRECATED */
|
||||
|
||||
#define STEAM_MAX_PATH (255)
|
||||
#define STEAM_QUESTION_MAXLEN (255)
|
||||
#define STEAM_SALT_SIZE (8)
|
||||
#define STEAM_PROGRESS_PERCENT_SCALE (0x00001000)
|
||||
|
||||
/* These are maximum significant string lengths, excluding nul-terminator. */
|
||||
#define STEAM_CARD_NUMBER_SIZE (17)
|
||||
#define STEAM_CARD_HOLDERNAME_SIZE (100)
|
||||
#define STEAM_CARD_EXPYEAR_SIZE (4)
|
||||
#define STEAM_CARD_EXPMONTH_SIZE (2)
|
||||
#define STEAM_CARD_CVV2_SIZE (5)
|
||||
#define STEAM_BILLING_ADDRESS1_SIZE (128)
|
||||
#define STEAM_BILLING_ADDRESS2_SIZE (128)
|
||||
#define STEAM_BILLING_CITY_SIZE (50)
|
||||
#define STEAM_BILLING_ZIP_SIZE (16)
|
||||
#define STEAM_BILLING_STATE_SIZE (32)
|
||||
#define STEAM_BILLING_COUNTRY_SIZE (32)
|
||||
#define STEAM_BILLING_PHONE_SIZE (20)
|
||||
#define STEAM_BILLING_EMAIL_ADDRESS_SIZE (100)
|
||||
#define STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE (20)
|
||||
#define STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE (200)
|
||||
#define STEAM_EXTERNAL_ACCOUNTNAME_SIZE (100)
|
||||
#define STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE (80)
|
||||
#define STEAM_BILLING_CONFIRMATION_CODE_SIZE (22)
|
||||
#define STEAM_BILLING_CARD_APPROVAL_CODE_SIZE (100)
|
||||
#define STEAM_BILLING_TRANS_DATE_SIZE (9) // mm/dd/yy
|
||||
#define STEAM_BILLING_TRANS_TIME_SIZE (9) // hh:mm:ss
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Scalar type and enumerated type definitions.
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
typedef unsigned int SteamHandle_t;
|
||||
|
||||
typedef void * SteamUserIDTicketValidationHandle_t;
|
||||
|
||||
typedef unsigned int SteamCallHandle_t;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
typedef unsigned __int64 SteamUnsigned64_t;
|
||||
#else
|
||||
typedef unsigned long long SteamUnsigned64_t;
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamSeekMethodSet = 0,
|
||||
eSteamSeekMethodCur = 1,
|
||||
eSteamSeekMethodEnd = 2
|
||||
} ESteamSeekMethod;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamBufferMethodFBF = 0,
|
||||
eSteamBufferMethodNBF = 1
|
||||
} ESteamBufferMethod;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamErrorNone = 0,
|
||||
eSteamErrorUnknown = 1,
|
||||
eSteamErrorLibraryNotInitialized = 2,
|
||||
eSteamErrorLibraryAlreadyInitialized = 3,
|
||||
eSteamErrorConfig = 4,
|
||||
eSteamErrorContentServerConnect = 5,
|
||||
eSteamErrorBadHandle = 6,
|
||||
eSteamErrorHandlesExhausted = 7,
|
||||
eSteamErrorBadArg = 8,
|
||||
eSteamErrorNotFound = 9,
|
||||
eSteamErrorRead = 10,
|
||||
eSteamErrorEOF = 11,
|
||||
eSteamErrorSeek = 12,
|
||||
eSteamErrorCannotWriteNonUserConfigFile = 13,
|
||||
eSteamErrorCacheOpen = 14,
|
||||
eSteamErrorCacheRead = 15,
|
||||
eSteamErrorCacheCorrupted = 16,
|
||||
eSteamErrorCacheWrite = 17,
|
||||
eSteamErrorCacheSession = 18,
|
||||
eSteamErrorCacheInternal = 19,
|
||||
eSteamErrorCacheBadApp = 20,
|
||||
eSteamErrorCacheVersion = 21,
|
||||
eSteamErrorCacheBadFingerPrint = 22,
|
||||
|
||||
eSteamErrorNotFinishedProcessing = 23,
|
||||
eSteamErrorNothingToDo = 24,
|
||||
eSteamErrorCorruptEncryptedUserIDTicket = 25,
|
||||
eSteamErrorSocketLibraryNotInitialized = 26,
|
||||
eSteamErrorFailedToConnectToUserIDTicketValidationServer = 27,
|
||||
eSteamErrorBadProtocolVersion = 28,
|
||||
eSteamErrorReplayedUserIDTicketFromClient = 29,
|
||||
eSteamErrorReceiveResultBufferTooSmall = 30,
|
||||
eSteamErrorSendFailed = 31,
|
||||
eSteamErrorReceiveFailed = 32,
|
||||
eSteamErrorReplayedReplyFromUserIDTicketValidationServer = 33,
|
||||
eSteamErrorBadSignatureFromUserIDTicketValidationServer = 34,
|
||||
eSteamErrorValidationStalledSoAborted = 35,
|
||||
eSteamErrorInvalidUserIDTicket = 36,
|
||||
eSteamErrorClientLoginRateTooHigh = 37,
|
||||
eSteamErrorClientWasNeverValidated = 38,
|
||||
eSteamErrorInternalSendBufferTooSmall = 39,
|
||||
eSteamErrorInternalReceiveBufferTooSmall = 40,
|
||||
eSteamErrorUserTicketExpired = 41,
|
||||
eSteamErrorCDKeyAlreadyInUseOnAnotherClient = 42,
|
||||
|
||||
eSteamErrorNotLoggedIn = 101,
|
||||
eSteamErrorAlreadyExists = 102,
|
||||
eSteamErrorAlreadySubscribed = 103,
|
||||
eSteamErrorNotSubscribed = 104,
|
||||
eSteamErrorAccessDenied = 105,
|
||||
eSteamErrorFailedToCreateCacheFile = 106,
|
||||
eSteamErrorCallStalledSoAborted = 107,
|
||||
eSteamErrorEngineNotRunning = 108,
|
||||
eSteamErrorEngineConnectionLost = 109,
|
||||
eSteamErrorLoginFailed = 110,
|
||||
eSteamErrorAccountPending = 111,
|
||||
eSteamErrorCacheWasMissingRetry = 112,
|
||||
eSteamErrorLocalTimeIncorrect = 113,
|
||||
eSteamErrorCacheNeedsDecryption = 114,
|
||||
eSteamErrorAccountDisabled = 115,
|
||||
eSteamErrorCacheNeedsRepair = 116,
|
||||
eSteamErrorRebootRequired = 117,
|
||||
|
||||
eSteamErrorNetwork = 200,
|
||||
eSteamErrorOffline = 201
|
||||
|
||||
|
||||
} ESteamError;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eNoDetailedErrorAvailable,
|
||||
eStandardCerrno,
|
||||
eWin32LastError,
|
||||
eWinSockLastError,
|
||||
eDetailedPlatformErrorCount
|
||||
} EDetailedPlatformErrorType;
|
||||
|
||||
typedef enum /* Filter elements returned by SteamFind{First,Next} */
|
||||
{
|
||||
eSteamFindLocalOnly, /* limit search to local filesystem */
|
||||
eSteamFindRemoteOnly, /* limit search to remote repository */
|
||||
eSteamFindAll /* do not limit search (duplicates allowed) */
|
||||
} ESteamFindFilter;
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Exported structure and complex type definitions.
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ESteamError eSteamError;
|
||||
EDetailedPlatformErrorType eDetailedErrorType;
|
||||
int nDetailedErrorCode;
|
||||
char szDesc[STEAM_MAX_PATH];
|
||||
} TSteamError;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int bIsDir; /* If non-zero, element is a directory; if zero, element is a file */
|
||||
unsigned int uSizeOrCount; /* If element is a file, this contains size of file in bytes */
|
||||
int bIsLocal; /* If non-zero, reported item is a standalone element on local filesystem */
|
||||
char cszName[STEAM_MAX_PATH]; /* Base element name (no path) */
|
||||
long lLastAccessTime; /* Seconds since 1/1/1970 (like time_t) when element was last accessed */
|
||||
long lLastModificationTime; /* Seconds since 1/1/1970 (like time_t) when element was last modified */
|
||||
long lCreationTime; /* Seconds since 1/1/1970 (like time_t) when element was created */
|
||||
} TSteamElemInfo;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int uNumSubscriptions;
|
||||
unsigned int uMaxNameChars;
|
||||
unsigned int uMaxApps;
|
||||
|
||||
} TSteamSubscriptionStats;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int uNumApps;
|
||||
unsigned int uMaxNameChars;
|
||||
unsigned int uMaxInstallDirNameChars;
|
||||
unsigned int uMaxVersionLabelChars;
|
||||
unsigned int uMaxLaunchOptions;
|
||||
unsigned int uMaxLaunchOptionDescChars;
|
||||
unsigned int uMaxLaunchOptionCmdLineChars;
|
||||
unsigned int uMaxNumIcons;
|
||||
unsigned int uMaxIconSize;
|
||||
unsigned int uMaxDependencies;
|
||||
|
||||
} TSteamAppStats;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *szLabel;
|
||||
unsigned int uMaxLabelChars;
|
||||
unsigned int uVersionId;
|
||||
int bIsNotAvailable;
|
||||
} TSteamAppVersion;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *szDesc;
|
||||
unsigned int uMaxDescChars;
|
||||
char *szCmdLine;
|
||||
unsigned int uMaxCmdLineChars;
|
||||
unsigned int uIndex;
|
||||
unsigned int uIconIndex;
|
||||
int bNoDesktopShortcut;
|
||||
int bNoStartMenuShortcut;
|
||||
int bIsLongRunningUnattended;
|
||||
|
||||
} TSteamAppLaunchOption;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *szName;
|
||||
unsigned int uMaxNameChars;
|
||||
char *szLatestVersionLabel;
|
||||
unsigned int uMaxLatestVersionLabelChars;
|
||||
char *szCurrentVersionLabel;
|
||||
unsigned int uMaxCurrentVersionLabelChars;
|
||||
char *szInstallDirName;
|
||||
unsigned int uMaxInstallDirNameChars;
|
||||
unsigned int uId;
|
||||
unsigned int uLatestVersionId;
|
||||
unsigned int uCurrentVersionId;
|
||||
unsigned int uMinCacheFileSizeMB;
|
||||
unsigned int uMaxCacheFileSizeMB;
|
||||
unsigned int uNumLaunchOptions;
|
||||
unsigned int uNumIcons;
|
||||
unsigned int uNumVersions;
|
||||
unsigned int uNumDependencies;
|
||||
|
||||
} TSteamApp;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eNoCost = 0,
|
||||
eBillOnceOnly = 1,
|
||||
eBillMonthly = 2,
|
||||
eProofOfPrepurchaseOnly = 3,
|
||||
eGuestPass = 4,
|
||||
eHardwarePromo = 5,
|
||||
eNumBillingTypes,
|
||||
} EBillingType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *szName;
|
||||
unsigned int uMaxNameChars;
|
||||
unsigned int *puAppIds;
|
||||
unsigned int uMaxAppIds;
|
||||
unsigned int uId;
|
||||
unsigned int uNumApps;
|
||||
EBillingType eBillingType;
|
||||
unsigned int uCostInCents;
|
||||
unsigned int uNumDiscounts;
|
||||
int bIsPreorder;
|
||||
int bRequiresShippingAddress;
|
||||
unsigned int uDomesticShippingCostInCents;
|
||||
unsigned int uInternationalShippingCostInCents;
|
||||
bool bIsCyberCafeSubscription;
|
||||
unsigned int uGameCode;
|
||||
char szGameCodeDesc[STEAM_MAX_PATH];
|
||||
bool bIsDisabled;
|
||||
bool bRequiresCD;
|
||||
unsigned int uTerritoryCode;
|
||||
bool bIsSteam3Subscription;
|
||||
|
||||
} TSteamSubscription;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char szName[STEAM_MAX_PATH];
|
||||
unsigned int uDiscountInCents;
|
||||
unsigned int uNumQualifiers;
|
||||
|
||||
} TSteamSubscriptionDiscount;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char szName[STEAM_MAX_PATH];
|
||||
unsigned int uRequiredSubscription;
|
||||
int bIsDisqualifier;
|
||||
|
||||
} TSteamDiscountQualifier;
|
||||
|
||||
typedef struct TSteamProgress
|
||||
{
|
||||
int bValid; /* non-zero if call provides progress info */
|
||||
unsigned int uPercentDone; /* 0 to 100 * STEAM_PROGRESS_PERCENT_SCALE if bValid */
|
||||
char szProgress[STEAM_MAX_PATH]; /* additional progress info */
|
||||
} TSteamProgress;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamNotifyTicketsWillExpire,
|
||||
eSteamNotifyAccountInfoChanged,
|
||||
eSteamNotifyContentDescriptionChanged,
|
||||
eSteamNotifyPleaseShutdown,
|
||||
eSteamNotifyNewContentServer,
|
||||
eSteamNotifySubscriptionStatusChanged,
|
||||
eSteamNotifyContentServerConnectionLost,
|
||||
eSteamNotifyCacheLoadingCompleted,
|
||||
eSteamNotifyCacheNeedsDecryption,
|
||||
eSteamNotifyCacheNeedsRepair
|
||||
} ESteamNotificationCallbackEvent;
|
||||
|
||||
|
||||
typedef void(*SteamNotificationCallback_t)(ESteamNotificationCallbackEvent eEvent, unsigned int nData);
|
||||
|
||||
|
||||
typedef char SteamPersonalQuestion_t[ STEAM_QUESTION_MAXLEN + 1 ];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char uchSalt[STEAM_SALT_SIZE];
|
||||
} SteamSalt_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eVisa = 1,
|
||||
eMaster = 2,
|
||||
eAmericanExpress = 3,
|
||||
eDiscover = 4,
|
||||
eDinnersClub = 5,
|
||||
eJCB = 6
|
||||
} ESteamPaymentCardType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ESteamPaymentCardType eCardType;
|
||||
char szCardNumber[ STEAM_CARD_NUMBER_SIZE +1 ];
|
||||
char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
|
||||
char szCardExpYear[ STEAM_CARD_EXPYEAR_SIZE + 1 ];
|
||||
char szCardExpMonth[ STEAM_CARD_EXPMONTH_SIZE+ 1 ];
|
||||
char szCardCVV2[ STEAM_CARD_CVV2_SIZE + 1 ];
|
||||
char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
|
||||
char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
|
||||
char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
|
||||
char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
|
||||
char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ];
|
||||
char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
|
||||
char szBillingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ];
|
||||
char szBillingEmailAddress[ STEAM_BILLING_EMAIL_ADDRESS_SIZE + 1 ];
|
||||
unsigned int uExpectedCostInCents;
|
||||
unsigned int uExpectedTaxInCents;
|
||||
/* If the TSteamSubscription says that shipping info is required, */
|
||||
/* then the following fields must be filled out. */
|
||||
/* If szShippingName is empty, then assumes so are the rest. */
|
||||
char szShippingName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
|
||||
char szShippingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
|
||||
char szShippingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
|
||||
char szShippingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
|
||||
char szShippingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
|
||||
char szShippingState[ STEAM_BILLING_STATE_SIZE + 1 ];
|
||||
char szShippingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
|
||||
char szShippingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ];
|
||||
unsigned int uExpectedShippingCostInCents;
|
||||
|
||||
} TSteamPaymentCardInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ];
|
||||
|
||||
/* A ProofOfPurchase token is not necessarily a nul-terminated string; it may be binary data
|
||||
(perhaps encrypted). Hence we need a length and an array of bytes. */
|
||||
unsigned int uLengthOfBinaryProofOfPurchaseToken;
|
||||
char cBinaryProofOfPurchaseToken[ STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE + 1 ];
|
||||
} TSteamPrepurchaseInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char szAccountName[ STEAM_EXTERNAL_ACCOUNTNAME_SIZE + 1 ];
|
||||
char szPassword[ STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE + 1 ];
|
||||
} TSteamExternalBillingInfo;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ePaymentCardInfo = 1,
|
||||
ePrepurchasedInfo = 2,
|
||||
eAccountBillingInfo = 3,
|
||||
eExternalBillingInfo = 4, /* indirect billing via ISP etc (not supported yet) */
|
||||
ePaymentCardReceipt = 5,
|
||||
ePrepurchaseReceipt = 6,
|
||||
eEmptyReceipt = 7
|
||||
} ESteamSubscriptionBillingInfoType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ESteamSubscriptionBillingInfoType eBillingInfoType;
|
||||
union {
|
||||
TSteamPaymentCardInfo PaymentCardInfo;
|
||||
TSteamPrepurchaseInfo PrepurchaseInfo;
|
||||
TSteamExternalBillingInfo ExternalBillingInfo;
|
||||
char bUseAccountBillingInfo;
|
||||
};
|
||||
|
||||
} TSteamSubscriptionBillingInfo;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* Subscribed */
|
||||
eSteamSubscriptionOK = 0, /* Subscribed */
|
||||
eSteamSubscriptionPending = 1, /* Awaiting transaction completion */
|
||||
eSteamSubscriptionPreorder = 2, /* Is currently a pre-order */
|
||||
eSteamSubscriptionPrepurchaseTransferred = 3, /* hop to this account */
|
||||
/* Unusbscribed */
|
||||
eSteamSubscriptionPrepurchaseInvalid = 4, /* Invalid cd-key */
|
||||
eSteamSubscriptionPrepurchaseRejected = 5, /* hopped out / banned / etc */
|
||||
eSteamSubscriptionPrepurchaseRevoked = 6, /* hop away from this account */
|
||||
eSteamSubscriptionPaymentCardDeclined = 7, /* CC txn declined */
|
||||
eSteamSubscriptionCancelledByUser = 8, /* Cancelled by client */
|
||||
eSteamSubscriptionCancelledByVendor = 9, /* Cancelled by us */
|
||||
eSteamSubscriptionPaymentCardUseLimit = 10, /* Card used too many times, potential fraud */
|
||||
eSteamSubscriptionPaymentCardAlert = 11, /* Got a "pick up card" or the like from bank */
|
||||
eSteamSubscriptionFailed = 12, /* Other Error in subscription data or transaction failed/lost */
|
||||
eSteamSubscriptionPaymentCardAVSFailure = 13, /* Card failed Address Verification check */
|
||||
eSteamSubscriptionPaymentCardInsufficientFunds = 14, /* Card failed due to insufficient funds */
|
||||
eSteamSubscriptionRestrictedCountry = 15 /* The subscription is not available in the user's country */
|
||||
|
||||
} ESteamSubscriptionStatus;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ESteamPaymentCardType eCardType;
|
||||
char szCardLastFourDigits[ 4 + 1 ];
|
||||
char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
|
||||
char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
|
||||
char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
|
||||
char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
|
||||
char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
|
||||
char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ];
|
||||
char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
|
||||
|
||||
// The following are only available after the subscription leaves "pending" status
|
||||
char szCardApprovalCode[ STEAM_BILLING_CARD_APPROVAL_CODE_SIZE + 1];
|
||||
char szTransDate[ STEAM_BILLING_TRANS_DATE_SIZE + 1]; /* mm/dd/yy */
|
||||
char szTransTime[ STEAM_BILLING_TRANS_TIME_SIZE + 1]; /* hh:mm:ss */
|
||||
unsigned int uPriceWithoutTax;
|
||||
unsigned int uTaxAmount;
|
||||
unsigned int uShippingCost;
|
||||
|
||||
} TSteamPaymentCardReceiptInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ];
|
||||
} TSteamPrepurchaseReceiptInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ESteamSubscriptionStatus eStatus;
|
||||
ESteamSubscriptionStatus ePreviousStatus;
|
||||
ESteamSubscriptionBillingInfoType eReceiptInfoType;
|
||||
char szConfirmationCode[ STEAM_BILLING_CONFIRMATION_CODE_SIZE + 1];
|
||||
union {
|
||||
TSteamPaymentCardReceiptInfo PaymentCardReceiptInfo;
|
||||
TSteamPrepurchaseReceiptInfo PrepurchaseReceiptInfo;
|
||||
};
|
||||
|
||||
} TSteamSubscriptionReceipt;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ePhysicalBytesReceivedThisSession = 1,
|
||||
eAppReadyToLaunchStatus = 2,
|
||||
eAppPreloadStatus = 3,
|
||||
eAppEntireDepot = 4,
|
||||
eCacheBytesPresent = 5
|
||||
} ESteamAppUpdateStatsQueryType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SteamUnsigned64_t uBytesTotal;
|
||||
SteamUnsigned64_t uBytesPresent;
|
||||
} TSteamUpdateStats;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamUserAdministrator = 0x00000001, /* May subscribe, unsubscribe, etc */
|
||||
eSteamUserDeveloper = 0x00000002, /* Steam or App developer */
|
||||
eSteamUserCyberCafe = 0x00000004 /* CyberCafe, school, etc -- UI should ask for password */
|
||||
/* before allowing logout, unsubscribe, etc */
|
||||
} ESteamUserTypeFlags;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamAccountStatusDefault = 0x00000000,
|
||||
eSteamAccountStatusEmailVerified = 0x00000001,
|
||||
/* Note: Mask value 0x2 is reserved for future use. (Some, but not all, public accounts already have this set.) */
|
||||
eSteamAccountDisabled = 0x00000004
|
||||
} ESteamAccountStatusBitFields ;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamBootstrapperError = -1,
|
||||
eSteamBootstrapperDontCheckForUpdate = 0,
|
||||
eSteamBootstrapperCheckForUpdateAndRerun = 7
|
||||
|
||||
} ESteamBootStrapperClientAppResult;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamOnline = 0,
|
||||
eSteamOffline = 1,
|
||||
eSteamNoAuthMode = 2,
|
||||
eSteamBillingOffline = 3
|
||||
} eSteamOfflineStatus;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int eOfflineNow;
|
||||
int eOfflineNextSession;
|
||||
} TSteamOfflineStatus;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int uAppId;
|
||||
int bIsSystemDefined;
|
||||
char szMountPath[STEAM_MAX_PATH];
|
||||
} TSteamAppDependencyInfo;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamOpenFileRegular = 0x0,
|
||||
eSteamOpenFileIgnoreLocal = 0x1,
|
||||
eSteamOpenFileChecksumReads = 0x2
|
||||
} ESteamOpenFileFlags;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eSteamValveCDKeyValidationServer = 0,
|
||||
eSteamHalfLifeMasterServer = 1,
|
||||
eSteamFriendsServer = 2,
|
||||
eSteamCSERServer = 3,
|
||||
eSteamHalfLife2MasterServer = 4,
|
||||
eSteamRDKFMasterServer = 5,
|
||||
eMaxServerTypes = 6
|
||||
} ESteamServerType;
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** More exported constants
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
const SteamHandle_t STEAM_INVALID_HANDLE = 0;
|
||||
const SteamCallHandle_t STEAM_INVALID_CALL_HANDLE = 0;
|
||||
const SteamUserIDTicketValidationHandle_t STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE = 0;
|
||||
const unsigned int STEAM_USE_LATEST_VERSION = 0xFFFFFFFF;
|
||||
|
||||
#else
|
||||
|
||||
#define STEAM_INVALID_HANDLE ((SteamHandle_t)(0))
|
||||
#define STEAM_INVALID_CALL_HANDLE ((SteamCallHandle_t)(0))
|
||||
#define STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE ((SteamUserIDTicketValidationHandle_t)(0))
|
||||
#define STEAM_USE_LATEST_VERSION (0xFFFFFFFFu);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
** Each Steam instance (licensed Steam Service Provider) has a unique SteamInstanceID_t.
|
||||
**
|
||||
** Each Steam instance as its own DB of users.
|
||||
** Each user in the DB has a unique SteamLocalUserID_t (a serial number, with possible
|
||||
** rare gaps in the sequence).
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
typedef unsigned short SteamInstanceID_t; // MUST be 16 bits
|
||||
|
||||
|
||||
#if defined ( _WIN32 )
|
||||
typedef unsigned __int64 SteamLocalUserID_t; // MUST be 64 bits
|
||||
#else
|
||||
typedef unsigned long long SteamLocalUserID_t; // MUST be 64 bits
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Applications need to be able to authenticate Steam users from ANY instance.
|
||||
** So a SteamIDTicket contains SteamGlobalUserID, which is a unique combination of
|
||||
** instance and user id.
|
||||
**
|
||||
** SteamLocalUserID is an unsigned 64-bit integer.
|
||||
** For platforms without 64-bit int support, we provide access via a union that splits it into
|
||||
** high and low unsigned 32-bit ints. Such platforms will only need to compare LocalUserIDs
|
||||
** for equivalence anyway - not perform arithmetic with them.
|
||||
**
|
||||
********************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int Low32bits;
|
||||
unsigned int High32bits;
|
||||
} TSteamSplitLocalUserID;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SteamInstanceID_t m_SteamInstanceID;
|
||||
|
||||
union
|
||||
{
|
||||
SteamLocalUserID_t As64bits;
|
||||
TSteamSplitLocalUserID Split;
|
||||
} m_SteamLocalUserID;
|
||||
|
||||
} TSteamGlobalUserID;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
226
common/SteamInterface.h
Normal file
226
common/SteamInterface.h
Normal file
@@ -0,0 +1,226 @@
|
||||
|
||||
/************ (C) Copyright 2004 Valve Corporation, All rights reserved. ***********
|
||||
**
|
||||
** The copyright to the contents herein is the property of Valve Corporation.
|
||||
** The contents may be used and/or copied only with the written permission of
|
||||
** Valve, or in accordance with the terms and conditions stipulated in
|
||||
** the agreement/contract under which the contents have been supplied.
|
||||
**
|
||||
*******************************************************************************
|
||||
**
|
||||
** Contents:
|
||||
**
|
||||
** This file provides an obfuscated interface to the Steam service. This
|
||||
** interface is described in the SDK documentation.
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef INCLUDED_STEAM_INTERFACE_H
|
||||
#define INCLUDED_STEAM_INTERFACE_H
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDED_STEAM2_USERID_STRUCTS
|
||||
#include "SteamCommon.h"
|
||||
#endif
|
||||
|
||||
// IAppSystem interface. Returns an IAppSystem implementation; use QueryInterface on
|
||||
// that to get the ISteamInterface (same as the older _f function).
|
||||
#define STEAMDLL_APPSYSTEM_VERSION "SteamDLLAppsystem001"
|
||||
// extern "C" STEAM_API void * STEAM_CALL CreateInterface( const char *pName, int *pReturncode );
|
||||
|
||||
// create interface
|
||||
#define STEAM_INTERFACE_VERSION "Steam006"
|
||||
extern "C" STEAM_API void * STEAM_CALL _f(const char *szInterfaceVersionRequested);
|
||||
|
||||
// current abstract interface
|
||||
class ISteamInterface
|
||||
{
|
||||
public:
|
||||
virtual ~ISteamInterface() {};
|
||||
|
||||
virtual SteamCallHandle_t ChangePassword( const char *cszCurrentPassphrase, const char *cszNewPassphrase, TSteamError *pError ) = 0;
|
||||
virtual int GetCurrentEmailAddress( char *szEmailAddress, unsigned int uBufSize, unsigned int *puEmailChars, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t ChangePersonalQA( const char *cszCurrentPassphrase, const char *cszNewPersonalQuestion, const char *cszNewAnswerToQuestion, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t ChangeEmailAddress( const char *cszNewEmailAddress, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t VerifyEmailAddress( const char *cszEmailVerificationKey, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t RequestEmailAddressVerificationEmail( TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t ChangeAccountName( const char *cszCurrentPassphrase, const char *cszNewAccountName, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int MountAppFilesystem( TSteamError *pError ) = 0;
|
||||
virtual int UnmountAppFilesystem( TSteamError *pError ) = 0;
|
||||
virtual SteamHandle_t MountFilesystem( unsigned int uAppId, const char *szMountPath, TSteamError *pError ) = 0;
|
||||
virtual int UnmountFilesystem( SteamHandle_t hFs, TSteamError *pError ) = 0;
|
||||
virtual int Stat( const char *cszName, TSteamElemInfo *pInfo, TSteamError *pError ) = 0;
|
||||
virtual int SetvBuf( SteamHandle_t hFile, void* pBuf, ESteamBufferMethod eMethod, unsigned int uBytes, TSteamError *pError ) = 0;
|
||||
virtual int FlushFile( SteamHandle_t hFile, TSteamError *pError ) = 0;
|
||||
virtual SteamHandle_t OpenFile( const char *cszName, const char *cszMode, TSteamError *pError ) = 0;
|
||||
virtual SteamHandle_t OpenFileEx( const char *cszName, const char *cszMode, int nFlags, unsigned int *puFileSize, int *pbLocal, TSteamError *pError ) = 0;
|
||||
virtual SteamHandle_t OpenTmpFile( TSteamError *pError ) = 0;
|
||||
|
||||
virtual void ClearError( TSteamError *pError ) = 0;
|
||||
virtual int GetVersion( char *szVersion, unsigned int uVersionBufSize ) = 0;
|
||||
|
||||
virtual int GetOfflineStatus( TSteamOfflineStatus *pStatus, TSteamError *pError ) = 0;
|
||||
virtual int ChangeOfflineStatus( TSteamOfflineStatus *pStatus, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int ProcessCall( SteamCallHandle_t handle, TSteamProgress *pProgress, TSteamError *pError ) = 0;
|
||||
virtual int AbortCall( SteamCallHandle_t handle, TSteamError *pError ) = 0;
|
||||
virtual int BlockingCall( SteamCallHandle_t handle, unsigned int uiProcessTickMS, TSteamError *pError ) = 0;
|
||||
virtual int SetMaxStallCount( unsigned int uNumStalls, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int CloseFile( SteamHandle_t hFile, TSteamError *pError ) = 0;
|
||||
virtual unsigned int ReadFile( void *pBuf, unsigned int uSize, unsigned int uCount, SteamHandle_t hFile, TSteamError *pError ) = 0;
|
||||
virtual unsigned int WriteFile( const void *pBuf, unsigned int uSize, unsigned int uCount, SteamHandle_t hFile, TSteamError *pError ) = 0;
|
||||
virtual int Getc( SteamHandle_t hFile, TSteamError *pError ) = 0;
|
||||
virtual int Putc( int cChar, SteamHandle_t hFile, TSteamError *pError ) = 0;
|
||||
//virtual int PrintFile( SteamHandle_t hFile, TSteamError *pError, const char *cszFormat, ... ) = 0;
|
||||
virtual int SeekFile( SteamHandle_t hFile, long lOffset, ESteamSeekMethod, TSteamError *pError ) = 0;
|
||||
virtual long TellFile( SteamHandle_t hFile, TSteamError *pError ) = 0;
|
||||
virtual long SizeFile( SteamHandle_t hFile, TSteamError *pError ) = 0;
|
||||
virtual SteamHandle_t FindFirst( const char *cszPattern, ESteamFindFilter eFilter, TSteamElemInfo *pFindInfo, TSteamError *pError ) = 0;
|
||||
virtual int FindNext( SteamHandle_t hDirectory, TSteamElemInfo *pFindInfo, TSteamError *pError ) = 0;
|
||||
#if !defined( _X360 ) // X360TBD: Macro defined in winbase.h
|
||||
virtual int FindClose( SteamHandle_t hDirectory, TSteamError *pError ) = 0;
|
||||
#endif
|
||||
virtual int GetLocalFileCopy( const char *cszName, TSteamError *pError ) = 0;
|
||||
virtual int IsFileImmediatelyAvailable( const char *cszName, TSteamError *pError ) = 0;
|
||||
virtual int HintResourceNeed( const char *cszMasterList, int bForgetEverything, TSteamError *pError ) = 0;
|
||||
virtual int ForgetAllHints( TSteamError *pError ) = 0;
|
||||
virtual int PauseCachePreloading( TSteamError *pError ) = 0;
|
||||
virtual int ResumeCachePreloading( TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t WaitForResources( const char *cszMasterList, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int StartEngine(TSteamError *pError) = 0;
|
||||
virtual int ShutdownEngine(TSteamError *pError) = 0;
|
||||
|
||||
virtual int Startup( unsigned int uUsingMask, TSteamError *pError ) = 0;
|
||||
virtual int Cleanup( TSteamError *pError ) = 0;
|
||||
|
||||
virtual unsigned int NumAppsRunning( TSteamError *pError ) = 0;
|
||||
|
||||
virtual SteamCallHandle_t CreateAccount( const char *cszUser, const char *cszEmailAddress, const char *cszPassphrase, const char *cszCreationKey, const char *cszPersonalQuestion, const char *cszAnswerToQuestion, int *pbCreated, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t GenerateSuggestedAccountNames( const char *cszAccountNameToSelectMasterAS, const char *cszGenerateNamesLikeAccountName, char *pSuggestedNamesBuf, unsigned int uBufSize, unsigned int *puNumSuggestedChars, TSteamError *pError) = 0;
|
||||
virtual int IsLoggedIn( int *pbIsLoggedIn, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t Logout( TSteamError *pError ) = 0;
|
||||
virtual int IsSecureComputer( int *pbIsSecure, TSteamError *pError ) = 0;
|
||||
|
||||
virtual SteamHandle_t CreateLogContext( const char *cszName ) = 0;
|
||||
virtual int Log( SteamHandle_t hContext, const char *cszMsg ) = 0;
|
||||
virtual void LogResourceLoadStarted( const char *cszMsg ) = 0;
|
||||
virtual void LogResourceLoadFinished( const char *cszMsg ) = 0;
|
||||
|
||||
virtual SteamCallHandle_t RefreshLogin( const char *cszPassphrase, int bIsSecureComputer, TSteamError * pError ) = 0;
|
||||
virtual int VerifyPassword( const char *cszPassphrase, int *pbCorrect, TSteamError *pError ) = 0;
|
||||
virtual int GetUserType( unsigned int *puUserTypeFlags, TSteamError *pError ) = 0;
|
||||
virtual int GetAppStats( TSteamAppStats *pAppStats, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t IsAccountNameInUse( const char *cszAccountName, int *pbIsUsed, TSteamError *pError) = 0;
|
||||
virtual int GetAppIds( unsigned int *puIds, unsigned int uMaxIds, TSteamError *pError ) = 0;
|
||||
virtual int GetSubscriptionStats( TSteamSubscriptionStats *pSubscriptionStats, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t RefreshAccountInfo( int bContentDescriptionOnly, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t Subscribe( unsigned int uSubscriptionId, const TSteamSubscriptionBillingInfo *pSubscriptionBillingInfo, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t Unsubscribe( unsigned int uSubscriptionId, TSteamError *pError ) = 0;
|
||||
virtual int GetSubscriptionReceipt( unsigned int uSubscriptionId, TSteamSubscriptionReceipt *pSubscriptionReceipt, TSteamError *pError ) = 0;
|
||||
virtual int GetAccountStatus( unsigned int *puAccountStatusFlags, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t SetUser( const char *cszUser, int *pbUserSet, TSteamError *pError ) = 0;
|
||||
virtual int GetUser( char *szUser, unsigned int uBufSize, unsigned int *puUserChars, TSteamGlobalUserID *pOptionalReceiveUserID, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t Login( const char *cszUser, const char *cszPassphrase, int bIsSecureComputer, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t AckSubscriptionReceipt( unsigned int uSubscriptionId, TSteamError *pError ) = 0;
|
||||
virtual int IsAppSubscribed( unsigned int uAppId, int *pbIsAppSubscribed, int *pbIsSubscriptionPending, TSteamError *pError ) = 0;
|
||||
virtual int GetSubscriptionIds( unsigned int *puIds, unsigned int uMaxIds, TSteamError *pError ) = 0;
|
||||
virtual int EnumerateSubscription( unsigned int uId, TSteamSubscription *pSubscription, TSteamError *pError ) = 0;
|
||||
virtual int EnumerateSubscriptionDiscount( unsigned int uSubscriptionId, unsigned int uDiscountIndex, TSteamSubscriptionDiscount *pDiscount, TSteamError *pError ) = 0;
|
||||
virtual int EnumerateSubscriptionDiscountQualifier( unsigned int uSubscriptionId, unsigned int uDiscountIndex, unsigned int uQualifierIndex, TSteamDiscountQualifier *pDiscountQualifier, TSteamError *pError ) = 0;
|
||||
virtual int EnumerateApp( unsigned int uId, TSteamApp *pApp, TSteamError *pError ) = 0;
|
||||
virtual int EnumerateAppLaunchOption( unsigned int uAppId, unsigned int uLaunchOptionIndex, TSteamAppLaunchOption *pLaunchOption, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t DeleteAccount( TSteamError *pError ) = 0;
|
||||
virtual int EnumerateAppIcon( unsigned int uAppId, unsigned int uIconIndex, unsigned char *pIconData, unsigned int uIconDataBufSize, unsigned int *puSizeOfIconData, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t LaunchApp( unsigned int uAppId, unsigned int uLaunchOption, const char *cszArgs, TSteamError *pError ) = 0;
|
||||
virtual int GetCacheFilePath( unsigned int uCacheId, char *szPathBuf, unsigned int uBufSize, unsigned int *puPathChars, TSteamError *pError ) = 0;
|
||||
virtual int EnumerateAppVersion( unsigned int uAppId, unsigned int uVersionIndex, TSteamAppVersion *pAppVersion, TSteamError *pError ) = 0;
|
||||
virtual int EnumerateAppDependency( unsigned int uAppId, unsigned int uIndex, TSteamAppDependencyInfo *pDependencyInfo, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t StartLoadingCache( unsigned int uAppId, TSteamError *pError ) = 0;
|
||||
virtual int InsertAppDependency( unsigned int uAppId, unsigned int uIndex, TSteamAppDependencyInfo *pDependencyInfo, TSteamError *pError ) = 0;
|
||||
virtual int RemoveAppDependency( unsigned int uAppId, unsigned int uIndex, TSteamError *pError ) = 0;
|
||||
virtual int FindApp( const char *cszAppName, unsigned int *puAppId, TSteamError *pError ) = 0;
|
||||
virtual int GetAppDependencies( unsigned int uAppId, unsigned int *puCacheIds, unsigned int uMaxIds, TSteamError *pError ) = 0;
|
||||
virtual int IsSubscribed( unsigned int uSubscriptionId, int *pbIsSubscribed, int *pbIsSubscriptionPending, TSteamError *pError ) = 0;
|
||||
virtual int GetAppUserDefinedInfo( unsigned int uAppId, const char *cszKey, char *szValueBuf, unsigned int uValueBufLen, unsigned int *puValueLen, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t WaitForAppReadyToLaunch( unsigned int uAppId, TSteamError *pError ) = 0;
|
||||
virtual int IsCacheLoadingEnabled( unsigned int uAppId, int *pbIsLoading, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t StopLoadingCache( unsigned int uAppId, TSteamError *pError ) = 0;
|
||||
|
||||
virtual ESteamError GetEncryptedUserIDTicket
|
||||
(
|
||||
const void * pEncryptionKey,
|
||||
unsigned int uKeyLength,
|
||||
void * pOutputBuffer,
|
||||
unsigned int uSizeOfOutputBuffer,
|
||||
unsigned int * pReceiveSizeOfEncryptedTicket,
|
||||
TSteamError * pReceiveErrorCode
|
||||
) = 0;
|
||||
|
||||
virtual SteamCallHandle_t FlushCache( unsigned int uCacheId, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t RepairOrDecryptCaches( unsigned int uAppId, int bForceValidation, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t LoadCacheFromDir( unsigned int uAppId, const char *szPath, TSteamError *pError ) = 0;
|
||||
virtual int GetCacheDefaultDirectory( char *szPath, TSteamError *pError ) = 0;
|
||||
virtual int SetCacheDefaultDirectory( const char *szPath, TSteamError *pError ) = 0;
|
||||
virtual int GetAppDir( unsigned int uAppId, char *szPath, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t MoveApp( unsigned int uAppId, const char *szPath, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t GetAppCacheSize( unsigned int uCacheId, unsigned int *pCacheSizeInMb, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t SetAppCacheSize( unsigned int uCacheId, unsigned int nCacheSizeInMb, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t SetAppVersion( unsigned int uAppId, unsigned int uAppVersionId, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t Uninstall( TSteamError *pError ) = 0;
|
||||
virtual int SetNotificationCallback( SteamNotificationCallback_t pCallbackFunction, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t ChangeForgottenPassword( const char *cszUser, const char *cszAnswerToQuestion, const char *cszEmailVerificationKey, const char *cszNewPassphrase, int *pbChanged, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t RequestForgottenPasswordEmail( const char *cszUser, SteamPersonalQuestion_t ReceivePersonalQuestion, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t RequestAccountsByEmailAddressEmail( const char *cszEmailAddress, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t RequestAccountsByCdKeyEmail( const char *cszCdKey, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t GetNumAccountsWithEmailAddress( const char *cszEmailAddress, unsigned int *puNumAccounts, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t UpdateAccountBillingInfo( const TSteamPaymentCardInfo *pPaymentCardInfo, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t UpdateSubscriptionBillingInfo( unsigned int uSubscriptionId, const TSteamSubscriptionBillingInfo *pSubscriptionBillingInfo, TSteamError *pError ) = 0;
|
||||
virtual int GetSponsorUrl( unsigned int uAppId, char *szUrl, unsigned int uBufSize, unsigned int *pUrlChars, TSteamError *pError ) = 0;
|
||||
virtual int GetContentServerInfo( unsigned int uAppId, unsigned int *puServerId, unsigned int *puServerIpAddress, TSteamError *pError ) = 0;
|
||||
virtual SteamCallHandle_t GetAppUpdateStats( unsigned int uAppOrCacheId, ESteamAppUpdateStatsQueryType eQueryType, TSteamUpdateStats *pUpdateStats, TSteamError *pError ) = 0;
|
||||
virtual int GetTotalUpdateStats( TSteamUpdateStats *pUpdateStats, TSteamError *pError ) = 0;
|
||||
|
||||
virtual SteamCallHandle_t CreateCachePreloaders( TSteamError *pError ) = 0;
|
||||
|
||||
virtual void Win32SetMiniDumpComment( const char *comment ) = 0;
|
||||
virtual void Win32SetMiniDumpSourceControlId( unsigned int SourcecontrolID ) = 0;
|
||||
virtual void Win32SetMiniDumpEnableFullMemory() = 0;
|
||||
virtual void Win32WriteMiniDump( const char * szErrorOrAssertType, const char * szDescriptionOrAssertName, const char * szAssertExpr, const char * szAssertFilename, unsigned int uAssertLineNumber ) = 0;
|
||||
|
||||
virtual int GetCurrentAppId( unsigned int *puAppId, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int GetAppPurchaseCountry( unsigned int uAppId, char *szCountry, unsigned int uBufSize, int * pPurchaseTime, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int GetLocalClientVersion( unsigned int *puBootstrapperVersion, unsigned int *puClientVersion, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int IsFileNeededByCache( unsigned int uCacheId, const char *pchFileName, unsigned int uFileSize, TSteamError *pError ) = 0;
|
||||
virtual int LoadFileToCache( unsigned int uCacheId, const char *pchFileName, const void *pubDataChunk, unsigned int cubDataChunk, unsigned int cubDataOffset, TSteamError *pError ) = 0;
|
||||
virtual int GetCacheDecryptionKey( unsigned int uCacheId, char *pchKeyBuffer, unsigned int cubBuff, unsigned int *pcubKey, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int GetSubscriptionExtendedInfo( unsigned int uSubscriptionId, const char *cszKey, char *szValueBuf, unsigned int uValueBufLen, unsigned *puValueLen, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int GetSubscriptionPurchaseCountry( unsigned int uSubscriptionId, char *szCountry, unsigned int uBufSize, int * pPurchaseTime, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int GetAppUserDefinedRecord( unsigned int uAppid, KeyValueIteratorCallback_t pIterationCallback, void *pvParam, TSteamError *pError ) = 0;
|
||||
|
||||
virtual int FindServersNumServers(ESteamServerType eServerType) = 0;
|
||||
|
||||
// Get nth ipaddr:port for this server type
|
||||
// buffer needs to be 22 chars long: aaa.bbb.ccc.ddd:12345 plus null
|
||||
//
|
||||
// returns 0 if succsessful, negative is error
|
||||
virtual int FindServersIterateServer(ESteamServerType eServerType, unsigned int nServer, char *szIpAddrPort, int szIpAddrPortLen) = 0;
|
||||
|
||||
virtual const char * FindServersGetErrorString() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
118
common/SteamUserIDValidation.h
Normal file
118
common/SteamUserIDValidation.h
Normal file
@@ -0,0 +1,118 @@
|
||||
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Contents:
|
||||
**
|
||||
** This file provides the public interface to the Steam service. This
|
||||
** interface is described in the SDK documentation.
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef INCLUDED_STEAMUSERIDVALIDATION_H
|
||||
#define INCLUDED_STEAMUSERIDVALIDATION_H
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef INCLUDED_STEAM2_USERID_STRUCTS
|
||||
#include "SteamCommon.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*
|
||||
** User ID
|
||||
*/
|
||||
|
||||
/* Client calls this (see also ValidateNewValveCDKeyClient.h if appropriate) */
|
||||
STEAM_API ESteamError STEAM_CALL SteamGetEncryptedUserIDTicket
|
||||
(
|
||||
const void * pEncryptionKeyReceivedFromAppServer,
|
||||
unsigned int uEncryptionKeyLength,
|
||||
void * pOutputBuffer,
|
||||
unsigned int uSizeOfOutputBuffer,
|
||||
unsigned int * pReceiveSizeOfEncryptedTicket,
|
||||
TSteamError * pReceiveErrorCode
|
||||
);
|
||||
|
||||
|
||||
/* Game/Application server calls these */
|
||||
STEAM_API ESteamError STEAM_CALL SteamInitializeUserIDTicketValidator
|
||||
(
|
||||
const char * pszOptionalPublicEncryptionKeyFilename,
|
||||
const char * pszOptionalPrivateDecryptionKeyFilename,
|
||||
unsigned int ClientClockSkewToleranceInSeconds,
|
||||
unsigned int ServerClockSkewToleranceInSeconds,
|
||||
unsigned int MaxNumLoginsWithinClientClockSkewTolerancePerClient,
|
||||
unsigned int HintPeakSimultaneousValidations,
|
||||
unsigned int AbortValidationAfterStallingForNProcessSteps
|
||||
);
|
||||
|
||||
STEAM_API ESteamError STEAM_CALL SteamShutdownUserIDTicketValidator();
|
||||
|
||||
STEAM_API const char * STEAM_CALL SteamGetEncryptionKeyToSendToNewClient
|
||||
(
|
||||
unsigned int * pReceiveSizeOfEncryptionKey
|
||||
);
|
||||
|
||||
STEAM_API ESteamError STEAM_CALL SteamStartValidatingUserIDTicket
|
||||
(
|
||||
void * pEncryptedUserIDTicketFromClient,
|
||||
unsigned int uSizeOfEncryptedUserIDTicketFromClient,
|
||||
unsigned int ObservedClientIPAddr,
|
||||
SteamUserIDTicketValidationHandle_t * pReceiveHandle
|
||||
);
|
||||
|
||||
STEAM_API ESteamError STEAM_CALL SteamStartValidatingNewValveCDKey
|
||||
(
|
||||
void * pEncryptedNewValveCDKeyFromClient,
|
||||
unsigned int uSizeOfEncryptedNewValveCDKeyFromClient,
|
||||
unsigned int ObservedClientIPAddr,
|
||||
struct sockaddr * pPrimaryValidateNewCDKeyServerSockAddr,
|
||||
struct sockaddr * pSecondaryValidateNewCDKeyServerSockAddr,
|
||||
SteamUserIDTicketValidationHandle_t * pReceiveHandle
|
||||
);
|
||||
|
||||
|
||||
STEAM_API ESteamError STEAM_CALL SteamProcessOngoingUserIDTicketValidation
|
||||
(
|
||||
SteamUserIDTicketValidationHandle_t Handle,
|
||||
TSteamGlobalUserID * pReceiveValidSteamGlobalUserID,
|
||||
unsigned int * pReceiveClientLocalIPAddr,
|
||||
unsigned char * pOptionalReceiveProofOfAuthenticationToken,
|
||||
size_t SizeOfOptionalAreaToReceiveProofOfAuthenticationToken,
|
||||
size_t * pOptionalReceiveSizeOfProofOfAuthenticationToken
|
||||
);
|
||||
|
||||
STEAM_API void STEAM_CALL SteamAbortOngoingUserIDTicketValidation
|
||||
(
|
||||
SteamUserIDTicketValidationHandle_t Handle
|
||||
);
|
||||
|
||||
STEAM_API ESteamError STEAM_CALL SteamOptionalCleanUpAfterClientHasDisconnected
|
||||
(
|
||||
unsigned int ObservedClientIPAddr,
|
||||
unsigned int ClientLocalIPAddr
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef INCLUDED_STEAM2_USERID_STRUCTS */
|
||||
64
common/SteamWriteMiniDump.h
Normal file
64
common/SteamWriteMiniDump.h
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
/************ (C) Copyright 2002 Valve, L.L.C. All rights reserved. ***********
|
||||
**
|
||||
** The copyright to the contents herein is the property of Valve, L.L.C.
|
||||
** The contents may be used and/or copied only with the written permission of
|
||||
** Valve, L.L.C., or in accordance with the terms and conditions stipulated in
|
||||
** the agreement/contract under which the contents have been supplied.
|
||||
**
|
||||
*******************************************************************************
|
||||
**
|
||||
** Contents:
|
||||
**
|
||||
** This file provides the public interface to the Steam service. This
|
||||
** interface is described in the SDK documentation.
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef INCLUDED_STEAMWRITEMINIDUMP_H
|
||||
#define INCLUDED_STEAMWRITEMINIDUMP_H
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDED_STEAM2_USERID_STRUCTS
|
||||
#include "SteamCommon.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
** Write minidump using result of GetExceptionInformation() in an __except block
|
||||
*/
|
||||
STEAM_API void STEAM_CALL SteamWriteMiniDumpUsingExceptionInfo
|
||||
(
|
||||
unsigned int uStructuredExceptionCode,
|
||||
struct _EXCEPTION_POINTERS * pExceptionInfo
|
||||
);
|
||||
|
||||
STEAM_API void STEAM_CALL SteamWriteMiniDumpUsingExceptionInfoWithBuildId
|
||||
(
|
||||
unsigned int uStructuredExceptionCode,
|
||||
struct _EXCEPTION_POINTERS * pExceptionInfo,
|
||||
unsigned int uBuildID
|
||||
);
|
||||
|
||||
STEAM_API void STEAM_CALL SteamWriteMiniDumpSetComment
|
||||
(
|
||||
const char *cszComment
|
||||
);
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
48
common/blackbox_helper.cpp
Normal file
48
common/blackbox_helper.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "engine/iblackbox.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
extern IBlackBox *blackboxrecorder;
|
||||
|
||||
void BlackBox_Record( const char *type, PRINTF_FORMAT_STRING const char *pFormat, ... )
|
||||
{
|
||||
static ConVarRef blackbox( "blackbox" );
|
||||
|
||||
if ( IsX360() )
|
||||
return;
|
||||
|
||||
if ( !blackbox.IsValid() || !blackbox.GetBool() )
|
||||
return;
|
||||
|
||||
int type_num;
|
||||
for ( type_num = 0; type_num < blackboxrecorder->GetTypeCount(); type_num++ )
|
||||
{
|
||||
if ( !V_strcasecmp( blackboxrecorder->GetTypeName( type_num ), type ) )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( type_num >= blackboxrecorder->GetTypeCount() )
|
||||
{
|
||||
Msg( "Invalid blackbox type: %s\n", type );
|
||||
return;
|
||||
}
|
||||
|
||||
char szMessage[1024];
|
||||
va_list marker;
|
||||
|
||||
va_start( marker, pFormat);
|
||||
Q_vsnprintf( szMessage, sizeof( szMessage ), pFormat, marker);
|
||||
va_end( marker );
|
||||
|
||||
//Msg( "Record: %s: %s\n", type, szMessage );
|
||||
blackboxrecorder->Record( type_num, szMessage );
|
||||
}
|
||||
|
||||
11
common/blackbox_helper.h
Normal file
11
common/blackbox_helper.h
Normal file
@@ -0,0 +1,11 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
#ifndef BLACKBOX_HELPER_H
|
||||
#define BLACKBOX_HELPER_H 1
|
||||
|
||||
void BlackBox_Record(const char * type, PRINTF_FORMAT_STRING const char *fmt, ...);
|
||||
|
||||
#endif
|
||||
122
common/bugreporter/bugreporter.h
Normal file
122
common/bugreporter/bugreporter.h
Normal file
@@ -0,0 +1,122 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef BUGREPORTER_H
|
||||
#define BUGREPORTER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
abstract_class IBugReporter : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
// Initialize and login with default username/password for this computer (from resource/bugreporter.res)
|
||||
virtual bool Init( CreateInterfaceFn engineFactory ) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual bool IsPublicUI() = 0;
|
||||
|
||||
virtual char const *GetUserName() = 0;
|
||||
virtual char const *GetUserDisplayName() = 0;
|
||||
|
||||
virtual int GetNameCount() = 0;
|
||||
virtual char const *GetName( int index ) = 0;
|
||||
|
||||
virtual int GetDisplayNameCount() = 0;
|
||||
virtual char const *GetDisplayName( int index ) = 0;
|
||||
virtual char const *GetUserName( int index ) = 0;
|
||||
|
||||
virtual char const *GetDisplayNameForUserName( char const *username ) = 0;
|
||||
virtual char const *GetUserNameForDisplayName( char const *display ) = 0;
|
||||
|
||||
virtual int GetSeverityCount() = 0;
|
||||
virtual char const *GetSeverity( int index ) = 0;
|
||||
|
||||
virtual int GetPriorityCount() = 0;
|
||||
virtual char const *GetPriority( int index ) = 0;
|
||||
|
||||
virtual int GetAreaCount() = 0;
|
||||
virtual char const *GetArea( int index ) = 0;
|
||||
|
||||
virtual int GetAreaMapCount() = 0;
|
||||
virtual char const *GetAreaMap( int index ) = 0;
|
||||
|
||||
virtual int GetMapNumberCount() = 0;
|
||||
virtual char const *GetMapNumber( int index ) = 0;
|
||||
|
||||
virtual int GetReportTypeCount() = 0;
|
||||
virtual char const *GetReportType( int index ) = 0;
|
||||
|
||||
virtual char const *GetRepositoryURL( void ) = 0;
|
||||
virtual char const *GetSubmissionURL( void ) = 0;
|
||||
|
||||
virtual int GetLevelCount(int area) = 0;
|
||||
virtual char const *GetLevel(int area, int index ) = 0;
|
||||
|
||||
virtual int GetLevelOwnerCount(int area) = 0;
|
||||
virtual char const *GetLevelOwner(int area, int index ) = 0;
|
||||
|
||||
// Submission API
|
||||
virtual void StartNewBugReport() = 0;
|
||||
virtual void CancelNewBugReport() = 0;
|
||||
virtual bool CommitBugReport( int& bugSubmissionId ) = 0;
|
||||
|
||||
virtual void SetTitle( char const *title ) = 0;
|
||||
virtual void SetDescription( char const *description ) = 0;
|
||||
|
||||
// NULL for current user
|
||||
virtual void SetSubmitter( char const *username = 0 ) = 0;
|
||||
virtual void SetOwner( char const *username ) = 0;
|
||||
virtual void SetSeverity( char const *severity ) = 0;
|
||||
virtual void SetPriority( char const *priority ) = 0;
|
||||
virtual void SetArea( char const *area ) = 0;
|
||||
virtual void SetMapNumber( char const *area ) = 0;
|
||||
virtual void SetReportType( char const *report_type ) = 0;
|
||||
|
||||
virtual void SetLevel( char const *levelnamne ) = 0;
|
||||
virtual void SetPosition( char const *position ) = 0;
|
||||
virtual void SetOrientation( char const *pitch_yaw_roll ) = 0;
|
||||
virtual void SetBuildNumber( char const *build_num ) = 0;
|
||||
|
||||
virtual void SetScreenShot( char const *screenshot_unc_address ) = 0;
|
||||
virtual void SetSaveGame( char const *savegame_unc_address ) = 0;
|
||||
virtual void SetBSPName( char const *bsp_unc_address ) = 0;
|
||||
virtual void SetVMFName( char const *vmf_unc_address ) = 0;
|
||||
virtual void AddIncludedFile( char const *filename ) = 0;
|
||||
virtual void ResetIncludedFiles() = 0;
|
||||
|
||||
virtual void SetZipAttachmentName( char const *zipfilename ) = 0;
|
||||
|
||||
virtual void SetDriverInfo( char const *info ) = 0;
|
||||
virtual void SetMiscInfo( char const *info ) = 0;
|
||||
|
||||
virtual void SetCSERAddress( const struct netadr_s& adr ) = 0;
|
||||
virtual void SetExeName( char const *exename ) = 0;
|
||||
virtual void SetGameDirectory( char const *gamedir ) = 0;
|
||||
virtual void SetRAM( int ram ) = 0;
|
||||
virtual void SetCPU( int cpu ) = 0;
|
||||
virtual void SetProcessor( char const *processor ) = 0;
|
||||
virtual void SetDXVersion( unsigned int high, unsigned int low, unsigned int vendor, unsigned int device ) = 0;
|
||||
virtual void SetOSVersion( char const *osversion ) = 0;
|
||||
|
||||
virtual void SetSteamUserID( void *steamid, int idsize ) = 0;
|
||||
|
||||
virtual void SetConsoleHistory( char const *pchText ) = 0;
|
||||
};
|
||||
|
||||
#define INTERFACEVERSION_BUGREPORTER "BugReporter005"
|
||||
|
||||
abstract_class IBugReporterDefaultUsername
|
||||
{
|
||||
public:
|
||||
virtual char const *GetDefaultUsername() const = 0; // returns value of engine bugreporter_username convar since bugreporter .dlls don't have convars for now
|
||||
};
|
||||
|
||||
#define INTERFACEVERSION_BUGREPORTER_DEFAULT_USER_NAME "BugReporterUserName001"
|
||||
|
||||
#endif // BUGREPORTER_H
|
||||
114
common/bundled_module_info.cpp
Normal file
114
common/bundled_module_info.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
//=========== Copyright Valve Corporation, All rights reserved. =============//
|
||||
//
|
||||
// Purpose: Common location for hard-coded knowledge about module
|
||||
// bundles, such as tier2_bundle and tier3_bundle.
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include "bundled_module_info.h"
|
||||
|
||||
#include "tier0/icommandline.h"
|
||||
#include "tier1/strtools.h"
|
||||
|
||||
static const char * const s_pTier2BundleModules[] =
|
||||
{
|
||||
"filesystem_stdio",
|
||||
"imemanager",
|
||||
"inputsystem",
|
||||
"localize",
|
||||
"materialsystem2",
|
||||
"networksystem",
|
||||
"resourcesystem",
|
||||
"schemasystem",
|
||||
"soundsystem",
|
||||
};
|
||||
|
||||
static const char * const s_pTier3BundleModules[] =
|
||||
{
|
||||
"animationsystem",
|
||||
"meshsystem",
|
||||
"particles",
|
||||
"renderingpipelines",
|
||||
"scenesystem",
|
||||
"worldrenderer",
|
||||
};
|
||||
|
||||
static bool FindBundledModuleName( const char *pCheck, const char * const *pTable, int nTable )
|
||||
{
|
||||
for ( int i = 0; i < nTable; i++ )
|
||||
{
|
||||
if ( V_stricmp_fast( pCheck, pTable[i] ) == 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *RemapBundledModuleName( const char *pModuleName )
|
||||
{
|
||||
static bool s_bCheckedCmd;
|
||||
// Default to using bundles.
|
||||
static bool s_bNoTier2Bundle = true;
|
||||
static bool s_bNoTier3Bundle = true;
|
||||
static const char *s_pNoBundleModule;
|
||||
|
||||
if ( !s_bCheckedCmd )
|
||||
{
|
||||
if ( Plat_GetEnv( "SOURCE2_USE_BUNDLES" ) != NULL )
|
||||
{
|
||||
s_bNoTier2Bundle = false;
|
||||
s_bNoTier3Bundle = false;
|
||||
}
|
||||
|
||||
if ( Plat_GetEnv( "SOURCE2_NO_BUNDLES" ) != NULL )
|
||||
{
|
||||
s_bNoTier2Bundle = true;
|
||||
s_bNoTier3Bundle = true;
|
||||
}
|
||||
|
||||
if ( CommandLine()->HasParm( "-use_tier2_bundle" ) )
|
||||
{
|
||||
s_bNoTier2Bundle = false;
|
||||
}
|
||||
if ( CommandLine()->HasParm( "-use_tier3_bundle" ) )
|
||||
{
|
||||
s_bNoTier3Bundle = false;
|
||||
}
|
||||
|
||||
if ( CommandLine()->HasParm( "-no_tier2_bundle" ) )
|
||||
{
|
||||
s_bNoTier2Bundle = true;
|
||||
}
|
||||
if ( CommandLine()->HasParm( "-no_tier3_bundle" ) )
|
||||
{
|
||||
s_bNoTier3Bundle = true;
|
||||
}
|
||||
|
||||
s_pNoBundleModule = CommandLine()->ParmValue( "-no_bundle_module", "" );
|
||||
|
||||
s_bCheckedCmd = true;
|
||||
}
|
||||
|
||||
if ( s_pNoBundleModule &&
|
||||
s_pNoBundleModule[0] &&
|
||||
V_stricmp_fast( pModuleName, s_pNoBundleModule ) == 0 )
|
||||
{
|
||||
return pModuleName;
|
||||
}
|
||||
|
||||
if ( !s_bNoTier2Bundle &&
|
||||
FindBundledModuleName( pModuleName, s_pTier2BundleModules, ARRAYSIZE( s_pTier2BundleModules ) ) )
|
||||
{
|
||||
return "tier2_bundle";
|
||||
}
|
||||
|
||||
if ( !s_bNoTier3Bundle &&
|
||||
FindBundledModuleName( pModuleName, s_pTier3BundleModules, ARRAYSIZE( s_pTier3BundleModules ) ) )
|
||||
{
|
||||
return "tier3_bundle";
|
||||
}
|
||||
|
||||
return pModuleName;
|
||||
}
|
||||
44
common/bundled_module_info.h
Normal file
44
common/bundled_module_info.h
Normal file
@@ -0,0 +1,44 @@
|
||||
//=========== Copyright Valve Corporation, All rights reserved. =============//
|
||||
//
|
||||
// Purpose: Common location for hard-coded knowledge about module
|
||||
// bundles, such as tier2_bundle and tier3_bundle.
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
// Some places in code, such as vconsole2, have an explicit
|
||||
// list of DLLs to copy for execution. Make a central point
|
||||
// to control selecting the right thing based on whether bundles
|
||||
// are used or not.
|
||||
|
||||
#if USE_TIER2_BUNDLE
|
||||
#define WITH_TIER2_BUNDLE( _Exp ) _Exp
|
||||
#define WITHOUT_TIER2_BUNDLE( _Exp )
|
||||
#define WITH_TIER2_BUNDLE_COMMA( _Exp ) _Exp,
|
||||
#define WITHOUT_TIER2_BUNDLE_COMMA( _Exp )
|
||||
#else
|
||||
#define WITH_TIER2_BUNDLE( _Exp )
|
||||
#define WITHOUT_TIER2_BUNDLE( _Exp ) _Exp
|
||||
#define WITH_TIER2_BUNDLE_COMMA( _Exp )
|
||||
#define WITHOUT_TIER2_BUNDLE_COMMA( _Exp ) _Exp,
|
||||
#endif
|
||||
|
||||
#if USE_TIER3_BUNDLE
|
||||
#define WITH_TIER3_BUNDLE( _Exp ) _Exp
|
||||
#define WITHOUT_TIER3_BUNDLE( _Exp )
|
||||
#define WITH_TIER3_BUNDLE_COMMA( _Exp ) _Exp,
|
||||
#define WITHOUT_TIER3_BUNDLE_COMMA( _Exp )
|
||||
#else
|
||||
#define WITH_TIER3_BUNDLE( _Exp )
|
||||
#define WITHOUT_TIER3_BUNDLE( _Exp ) _Exp
|
||||
#define WITH_TIER3_BUNDLE_COMMA( _Exp )
|
||||
#define WITHOUT_TIER3_BUNDLE_COMMA( _Exp ) _Exp,
|
||||
#endif
|
||||
|
||||
// Given a specific module name return the bundled module
|
||||
// name if the specific module is part of a bundle, otherwise
|
||||
// return the given module name.
|
||||
const char *RemapBundledModuleName( const char *pModuleName );
|
||||
342
common/clang/clang_utils.cpp
Normal file
342
common/clang/clang_utils.cpp
Normal file
@@ -0,0 +1,342 @@
|
||||
//========= Copyright 1996-2016, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Clang utility code
|
||||
//
|
||||
//=====================================================================================//
|
||||
|
||||
#include "clang/clang_utils.h"
|
||||
|
||||
#include "tier1/strtools.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "environment_utils.h"
|
||||
|
||||
// Include the main Clang interface header:
|
||||
#include "clang-c/Index.h"
|
||||
|
||||
|
||||
CUtlString & TransformArgumentForCommandLineUsage( CUtlString &argument, bool bEscapeContainedQuotes )
|
||||
{
|
||||
bool bHasSpace = V_containsWhitespace( argument.Get() );
|
||||
|
||||
if ( V_strstr( argument.Get(), "\"" ) )
|
||||
{
|
||||
if ( bEscapeContainedQuotes )
|
||||
{
|
||||
// Transform " to \"
|
||||
char temp[ MAX_PATH ];
|
||||
bool bResult = V_StrSubst( argument.Get(), "\"", "\\\"", temp, ARRAYSIZE( temp ), true );
|
||||
NOTE_UNUSED( bResult );
|
||||
Assert( bResult );
|
||||
argument = temp;
|
||||
}
|
||||
|
||||
// TODO: support arguments containing both quotes and spaces, e.g: -Dmystring="hi there"
|
||||
Assert( !bHasSpace );
|
||||
}
|
||||
if ( bHasSpace )
|
||||
{
|
||||
// Wrap the argument with quotes
|
||||
argument = CUtlString( "\"" ) + argument + "\"";
|
||||
}
|
||||
|
||||
// Append a space to separate arguments
|
||||
argument += " ";
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Clang_IsHeaderFile( const char *pFilename )
|
||||
{
|
||||
// These extensions are used for header files in VPCs in the Source2 tree:
|
||||
// TODO: move this util into VPC common code... optimize it
|
||||
if ( V_striEndsWith( pFilename, ".h" ) ) return true;
|
||||
if ( V_striEndsWith( pFilename, ".inl" ) ) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Clang_IsSourceFile( const char *pFilename )
|
||||
{
|
||||
// These extensions are used for source files in VPCs in the Source2 tree:
|
||||
// TODO: move this util into VPC common code... optimize it
|
||||
if ( V_striEndsWith( pFilename, ".cpp" ) ) return true;
|
||||
if ( V_striEndsWith( pFilename, ".cc" ) ) return true;
|
||||
if ( V_striEndsWith( pFilename, ".c" ) ) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Clang_AddCompilerOptions( CUtlVector< CUtlString > &arguments, const char *pCompiler )
|
||||
{
|
||||
if ( !V_stricmp_fast( pCompiler, "VS2005" ) || !V_stricmp_fast( pCompiler, "VS2010" ) )
|
||||
{
|
||||
// Add Microsoft extensions/compatibility
|
||||
arguments.AddToTail( "-fms-extensions" );
|
||||
arguments.AddToTail( "-fms-compatibility" );
|
||||
arguments.AddToTail( "-mms-bitfields" );
|
||||
|
||||
// Omit '_MSC_VER' (we'll get this in VPC's list of defines)
|
||||
arguments.AddToTail( "-fmsc-version=0" );
|
||||
|
||||
// Define the appropriate C/C++ standard
|
||||
if ( !V_stricmp_fast( pCompiler, "VS2005" ) )
|
||||
{
|
||||
arguments.AddToTail( "-std=c++98" );
|
||||
return true;
|
||||
}
|
||||
if ( !V_stricmp_fast( pCompiler, "VS2010" ) )
|
||||
{
|
||||
// [sergiy 2012/10/09] this used to crash for src/particles/builtin_constraints.cpp (get the latest Clang drop and/or submit a minimal repro)
|
||||
// I recompiled clang and it doesn't seem to crash, so I'm swithing it to C++11 to get Rubikon ( which uses c++11 features) to compile. But we can switch back any time
|
||||
arguments.AddToTail( "-std=c++11" );
|
||||
//arguments.AddToTail( "-std=c++98" );
|
||||
arguments.AddToTail( "-fmsc-version=1600" );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: clang defaults to the 'gnu99' C/C++ standard
|
||||
// we may want to use '-std=gnu++11' when we add mac+linux support
|
||||
arguments.AddToTail( "-std=gnu99" );
|
||||
|
||||
AssertMsg1( false, "ERROR: Clang_GenerateOptions not implemented for this compiler yet! (%s)\n", pCompiler );
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Clang_AddPlatformOptions( CUtlVector< CUtlString > &arguments, const char *pPlatform )
|
||||
{
|
||||
// See LLVM\include\llvm\ADT\Triple.h and LLVM\tools\clang\lib\Basic\Targets.cpp
|
||||
// for information about supported targets... the target 'triple' is of the form:
|
||||
//
|
||||
// architecture-vendor-os[-environment]
|
||||
//
|
||||
// The fourth part is optional. Some of the supported values:
|
||||
//
|
||||
// [x86|x86_64|ppc|ppc64] - [pc|apple|scei|unknown] - [win32|mingw32|cygwin|macosx|lv2|linux] - [gnu|ANDROIDEABI]
|
||||
|
||||
if ( !V_stricmp_fast( pPlatform, "WIN32" ) )
|
||||
{
|
||||
// TODO: might get better support with 'mingw32' or 'cygwin' than 'win32' (wtf are these things??)
|
||||
arguments.AddToTail( "-target" );
|
||||
arguments.AddToTail( "i686-pc-win32" );
|
||||
return true;
|
||||
}
|
||||
if ( !V_stricmp_fast( pPlatform, "WIN64" ) )
|
||||
{
|
||||
// Need to tell Clang if this is a 64-bit CPU (or it will complain about usage of size_t in operator new)
|
||||
// [ NOTE: the option '-m64' will internally transform i686-pc-win32 into x86_64-pc-win32 ]
|
||||
arguments.AddToTail( "-target" );
|
||||
arguments.AddToTail( "x86_64-pc-win32" );
|
||||
// Define away unsupported intrinsics (breaks Rubikon due to __debugbreak being declared in system header intrin.h). We can put it back any time
|
||||
//arguments.AddToTail( "-D__debugbreak(...)=__asm { int 3 }" );
|
||||
return true;
|
||||
}
|
||||
if ( !V_stricmp_fast( pPlatform, "OSX" ) )
|
||||
{
|
||||
// TODO: for OSX/iOS, the os string should include a version number, e.g 'macosx10.8.0'
|
||||
AssertMsg( 0, "Untested!\n" );
|
||||
arguments.AddToTail( "-target" );
|
||||
arguments.AddToTail( "ppc-apple-macosx" );
|
||||
return true;
|
||||
}
|
||||
if ( !V_stricmp_fast( pPlatform, "X360" ) )
|
||||
{
|
||||
// TODO: figure out which target triple to use... we want to pretend we're using PPC for Win32 (Clang doesn't know about XBox)
|
||||
AssertMsg( 0, "Untested!\n" );
|
||||
arguments.AddToTail( "-target" );
|
||||
arguments.AddToTail( "ppc-pc-win32" );
|
||||
return true;
|
||||
}
|
||||
if ( !V_stricmp_fast( pPlatform, "PS3" ) )
|
||||
{
|
||||
// TODO: PS3 uses 'lv2' for OS and 'scei' for the vendor, but for some reason 'ppc64-scei-lv2' doesn't work.
|
||||
// NOTE: SPU compilation is also supported, via 'cellspu-scei-lv2'
|
||||
AssertMsg( 0, "Untested!\n" );
|
||||
arguments.AddToTail( "-target" );
|
||||
arguments.AddToTail( "ppc64-scei-lv2" );
|
||||
return true;
|
||||
}
|
||||
|
||||
AssertMsg1( false, "ERROR: Clang_GenerateOptions not implemented for this platform yet! (%s)\n", pPlatform );
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Clang_AddSystemIncludePaths( CUtlVector< CUtlString > &arguments, const char *pPlatform, const char *pCompiler )
|
||||
{
|
||||
CUtlVector< CUtlString > systemPaths;
|
||||
if ( !GetSystemIncludePaths( systemPaths, pPlatform, pCompiler ) )
|
||||
{
|
||||
AssertMsg2( false, "ERROR: Clang_GenerateOptions not implemented for this platform/compiler yet! (%s/%s)\n", pPlatform, pCompiler );
|
||||
return false;
|
||||
}
|
||||
|
||||
// System include paths (added with '-isystem') will be searched *after* all the regular '-I' includes
|
||||
// [http://gcc.gnu.org/onlinedocs/cpp/System-Headers.html]
|
||||
CUtlString includePrefix( "-isystem" );
|
||||
for ( int i=0; i < systemPaths.Count(); i++ )
|
||||
{
|
||||
arguments.AddToTail( includePrefix + systemPaths[i] );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Clang_GenerateCommandString( CUtlString &command, bool bForLibClangDLL, const char *pFilename, const char *pPlatform, const char *pCompiler,
|
||||
const CUtlVector< CUtlString > &defines, const CUtlVector< CUtlString > &includes,
|
||||
const CUtlString &pchName, bool bBuildPCH, int parseFlags )
|
||||
{
|
||||
CUtlVector< CUtlString > arguments;
|
||||
arguments.EnsureCapacity( 512 ); // Avoid needless string copying
|
||||
command.Clear();
|
||||
|
||||
// Detect file type (source or header)
|
||||
bool bIsHeader = Clang_IsHeaderFile( pFilename );
|
||||
if ( !bIsHeader && !Clang_IsSourceFile( pFilename ) )
|
||||
{
|
||||
AssertMsg2( Clang_IsHeaderFile( pFilename ) || Clang_IsSourceFile( pFilename ), "ERROR (%s): unrecognised file type '%s'!\n", __FUNCTION__, pFilename );
|
||||
return false;
|
||||
}
|
||||
if ( bIsHeader )
|
||||
{
|
||||
// By default, Clang interprets '.h' files as C, not C++:
|
||||
// TODO: should we just always specify "c++"? (i.e should we parse ".c" files as C++? and is "c++-header" actually better for headers?)
|
||||
arguments.AddToTail( "-x" ); // "Treat subsequent input files as having type <language>"
|
||||
arguments.AddToTail( "c++-header" );
|
||||
}
|
||||
if ( !bBuildPCH )
|
||||
{
|
||||
// TODO: -fsyntax-only yields invalid PCHs, but building without it causes clang to crash on other files (e.g src/client/c_baseanimating.cpp)
|
||||
// need to drill into this (build clang in debug, make a minimal repro), so we can submit bug reports
|
||||
arguments.AddToTail( "-fsyntax-only" ); // "Check the code for syntax errors, but don't do anything beyond that"
|
||||
}
|
||||
|
||||
// Add standard options
|
||||
arguments.AddToTail( "-c" ); //[ignored] "Compile or assemble the source files, but do not link."
|
||||
arguments.AddToTail( "-nostdinc" ); // "Disable standard system #include directories"
|
||||
// NOTE: -nostdinc works and overrides -nobuiltininc, while
|
||||
// -nostdsysteminc and nostdinc++ do not work (had to GREP the LLVM source code to determine this !)
|
||||
|
||||
// These help to diagnose parse errors:
|
||||
arguments.AddToTail( "-ferror-limit=100" ); // "Max errors to allow before parsing terminates"
|
||||
arguments.AddToTail( "-fmacro-backtrace-limit=0" ); // "Max macro expansion depth in diagnostic spew"
|
||||
//arguments.AddToTail( "-v" ); // "Show commands to run and use verbose output"
|
||||
|
||||
// Add options corresponding to the passed parse flags:
|
||||
if ( parseFlags & CXTranslationUnit_DetailedPreprocessingRecord )
|
||||
{
|
||||
arguments.AddToTail( "-Xclang" ); // "Pass <arg> to the clang compiler"
|
||||
arguments.AddToTail( "-detailed-preprocessing-record" );// "Include pre-processor data in the AST"
|
||||
}
|
||||
|
||||
// Suppress warnings we don't want to see:
|
||||
// TODO: can these be removed now I've added the VS2010 options?
|
||||
arguments.AddToTail( "-Wno-microsoft" ); // "XXX is a microsoft extension"
|
||||
arguments.AddToTail( "-Wno-c++11-extensions" ); // "warnings about using C++11 features as extensions in earlier C++ versions"
|
||||
// TODO: these suppress warnings we should actually fix later:
|
||||
arguments.AddToTail( "-Wno-return-type-c-linkage" ); // "XXX has C-linkage specified, but returns user-defined type YYY which is incompatible with C"
|
||||
arguments.AddToTail( "-Wno-invalid-token-paste" ); // "pasting formed 'XXX', an invalid preprocessing token"
|
||||
|
||||
// __FUNCTION__ is implemented by Clang in the GCC style; it's a compiler-generated variable, not
|
||||
// a preprocessor-generated string literal, so you can't do things like: "Error in " __FUNCTION__ "!\n"
|
||||
// [ http://stackoverflow.com/questions/11142779/function-and-friends-act-weird-in-xcode ]
|
||||
arguments.AddToTail( "-D__FUNCTION__=__FILE__" );
|
||||
|
||||
if ( bIsHeader && pchName.IsEmpty() )
|
||||
{
|
||||
// Clang cannot parse many of our standalone .h files, since they don't include everything they
|
||||
// need (e.g baseschema.h), so if we're not using a PCH then define away schema stuff:
|
||||
// TODO: remove this once we port Schemacompiler to use Clang!
|
||||
arguments.AddToTail( "-Dschema=" );
|
||||
arguments.AddToTail( "-Dnoschema=" );
|
||||
arguments.AddToTail( "-Dschema_pragma(...)=" );
|
||||
arguments.AddToTail( "-DMETA(...)=" );
|
||||
arguments.AddToTail( "-DTYPEMETA(...)=" );
|
||||
arguments.AddToTail( "-DSCHEMA_IGNORE_NEXT_PARENS(...)=" );
|
||||
arguments.AddToTail( "-DMETA_ADD(...)=SCHEMA_IGNORE_NEXT_PARENS" );
|
||||
arguments.AddToTail( "-DMETA_REMOVE(...)=SCHEMA_IGNORE_NEXT_PARENS" );
|
||||
arguments.AddToTail( "-DMETA_OVERRIDE(...)=SCHEMA_IGNORE_NEXT_PARENS" );
|
||||
arguments.AddToTail( "-DMETA_REMOVE_ALL(...)=SCHEMA_IGNORE_NEXT_PARENS" );
|
||||
}
|
||||
|
||||
// __FUNCTION__ is implemented by Clang in the GCC style; it's a compiler-generated variable, not
|
||||
// a preprocessor-generated string literal, so you can't do things like: "Error in " __FUNCTION__ "!\n"
|
||||
// [ http://stackoverflow.com/questions/11142779/function-and-friends-act-weird-in-xcode ]
|
||||
arguments.AddToTail( "-D__FUNCTION__=__FILE__" );
|
||||
|
||||
|
||||
// Add platform-specific options:
|
||||
if ( !Clang_AddPlatformOptions( arguments, pPlatform ) )
|
||||
return false;
|
||||
|
||||
// Add compiler-specific options:
|
||||
if ( !Clang_AddCompilerOptions( arguments, pCompiler ) )
|
||||
return false;
|
||||
|
||||
// Add system include dirs explicitly (options above disable Clang's built-in include paths)
|
||||
if ( !Clang_AddSystemIncludePaths( arguments, pPlatform, pCompiler ) )
|
||||
return false;
|
||||
|
||||
|
||||
// Add the caller's preprocessor defines and include directories:
|
||||
CUtlString definePrefix( "-D" ), includePrefix( "-I" );
|
||||
for ( int i=0; i < defines.Count(); i++ ) arguments.AddToTail( definePrefix + defines[i] );
|
||||
for ( int i=0; i < includes.Count(); i++ ) arguments.AddToTail( includePrefix + includes[i] );
|
||||
|
||||
if ( bBuildPCH )
|
||||
{
|
||||
// This file is used as a PCH, so output the file <pchName>.pch:
|
||||
arguments.AddToTail( "-emit-ast" );
|
||||
arguments.AddToTail( "-o" );
|
||||
arguments.AddToTail( pchName + ".pch" );
|
||||
}
|
||||
else if ( !pchName.IsEmpty() )
|
||||
{
|
||||
// If the file uses a PCH, add "-include <pchName>"
|
||||
// NOTE: this is safely ignored for files which do not actually include the PCH file (e.g headers)
|
||||
arguments.AddToTail( "-include" );
|
||||
arguments.AddToTail( pchName );
|
||||
}
|
||||
|
||||
// Put the filename last, after all the options:
|
||||
arguments.AddToTail( pFilename );
|
||||
|
||||
// Transform each argument as appropriate for its intended usage
|
||||
// (either passing via the libclang.dll API, or passing via the command-line):
|
||||
for ( int i = 0; i < arguments.Count(); i++ )
|
||||
{
|
||||
command += TransformArgumentForCommandLineUsage( arguments[i], !bForLibClangDLL );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Clang_GenerateDLLArguments( ICommandLine *pArguments, const char *pFilename, const char *pPlatform, const char *pCompiler,
|
||||
const CUtlVector< CUtlString > &defines, const CUtlVector< CUtlString > &includes,
|
||||
const CUtlString &pchName, bool bBuildPCH, int parseFlags )
|
||||
{
|
||||
CUtlString command;
|
||||
bool bResult = Clang_GenerateCommandString( command, true, pFilename, pPlatform, pCompiler, defines, includes, pchName, bBuildPCH, parseFlags );
|
||||
pArguments->CreateCmdLine( command.Get() );
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Clang_GenerateCommandLine( CUtlString &command, const char *pFilename, const char *pPlatform, const char *pCompiler,
|
||||
const CUtlVector< CUtlString > &defines, const CUtlVector< CUtlString > &includes,
|
||||
const CUtlString &pchName, bool bBuildPCH, int parseFlags )
|
||||
{
|
||||
return Clang_GenerateCommandString( command, false, pFilename, pPlatform, pCompiler, defines, includes, pchName, bBuildPCH, parseFlags );
|
||||
}
|
||||
39
common/clang/clang_utils.h
Normal file
39
common/clang/clang_utils.h
Normal file
@@ -0,0 +1,39 @@
|
||||
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Clang utility code
|
||||
//
|
||||
//=====================================================================================//
|
||||
|
||||
#ifndef CLANG_UTILS_H
|
||||
#define CLANG_UTILS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
class CUtlString;
|
||||
|
||||
|
||||
// Generate the appropriate Clang command for the given file/platform/compiler/defines/include-paths/flags
|
||||
// - 'DLLArguments' fills in an ICommandLine which can be used with libclang.dll (clang_parseTranslationUnit, etc)
|
||||
// 'CommandLine' generates a string which can be used as input to clang.exe on the command-line.
|
||||
// - 'pchName' specifies the name of the PCH file to include/create (empty means no PCH),
|
||||
// 'bBuildPCH' specifies that this file builds a .pch file (Clang_GenerateCommandLine will generate the output file <pchName>.pch),
|
||||
// - Supported values for pPlatform: "WIN32", "WIN64", "X360"
|
||||
// Supported values for pCompiler: "VS2005", "VS2010"
|
||||
extern bool Clang_GenerateDLLArguments( ICommandLine *pArguments, const char *pFilename, const char *pPlatform, const char *pCompiler,
|
||||
const CUtlVector< CUtlString > &defines, const CUtlVector< CUtlString > &includePaths,
|
||||
const CUtlString &pchName, bool bBuildPCH = false, int parseFlags = 0 );
|
||||
extern bool Clang_GenerateCommandLine( CUtlString &command, const char *pFilename, const char *pPlatform, const char *pCompiler,
|
||||
const CUtlVector< CUtlString > &defines, const CUtlVector< CUtlString > &includePaths,
|
||||
const CUtlString &pchName, bool bBuildPCH = false, int parseFlags = 0 );
|
||||
|
||||
// Does this have a recognized source file extension? (.cpp, .c)
|
||||
extern bool Clang_IsSourceFile( const char *pFilename );
|
||||
|
||||
// Does this have a recognized header file extension? (.h, .inl)
|
||||
extern bool Clang_IsHeaderFile( const char *pFilename );
|
||||
|
||||
#endif // CLANG_UTILS_H
|
||||
103
common/compiledcaptionswap.cpp
Normal file
103
common/compiledcaptionswap.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Swap a compiled caption file.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#include "utlbuffer.h"
|
||||
#include "byteswap.h"
|
||||
#include "filesystem.h"
|
||||
#include "tier2/fileutils.h"
|
||||
#include "captioncompiler.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
BEGIN_BYTESWAP_DATADESC( CompiledCaptionHeader_t )
|
||||
DEFINE_FIELD( magic, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( version, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( numblocks, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( blocksize, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( directorysize, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( dataoffset, FIELD_INTEGER ),
|
||||
END_BYTESWAP_DATADESC()
|
||||
|
||||
BEGIN_BYTESWAP_DATADESC( CaptionLookup_t )
|
||||
DEFINE_FIELD( hash, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( blockNum, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( offset, FIELD_SHORT ),
|
||||
DEFINE_FIELD( length, FIELD_SHORT ),
|
||||
END_BYTESWAP_DATADESC()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Swap a compiled closecaption file
|
||||
//-----------------------------------------------------------------------------
|
||||
bool SwapClosecaptionFile( void *pData )
|
||||
{
|
||||
CByteswap swap;
|
||||
swap.ActivateByteSwapping( true );
|
||||
|
||||
CompiledCaptionHeader_t *pHdr = (CompiledCaptionHeader_t*)pData;
|
||||
|
||||
if ( !IsPC() )
|
||||
{
|
||||
// pre-swap file header
|
||||
swap.SwapFieldsToTargetEndian( pHdr );
|
||||
}
|
||||
|
||||
if ( pHdr->magic != COMPILED_CAPTION_FILEID || pHdr->version != COMPILED_CAPTION_VERSION )
|
||||
{
|
||||
// bad data
|
||||
return false;
|
||||
}
|
||||
|
||||
// lookup headers
|
||||
pData = (byte*)pData + sizeof(CompiledCaptionHeader_t);
|
||||
swap.SwapFieldsToTargetEndian( (CaptionLookup_t*)pData, pHdr->directorysize );
|
||||
|
||||
// unicode data
|
||||
pData = (byte*)pHdr + pHdr->dataoffset;
|
||||
swap.SwapBufferToTargetEndian( (wchar_t*)pData, (wchar_t*)pData, pHdr->numblocks * pHdr->blocksize / sizeof(wchar_t) );
|
||||
|
||||
if ( IsPC() )
|
||||
{
|
||||
// post-swap file header
|
||||
swap.SwapFieldsToTargetEndian( pHdr );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined( CLIENT_DLL ) || defined( GAME_DLL )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Callback for UpdateOrCreate - generates .360 file
|
||||
//-----------------------------------------------------------------------------
|
||||
static bool CaptionCreateCallback( const char *pSourceName, const char *pTargetName, const char *pPathID, void *pExtraData )
|
||||
{
|
||||
// Generate the file
|
||||
CUtlBuffer buf;
|
||||
bool bOk = g_pFullFileSystem->ReadFile( pSourceName, pPathID, buf );
|
||||
if ( bOk )
|
||||
{
|
||||
bOk = SwapClosecaptionFile( buf.Base() );
|
||||
if ( bOk )
|
||||
{
|
||||
bOk = g_pFullFileSystem->WriteFile( pTargetName, pPathID, buf );
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning( "Failed to create %s\n", pTargetName );
|
||||
}
|
||||
}
|
||||
return bOk;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Calls utility function UpdateOrCreate
|
||||
//-----------------------------------------------------------------------------
|
||||
int UpdateOrCreateCaptionFile( const char *pSourceName, char *pTargetName, int maxLen, bool bForce )
|
||||
{
|
||||
return ::UpdateOrCreate( pSourceName, pTargetName, maxLen, "GAME", CaptionCreateCallback, bForce );
|
||||
}
|
||||
#endif
|
||||
166
common/cserserverprotocol_engine.h
Normal file
166
common/cserserverprotocol_engine.h
Normal file
@@ -0,0 +1,166 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef CSERSERVERPROTOCOL_ENGINE_H
|
||||
#define CSERSERVERPROTOCOL_ENGINE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// NOTE: These defined must match the ones in Steam's CSERServerProtocol.h!!!
|
||||
|
||||
#define C2M_REPORT_GAMESTATISTICS 'k'
|
||||
#define C2M_REPORT_GAMESTATISTICS_PROTOCOL_VERSION_1 1
|
||||
#define C2M_REPORT_GAMESTATISTICS_PROTOCOL_VERSION 2
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GS_UNKNOWN = 0,
|
||||
GS_NO_UPLOAD,
|
||||
GS_UPLOAD_REQESTED,
|
||||
|
||||
// Must be last
|
||||
GS_NUM_TYPES
|
||||
} EGameStatsEnum;
|
||||
|
||||
// C2M_REPORT_GAMESTATISTICS details (OLD VERSION)
|
||||
// u8(C2M_REPORT_GAMESTATISTICS_PROTOCOL_VERSION_1)
|
||||
// u32(build_number)
|
||||
// string( exename )
|
||||
// string( gamedir )
|
||||
// string( mapname )
|
||||
// u32 requested upload data length
|
||||
|
||||
// C2M_REPORT_GAMESTATISTICS details (current version)
|
||||
// u8(C2M_REPORT_GAMESTATISTICS_PROTOCOL_VERSION)
|
||||
// u32(appID)
|
||||
// u32 requested upload data length
|
||||
|
||||
#define M2C_ACKREPORT_GAMESTATISTICS 'l'
|
||||
// M2C_ACKREPORT_GAMESTATISTICS details
|
||||
// u8(protocol okay (bool))
|
||||
// u8(GS_NO_UPLOAD or GS_UPLOAD_REQESTED )
|
||||
// iff GS_UPLOAD_REQESTED then add:
|
||||
// u32(harvester ip address)
|
||||
// u16(harvester port #)
|
||||
// u32(upload context id)
|
||||
|
||||
#define C2M_PHONEHOME 'm'
|
||||
#define C2M_PHONEHOME_PROTOCOL_VERSION 3
|
||||
|
||||
// C2M_PHONEHOME
|
||||
// u8( C2M_PHONEHOME_PROTOCOL_VERSION )
|
||||
// u32( sessionid ) or 0 to request a new sessionid
|
||||
// u16(encryptedlength)
|
||||
// remainder = encrypteddata:
|
||||
// u8 corruption id == 1
|
||||
// string build unique id
|
||||
// string computername
|
||||
// string username
|
||||
// string gamedir
|
||||
// float( enginetimestamp )
|
||||
// u8 messagetype:
|
||||
// 1: engine startup
|
||||
// 2: engine shutdown
|
||||
// 3: map started + mapname
|
||||
// 4: map finished + mapname
|
||||
// string( mapname )
|
||||
|
||||
#define M2C_ACKPHONEHOME 'n'
|
||||
// M2C_ACKPHONEHOME details
|
||||
// u8(connection allowed (bool))
|
||||
// u32(sessionid)
|
||||
|
||||
#define C2M_BUGREPORT 'o'
|
||||
|
||||
#define C2M_BUGREPORT_PROTOCOL_VERSION 3
|
||||
|
||||
// C2M_BUGREPORT details
|
||||
// u8(C2M_BUGREPORT_PROTOCOL_VERSION)
|
||||
// u16(encryptedlength)
|
||||
// remainder=encrypteddata
|
||||
|
||||
// encrypted payload:
|
||||
// byte corruptionid = 1
|
||||
// u32(buildnumber)
|
||||
// string(exename 64)
|
||||
// string(gamedir 64)
|
||||
// string(mapname 64)
|
||||
// u32 RAM
|
||||
// u32 CPU
|
||||
// string(processor)
|
||||
// u32 DXVerHigh
|
||||
// u32 DXVerLow
|
||||
// u32 DXVendorID
|
||||
// u32 DXDeviceID
|
||||
// string(OSVer)
|
||||
|
||||
// Version 2+:
|
||||
// {
|
||||
// reporttype(char 32)
|
||||
// email(char 80)
|
||||
// accountname(char 80)
|
||||
// }
|
||||
|
||||
// Version 3+
|
||||
// {
|
||||
// userid( sizeof( TSteamGlobalUserID ) )
|
||||
// }
|
||||
|
||||
// --- all versions
|
||||
// string(title 128)
|
||||
// u32(.zip file size, or 0 if none available)
|
||||
// u32(text length > max 1024)
|
||||
// text(descriptive text -- capped to text length bytes)
|
||||
|
||||
#define M2C_ACKBUGREPORT 'p'
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BR_UNKNOWN = 0,
|
||||
BR_NO_FILES,
|
||||
BR_REQEST_FILES,
|
||||
|
||||
// Must be last
|
||||
BR_NUM_TYPES
|
||||
} EBugReportAckEnum;
|
||||
|
||||
// M2C_ACKBUGREPORT details
|
||||
// u8(protocol okay (bool))
|
||||
// u8(BR_NO_FILES or BR_REQEST_FILES )
|
||||
// iff BR_REQEST_FILES then add:
|
||||
// u32(harvester ip address)
|
||||
// u16(harvester port #)
|
||||
// u32(upload context id)
|
||||
|
||||
// Arbitrary encrypted data upload
|
||||
#define C2M_UPLOADDATA 'q'
|
||||
|
||||
#define C2M_UPLOADDATA_PROTOCOL_VERSION 1
|
||||
|
||||
#define C2M_UPLOADDATA_DATA_VERSION 1
|
||||
|
||||
// C2M_BUGREPORT details
|
||||
// u8(C2M_UPLOADDATA_PROTOCOL_VERSION)
|
||||
// u16(encryptedlength)
|
||||
// remainder=encrypteddata
|
||||
|
||||
// encrypted payload:
|
||||
// byte(corruptionid)
|
||||
// byte(protocolid) // C2M_UPLOADDATA_DATA_VERSION
|
||||
// string(tablename 40)
|
||||
// u8(numvalues)
|
||||
// for each value:
|
||||
// string(fieldname 32)
|
||||
// string(value 128)
|
||||
|
||||
#define M2C_ACKUPLOADDATA 'r'
|
||||
|
||||
// M2C_ACKUPLOADDATA details
|
||||
// u8(protocol okay (bool))
|
||||
|
||||
|
||||
#endif // CSERSERVERPROTOCOL_ENGINE_H
|
||||
16
common/csgo_limits.h
Normal file
16
common/csgo_limits.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//========= Copyright c 1996-2014, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef CSGO_LIMITS_H
|
||||
#define CSGO_LIMITS_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define MAX_CLAN_TAG_LENGTH 16 // max for new tags is actually 12, this allows some backward compat.
|
||||
// this must be shared across a lot of projects: client, server, matchmaking, engine
|
||||
|
||||
#endif // CSGO_LIMITS_H
|
||||
92
common/csgo_limits.inl
Normal file
92
common/csgo_limits.inl
Normal file
@@ -0,0 +1,92 @@
|
||||
//========= Copyright c 1996-2014, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
static inline void CopyStringTruncatingMalformedUTF8Tail( char *pchBuffer, char const *szSrc, int numBufferBytes )
|
||||
{
|
||||
//
|
||||
// There's a bug in Steam client where the clan tag may be truncated
|
||||
// in the middle of UTF-8 sequence. Also we have a more restrictive
|
||||
// clan tags length in the game to not bloat the name string.
|
||||
//
|
||||
|
||||
if ( numBufferBytes <= 0 )
|
||||
{
|
||||
Assert( numBufferBytes > 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( numBufferBytes == 1 )
|
||||
{
|
||||
pchBuffer[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
int nStrLen = V_strlen( szSrc );
|
||||
if ( nStrLen <= 0 )
|
||||
{
|
||||
pchBuffer[ 0 ] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Now we know that input is non-empty string, and buffer can hold at least one character
|
||||
// let's figure out how many characters can fit?
|
||||
|
||||
if ( nStrLen > numBufferBytes - 1 )
|
||||
nStrLen = numBufferBytes - 1;
|
||||
|
||||
//
|
||||
// Check what the last character in the source string is?
|
||||
//
|
||||
// The last character is a UTF-8 sequence begin character or sequence continuation character
|
||||
// See how many characters must have been in the end of the string?
|
||||
for ( int numCheck = 0; numCheck < nStrLen; ++ numCheck )
|
||||
{
|
||||
int idxCheck = nStrLen - 1 - numCheck;
|
||||
if ( ( szSrc[ idxCheck ] & ( 0x80 | 0x40 ) ) == ( 0x80 | 0x40 ) )
|
||||
{
|
||||
// This is the start of UTF8 sequence
|
||||
int numCharactersSequenceLengthSeen = numCheck + 1;
|
||||
int numCharactersSequenceMarker = 2; // at least two bytes
|
||||
for ( uint8 uiMarker = uint8( uint8( szSrc[ idxCheck ] ) << 2 );
|
||||
( ( uiMarker & 0x80 ) != 0 );
|
||||
uiMarker <<= 1 )
|
||||
++ numCharactersSequenceMarker;
|
||||
|
||||
// If the marker shows more characters than seen, discard the tail
|
||||
if ( numCharactersSequenceMarker != numCharactersSequenceLengthSeen )
|
||||
nStrLen -= numCharactersSequenceLengthSeen;
|
||||
break;
|
||||
}
|
||||
else if ( ( szSrc[ idxCheck ] & ( 0x80 | 0x40 ) ) == ( 0x80 ) )
|
||||
{
|
||||
// This is a continuation of UTF8 sequence
|
||||
if ( idxCheck )
|
||||
continue; // Keep looking backwards
|
||||
else
|
||||
{ // Scanned all the way back to start of string and found no UTF8 sequence start character
|
||||
nStrLen = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Looking at regular lower ASCII 0x00-0x7F character, valid for string termination
|
||||
nStrLen -= numCheck;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !nStrLen )
|
||||
{
|
||||
// This was an entirely invalid string, copy a questionmark
|
||||
pchBuffer[0] = '?';
|
||||
pchBuffer[1] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy whatever we determined
|
||||
V_strncpy( pchBuffer, szSrc, nStrLen + 1 );
|
||||
}
|
||||
117
common/cstringhash.h
Normal file
117
common/cstringhash.h
Normal file
@@ -0,0 +1,117 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef CSTRINGHASH_H
|
||||
#define CSTRINGHASH_H
|
||||
#pragma once
|
||||
|
||||
#include "string.h"
|
||||
|
||||
#define STRING_HASH_TABLE_SIZE 701
|
||||
|
||||
template <class T> class CStringHash
|
||||
{
|
||||
public:
|
||||
CStringHash()
|
||||
{
|
||||
memset( m_HashTable, 0, sizeof( StringHashNode_t * ) * STRING_HASH_TABLE_SIZE );
|
||||
}
|
||||
~CStringHash()
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < STRING_HASH_TABLE_SIZE; i++ )
|
||||
{
|
||||
StringHashNode_t *curEntry;
|
||||
curEntry = m_HashTable[i];
|
||||
if( curEntry )
|
||||
{
|
||||
StringHashNode_t *next;
|
||||
next = curEntry->next;
|
||||
delete curEntry;
|
||||
curEntry = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
// return false if it already exists
|
||||
// there can only be one entry for each string.
|
||||
bool Insert( const char *string, T val )
|
||||
{
|
||||
unsigned int hashID = HashString( string );
|
||||
StringHashNode_t *newEntry;
|
||||
if( !m_HashTable[hashID] )
|
||||
{
|
||||
// first on at this hashID
|
||||
// fixme: need to make the allocation function configurable.
|
||||
newEntry = m_HashTable[hashID] = new StringHashNode_t;
|
||||
newEntry->next = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
StringHashNode_t *curEntry;
|
||||
curEntry = m_HashTable[hashID];
|
||||
while( curEntry )
|
||||
{
|
||||
if( stricmp( curEntry->string, string ) == 0 )
|
||||
{
|
||||
// replace the data at the current entry with the enw data.
|
||||
curEntry->data = val;
|
||||
return false;
|
||||
}
|
||||
curEntry = curEntry->next;
|
||||
}
|
||||
newEntry = new StringHashNode_t;
|
||||
newEntry->next = m_HashTable[hashID];
|
||||
m_HashTable[hashID] = newEntry;
|
||||
}
|
||||
int len = strlen( string ) + 1;
|
||||
newEntry->string = new char[len];
|
||||
Q_strncpy( newEntry->string, string, len );
|
||||
newEntry->data = val;
|
||||
return true;
|
||||
}
|
||||
|
||||
T Find( const char *string )
|
||||
{
|
||||
int hashID = HashString( string );
|
||||
StringHashNode_t *curEntry;
|
||||
curEntry = m_HashTable[hashID];
|
||||
while( curEntry )
|
||||
{
|
||||
if( stricmp( curEntry->string, string ) == 0 )
|
||||
{
|
||||
return curEntry->data;
|
||||
}
|
||||
curEntry = curEntry->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int HashString( const char *string )
|
||||
{
|
||||
const char *s = string;
|
||||
unsigned int result = 0;
|
||||
|
||||
while( *s )
|
||||
{
|
||||
result += tolower( ( int )*s ) * 6029;
|
||||
result *= 5749;
|
||||
s++;
|
||||
}
|
||||
return result % STRING_HASH_TABLE_SIZE;
|
||||
}
|
||||
typedef struct StringHashNode_s
|
||||
{
|
||||
char *string;
|
||||
T data;
|
||||
struct StringHashNode_s *next;
|
||||
} StringHashNode_t;
|
||||
StringHashNode_t *m_HashTable[STRING_HASH_TABLE_SIZE];
|
||||
};
|
||||
|
||||
#endif // CSTRINGHASH_H
|
||||
16
common/debug_dll_check.cpp
Normal file
16
common/debug_dll_check.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//======= Copyright © 1996-2008, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose: Add a specially formatted string to each debug DLL of the form
|
||||
// "%DLLNAME%.dll is built debug!". We can search for this string via
|
||||
// a Perforce trigger to ensure that debug LIBs are not checked in.
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#if defined(DEBUG) || defined(_DEBUG)
|
||||
#include "tier0/platform.h"
|
||||
|
||||
#define _DEBUGONLYSTRING(x) #x
|
||||
#define DEBUGONLYSTRING(x) _DEBUGONLYSTRING(x)
|
||||
DLL_GLOBAL_EXPORT char const *pDebugString = DEBUGONLYSTRING(DLLNAME) ".dll is built debug!";
|
||||
|
||||
#endif
|
||||
34
common/debug_lib_check.cpp
Normal file
34
common/debug_lib_check.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//======= Copyright © 1996-2008, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose: Add a specially formatted string to each debug library of the form
|
||||
// "%LIBNAME%.lib is built debug!". We can search for this string via
|
||||
// a Perforce trigger to ensure that debug LIBs are not checked in.
|
||||
//
|
||||
// Also added a global int that is emitted only in release builds so
|
||||
// that release DLLs and EXEs can ensure that they are linking to
|
||||
// release versions of LIBs at link time. The global int adhere to the
|
||||
// naming convention "%LIBNAME%_lib_is_a_release_build".
|
||||
//
|
||||
// To take advantage of this pattern a DLL or EXE should add code
|
||||
// at global scope similar to the following in one of its modules:
|
||||
//
|
||||
// #if !defined(_DEBUG)
|
||||
// extern int bitmap_lib_is_a_release_build;
|
||||
//
|
||||
// void DebugTestFunction()
|
||||
// {
|
||||
// bitmap_lib_is_a_release_build = 0;
|
||||
// }
|
||||
// #endif
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#if defined(DEBUG) || defined(_DEBUG)
|
||||
#define _DEBUGONLYSTRING(x) #x
|
||||
#define DEBUGONLYSTRING(x) _DEBUGONLYSTRING(x)
|
||||
static volatile char const *pDebugString = DEBUGONLYSTRING(LIBNAME) ".lib is built debug!";
|
||||
#else
|
||||
#define _RELONLYINT(x) int x ## _lib_is_a_release_build = 0
|
||||
#define RELONLYINT(x) _RELONLYINT(x)
|
||||
RELONLYINT(LIBNAME);
|
||||
#endif
|
||||
1626
common/detour/detourfunc.cpp
Normal file
1626
common/detour/detourfunc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
277
common/detour/detourfunc.h
Normal file
277
common/detour/detourfunc.h
Normal file
@@ -0,0 +1,277 @@
|
||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose: Function Detouring code used by the overlay
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
#ifndef DETOURFUNC_H
|
||||
#define DETOURFUNC_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
void * HookFunc( BYTE *pRealFunctionAddr, const BYTE *pHookFunctionAddr, int nJumpsToFollowBeforeHooking = 0 );
|
||||
|
||||
bool HookFuncSafe( BYTE *pRealFunctionAddr, const BYTE *pHookFunctionAddr, void ** ppRelocFunctionAddr, int nJumpsToFollowBeforeHooking = 0 );
|
||||
bool bIsFuncHooked( BYTE *pRealFunctionAddr, void *pHookFunc = NULL );
|
||||
void UnhookFunc( BYTE *pRealFunctionAddr, BYTE *pOriginalFunctionAddr_DEPRECATED );
|
||||
void UnhookFunc( BYTE *pRealFunctionAddr, bool bLogFailures = true );
|
||||
void UnhookFuncByRelocAddr( BYTE *pRelocFunctionAddr, bool bLogFailures = true );
|
||||
|
||||
void RegregisterTrampolines();
|
||||
|
||||
void DetectUnloadedHooks();
|
||||
|
||||
#if defined( _WIN32 ) && DEBUG_ENABLE_DETOUR_RECORDING
|
||||
template <typename T, int k_nCountElements >
|
||||
class CCallRecordSet
|
||||
{
|
||||
public:
|
||||
typedef T ElemType_t;
|
||||
|
||||
CCallRecordSet()
|
||||
{
|
||||
m_cElements = 0;
|
||||
m_cElementPostWrite = 0;
|
||||
m_cElementMax = k_nCountElements;
|
||||
m_cubElements = sizeof(m_rgElements);
|
||||
memset( m_rgElements, 0, sizeof(m_rgElements) );
|
||||
}
|
||||
|
||||
// if return value is >= 0, then we matched an existing record
|
||||
int AddFunctionCallRecord( const ElemType_t &fcr )
|
||||
{
|
||||
// if we are full, dont bother searching any more
|
||||
// this reduces our perf impact to near zero if these functions are
|
||||
// called a lot more than we expect
|
||||
int cElements = m_cElements;
|
||||
if ( cElements >= k_nCountElements )
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
// search backwards through the log
|
||||
for( int i = cElements-1; i >= 0; i-- )
|
||||
{
|
||||
if ( m_rgElements[i] == fcr )
|
||||
return i;
|
||||
}
|
||||
|
||||
cElements = ++m_cElements;
|
||||
if ( cElements <= k_nCountElements )
|
||||
{
|
||||
m_rgElements[cElements-1] = fcr;
|
||||
}
|
||||
// if an external reader sees m_cElements != m_cElementPostWrite
|
||||
// they know the last item(s) may not be complete
|
||||
m_cElementPostWrite++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
CInterlockedIntT< int > m_cElements;
|
||||
CInterlockedIntT< int > m_cElementPostWrite;
|
||||
int m_cElementMax;
|
||||
int m_cubElements;
|
||||
ElemType_t m_rgElements[k_nCountElements];
|
||||
};
|
||||
|
||||
|
||||
class CRecordDetouredCalls
|
||||
{
|
||||
public:
|
||||
CRecordDetouredCalls();
|
||||
|
||||
void SetMasterSwitchOn() { m_bMasterSwitch = true; }
|
||||
bool BIsMasterSwitchOn() { return m_bMasterSwitch; }
|
||||
|
||||
bool BShouldRecordProtectFlags( DWORD flProtect );
|
||||
|
||||
void RecordGetAsyncKeyState( DWORD vKey,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
void RecordVirtualAlloc( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect,
|
||||
LPVOID lpvResult, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
void RecordVirtualProtect( LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, DWORD flOldProtect,
|
||||
BOOL bResult, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
void RecordVirtualAllocEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect,
|
||||
LPVOID lpvResult, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
void RecordVirtualProtectEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, DWORD flOldProtect,
|
||||
BOOL bResult, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
void RecordLoadLibraryW(
|
||||
LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags,
|
||||
HMODULE hModule, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
void RecordLoadLibraryA(
|
||||
LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags,
|
||||
HMODULE hModule, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
private:
|
||||
|
||||
struct FunctionCallRecordBase_t
|
||||
{
|
||||
void SharedInit(
|
||||
DWORD dwResult, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
DWORD m_dwResult;
|
||||
DWORD m_dwGetLastError;
|
||||
LPVOID m_lpFirstCallersAddress;
|
||||
LPVOID m_lpLastCallerAddress;
|
||||
};
|
||||
|
||||
// for GetAsyncKeyState the only thing we care about is the call site
|
||||
// dont care about results or params
|
||||
struct GetAsyncKeyStateCallRecord_t : public FunctionCallRecordBase_t
|
||||
{
|
||||
GetAsyncKeyStateCallRecord_t()
|
||||
{}
|
||||
|
||||
void InitGetAsyncKeyState( DWORD vKey,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
bool operator==( const FunctionCallRecordBase_t &rhs ) const
|
||||
{
|
||||
// compare callers only, dont care about results or params
|
||||
return
|
||||
m_lpFirstCallersAddress == rhs.m_lpFirstCallersAddress &&
|
||||
m_lpLastCallerAddress == rhs.m_lpLastCallerAddress;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct VirtualAllocCallRecord_t : public FunctionCallRecordBase_t
|
||||
{
|
||||
VirtualAllocCallRecord_t()
|
||||
{}
|
||||
|
||||
// VirtualAlloc
|
||||
void InitVirtualAlloc( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect,
|
||||
LPVOID lpvResult, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
// VirtualAllocEx
|
||||
void InitVirtualAllocEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect,
|
||||
LPVOID lpvResult, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
// VirtualProtect
|
||||
void InitVirtualProtect( LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, DWORD flOldProtect,
|
||||
BOOL bResult, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
// VirtualProtectEx
|
||||
void InitVirtualProtectEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, DWORD flOldProtect,
|
||||
BOOL bResult, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
bool operator==( const VirtualAllocCallRecord_t &rhs ) const
|
||||
{
|
||||
// compare everything
|
||||
return
|
||||
m_dwResult == rhs.m_dwResult &&
|
||||
m_dwGetLastError == rhs.m_dwGetLastError &&
|
||||
m_dwProcessId == rhs.m_dwProcessId &&
|
||||
m_lpAddress == rhs.m_lpAddress &&
|
||||
m_dwSize == rhs.m_dwSize &&
|
||||
m_flProtect == rhs.m_flProtect &&
|
||||
m_dw2 == rhs.m_dw2 &&
|
||||
m_lpFirstCallersAddress == rhs.m_lpFirstCallersAddress &&
|
||||
m_lpLastCallerAddress == rhs.m_lpLastCallerAddress;
|
||||
}
|
||||
|
||||
DWORD m_dwProcessId;
|
||||
LPVOID m_lpAddress;
|
||||
SIZE_T m_dwSize;
|
||||
DWORD m_flProtect;
|
||||
DWORD m_dw2;
|
||||
};
|
||||
|
||||
// for LoadLibrary just log everything, params and call sites
|
||||
struct LoadLibraryCallRecord_t : public FunctionCallRecordBase_t
|
||||
{
|
||||
LoadLibraryCallRecord_t() {}
|
||||
|
||||
// LoadLibraryExW or LoadLibraryW
|
||||
void InitLoadLibraryW(
|
||||
LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags,
|
||||
HMODULE hModule, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
void InitLoadLibraryA(
|
||||
LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags,
|
||||
HMODULE hModule, DWORD dwGetLastError,
|
||||
PVOID lpCallersAddress, PVOID lpCallersCallerAddress
|
||||
);
|
||||
|
||||
bool operator==( const LoadLibraryCallRecord_t &rhs ) const
|
||||
{
|
||||
// compare the result ( hModule ) but not the callers
|
||||
// we arent going to have a perfect history of every caller
|
||||
if ( m_dwResult != rhs.m_dwResult )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// and then what we have of the actual filename
|
||||
return ( memcmp( m_rgubFileName, &rhs.m_rgubFileName, sizeof(m_rgubFileName) ) == 0 );
|
||||
}
|
||||
|
||||
uint8 m_rgubFileName[128];
|
||||
HANDLE m_hFile;
|
||||
DWORD m_dwFlags;
|
||||
};
|
||||
|
||||
// These GUIDs are constants, and it is how we find this structure when looking through the data section
|
||||
// when we are trying to read this data with an external process
|
||||
GUID m_guidMarkerBegin;
|
||||
|
||||
// some helpers for parsing the structure externally
|
||||
int m_nVersionNumber;
|
||||
int m_cubRecordDetouredCalls;
|
||||
int m_cubGetAsyncKeyStateCallRecord;
|
||||
int m_cubVirtualAllocCallRecord;
|
||||
int m_cubVirtualProtectCallRecord;
|
||||
int m_cubLoadLibraryCallRecord;
|
||||
|
||||
// these numbers were chosen by profiling CS:GO a bunch
|
||||
CCallRecordSet< GetAsyncKeyStateCallRecord_t, 50 > m_GetAsyncKeyStateCallRecord;
|
||||
CCallRecordSet< VirtualAllocCallRecord_t, 300 > m_VirtualAllocCallRecord;
|
||||
CCallRecordSet< VirtualAllocCallRecord_t, 500 > m_VirtualProtectCallRecord;
|
||||
CCallRecordSet< LoadLibraryCallRecord_t, 200 > m_LoadLibraryCallRecord;
|
||||
|
||||
bool m_bMasterSwitch;
|
||||
// These GUIDs are constants, and it is how we find this structure when looking through the data section
|
||||
GUID m_guidMarkerEnd;
|
||||
|
||||
};
|
||||
|
||||
extern CRecordDetouredCalls g_RecordDetouredCalls;
|
||||
|
||||
typedef PVOID (WINAPI *RtlGetCallersAddress_t)( PVOID *CallersAddress, PVOID *CallersCaller );
|
||||
extern RtlGetCallersAddress_t g_pRtlGetCallersAddress;
|
||||
#endif // _WIN32
|
||||
|
||||
#endif // DETOURFUNC_H
|
||||
1281
common/detour/disassembler.cpp
Normal file
1281
common/detour/disassembler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
48
common/detour/disassembler.h
Normal file
48
common/detour/disassembler.h
Normal file
@@ -0,0 +1,48 @@
|
||||
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: couple of helper functions for win32 PE modules
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#pragma once
|
||||
|
||||
enum EOpCodeOffsetType
|
||||
{
|
||||
k_ENoRelativeOffsets,
|
||||
k_EDWORDOffsetAtByteTwo,
|
||||
k_EDWORDOffsetAtByteThree,
|
||||
k_EDWORDOffsetAtByteFour,
|
||||
k_EBYTEOffsetAtByteTwo,
|
||||
};
|
||||
|
||||
bool ParseOpcode( unsigned char *pOpcode, int &nLength, EOpCodeOffsetType &eOffsetType );
|
||||
|
||||
#define CALCULATE_ADDRESS(base, offset) (((DWORD)(base)) + (offset))
|
||||
#define GET_HEADER_DICTIONARY(module, idx) &(module)->pNtHeaders->OptionalHeader.DataDirectory[idx]
|
||||
|
||||
|
||||
// This structure describes an opcode parsed by our disassembler
|
||||
typedef unsigned __int32 uint32;
|
||||
typedef unsigned char uint8;
|
||||
typedef struct
|
||||
{
|
||||
int bOpcode;
|
||||
int cubOpcode;
|
||||
int cubImmed;
|
||||
uint32 uJump;
|
||||
uint32 uImmed; // not filled in
|
||||
bool bModRM;
|
||||
bool bRelative;
|
||||
bool bCantContinue;
|
||||
bool bJumpOrCall;
|
||||
bool bURJ;
|
||||
} OPCODE_t;
|
||||
|
||||
bool ParseCode( uint8 *pubCode, OPCODE_t *pOpcode, int cubLeft );
|
||||
uint32 ComputeJumpAddress( OPCODE_t *pOpcode, uint32 uVACurrent );
|
||||
bool OpcodeText( OPCODE_t *pOpcode, char *rgchText );
|
||||
bool LikelyValid( OPCODE_t *pOpcode );
|
||||
bool LikelyNewValid( OPCODE_t *pOpcode );
|
||||
int DisassembleSingleFunction( unsigned char *pubStart, int cub );
|
||||
|
||||
|
||||
6996
common/dx11sdk/D2D1.h
Normal file
6996
common/dx11sdk/D2D1.h
Normal file
File diff suppressed because it is too large
Load Diff
948
common/dx11sdk/D2D1Helper.h
Normal file
948
common/dx11sdk/D2D1Helper.h
Normal file
@@ -0,0 +1,948 @@
|
||||
|
||||
/*=========================================================================*\
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
File: D2D1helper.h
|
||||
|
||||
Module Name: D2D
|
||||
|
||||
Description: Helper files over the D2D interfaces and APIs.
|
||||
|
||||
\*=========================================================================*/
|
||||
#pragma once
|
||||
|
||||
#ifndef _D2D1_HELPER_H_
|
||||
#define _D2D1_HELPER_H_
|
||||
|
||||
#ifndef _D2D1_H_
|
||||
#include <d2d1.h>
|
||||
#endif // #ifndef _D2D1_H_
|
||||
|
||||
#ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
namespace D2D1
|
||||
{
|
||||
//
|
||||
// Forward declared IdentityMatrix function to allow matrix class to use
|
||||
// these constructors.
|
||||
//
|
||||
D2D1FORCEINLINE
|
||||
D2D1_MATRIX_3X2_F
|
||||
IdentityMatrix();
|
||||
|
||||
//
|
||||
// The default trait type for objects in D2D is float.
|
||||
//
|
||||
template<typename Type>
|
||||
struct TypeTraits
|
||||
{
|
||||
typedef D2D1_POINT_2F Point;
|
||||
typedef D2D1_SIZE_F Size;
|
||||
typedef D2D1_RECT_F Rect;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct TypeTraits<UINT32>
|
||||
{
|
||||
typedef D2D1_POINT_2U Point;
|
||||
typedef D2D1_SIZE_U Size;
|
||||
typedef D2D1_RECT_U Rect;
|
||||
};
|
||||
|
||||
static inline
|
||||
FLOAT FloatMax()
|
||||
{
|
||||
#ifdef FLT_MAX
|
||||
return FLT_MAX;
|
||||
#else
|
||||
return 3.402823466e+38F;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Construction helpers
|
||||
//
|
||||
template<typename Type>
|
||||
D2D1FORCEINLINE
|
||||
typename TypeTraits<Type>::Point
|
||||
Point2(
|
||||
Type x,
|
||||
Type y
|
||||
)
|
||||
{
|
||||
typename TypeTraits<Type>::Point point = { x, y };
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_POINT_2F
|
||||
Point2F(
|
||||
FLOAT x = 0.f,
|
||||
FLOAT y = 0.f
|
||||
)
|
||||
{
|
||||
return Point2<FLOAT>(x, y);
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_POINT_2U
|
||||
Point2U(
|
||||
UINT32 x = 0,
|
||||
UINT32 y = 0
|
||||
)
|
||||
{
|
||||
return Point2<UINT32>(x, y);
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
D2D1FORCEINLINE
|
||||
typename TypeTraits<Type>::Size
|
||||
Size(
|
||||
Type width,
|
||||
Type height
|
||||
)
|
||||
{
|
||||
typename TypeTraits<Type>::Size size = { width, height };
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_SIZE_F
|
||||
SizeF(
|
||||
FLOAT width = 0.f,
|
||||
FLOAT height = 0.f
|
||||
)
|
||||
{
|
||||
return Size<FLOAT>(width, height);
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_SIZE_U
|
||||
SizeU(
|
||||
UINT32 width = 0,
|
||||
UINT32 height = 0
|
||||
)
|
||||
{
|
||||
return Size<UINT32>(width, height);
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
D2D1FORCEINLINE
|
||||
typename TypeTraits<Type>::Rect
|
||||
Rect(
|
||||
Type left,
|
||||
Type top,
|
||||
Type right,
|
||||
Type bottom
|
||||
)
|
||||
{
|
||||
typename TypeTraits<Type>::Rect rect = { left, top, right, bottom };
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_RECT_F
|
||||
RectF(
|
||||
FLOAT left = 0.f,
|
||||
FLOAT top = 0.f,
|
||||
FLOAT right = 0.f,
|
||||
FLOAT bottom = 0.f
|
||||
)
|
||||
{
|
||||
return Rect<FLOAT>(left, top, right, bottom);
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_RECT_U
|
||||
RectU(
|
||||
UINT32 left = 0,
|
||||
UINT32 top = 0,
|
||||
UINT32 right = 0,
|
||||
UINT32 bottom = 0
|
||||
)
|
||||
{
|
||||
return Rect<UINT32>(left, top, right, bottom);
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_RECT_F
|
||||
InfiniteRect()
|
||||
{
|
||||
D2D1_RECT_F rect = { -FloatMax(), -FloatMax(), FloatMax(), FloatMax() };
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_ARC_SEGMENT
|
||||
ArcSegment(
|
||||
__in CONST D2D1_POINT_2F &point,
|
||||
__in CONST D2D1_SIZE_F &size,
|
||||
__in FLOAT rotationAngle,
|
||||
__in D2D1_SWEEP_DIRECTION sweepDirection,
|
||||
__in D2D1_ARC_SIZE arcSize
|
||||
)
|
||||
{
|
||||
D2D1_ARC_SEGMENT arcSegment = { point, size, rotationAngle, sweepDirection, arcSize };
|
||||
|
||||
return arcSegment;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_BEZIER_SEGMENT
|
||||
BezierSegment(
|
||||
__in CONST D2D1_POINT_2F &point1,
|
||||
__in CONST D2D1_POINT_2F &point2,
|
||||
__in CONST D2D1_POINT_2F &point3
|
||||
)
|
||||
{
|
||||
D2D1_BEZIER_SEGMENT bezierSegment = { point1, point2, point3 };
|
||||
|
||||
return bezierSegment;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_ELLIPSE
|
||||
Ellipse(
|
||||
__in CONST D2D1_POINT_2F ¢er,
|
||||
FLOAT radiusX,
|
||||
FLOAT radiusY
|
||||
)
|
||||
{
|
||||
D2D1_ELLIPSE ellipse;
|
||||
|
||||
ellipse.point = center;
|
||||
ellipse.radiusX = radiusX;
|
||||
ellipse.radiusY = radiusY;
|
||||
|
||||
return ellipse;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_ROUNDED_RECT
|
||||
RoundedRect(
|
||||
__in CONST D2D1_RECT_F &rect,
|
||||
FLOAT radiusX,
|
||||
FLOAT radiusY
|
||||
)
|
||||
{
|
||||
D2D1_ROUNDED_RECT roundedRect;
|
||||
|
||||
roundedRect.rect = rect;
|
||||
roundedRect.radiusX = radiusX;
|
||||
roundedRect.radiusY = radiusY;
|
||||
|
||||
return roundedRect;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_BRUSH_PROPERTIES
|
||||
BrushProperties(
|
||||
__in FLOAT opacity = 1.0,
|
||||
__in CONST D2D1_MATRIX_3X2_F &transform = D2D1::IdentityMatrix()
|
||||
)
|
||||
{
|
||||
D2D1_BRUSH_PROPERTIES brushProperties;
|
||||
|
||||
brushProperties.opacity = opacity;
|
||||
brushProperties.transform = transform;
|
||||
|
||||
return brushProperties;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_GRADIENT_STOP
|
||||
GradientStop(
|
||||
FLOAT position,
|
||||
__in CONST D2D1_COLOR_F &color
|
||||
)
|
||||
{
|
||||
D2D1_GRADIENT_STOP gradientStop = { position, color };
|
||||
|
||||
return gradientStop;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_QUADRATIC_BEZIER_SEGMENT
|
||||
QuadraticBezierSegment(
|
||||
__in CONST D2D1_POINT_2F &point1,
|
||||
__in CONST D2D1_POINT_2F &point2
|
||||
)
|
||||
{
|
||||
D2D1_QUADRATIC_BEZIER_SEGMENT quadraticBezier = { point1, point2 };
|
||||
|
||||
return quadraticBezier;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_STROKE_STYLE_PROPERTIES
|
||||
StrokeStyleProperties(
|
||||
D2D1_CAP_STYLE startCap = D2D1_CAP_STYLE_FLAT,
|
||||
D2D1_CAP_STYLE endCap = D2D1_CAP_STYLE_FLAT,
|
||||
D2D1_CAP_STYLE dashCap = D2D1_CAP_STYLE_FLAT,
|
||||
D2D1_LINE_JOIN lineJoin = D2D1_LINE_JOIN_MITER,
|
||||
FLOAT miterLimit = 10.0f,
|
||||
D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE_SOLID,
|
||||
FLOAT dashOffset = 0.0f
|
||||
)
|
||||
{
|
||||
D2D1_STROKE_STYLE_PROPERTIES strokeStyleProperties;
|
||||
|
||||
strokeStyleProperties.startCap = startCap;
|
||||
strokeStyleProperties.endCap = endCap;
|
||||
strokeStyleProperties.dashCap = dashCap;
|
||||
strokeStyleProperties.lineJoin = lineJoin;
|
||||
strokeStyleProperties.miterLimit = miterLimit;
|
||||
strokeStyleProperties.dashStyle = dashStyle;
|
||||
strokeStyleProperties.dashOffset = dashOffset;
|
||||
|
||||
return strokeStyleProperties;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_BITMAP_BRUSH_PROPERTIES
|
||||
BitmapBrushProperties(
|
||||
D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP,
|
||||
D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP,
|
||||
D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR
|
||||
)
|
||||
{
|
||||
D2D1_BITMAP_BRUSH_PROPERTIES bitmapBrushProperties;
|
||||
|
||||
bitmapBrushProperties.extendModeX = extendModeX;
|
||||
bitmapBrushProperties.extendModeY = extendModeY;
|
||||
bitmapBrushProperties.interpolationMode = interpolationMode;
|
||||
|
||||
return bitmapBrushProperties;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES
|
||||
LinearGradientBrushProperties(
|
||||
__in CONST D2D1_POINT_2F &startPoint,
|
||||
__in CONST D2D1_POINT_2F &endPoint
|
||||
)
|
||||
{
|
||||
D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties;
|
||||
|
||||
linearGradientBrushProperties.startPoint = startPoint;
|
||||
linearGradientBrushProperties.endPoint = endPoint;
|
||||
|
||||
return linearGradientBrushProperties;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES
|
||||
RadialGradientBrushProperties(
|
||||
__in CONST D2D1_POINT_2F ¢er,
|
||||
__in CONST D2D1_POINT_2F &gradientOriginOffset,
|
||||
FLOAT radiusX,
|
||||
FLOAT radiusY
|
||||
)
|
||||
{
|
||||
D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties;
|
||||
|
||||
radialGradientBrushProperties.center = center;
|
||||
radialGradientBrushProperties.gradientOriginOffset = gradientOriginOffset;
|
||||
radialGradientBrushProperties.radiusX = radiusX;
|
||||
radialGradientBrushProperties.radiusY = radiusY;
|
||||
|
||||
return radialGradientBrushProperties;
|
||||
}
|
||||
|
||||
//
|
||||
// PixelFormat
|
||||
//
|
||||
D2D1FORCEINLINE
|
||||
D2D1_PIXEL_FORMAT
|
||||
PixelFormat(
|
||||
__in DXGI_FORMAT dxgiFormat = DXGI_FORMAT_UNKNOWN,
|
||||
__in D2D1_ALPHA_MODE alphaMode = D2D1_ALPHA_MODE_UNKNOWN
|
||||
)
|
||||
{
|
||||
D2D1_PIXEL_FORMAT pixelFormat;
|
||||
|
||||
pixelFormat.format = dxgiFormat;
|
||||
pixelFormat.alphaMode = alphaMode;
|
||||
|
||||
return pixelFormat;
|
||||
}
|
||||
|
||||
//
|
||||
// Bitmaps
|
||||
//
|
||||
D2D1FORCEINLINE
|
||||
D2D1_BITMAP_PROPERTIES
|
||||
BitmapProperties(
|
||||
CONST D2D1_PIXEL_FORMAT &pixelFormat = D2D1::PixelFormat(),
|
||||
FLOAT dpiX = 96.0f,
|
||||
FLOAT dpiY = 96.0f
|
||||
)
|
||||
{
|
||||
D2D1_BITMAP_PROPERTIES bitmapProperties;
|
||||
|
||||
bitmapProperties.pixelFormat = pixelFormat;
|
||||
bitmapProperties.dpiX = dpiX;
|
||||
bitmapProperties.dpiY = dpiY;
|
||||
|
||||
return bitmapProperties;
|
||||
}
|
||||
|
||||
//
|
||||
// Render Targets
|
||||
//
|
||||
D2D1FORCEINLINE
|
||||
D2D1_RENDER_TARGET_PROPERTIES
|
||||
RenderTargetProperties(
|
||||
D2D1_RENDER_TARGET_TYPE type = D2D1_RENDER_TARGET_TYPE_DEFAULT,
|
||||
__in CONST D2D1_PIXEL_FORMAT &pixelFormat = D2D1::PixelFormat(),
|
||||
FLOAT dpiX = 0.0,
|
||||
FLOAT dpiY = 0.0,
|
||||
D2D1_RENDER_TARGET_USAGE usage = D2D1_RENDER_TARGET_USAGE_NONE,
|
||||
D2D1_FEATURE_LEVEL minLevel = D2D1_FEATURE_LEVEL_DEFAULT
|
||||
)
|
||||
{
|
||||
D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties;
|
||||
|
||||
renderTargetProperties.type = type;
|
||||
renderTargetProperties.pixelFormat = pixelFormat;
|
||||
renderTargetProperties.dpiX = dpiX;
|
||||
renderTargetProperties.dpiY = dpiY;
|
||||
renderTargetProperties.usage = usage;
|
||||
renderTargetProperties.minLevel = minLevel;
|
||||
|
||||
return renderTargetProperties;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_HWND_RENDER_TARGET_PROPERTIES
|
||||
HwndRenderTargetProperties(
|
||||
__in HWND hwnd,
|
||||
__in D2D1_SIZE_U pixelSize = D2D1::Size(static_cast<UINT>(0), static_cast<UINT>(0)),
|
||||
__in D2D1_PRESENT_OPTIONS presentOptions = D2D1_PRESENT_OPTIONS_NONE
|
||||
)
|
||||
{
|
||||
D2D1_HWND_RENDER_TARGET_PROPERTIES hwndRenderTargetProperties;
|
||||
|
||||
hwndRenderTargetProperties.hwnd = hwnd;
|
||||
hwndRenderTargetProperties.pixelSize = pixelSize;
|
||||
hwndRenderTargetProperties.presentOptions = presentOptions;
|
||||
|
||||
return hwndRenderTargetProperties;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_LAYER_PARAMETERS
|
||||
LayerParameters(
|
||||
__in CONST D2D1_RECT_F &contentBounds = D2D1::InfiniteRect(),
|
||||
__in_opt ID2D1Geometry *geometricMask = NULL,
|
||||
D2D1_ANTIALIAS_MODE maskAntialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
|
||||
D2D1_MATRIX_3X2_F maskTransform = D2D1::IdentityMatrix(),
|
||||
FLOAT opacity = 1.0,
|
||||
__in_opt ID2D1Brush *opacityBrush = NULL,
|
||||
D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE
|
||||
)
|
||||
{
|
||||
D2D1_LAYER_PARAMETERS layerParameters = { 0 };
|
||||
|
||||
layerParameters.contentBounds = contentBounds;
|
||||
layerParameters.geometricMask = geometricMask;
|
||||
layerParameters.maskAntialiasMode = maskAntialiasMode;
|
||||
layerParameters.maskTransform = maskTransform;
|
||||
layerParameters.opacity = opacity;
|
||||
layerParameters.opacityBrush = opacityBrush;
|
||||
layerParameters.layerOptions = layerOptions;
|
||||
|
||||
return layerParameters;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_DRAWING_STATE_DESCRIPTION
|
||||
DrawingStateDescription(
|
||||
D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
|
||||
D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT,
|
||||
D2D1_TAG tag1 = 0,
|
||||
D2D1_TAG tag2 = 0,
|
||||
__in const D2D1_MATRIX_3X2_F &transform = D2D1::IdentityMatrix()
|
||||
)
|
||||
{
|
||||
D2D1_DRAWING_STATE_DESCRIPTION drawingStateDescription;
|
||||
|
||||
drawingStateDescription.antialiasMode = antialiasMode;
|
||||
drawingStateDescription.textAntialiasMode = textAntialiasMode;
|
||||
drawingStateDescription.tag1 = tag1;
|
||||
drawingStateDescription.tag2 = tag2;
|
||||
drawingStateDescription.transform = transform;
|
||||
|
||||
return drawingStateDescription;
|
||||
}
|
||||
|
||||
//
|
||||
// Colors, this enum defines a set of predefined colors.
|
||||
//
|
||||
class ColorF : public D2D1_COLOR_F
|
||||
{
|
||||
public:
|
||||
|
||||
enum Enum
|
||||
{
|
||||
AliceBlue = 0xF0F8FF,
|
||||
AntiqueWhite = 0xFAEBD7,
|
||||
Aqua = 0x00FFFF,
|
||||
Aquamarine = 0x7FFFD4,
|
||||
Azure = 0xF0FFFF,
|
||||
Beige = 0xF5F5DC,
|
||||
Bisque = 0xFFE4C4,
|
||||
Black = 0x000000,
|
||||
BlanchedAlmond = 0xFFEBCD,
|
||||
Blue = 0x0000FF,
|
||||
BlueViolet = 0x8A2BE2,
|
||||
Brown = 0xA52A2A,
|
||||
BurlyWood = 0xDEB887,
|
||||
CadetBlue = 0x5F9EA0,
|
||||
Chartreuse = 0x7FFF00,
|
||||
Chocolate = 0xD2691E,
|
||||
Coral = 0xFF7F50,
|
||||
CornflowerBlue = 0x6495ED,
|
||||
Cornsilk = 0xFFF8DC,
|
||||
Crimson = 0xDC143C,
|
||||
Cyan = 0x00FFFF,
|
||||
DarkBlue = 0x00008B,
|
||||
DarkCyan = 0x008B8B,
|
||||
DarkGoldenrod = 0xB8860B,
|
||||
DarkGray = 0xA9A9A9,
|
||||
DarkGreen = 0x006400,
|
||||
DarkKhaki = 0xBDB76B,
|
||||
DarkMagenta = 0x8B008B,
|
||||
DarkOliveGreen = 0x556B2F,
|
||||
DarkOrange = 0xFF8C00,
|
||||
DarkOrchid = 0x9932CC,
|
||||
DarkRed = 0x8B0000,
|
||||
DarkSalmon = 0xE9967A,
|
||||
DarkSeaGreen = 0x8FBC8F,
|
||||
DarkSlateBlue = 0x483D8B,
|
||||
DarkSlateGray = 0x2F4F4F,
|
||||
DarkTurquoise = 0x00CED1,
|
||||
DarkViolet = 0x9400D3,
|
||||
DeepPink = 0xFF1493,
|
||||
DeepSkyBlue = 0x00BFFF,
|
||||
DimGray = 0x696969,
|
||||
DodgerBlue = 0x1E90FF,
|
||||
Firebrick = 0xB22222,
|
||||
FloralWhite = 0xFFFAF0,
|
||||
ForestGreen = 0x228B22,
|
||||
Fuchsia = 0xFF00FF,
|
||||
Gainsboro = 0xDCDCDC,
|
||||
GhostWhite = 0xF8F8FF,
|
||||
Gold = 0xFFD700,
|
||||
Goldenrod = 0xDAA520,
|
||||
Gray = 0x808080,
|
||||
Green = 0x008000,
|
||||
GreenYellow = 0xADFF2F,
|
||||
Honeydew = 0xF0FFF0,
|
||||
HotPink = 0xFF69B4,
|
||||
IndianRed = 0xCD5C5C,
|
||||
Indigo = 0x4B0082,
|
||||
Ivory = 0xFFFFF0,
|
||||
Khaki = 0xF0E68C,
|
||||
Lavender = 0xE6E6FA,
|
||||
LavenderBlush = 0xFFF0F5,
|
||||
LawnGreen = 0x7CFC00,
|
||||
LemonChiffon = 0xFFFACD,
|
||||
LightBlue = 0xADD8E6,
|
||||
LightCoral = 0xF08080,
|
||||
LightCyan = 0xE0FFFF,
|
||||
LightGoldenrodYellow = 0xFAFAD2,
|
||||
LightGreen = 0x90EE90,
|
||||
LightGray = 0xD3D3D3,
|
||||
LightPink = 0xFFB6C1,
|
||||
LightSalmon = 0xFFA07A,
|
||||
LightSeaGreen = 0x20B2AA,
|
||||
LightSkyBlue = 0x87CEFA,
|
||||
LightSlateGray = 0x778899,
|
||||
LightSteelBlue = 0xB0C4DE,
|
||||
LightYellow = 0xFFFFE0,
|
||||
Lime = 0x00FF00,
|
||||
LimeGreen = 0x32CD32,
|
||||
Linen = 0xFAF0E6,
|
||||
Magenta = 0xFF00FF,
|
||||
Maroon = 0x800000,
|
||||
MediumAquamarine = 0x66CDAA,
|
||||
MediumBlue = 0x0000CD,
|
||||
MediumOrchid = 0xBA55D3,
|
||||
MediumPurple = 0x9370DB,
|
||||
MediumSeaGreen = 0x3CB371,
|
||||
MediumSlateBlue = 0x7B68EE,
|
||||
MediumSpringGreen = 0x00FA9A,
|
||||
MediumTurquoise = 0x48D1CC,
|
||||
MediumVioletRed = 0xC71585,
|
||||
MidnightBlue = 0x191970,
|
||||
MintCream = 0xF5FFFA,
|
||||
MistyRose = 0xFFE4E1,
|
||||
Moccasin = 0xFFE4B5,
|
||||
NavajoWhite = 0xFFDEAD,
|
||||
Navy = 0x000080,
|
||||
OldLace = 0xFDF5E6,
|
||||
Olive = 0x808000,
|
||||
OliveDrab = 0x6B8E23,
|
||||
Orange = 0xFFA500,
|
||||
OrangeRed = 0xFF4500,
|
||||
Orchid = 0xDA70D6,
|
||||
PaleGoldenrod = 0xEEE8AA,
|
||||
PaleGreen = 0x98FB98,
|
||||
PaleTurquoise = 0xAFEEEE,
|
||||
PaleVioletRed = 0xDB7093,
|
||||
PapayaWhip = 0xFFEFD5,
|
||||
PeachPuff = 0xFFDAB9,
|
||||
Peru = 0xCD853F,
|
||||
Pink = 0xFFC0CB,
|
||||
Plum = 0xDDA0DD,
|
||||
PowderBlue = 0xB0E0E6,
|
||||
Purple = 0x800080,
|
||||
Red = 0xFF0000,
|
||||
RosyBrown = 0xBC8F8F,
|
||||
RoyalBlue = 0x4169E1,
|
||||
SaddleBrown = 0x8B4513,
|
||||
Salmon = 0xFA8072,
|
||||
SandyBrown = 0xF4A460,
|
||||
SeaGreen = 0x2E8B57,
|
||||
SeaShell = 0xFFF5EE,
|
||||
Sienna = 0xA0522D,
|
||||
Silver = 0xC0C0C0,
|
||||
SkyBlue = 0x87CEEB,
|
||||
SlateBlue = 0x6A5ACD,
|
||||
SlateGray = 0x708090,
|
||||
Snow = 0xFFFAFA,
|
||||
SpringGreen = 0x00FF7F,
|
||||
SteelBlue = 0x4682B4,
|
||||
Tan = 0xD2B48C,
|
||||
Teal = 0x008080,
|
||||
Thistle = 0xD8BFD8,
|
||||
Tomato = 0xFF6347,
|
||||
Turquoise = 0x40E0D0,
|
||||
Violet = 0xEE82EE,
|
||||
Wheat = 0xF5DEB3,
|
||||
White = 0xFFFFFF,
|
||||
WhiteSmoke = 0xF5F5F5,
|
||||
Yellow = 0xFFFF00,
|
||||
YellowGreen = 0x9ACD32,
|
||||
};
|
||||
|
||||
//
|
||||
// Construct a color, note that the alpha value from the "rgb" component
|
||||
// is never used.
|
||||
//
|
||||
D2D1FORCEINLINE
|
||||
ColorF(
|
||||
UINT32 rgb,
|
||||
FLOAT a = 1.0
|
||||
)
|
||||
{
|
||||
Init(rgb, a);
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
ColorF(
|
||||
Enum knownColor,
|
||||
FLOAT a = 1.0
|
||||
)
|
||||
{
|
||||
Init(knownColor, a);
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
ColorF(
|
||||
FLOAT r,
|
||||
FLOAT g,
|
||||
FLOAT b,
|
||||
FLOAT a = 1.0
|
||||
)
|
||||
{
|
||||
this->r = r;
|
||||
this->g = g;
|
||||
this->b = b;
|
||||
this->a = a;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
D2D1FORCEINLINE
|
||||
void
|
||||
Init(
|
||||
UINT32 rgb,
|
||||
FLOAT a
|
||||
)
|
||||
{
|
||||
this->r = static_cast<FLOAT>((rgb & sc_redMask) >> sc_redShift) / 255.f;
|
||||
this->g = static_cast<FLOAT>((rgb & sc_greenMask) >> sc_greenShift) / 255.f;
|
||||
this->b = static_cast<FLOAT>((rgb & sc_blueMask) >> sc_blueShift) / 255.f;
|
||||
this->a = a;
|
||||
}
|
||||
|
||||
static const UINT32 sc_redShift = 16;
|
||||
static const UINT32 sc_greenShift = 8;
|
||||
static const UINT32 sc_blueShift = 0;
|
||||
|
||||
static const UINT32 sc_redMask = 0xff << sc_redShift;
|
||||
static const UINT32 sc_greenMask = 0xff << sc_greenShift;
|
||||
static const UINT32 sc_blueMask = 0xff << sc_blueShift;
|
||||
};
|
||||
|
||||
class Matrix3x2F : public D2D1_MATRIX_3X2_F
|
||||
{
|
||||
public:
|
||||
|
||||
D2D1FORCEINLINE
|
||||
Matrix3x2F(
|
||||
FLOAT _11,
|
||||
FLOAT _12,
|
||||
FLOAT _21,
|
||||
FLOAT _22,
|
||||
FLOAT _31,
|
||||
FLOAT _32
|
||||
)
|
||||
{
|
||||
this->_11 = _11;
|
||||
this->_12 = _12;
|
||||
this->_21 = _21;
|
||||
this->_22 = _22;
|
||||
this->_31 = _31;
|
||||
this->_32 = _32;
|
||||
}
|
||||
|
||||
//
|
||||
// Creates an identity matrix
|
||||
//
|
||||
D2D1FORCEINLINE
|
||||
Matrix3x2F(
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Named quasi-constructors
|
||||
//
|
||||
static D2D1FORCEINLINE
|
||||
Matrix3x2F
|
||||
Identity()
|
||||
{
|
||||
Matrix3x2F identity;
|
||||
|
||||
identity._11 = 1.f;
|
||||
identity._12 = 0.f;
|
||||
identity._21 = 0.f;
|
||||
identity._22 = 1.f;
|
||||
identity._31 = 0.f;
|
||||
identity._32 = 0.f;
|
||||
|
||||
return identity;
|
||||
}
|
||||
|
||||
static D2D1FORCEINLINE
|
||||
Matrix3x2F
|
||||
Translation(
|
||||
D2D1_SIZE_F size
|
||||
)
|
||||
{
|
||||
Matrix3x2F translation;
|
||||
|
||||
translation._11 = 1.0; translation._12 = 0.0;
|
||||
translation._21 = 0.0; translation._22 = 1.0;
|
||||
translation._31 = size.width; translation._32 = size.height;
|
||||
|
||||
return translation;
|
||||
}
|
||||
|
||||
static D2D1FORCEINLINE
|
||||
Matrix3x2F
|
||||
Translation(
|
||||
FLOAT x,
|
||||
FLOAT y
|
||||
)
|
||||
{
|
||||
return Translation(SizeF(x, y));
|
||||
}
|
||||
|
||||
|
||||
static D2D1FORCEINLINE
|
||||
Matrix3x2F
|
||||
Scale(
|
||||
D2D1_SIZE_F size,
|
||||
D2D1_POINT_2F center = D2D1::Point2F()
|
||||
)
|
||||
{
|
||||
Matrix3x2F scale;
|
||||
|
||||
scale._11 = size.width; scale._12 = 0.0;
|
||||
scale._21 = 0.0; scale._22 = size.height;
|
||||
scale._31 = center.x - size.width * center.x;
|
||||
scale._32 = center.y - size.height * center.y;
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
static D2D1FORCEINLINE
|
||||
Matrix3x2F
|
||||
Scale(
|
||||
FLOAT x,
|
||||
FLOAT y,
|
||||
D2D1_POINT_2F center = D2D1::Point2F()
|
||||
)
|
||||
{
|
||||
return Scale(SizeF(x, y), center);
|
||||
}
|
||||
|
||||
static D2D1FORCEINLINE
|
||||
Matrix3x2F
|
||||
Rotation(
|
||||
FLOAT angle,
|
||||
D2D1_POINT_2F center = D2D1::Point2F()
|
||||
)
|
||||
{
|
||||
Matrix3x2F rotation;
|
||||
|
||||
D2D1MakeRotateMatrix(angle, center, &rotation);
|
||||
|
||||
return rotation;
|
||||
}
|
||||
|
||||
static D2D1FORCEINLINE
|
||||
Matrix3x2F
|
||||
Skew(
|
||||
FLOAT angleX,
|
||||
FLOAT angleY,
|
||||
D2D1_POINT_2F center = D2D1::Point2F()
|
||||
)
|
||||
{
|
||||
Matrix3x2F skew;
|
||||
|
||||
D2D1MakeSkewMatrix(angleX, angleY, center, &skew);
|
||||
|
||||
return skew;
|
||||
}
|
||||
|
||||
//
|
||||
// Functions for convertion from the base D2D1_MATRIX_3X2_F to this type
|
||||
// without making a copy
|
||||
//
|
||||
static inline const Matrix3x2F* ReinterpretBaseType(const D2D1_MATRIX_3X2_F *pMatrix)
|
||||
{
|
||||
return static_cast<const Matrix3x2F *>(pMatrix);
|
||||
}
|
||||
|
||||
static inline Matrix3x2F* ReinterpretBaseType(D2D1_MATRIX_3X2_F *pMatrix)
|
||||
{
|
||||
return static_cast<Matrix3x2F *>(pMatrix);
|
||||
}
|
||||
|
||||
inline
|
||||
FLOAT
|
||||
Determinant() const
|
||||
{
|
||||
return (_11 * _22) - (_12 * _21);
|
||||
}
|
||||
|
||||
inline
|
||||
bool
|
||||
IsInvertible() const
|
||||
{
|
||||
return !!D2D1IsMatrixInvertible(this);
|
||||
}
|
||||
|
||||
inline
|
||||
bool
|
||||
Invert()
|
||||
{
|
||||
return !!D2D1InvertMatrix(this);
|
||||
}
|
||||
|
||||
inline
|
||||
bool
|
||||
IsIdentity() const
|
||||
{
|
||||
return _11 == 1.f && _12 == 0.f
|
||||
&& _21 == 0.f && _22 == 1.f
|
||||
&& _31 == 0.f && _32 == 0.f;
|
||||
}
|
||||
|
||||
inline
|
||||
void SetProduct(
|
||||
const Matrix3x2F &a,
|
||||
const Matrix3x2F &b
|
||||
)
|
||||
{
|
||||
_11 = a._11 * b._11 + a._12 * b._21;
|
||||
_12 = a._11 * b._12 + a._12 * b._22;
|
||||
_21 = a._21 * b._11 + a._22 * b._21;
|
||||
_22 = a._21 * b._12 + a._22 * b._22;
|
||||
_31 = a._31 * b._11 + a._32 * b._21 + b._31;
|
||||
_32 = a._31 * b._12 + a._32 * b._22 + b._32;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
Matrix3x2F
|
||||
operator*(
|
||||
const Matrix3x2F &matrix
|
||||
) const
|
||||
{
|
||||
Matrix3x2F result;
|
||||
|
||||
result.SetProduct(*this, matrix);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_POINT_2F
|
||||
TransformPoint(
|
||||
D2D1_POINT_2F point
|
||||
) const
|
||||
{
|
||||
D2D1_POINT_2F result =
|
||||
{
|
||||
point.x * _11 + point.y * _21 + _31,
|
||||
point.x * _12 + point.y * _22 + _32
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_POINT_2F
|
||||
operator*(
|
||||
const D2D1_POINT_2F &point,
|
||||
const D2D1_MATRIX_3X2_F &matrix
|
||||
)
|
||||
{
|
||||
return Matrix3x2F::ReinterpretBaseType(&matrix)->TransformPoint(point);
|
||||
}
|
||||
|
||||
D2D1_MATRIX_3X2_F
|
||||
IdentityMatrix()
|
||||
{
|
||||
return Matrix3x2F::Identity();
|
||||
}
|
||||
|
||||
} // namespace D2D1
|
||||
|
||||
D2D1FORCEINLINE
|
||||
D2D1_MATRIX_3X2_F
|
||||
operator*(
|
||||
const D2D1_MATRIX_3X2_F &matrix1,
|
||||
const D2D1_MATRIX_3X2_F &matrix2
|
||||
)
|
||||
{
|
||||
return
|
||||
(*D2D1::Matrix3x2F::ReinterpretBaseType(&matrix1)) *
|
||||
(*D2D1::Matrix3x2F::ReinterpretBaseType(&matrix2));
|
||||
}
|
||||
|
||||
#endif // #ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
#endif // #ifndef _D2D1_HELPER_H_
|
||||
|
||||
145
common/dx11sdk/D2DBaseTypes.h
Normal file
145
common/dx11sdk/D2DBaseTypes.h
Normal file
@@ -0,0 +1,145 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// This file is automatically generated. Please do not edit it directly.
|
||||
//
|
||||
// File name: D2DBaseTypes.h
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
|
||||
#ifndef _D2DBASETYPES_INCLUDED
|
||||
#define _D2DBASETYPES_INCLUDED
|
||||
|
||||
#ifndef COM_NO_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif // #ifndef COM_NO_WINDOWS_H
|
||||
|
||||
#ifndef D3DCOLORVALUE_DEFINED
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Struct:
|
||||
// D3DCOLORVALUE
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct D3DCOLORVALUE
|
||||
{
|
||||
FLOAT r;
|
||||
FLOAT g;
|
||||
FLOAT b;
|
||||
FLOAT a;
|
||||
|
||||
} D3DCOLORVALUE;
|
||||
|
||||
#define D3DCOLORVALUE_DEFINED
|
||||
#endif
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Struct:
|
||||
// D2D_POINT_2U
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct D2D_POINT_2U
|
||||
{
|
||||
UINT32 x;
|
||||
UINT32 y;
|
||||
|
||||
} D2D_POINT_2U;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Struct:
|
||||
// D2D_POINT_2F
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct D2D_POINT_2F
|
||||
{
|
||||
FLOAT x;
|
||||
FLOAT y;
|
||||
|
||||
} D2D_POINT_2F;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Struct:
|
||||
// D2D_RECT_F
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct D2D_RECT_F
|
||||
{
|
||||
FLOAT left;
|
||||
FLOAT top;
|
||||
FLOAT right;
|
||||
FLOAT bottom;
|
||||
|
||||
} D2D_RECT_F;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Struct:
|
||||
// D2D_RECT_U
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct D2D_RECT_U
|
||||
{
|
||||
UINT32 left;
|
||||
UINT32 top;
|
||||
UINT32 right;
|
||||
UINT32 bottom;
|
||||
|
||||
} D2D_RECT_U;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Struct:
|
||||
// D2D_SIZE_F
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct D2D_SIZE_F
|
||||
{
|
||||
FLOAT width;
|
||||
FLOAT height;
|
||||
|
||||
} D2D_SIZE_F;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Struct:
|
||||
// D2D_SIZE_U
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct D2D_SIZE_U
|
||||
{
|
||||
UINT32 width;
|
||||
UINT32 height;
|
||||
|
||||
} D2D_SIZE_U;
|
||||
|
||||
typedef D3DCOLORVALUE D2D_COLOR_F;
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Struct:
|
||||
// D2D_MATRIX_3X2_F
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct D2D_MATRIX_3X2_F
|
||||
{
|
||||
FLOAT _11;
|
||||
FLOAT _12;
|
||||
FLOAT _21;
|
||||
FLOAT _22;
|
||||
FLOAT _31;
|
||||
FLOAT _32;
|
||||
|
||||
} D2D_MATRIX_3X2_F;
|
||||
|
||||
#endif // #ifndef _D2DBASETYPES_INCLUDED
|
||||
206
common/dx11sdk/D2Derr.h
Normal file
206
common/dx11sdk/D2Derr.h
Normal file
@@ -0,0 +1,206 @@
|
||||
/*=========================================================================*\
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
\*=========================================================================*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*=========================================================================*\
|
||||
D2D Status Codes
|
||||
\*=========================================================================*/
|
||||
|
||||
#define FACILITY_D2D 0x899
|
||||
|
||||
#define MAKE_D2DHR( sev, code )\
|
||||
MAKE_HRESULT( sev, FACILITY_D2D, (code) )
|
||||
|
||||
#define MAKE_D2DHR_ERR( code )\
|
||||
MAKE_D2DHR( 1, code )
|
||||
|
||||
|
||||
//+----------------------------------------------------------------------------
|
||||
//
|
||||
// D2D error codes
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Error codes shared with WINCODECS
|
||||
//
|
||||
|
||||
//
|
||||
// The pixel format is not supported.
|
||||
//
|
||||
#define D2DERR_UNSUPPORTED_PIXEL_FORMAT WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT
|
||||
|
||||
//
|
||||
// Error codes that were already returned in prior versions and were part of the
|
||||
// MIL facility.
|
||||
|
||||
//
|
||||
// Error codes mapped from WIN32 where there isn't already another HRESULT based
|
||||
// define
|
||||
//
|
||||
|
||||
//
|
||||
// The supplied buffer was too small to accomodate the data.
|
||||
//
|
||||
#define D2DERR_INSUFFICIENT_BUFFER HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
|
||||
|
||||
|
||||
//
|
||||
// D2D specific codes
|
||||
//
|
||||
|
||||
//
|
||||
// The object was not in the correct state to process the method.
|
||||
//
|
||||
#define D2DERR_WRONG_STATE MAKE_D2DHR_ERR(0x001)
|
||||
|
||||
//
|
||||
// The object has not yet been initialized.
|
||||
//
|
||||
#define D2DERR_NOT_INITIALIZED MAKE_D2DHR_ERR(0x002)
|
||||
|
||||
//
|
||||
// The requested opertion is not supported.
|
||||
//
|
||||
#define D2DERR_UNSUPPORTED_OPERATION MAKE_D2DHR_ERR(0x003)
|
||||
|
||||
//
|
||||
// The geomery scanner failed to process the data.
|
||||
//
|
||||
#define D2DERR_SCANNER_FAILED MAKE_D2DHR_ERR(0x004)
|
||||
|
||||
//
|
||||
// D2D could not access the screen.
|
||||
//
|
||||
#define D2DERR_SCREEN_ACCESS_DENIED MAKE_D2DHR_ERR(0x005)
|
||||
|
||||
//
|
||||
// A valid display state could not be determined.
|
||||
//
|
||||
#define D2DERR_DISPLAY_STATE_INVALID MAKE_D2DHR_ERR(0x006)
|
||||
|
||||
//
|
||||
// The supplied vector is vero.
|
||||
//
|
||||
#define D2DERR_ZERO_VECTOR MAKE_D2DHR_ERR(0x007)
|
||||
|
||||
//
|
||||
// An internal error (D2D bug) occurred. On checked builds, we would assert.
|
||||
//
|
||||
// The application should close this instance of D2D and should consider
|
||||
// restarting its process.
|
||||
//
|
||||
#define D2DERR_INTERNAL_ERROR MAKE_D2DHR_ERR(0x008)
|
||||
|
||||
//
|
||||
// The display format we need to render is not supported by the
|
||||
// hardware device.
|
||||
//
|
||||
#define D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED MAKE_D2DHR_ERR(0x009)
|
||||
|
||||
//
|
||||
// A call to this method is invalid.
|
||||
//
|
||||
#define D2DERR_INVALID_CALL MAKE_D2DHR_ERR(0x00A)
|
||||
|
||||
//
|
||||
// No HW rendering device is available for this operation.
|
||||
//
|
||||
#define D2DERR_NO_HARDWARE_DEVICE MAKE_D2DHR_ERR(0x00B)
|
||||
|
||||
//
|
||||
// There has been a presentation error that may be recoverable. The caller
|
||||
// needs to recreate, rerender the entire frame, and reattempt present.
|
||||
//
|
||||
#define D2DERR_RECREATE_TARGET MAKE_D2DHR_ERR(0x00C)
|
||||
|
||||
//
|
||||
// Shader construction failed because it was too complex.
|
||||
//
|
||||
#define D2DERR_TOO_MANY_SHADER_ELEMENTS MAKE_D2DHR_ERR(0x00D)
|
||||
|
||||
//
|
||||
// Shader compilation failed.
|
||||
//
|
||||
#define D2DERR_SHADER_COMPILE_FAILED MAKE_D2DHR_ERR(0x00E)
|
||||
|
||||
//
|
||||
// Requested DX surface size exceeded maximum texture size.
|
||||
//
|
||||
#define D2DERR_MAX_TEXTURE_SIZE_EXCEEDED MAKE_D2DHR_ERR(0x00F)
|
||||
|
||||
//
|
||||
// The requested D2D version is not supported.
|
||||
//
|
||||
#define D2DERR_UNSUPPORTED_VERSION MAKE_D2DHR_ERR(0x010)
|
||||
|
||||
//
|
||||
// Invalid number.
|
||||
//
|
||||
#define D2DERR_BAD_NUMBER MAKE_D2DHR_ERR(0x0011)
|
||||
|
||||
//
|
||||
// Objects used together must be created from the same factory instance.
|
||||
//
|
||||
#define D2DERR_WRONG_FACTORY MAKE_D2DHR_ERR(0x012)
|
||||
|
||||
//
|
||||
// A layer resource can only be in use once at any point in time.
|
||||
//
|
||||
#define D2DERR_LAYER_ALREADY_IN_USE MAKE_D2DHR_ERR(0x013)
|
||||
|
||||
//
|
||||
// The pop call did not match the corresponding push call
|
||||
//
|
||||
#define D2DERR_POP_CALL_DID_NOT_MATCH_PUSH MAKE_D2DHR_ERR(0x014)
|
||||
|
||||
//
|
||||
// The resource was realized on the wrong render target
|
||||
//
|
||||
#define D2DERR_WRONG_RENDER_TARGET MAKE_D2DHR_ERR(0x015)
|
||||
|
||||
//
|
||||
// The push and pop calls were unbalanced
|
||||
//
|
||||
#define D2DERR_PUSH_POP_UNBALANCED MAKE_D2DHR_ERR(0x016)
|
||||
|
||||
//
|
||||
// Attempt to copy from a render target while a layer or clip rect is applied
|
||||
//
|
||||
#define D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT MAKE_D2DHR_ERR(0x017)
|
||||
|
||||
//
|
||||
// The brush types are incompatible for the call.
|
||||
//
|
||||
#define D2DERR_INCOMPATIBLE_BRUSH_TYPES MAKE_D2DHR_ERR(0x018)
|
||||
|
||||
//
|
||||
// An unknown win32 failure occurred.
|
||||
//
|
||||
#define D2DERR_WIN32_ERROR MAKE_D2DHR_ERR(0x019)
|
||||
|
||||
//
|
||||
// The render target is not compatible with GDI
|
||||
//
|
||||
#define D2DERR_TARGET_NOT_GDI_COMPATIBLE MAKE_D2DHR_ERR(0x01A)
|
||||
|
||||
//
|
||||
// A text client drawing effect object is of the wrong type
|
||||
//
|
||||
#define D2DERR_TEXT_EFFECT_IS_WRONG_TYPE MAKE_D2DHR_ERR(0x01B)
|
||||
|
||||
//
|
||||
// The application is holding a reference to the IDWriteTextRenderer interface
|
||||
// after the corresponding DrawText or DrawTextLayout call has returned. The
|
||||
// IDWriteTextRenderer instance will be zombied.
|
||||
//
|
||||
#define D2DERR_TEXT_RENDERER_NOT_RELEASED MAKE_D2DHR_ERR(0x01C)
|
||||
|
||||
//
|
||||
// The requested size is larger than the guaranteed supported texture size.
|
||||
//
|
||||
#define D2DERR_EXCEEDS_MAX_BITMAP_SIZE MAKE_D2DHR_ERR(0x01D)
|
||||
6761
common/dx11sdk/D3D10.h
Normal file
6761
common/dx11sdk/D3D10.h
Normal file
File diff suppressed because it is too large
Load Diff
1796
common/dx11sdk/D3D10_1.h
Normal file
1796
common/dx11sdk/D3D10_1.h
Normal file
File diff suppressed because it is too large
Load Diff
300
common/dx11sdk/D3D10_1shader.h
Normal file
300
common/dx11sdk/D3D10_1shader.h
Normal file
@@ -0,0 +1,300 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3D10_1Shader.h
|
||||
// Content: D3D10.1 Shader Types and APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3D10_1SHADER_H__
|
||||
#define __D3D10_1SHADER_H__
|
||||
|
||||
#include "d3d10shader.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Shader debugging structures
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum _D3D10_SHADER_DEBUG_REGTYPE
|
||||
{
|
||||
D3D10_SHADER_DEBUG_REG_INPUT,
|
||||
D3D10_SHADER_DEBUG_REG_OUTPUT,
|
||||
D3D10_SHADER_DEBUG_REG_CBUFFER,
|
||||
D3D10_SHADER_DEBUG_REG_TBUFFER,
|
||||
D3D10_SHADER_DEBUG_REG_TEMP,
|
||||
D3D10_SHADER_DEBUG_REG_TEMPARRAY,
|
||||
D3D10_SHADER_DEBUG_REG_TEXTURE,
|
||||
D3D10_SHADER_DEBUG_REG_SAMPLER,
|
||||
D3D10_SHADER_DEBUG_REG_IMMEDIATECBUFFER,
|
||||
D3D10_SHADER_DEBUG_REG_LITERAL,
|
||||
D3D10_SHADER_DEBUG_REG_UNUSED,
|
||||
D3D11_SHADER_DEBUG_REG_INTERFACE_POINTERS,
|
||||
D3D10_SHADER_DEBUG_REG_FORCE_DWORD = 0x7fffffff,
|
||||
} D3D10_SHADER_DEBUG_REGTYPE;
|
||||
|
||||
typedef enum _D3D10_SHADER_DEBUG_SCOPETYPE
|
||||
{
|
||||
D3D10_SHADER_DEBUG_SCOPE_GLOBAL,
|
||||
D3D10_SHADER_DEBUG_SCOPE_BLOCK,
|
||||
D3D10_SHADER_DEBUG_SCOPE_FORLOOP,
|
||||
D3D10_SHADER_DEBUG_SCOPE_STRUCT,
|
||||
D3D10_SHADER_DEBUG_SCOPE_FUNC_PARAMS,
|
||||
D3D10_SHADER_DEBUG_SCOPE_STATEBLOCK,
|
||||
D3D10_SHADER_DEBUG_SCOPE_NAMESPACE,
|
||||
D3D10_SHADER_DEBUG_SCOPE_ANNOTATION,
|
||||
D3D10_SHADER_DEBUG_SCOPE_FORCE_DWORD = 0x7fffffff,
|
||||
} D3D10_SHADER_DEBUG_SCOPETYPE;
|
||||
|
||||
typedef enum _D3D10_SHADER_DEBUG_VARTYPE
|
||||
{
|
||||
D3D10_SHADER_DEBUG_VAR_VARIABLE,
|
||||
D3D10_SHADER_DEBUG_VAR_FUNCTION,
|
||||
D3D10_SHADER_DEBUG_VAR_FORCE_DWORD = 0x7fffffff,
|
||||
} D3D10_SHADER_DEBUG_VARTYPE;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// These are the serialized structures that get written to the file
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_TOKEN_INFO
|
||||
{
|
||||
UINT File; // offset into file list
|
||||
UINT Line; // line #
|
||||
UINT Column; // column #
|
||||
|
||||
UINT TokenLength;
|
||||
UINT TokenId; // offset to LPCSTR of length TokenLength in string datastore
|
||||
} D3D10_SHADER_DEBUG_TOKEN_INFO;
|
||||
|
||||
// Variable list
|
||||
typedef struct _D3D10_SHADER_DEBUG_VAR_INFO
|
||||
{
|
||||
// Index into token list for declaring identifier
|
||||
UINT TokenId;
|
||||
D3D10_SHADER_VARIABLE_TYPE Type;
|
||||
// register and component for this variable, only valid/necessary for arrays
|
||||
UINT Register;
|
||||
UINT Component;
|
||||
// gives the original variable that declared this variable
|
||||
UINT ScopeVar;
|
||||
// this variable's offset in its ScopeVar
|
||||
UINT ScopeVarOffset;
|
||||
} D3D10_SHADER_DEBUG_VAR_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_INPUT_INFO
|
||||
{
|
||||
// index into array of variables of variable to initialize
|
||||
UINT Var;
|
||||
// input, cbuffer, tbuffer
|
||||
D3D10_SHADER_DEBUG_REGTYPE InitialRegisterSet;
|
||||
// set to cbuffer or tbuffer slot, geometry shader input primitive #,
|
||||
// identifying register for indexable temp, or -1
|
||||
UINT InitialBank;
|
||||
// -1 if temp, otherwise gives register in register set
|
||||
UINT InitialRegister;
|
||||
// -1 if temp, otherwise gives component
|
||||
UINT InitialComponent;
|
||||
// initial value if literal
|
||||
UINT InitialValue;
|
||||
} D3D10_SHADER_DEBUG_INPUT_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_SCOPEVAR_INFO
|
||||
{
|
||||
// Index into variable token
|
||||
UINT TokenId;
|
||||
|
||||
D3D10_SHADER_DEBUG_VARTYPE VarType; // variable or function (different namespaces)
|
||||
D3D10_SHADER_VARIABLE_CLASS Class;
|
||||
UINT Rows; // number of rows (matrices)
|
||||
UINT Columns; // number of columns (vectors and matrices)
|
||||
|
||||
// In an array of structures, one struct member scope is provided, and
|
||||
// you'll have to add the array stride times the index to the variable
|
||||
// index you find, then find that variable in this structure's list of
|
||||
// variables.
|
||||
|
||||
// gives a scope to look up struct members. -1 if not a struct
|
||||
UINT StructMemberScope;
|
||||
|
||||
// number of array indices
|
||||
UINT uArrayIndices; // a[3][2][1] has 3 indices
|
||||
// maximum array index for each index
|
||||
// offset to UINT[uArrayIndices] in UINT datastore
|
||||
UINT ArrayElements; // a[3][2][1] has {3, 2, 1}
|
||||
// how many variables each array index moves
|
||||
// offset to UINT[uArrayIndices] in UINT datastore
|
||||
UINT ArrayStrides; // a[3][2][1] has {2, 1, 1}
|
||||
|
||||
UINT uVariables;
|
||||
// index of the first variable, later variables are offsets from this one
|
||||
UINT uFirstVariable;
|
||||
} D3D10_SHADER_DEBUG_SCOPEVAR_INFO;
|
||||
|
||||
// scope data, this maps variable names to debug variables (useful for the watch window)
|
||||
typedef struct _D3D10_SHADER_DEBUG_SCOPE_INFO
|
||||
{
|
||||
D3D10_SHADER_DEBUG_SCOPETYPE ScopeType;
|
||||
UINT Name; // offset to name of scope in strings list
|
||||
UINT uNameLen; // length of name string
|
||||
UINT uVariables;
|
||||
UINT VariableData; // Offset to UINT[uVariables] indexing the Scope Variable list
|
||||
} D3D10_SHADER_DEBUG_SCOPE_INFO;
|
||||
|
||||
// instruction outputs
|
||||
typedef struct _D3D10_SHADER_DEBUG_OUTPUTVAR
|
||||
{
|
||||
// index variable being written to, if -1 it's not going to a variable
|
||||
UINT Var;
|
||||
// range data that the compiler expects to be true
|
||||
UINT uValueMin, uValueMax;
|
||||
INT iValueMin, iValueMax;
|
||||
FLOAT fValueMin, fValueMax;
|
||||
|
||||
BOOL bNaNPossible, bInfPossible;
|
||||
} D3D10_SHADER_DEBUG_OUTPUTVAR;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_OUTPUTREG_INFO
|
||||
{
|
||||
// Only temp, indexable temp, and output are valid here
|
||||
D3D10_SHADER_DEBUG_REGTYPE OutputRegisterSet;
|
||||
// -1 means no output
|
||||
UINT OutputReg;
|
||||
// if a temp array, identifier for which one
|
||||
UINT TempArrayReg;
|
||||
// -1 means masked out
|
||||
UINT OutputComponents[4];
|
||||
D3D10_SHADER_DEBUG_OUTPUTVAR OutputVars[4];
|
||||
// when indexing the output, get the value of this register, then add
|
||||
// that to uOutputReg. If uIndexReg is -1, then there is no index.
|
||||
// find the variable whose register is the sum (by looking in the ScopeVar)
|
||||
// and component matches, then set it. This should only happen for indexable
|
||||
// temps and outputs.
|
||||
UINT IndexReg;
|
||||
UINT IndexComp;
|
||||
} D3D10_SHADER_DEBUG_OUTPUTREG_INFO;
|
||||
|
||||
// per instruction data
|
||||
typedef struct _D3D10_SHADER_DEBUG_INST_INFO
|
||||
{
|
||||
UINT Id; // Which instruction this is in the bytecode
|
||||
UINT Opcode; // instruction type
|
||||
|
||||
// 0, 1, or 2
|
||||
UINT uOutputs;
|
||||
|
||||
// up to two outputs per instruction
|
||||
D3D10_SHADER_DEBUG_OUTPUTREG_INFO pOutputs[2];
|
||||
|
||||
// index into the list of tokens for this instruction's token
|
||||
UINT TokenId;
|
||||
|
||||
// how many function calls deep this instruction is
|
||||
UINT NestingLevel;
|
||||
|
||||
// list of scopes from outer-most to inner-most
|
||||
// Number of scopes
|
||||
UINT Scopes;
|
||||
UINT ScopeInfo; // Offset to UINT[uScopes] specifying indices of the ScopeInfo Array
|
||||
|
||||
// list of variables accessed by this instruction
|
||||
// Number of variables
|
||||
UINT AccessedVars;
|
||||
UINT AccessedVarsInfo; // Offset to UINT[AccessedVars] specifying indices of the ScopeVariableInfo Array
|
||||
} D3D10_SHADER_DEBUG_INST_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_FILE_INFO
|
||||
{
|
||||
UINT FileName; // Offset to LPCSTR for file name
|
||||
UINT FileNameLen; // Length of file name
|
||||
UINT FileData; // Offset to LPCSTR of length FileLen
|
||||
UINT FileLen; // Length of file
|
||||
} D3D10_SHADER_DEBUG_FILE_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_INFO
|
||||
{
|
||||
UINT Size; // sizeof(D3D10_SHADER_DEBUG_INFO)
|
||||
UINT Creator; // Offset to LPCSTR for compiler version
|
||||
UINT EntrypointName; // Offset to LPCSTR for Entry point name
|
||||
UINT ShaderTarget; // Offset to LPCSTR for shader target
|
||||
UINT CompileFlags; // flags used to compile
|
||||
UINT Files; // number of included files
|
||||
UINT FileInfo; // Offset to D3D10_SHADER_DEBUG_FILE_INFO[Files]
|
||||
UINT Instructions; // number of instructions
|
||||
UINT InstructionInfo; // Offset to D3D10_SHADER_DEBUG_INST_INFO[Instructions]
|
||||
UINT Variables; // number of variables
|
||||
UINT VariableInfo; // Offset to D3D10_SHADER_DEBUG_VAR_INFO[Variables]
|
||||
UINT InputVariables; // number of variables to initialize before running
|
||||
UINT InputVariableInfo; // Offset to D3D10_SHADER_DEBUG_INPUT_INFO[InputVariables]
|
||||
UINT Tokens; // number of tokens to initialize
|
||||
UINT TokenInfo; // Offset to D3D10_SHADER_DEBUG_TOKEN_INFO[Tokens]
|
||||
UINT Scopes; // number of scopes
|
||||
UINT ScopeInfo; // Offset to D3D10_SHADER_DEBUG_SCOPE_INFO[Scopes]
|
||||
UINT ScopeVariables; // number of variables declared
|
||||
UINT ScopeVariableInfo; // Offset to D3D10_SHADER_DEBUG_SCOPEVAR_INFO[Scopes]
|
||||
UINT UintOffset; // Offset to the UINT datastore, all UINT offsets are from this offset
|
||||
UINT StringOffset; // Offset to the string datastore, all string offsets are from this offset
|
||||
} D3D10_SHADER_DEBUG_INFO;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ID3D10ShaderReflection1:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Interface definitions
|
||||
//
|
||||
|
||||
typedef interface ID3D10ShaderReflection1 ID3D10ShaderReflection1;
|
||||
typedef interface ID3D10ShaderReflection1 *LPD3D10SHADERREFLECTION1;
|
||||
|
||||
// {C3457783-A846-47CE-9520-CEA6F66E7447}
|
||||
DEFINE_GUID(IID_ID3D10ShaderReflection1,
|
||||
0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D10ShaderReflection1
|
||||
|
||||
DECLARE_INTERFACE_(ID3D10ShaderReflection1, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ LPCSTR Name, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetMovInstructionCount)(THIS_ UINT* pCount) PURE;
|
||||
STDMETHOD(GetMovcInstructionCount)(THIS_ UINT* pCount) PURE;
|
||||
STDMETHOD(GetConversionInstructionCount)(THIS_ UINT* pCount) PURE;
|
||||
STDMETHOD(GetBitwiseInstructionCount)(THIS_ UINT* pCount) PURE;
|
||||
|
||||
STDMETHOD(GetGSInputPrimitive)(THIS_ D3D10_PRIMITIVE* pPrim) PURE;
|
||||
STDMETHOD(IsLevel9Shader)(THIS_ BOOL* pbLevel9Shader) PURE;
|
||||
STDMETHOD(IsSampleFrequencyShader)(THIS_ BOOL* pbSampleFrequency) PURE;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// APIs //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3D10_1SHADER_H__
|
||||
|
||||
1455
common/dx11sdk/D3D10effect.h
Normal file
1455
common/dx11sdk/D3D10effect.h
Normal file
File diff suppressed because it is too large
Load Diff
733
common/dx11sdk/D3D10shader.h
Normal file
733
common/dx11sdk/D3D10shader.h
Normal file
@@ -0,0 +1,733 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3D10Shader.h
|
||||
// Content: D3D10 Shader Types and APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3D10SHADER_H__
|
||||
#define __D3D10SHADER_H__
|
||||
|
||||
#include "d3d10.h"
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// D3D10_TX_VERSION:
|
||||
// --------------
|
||||
// Version token used to create a procedural texture filler in effects
|
||||
// Used by D3D10Fill[]TX functions
|
||||
//---------------------------------------------------------------------------
|
||||
#define D3D10_TX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor))
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10SHADER flags:
|
||||
// -----------------
|
||||
// D3D10_SHADER_DEBUG
|
||||
// Insert debug file/line/type/symbol information.
|
||||
//
|
||||
// D3D10_SHADER_SKIP_VALIDATION
|
||||
// Do not validate the generated code against known capabilities and
|
||||
// constraints. This option is only recommended when compiling shaders
|
||||
// you KNOW will work. (ie. have compiled before without this option.)
|
||||
// Shaders are always validated by D3D before they are set to the device.
|
||||
//
|
||||
// D3D10_SHADER_SKIP_OPTIMIZATION
|
||||
// Instructs the compiler to skip optimization steps during code generation.
|
||||
// Unless you are trying to isolate a problem in your code using this option
|
||||
// is not recommended.
|
||||
//
|
||||
// D3D10_SHADER_PACK_MATRIX_ROW_MAJOR
|
||||
// Unless explicitly specified, matrices will be packed in row-major order
|
||||
// on input and output from the shader.
|
||||
//
|
||||
// D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR
|
||||
// Unless explicitly specified, matrices will be packed in column-major
|
||||
// order on input and output from the shader. This is generally more
|
||||
// efficient, since it allows vector-matrix multiplication to be performed
|
||||
// using a series of dot-products.
|
||||
//
|
||||
// D3D10_SHADER_PARTIAL_PRECISION
|
||||
// Force all computations in resulting shader to occur at partial precision.
|
||||
// This may result in faster evaluation of shaders on some hardware.
|
||||
//
|
||||
// D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT
|
||||
// Force compiler to compile against the next highest available software
|
||||
// target for vertex shaders. This flag also turns optimizations off,
|
||||
// and debugging on.
|
||||
//
|
||||
// D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT
|
||||
// Force compiler to compile against the next highest available software
|
||||
// target for pixel shaders. This flag also turns optimizations off,
|
||||
// and debugging on.
|
||||
//
|
||||
// D3D10_SHADER_NO_PRESHADER
|
||||
// Disables Preshaders. Using this flag will cause the compiler to not
|
||||
// pull out static expression for evaluation on the host cpu
|
||||
//
|
||||
// D3D10_SHADER_AVOID_FLOW_CONTROL
|
||||
// Hint compiler to avoid flow-control constructs where possible.
|
||||
//
|
||||
// D3D10_SHADER_PREFER_FLOW_CONTROL
|
||||
// Hint compiler to prefer flow-control constructs where possible.
|
||||
//
|
||||
// D3D10_SHADER_ENABLE_STRICTNESS
|
||||
// By default, the HLSL/Effect compilers are not strict on deprecated syntax.
|
||||
// Specifying this flag enables the strict mode. Deprecated syntax may be
|
||||
// removed in a future release, and enabling syntax is a good way to make sure
|
||||
// your shaders comply to the latest spec.
|
||||
//
|
||||
// D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY
|
||||
// This enables older shaders to compile to 4_0 targets.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#define D3D10_SHADER_DEBUG (1 << 0)
|
||||
#define D3D10_SHADER_SKIP_VALIDATION (1 << 1)
|
||||
#define D3D10_SHADER_SKIP_OPTIMIZATION (1 << 2)
|
||||
#define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR (1 << 3)
|
||||
#define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR (1 << 4)
|
||||
#define D3D10_SHADER_PARTIAL_PRECISION (1 << 5)
|
||||
#define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT (1 << 6)
|
||||
#define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT (1 << 7)
|
||||
#define D3D10_SHADER_NO_PRESHADER (1 << 8)
|
||||
#define D3D10_SHADER_AVOID_FLOW_CONTROL (1 << 9)
|
||||
#define D3D10_SHADER_PREFER_FLOW_CONTROL (1 << 10)
|
||||
#define D3D10_SHADER_ENABLE_STRICTNESS (1 << 11)
|
||||
#define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12)
|
||||
#define D3D10_SHADER_IEEE_STRICTNESS (1 << 13)
|
||||
|
||||
|
||||
// optimization level flags
|
||||
#define D3D10_SHADER_OPTIMIZATION_LEVEL0 (1 << 14)
|
||||
#define D3D10_SHADER_OPTIMIZATION_LEVEL1 0
|
||||
#define D3D10_SHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
|
||||
#define D3D10_SHADER_OPTIMIZATION_LEVEL3 (1 << 15)
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10_SHADER_MACRO:
|
||||
// ----------
|
||||
// Preprocessor macro definition. The application pass in a NULL-terminated
|
||||
// array of this structure to various D3D10 APIs. This enables the application
|
||||
// to #define tokens at runtime, before the file is parsed.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct _D3D10_SHADER_MACRO
|
||||
{
|
||||
LPCSTR Name;
|
||||
LPCSTR Definition;
|
||||
|
||||
} D3D10_SHADER_MACRO, *LPD3D10_SHADER_MACRO;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10_SHADER_VARIABLE_CLASS:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum _D3D10_SHADER_VARIABLE_CLASS
|
||||
{
|
||||
D3D10_SVC_SCALAR,
|
||||
D3D10_SVC_VECTOR,
|
||||
D3D10_SVC_MATRIX_ROWS,
|
||||
D3D10_SVC_MATRIX_COLUMNS,
|
||||
D3D10_SVC_OBJECT,
|
||||
D3D10_SVC_STRUCT,
|
||||
|
||||
D3D11_SVC_INTERFACE_CLASS,
|
||||
D3D11_SVC_INTERFACE_POINTER,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D10_SVC_FORCE_DWORD = 0x7fffffff
|
||||
|
||||
} D3D10_SHADER_VARIABLE_CLASS, *LPD3D10_SHADER_VARIABLE_CLASS;
|
||||
|
||||
typedef enum _D3D10_SHADER_VARIABLE_FLAGS
|
||||
{
|
||||
D3D10_SVF_USERPACKED = 1,
|
||||
D3D10_SVF_USED = 2,
|
||||
|
||||
D3D11_SVF_INTERFACE_POINTER = 4,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D10_SVF_FORCE_DWORD = 0x7fffffff
|
||||
|
||||
} D3D10_SHADER_VARIABLE_FLAGS, *LPD3D10_SHADER_VARIABLE_FLAGS;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10_SHADER_VARIABLE_TYPE:
|
||||
//----------------------------------------------------------------------------
|
||||
typedef enum _D3D10_SHADER_VARIABLE_TYPE
|
||||
{
|
||||
D3D10_SVT_VOID = 0,
|
||||
D3D10_SVT_BOOL = 1,
|
||||
D3D10_SVT_INT = 2,
|
||||
D3D10_SVT_FLOAT = 3,
|
||||
D3D10_SVT_STRING = 4,
|
||||
D3D10_SVT_TEXTURE = 5,
|
||||
D3D10_SVT_TEXTURE1D = 6,
|
||||
D3D10_SVT_TEXTURE2D = 7,
|
||||
D3D10_SVT_TEXTURE3D = 8,
|
||||
D3D10_SVT_TEXTURECUBE = 9,
|
||||
D3D10_SVT_SAMPLER = 10,
|
||||
D3D10_SVT_PIXELSHADER = 15,
|
||||
D3D10_SVT_VERTEXSHADER = 16,
|
||||
D3D10_SVT_UINT = 19,
|
||||
D3D10_SVT_UINT8 = 20,
|
||||
D3D10_SVT_GEOMETRYSHADER = 21,
|
||||
D3D10_SVT_RASTERIZER = 22,
|
||||
D3D10_SVT_DEPTHSTENCIL = 23,
|
||||
D3D10_SVT_BLEND = 24,
|
||||
D3D10_SVT_BUFFER = 25,
|
||||
D3D10_SVT_CBUFFER = 26,
|
||||
D3D10_SVT_TBUFFER = 27,
|
||||
D3D10_SVT_TEXTURE1DARRAY = 28,
|
||||
D3D10_SVT_TEXTURE2DARRAY = 29,
|
||||
D3D10_SVT_RENDERTARGETVIEW = 30,
|
||||
D3D10_SVT_DEPTHSTENCILVIEW = 31,
|
||||
|
||||
D3D10_SVT_TEXTURE2DMS = 32,
|
||||
D3D10_SVT_TEXTURE2DMSARRAY = 33,
|
||||
|
||||
D3D10_SVT_TEXTURECUBEARRAY = 34,
|
||||
|
||||
D3D11_SVT_HULLSHADER = 35,
|
||||
D3D11_SVT_DOMAINSHADER = 36,
|
||||
|
||||
D3D11_SVT_INTERFACE_POINTER = 37,
|
||||
D3D11_SVT_COMPUTESHADER = 38,
|
||||
|
||||
D3D11_SVT_DOUBLE = 39,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D10_SVT_FORCE_DWORD = 0x7fffffff
|
||||
|
||||
} D3D10_SHADER_VARIABLE_TYPE, *LPD3D10_SHADER_VARIABLE_TYPE;
|
||||
|
||||
typedef enum _D3D10_SHADER_INPUT_FLAGS
|
||||
{
|
||||
D3D10_SIF_USERPACKED = 1,
|
||||
D3D10_SIF_COMPARISON_SAMPLER = 2, // is this a comparison sampler?
|
||||
D3D10_SIF_TEXTURE_COMPONENT_0 = 4, // this 2-bit value encodes c - 1, where c
|
||||
D3D10_SIF_TEXTURE_COMPONENT_1 = 8, // is the number of components in the texture
|
||||
D3D10_SIF_TEXTURE_COMPONENTS = 12,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D10_SIF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D10_SHADER_INPUT_FLAGS, *LPD3D10_SHADER_INPUT_FLAGS;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10_SHADER_INPUT_TYPE
|
||||
//----------------------------------------------------------------------------
|
||||
typedef enum _D3D10_SHADER_INPUT_TYPE
|
||||
{
|
||||
D3D10_SIT_CBUFFER,
|
||||
D3D10_SIT_TBUFFER,
|
||||
D3D10_SIT_TEXTURE,
|
||||
D3D10_SIT_SAMPLER,
|
||||
D3D11_SIT_UAV_RWTYPED,
|
||||
D3D11_SIT_STRUCTURED,
|
||||
D3D11_SIT_UAV_RWSTRUCTURED,
|
||||
D3D11_SIT_BYTEADDRESS,
|
||||
D3D11_SIT_UAV_RWBYTEADDRESS,
|
||||
D3D11_SIT_UAV_APPEND_BYTEADDRESS,
|
||||
D3D11_SIT_UAV_CONSUME_BYTEADDRESS,
|
||||
D3D11_SIT_UAV_APPEND_STRUCTURED,
|
||||
D3D11_SIT_UAV_CONSUME_STRUCTURED,
|
||||
} D3D10_SHADER_INPUT_TYPE, *LPD3D10_SHADER_INPUT_TYPE;
|
||||
|
||||
typedef enum _D3D10_SHADER_CBUFFER_FLAGS
|
||||
{
|
||||
D3D10_CBF_USERPACKED = 1,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D10_CBF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D10_SHADER_CBUFFER_FLAGS, *LPD3D10_SHADER_CBUFFER_FLAGS;
|
||||
|
||||
typedef enum _D3D10_CBUFFER_TYPE
|
||||
{
|
||||
D3D10_CT_CBUFFER,
|
||||
D3D10_CT_TBUFFER,
|
||||
} D3D10_CBUFFER_TYPE, *LPD3D10_CBUFFER_TYPE;
|
||||
|
||||
typedef enum D3D10_NAME
|
||||
{
|
||||
D3D10_NAME_UNDEFINED = 0,
|
||||
|
||||
// Names meaningful to both HLSL and hardware
|
||||
D3D10_NAME_POSITION = 1,
|
||||
D3D10_NAME_CLIP_DISTANCE = 2,
|
||||
D3D10_NAME_CULL_DISTANCE = 3,
|
||||
D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = 4,
|
||||
D3D10_NAME_VIEWPORT_ARRAY_INDEX = 5,
|
||||
D3D10_NAME_VERTEX_ID = 6,
|
||||
D3D10_NAME_PRIMITIVE_ID = 7,
|
||||
D3D10_NAME_INSTANCE_ID = 8,
|
||||
D3D10_NAME_IS_FRONT_FACE = 9,
|
||||
D3D10_NAME_SAMPLE_INDEX = 10,
|
||||
D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11,
|
||||
D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12,
|
||||
D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13,
|
||||
D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14,
|
||||
D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15,
|
||||
D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16,
|
||||
|
||||
// Names meaningful to HLSL only
|
||||
D3D10_NAME_TARGET = 64,
|
||||
D3D10_NAME_DEPTH = 65,
|
||||
D3D10_NAME_COVERAGE = 66,
|
||||
D3D11_NAME_DEPTH_GREATER_EQUAL = 67,
|
||||
D3D11_NAME_DEPTH_LESS_EQUAL = 68,
|
||||
|
||||
} D3D10_NAME;
|
||||
|
||||
typedef enum D3D10_RESOURCE_RETURN_TYPE
|
||||
{
|
||||
D3D10_RETURN_TYPE_UNORM = 1,
|
||||
D3D10_RETURN_TYPE_SNORM = 2,
|
||||
D3D10_RETURN_TYPE_SINT = 3,
|
||||
D3D10_RETURN_TYPE_UINT = 4,
|
||||
D3D10_RETURN_TYPE_FLOAT = 5,
|
||||
D3D10_RETURN_TYPE_MIXED = 6,
|
||||
} D3D10_RESOURCE_RETURN_TYPE;
|
||||
|
||||
typedef enum D3D10_REGISTER_COMPONENT_TYPE
|
||||
{
|
||||
D3D10_REGISTER_COMPONENT_UNKNOWN = 0,
|
||||
D3D10_REGISTER_COMPONENT_UINT32 = 1,
|
||||
D3D10_REGISTER_COMPONENT_SINT32 = 2,
|
||||
D3D10_REGISTER_COMPONENT_FLOAT32 = 3
|
||||
} D3D10_REGISTER_COMPONENT_TYPE;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10_INCLUDE_TYPE:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum _D3D10_INCLUDE_TYPE
|
||||
{
|
||||
D3D10_INCLUDE_LOCAL,
|
||||
D3D10_INCLUDE_SYSTEM,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D10_INCLUDE_FORCE_DWORD = 0x7fffffff
|
||||
|
||||
} D3D10_INCLUDE_TYPE, *LPD3D10_INCLUDE_TYPE;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ID3D10Include:
|
||||
// -------------
|
||||
// This interface is intended to be implemented by the application, and can
|
||||
// be used by various D3D10 APIs. This enables application-specific handling
|
||||
// of #include directives in source files.
|
||||
//
|
||||
// Open()
|
||||
// Opens an include file. If successful, it should fill in ppData and
|
||||
// pBytes. The data pointer returned must remain valid until Close is
|
||||
// subsequently called. The name of the file is encoded in UTF-8 format.
|
||||
// Close()
|
||||
// Closes an include file. If Open was successful, Close is guaranteed
|
||||
// to be called before the API using this interface returns.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef interface ID3D10Include ID3D10Include;
|
||||
typedef interface ID3D10Include *LPD3D10INCLUDE;
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D10Include
|
||||
|
||||
DECLARE_INTERFACE(ID3D10Include)
|
||||
{
|
||||
STDMETHOD(Open)(THIS_ D3D10_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE;
|
||||
STDMETHOD(Close)(THIS_ LPCVOID pData) PURE;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ID3D10ShaderReflection:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Structure definitions
|
||||
//
|
||||
|
||||
typedef struct _D3D10_SHADER_DESC
|
||||
{
|
||||
UINT Version; // Shader version
|
||||
LPCSTR Creator; // Creator string
|
||||
UINT Flags; // Shader compilation/parse flags
|
||||
|
||||
UINT ConstantBuffers; // Number of constant buffers
|
||||
UINT BoundResources; // Number of bound resources
|
||||
UINT InputParameters; // Number of parameters in the input signature
|
||||
UINT OutputParameters; // Number of parameters in the output signature
|
||||
|
||||
UINT InstructionCount; // Number of emitted instructions
|
||||
UINT TempRegisterCount; // Number of temporary registers used
|
||||
UINT TempArrayCount; // Number of temporary arrays used
|
||||
UINT DefCount; // Number of constant defines
|
||||
UINT DclCount; // Number of declarations (input + output)
|
||||
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
|
||||
UINT TextureLoadInstructions; // Number of texture load instructions
|
||||
UINT TextureCompInstructions; // Number of texture comparison instructions
|
||||
UINT TextureBiasInstructions; // Number of texture bias instructions
|
||||
UINT TextureGradientInstructions; // Number of texture gradient instructions
|
||||
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
|
||||
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
|
||||
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
|
||||
UINT StaticFlowControlCount; // Number of static flow control instructions used
|
||||
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
|
||||
UINT MacroInstructionCount; // Number of macro instructions used
|
||||
UINT ArrayInstructionCount; // Number of array instructions used
|
||||
UINT CutInstructionCount; // Number of cut instructions used
|
||||
UINT EmitInstructionCount; // Number of emit instructions used
|
||||
D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
|
||||
UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
|
||||
} D3D10_SHADER_DESC;
|
||||
|
||||
typedef struct _D3D10_SHADER_BUFFER_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the constant buffer
|
||||
D3D10_CBUFFER_TYPE Type; // Indicates that this is a CBuffer or TBuffer
|
||||
UINT Variables; // Number of member variables
|
||||
UINT Size; // Size of CB (in bytes)
|
||||
UINT uFlags; // Buffer description flags
|
||||
} D3D10_SHADER_BUFFER_DESC;
|
||||
|
||||
typedef struct _D3D10_SHADER_VARIABLE_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the variable
|
||||
UINT StartOffset; // Offset in constant buffer's backing store
|
||||
UINT Size; // Size of variable (in bytes)
|
||||
UINT uFlags; // Variable flags
|
||||
LPVOID DefaultValue; // Raw pointer to default value
|
||||
} D3D10_SHADER_VARIABLE_DESC;
|
||||
|
||||
typedef struct _D3D10_SHADER_TYPE_DESC
|
||||
{
|
||||
D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
|
||||
D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
|
||||
UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
|
||||
UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
|
||||
UINT Elements; // Number of elements (0 if not an array)
|
||||
UINT Members; // Number of members (0 if not a structure)
|
||||
UINT Offset; // Offset from the start of structure (0 if not a structure member)
|
||||
} D3D10_SHADER_TYPE_DESC;
|
||||
|
||||
typedef struct _D3D10_SHADER_INPUT_BIND_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the resource
|
||||
D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
|
||||
UINT BindPoint; // Starting bind point
|
||||
UINT BindCount; // Number of contiguous bind points (for arrays)
|
||||
|
||||
UINT uFlags; // Input binding flags
|
||||
D3D10_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
|
||||
D3D10_SRV_DIMENSION Dimension; // Dimension (if texture)
|
||||
UINT NumSamples; // Number of samples (0 if not MS texture)
|
||||
} D3D10_SHADER_INPUT_BIND_DESC;
|
||||
|
||||
typedef struct _D3D10_SIGNATURE_PARAMETER_DESC
|
||||
{
|
||||
LPCSTR SemanticName; // Name of the semantic
|
||||
UINT SemanticIndex; // Index of the semantic
|
||||
UINT Register; // Number of member variables
|
||||
D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable
|
||||
D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.)
|
||||
BYTE Mask; // Mask to indicate which components of the register
|
||||
// are used (combination of D3D10_COMPONENT_MASK values)
|
||||
BYTE ReadWriteMask; // Mask to indicate whether a given component is
|
||||
// never written (if this is an output signature) or
|
||||
// always read (if this is an input signature).
|
||||
// (combination of D3D10_COMPONENT_MASK values)
|
||||
|
||||
} D3D10_SIGNATURE_PARAMETER_DESC;
|
||||
|
||||
|
||||
//
|
||||
// Interface definitions
|
||||
//
|
||||
|
||||
typedef interface ID3D10ShaderReflectionType ID3D10ShaderReflectionType;
|
||||
typedef interface ID3D10ShaderReflectionType *LPD3D10SHADERREFLECTIONTYPE;
|
||||
|
||||
// {C530AD7D-9B16-4395-A979-BA2ECFF83ADD}
|
||||
DEFINE_GUID(IID_ID3D10ShaderReflectionType,
|
||||
0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D10ShaderReflectionType
|
||||
|
||||
DECLARE_INTERFACE(ID3D10ShaderReflectionType)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE;
|
||||
STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT Index) PURE;
|
||||
};
|
||||
|
||||
typedef interface ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable;
|
||||
typedef interface ID3D10ShaderReflectionVariable *LPD3D10SHADERREFLECTIONVARIABLE;
|
||||
|
||||
// {1BF63C95-2650-405d-99C1-3636BD1DA0A1}
|
||||
DEFINE_GUID(IID_ID3D10ShaderReflectionVariable,
|
||||
0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D10ShaderReflectionVariable
|
||||
|
||||
DECLARE_INTERFACE(ID3D10ShaderReflectionVariable)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_VARIABLE_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionType*, GetType)(THIS) PURE;
|
||||
};
|
||||
|
||||
typedef interface ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer;
|
||||
typedef interface ID3D10ShaderReflectionConstantBuffer *LPD3D10SHADERREFLECTIONCONSTANTBUFFER;
|
||||
|
||||
// {66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0}
|
||||
DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer,
|
||||
0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D10ShaderReflectionConstantBuffer
|
||||
|
||||
DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_BUFFER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE;
|
||||
};
|
||||
|
||||
typedef interface ID3D10ShaderReflection ID3D10ShaderReflection;
|
||||
typedef interface ID3D10ShaderReflection *LPD3D10SHADERREFLECTION;
|
||||
|
||||
// {D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA}
|
||||
DEFINE_GUID(IID_ID3D10ShaderReflection,
|
||||
0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D10ShaderReflection
|
||||
|
||||
DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// APIs //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10CompileShader:
|
||||
// ------------------
|
||||
// Compiles a shader.
|
||||
//
|
||||
// Parameters:
|
||||
// pSrcFile
|
||||
// Source file name.
|
||||
// hSrcModule
|
||||
// Module handle. if NULL, current module will be used.
|
||||
// pSrcResource
|
||||
// Resource name in module.
|
||||
// pSrcData
|
||||
// Pointer to source code.
|
||||
// SrcDataLen
|
||||
// Size of source code, in bytes.
|
||||
// pDefines
|
||||
// Optional NULL-terminated array of preprocessor macro definitions.
|
||||
// pInclude
|
||||
// Optional interface pointer to use for handling #include directives.
|
||||
// If this parameter is NULL, #includes will be honored when compiling
|
||||
// from file, and will error when compiling from resource or memory.
|
||||
// pFunctionName
|
||||
// Name of the entrypoint function where execution should begin.
|
||||
// pProfile
|
||||
// Instruction set to be used when generating code. The D3D10 entry
|
||||
// point currently supports only "vs_4_0", "ps_4_0", and "gs_4_0".
|
||||
// Flags
|
||||
// See D3D10_SHADER_xxx flags.
|
||||
// ppShader
|
||||
// Returns a buffer containing the created shader. This buffer contains
|
||||
// the compiled shader code, as well as any embedded debug and symbol
|
||||
// table info. (See D3D10GetShaderConstantTable)
|
||||
// ppErrorMsgs
|
||||
// Returns a buffer containing a listing of errors and warnings that were
|
||||
// encountered during the compile. If you are running in a debugger,
|
||||
// these are the same messages you will see in your debug output.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3D10CompileShader(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10DisassembleShader:
|
||||
// ----------------------
|
||||
// Takes a binary shader, and returns a buffer containing text assembly.
|
||||
//
|
||||
// Parameters:
|
||||
// pShader
|
||||
// Pointer to the shader byte code.
|
||||
// BytecodeLength
|
||||
// Size of the shader byte code in bytes.
|
||||
// EnableColorCode
|
||||
// Emit HTML tags for color coding the output?
|
||||
// pComments
|
||||
// Pointer to a comment string to include at the top of the shader.
|
||||
// ppDisassembly
|
||||
// Returns a buffer containing the disassembled shader.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3D10DisassembleShader(CONST void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, LPCSTR pComments, ID3D10Blob** ppDisassembly);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10GetPixelShaderProfile/D3D10GetVertexShaderProfile/D3D10GetGeometryShaderProfile:
|
||||
// -----------------------------------------------------
|
||||
// Returns the name of the HLSL profile best suited to a given device.
|
||||
//
|
||||
// Parameters:
|
||||
// pDevice
|
||||
// Pointer to the device in question
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
LPCSTR WINAPI D3D10GetPixelShaderProfile(ID3D10Device *pDevice);
|
||||
|
||||
LPCSTR WINAPI D3D10GetVertexShaderProfile(ID3D10Device *pDevice);
|
||||
|
||||
LPCSTR WINAPI D3D10GetGeometryShaderProfile(ID3D10Device *pDevice);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10ReflectShader:
|
||||
// ------------------
|
||||
// Creates a shader reflection object that can be used to retrieve information
|
||||
// about a compiled shader
|
||||
//
|
||||
// Parameters:
|
||||
// pShaderBytecode
|
||||
// Pointer to a compiled shader (same pointer that is passed into
|
||||
// ID3D10Device::CreateShader)
|
||||
// BytecodeLength
|
||||
// Length of the shader bytecode buffer
|
||||
// ppReflector
|
||||
// [out] Returns a ID3D10ShaderReflection object that can be used to
|
||||
// retrieve shader resource and constant buffer information
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3D10ReflectShader(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10ShaderReflection **ppReflector);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10PreprocessShader
|
||||
// ---------------------
|
||||
// Creates a shader reflection object that can be used to retrieve information
|
||||
// about a compiled shader
|
||||
//
|
||||
// Parameters:
|
||||
// pSrcData
|
||||
// Pointer to source code
|
||||
// SrcDataLen
|
||||
// Size of source code, in bytes
|
||||
// pFileName
|
||||
// Source file name (used for error output)
|
||||
// pDefines
|
||||
// Optional NULL-terminated array of preprocessor macro definitions.
|
||||
// pInclude
|
||||
// Optional interface pointer to use for handling #include directives.
|
||||
// If this parameter is NULL, #includes will be honored when assembling
|
||||
// from file, and will error when assembling from resource or memory.
|
||||
// ppShaderText
|
||||
// Returns a buffer containing a single large string that represents
|
||||
// the resulting formatted token stream
|
||||
// ppErrorMsgs
|
||||
// Returns a buffer containing a listing of errors and warnings that were
|
||||
// encountered during assembly. If you are running in a debugger,
|
||||
// these are the same messages you will see in your debug output.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3D10PreprocessShader(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Shader blob manipulation routines
|
||||
// ---------------------------------
|
||||
//
|
||||
// void *pShaderBytecode - a buffer containing the result of an HLSL
|
||||
// compilation. Typically this opaque buffer contains several
|
||||
// discrete sections including the shader executable code, the input
|
||||
// signature, and the output signature. This can typically be retrieved
|
||||
// by calling ID3D10Blob::GetBufferPointer() on the returned blob
|
||||
// from HLSL's compile APIs.
|
||||
//
|
||||
// UINT BytecodeLength - the length of pShaderBytecode. This can
|
||||
// typically be retrieved by calling ID3D10Blob::GetBufferSize()
|
||||
// on the returned blob from HLSL's compile APIs.
|
||||
//
|
||||
// ID3D10Blob **ppSignatureBlob(s) - a newly created buffer that
|
||||
// contains only the signature portions of the original bytecode.
|
||||
// This is a copy; the original bytecode is not modified. You may
|
||||
// specify NULL for this parameter to have the bytecode validated
|
||||
// for the presence of the corresponding signatures without actually
|
||||
// copying them and creating a new blob.
|
||||
//
|
||||
// Returns E_INVALIDARG if any required parameters are NULL
|
||||
// Returns E_FAIL is the bytecode is corrupt or missing signatures
|
||||
// Returns S_OK on success
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
HRESULT WINAPI D3D10GetInputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob);
|
||||
HRESULT WINAPI D3D10GetOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob);
|
||||
HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D10GetShaderDebugInfo:
|
||||
// -----------------------
|
||||
// Gets shader debug info. Debug info is generated by D3D10CompileShader and is
|
||||
// embedded in the body of the shader.
|
||||
//
|
||||
// Parameters:
|
||||
// pShaderBytecode
|
||||
// Pointer to the function bytecode
|
||||
// BytecodeLength
|
||||
// Length of the shader bytecode buffer
|
||||
// ppDebugInfo
|
||||
// Buffer used to return debug info. For information about the layout
|
||||
// of this buffer, see definition of D3D10_SHADER_DEBUG_INFO above.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3D10GetShaderDebugInfo(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob** ppDebugInfo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3D10SHADER_H__
|
||||
|
||||
10330
common/dx11sdk/D3D11.h
Normal file
10330
common/dx11sdk/D3D11.h
Normal file
File diff suppressed because it is too large
Load Diff
1664
common/dx11sdk/D3D11SDKLayers.h
Normal file
1664
common/dx11sdk/D3D11SDKLayers.h
Normal file
File diff suppressed because it is too large
Load Diff
297
common/dx11sdk/D3D11Shader.h
Normal file
297
common/dx11sdk/D3D11Shader.h
Normal file
@@ -0,0 +1,297 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3D11Shader.h
|
||||
// Content: D3D11 Shader Types and APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3D11SHADER_H__
|
||||
#define __D3D11SHADER_H__
|
||||
|
||||
#include "d3d10_1shader.h"
|
||||
|
||||
|
||||
typedef enum D3D11_RESOURCE_RETURN_TYPE
|
||||
{
|
||||
D3D11_RETURN_TYPE_UNORM = 1,
|
||||
D3D11_RETURN_TYPE_SNORM = 2,
|
||||
D3D11_RETURN_TYPE_SINT = 3,
|
||||
D3D11_RETURN_TYPE_UINT = 4,
|
||||
D3D11_RETURN_TYPE_FLOAT = 5,
|
||||
D3D11_RETURN_TYPE_MIXED = 6,
|
||||
D3D11_RETURN_TYPE_DOUBLE = 7,
|
||||
D3D11_RETURN_TYPE_CONTINUED = 8,
|
||||
} D3D11_RESOURCE_RETURN_TYPE;
|
||||
|
||||
typedef enum _D3D11_CBUFFER_TYPE
|
||||
{
|
||||
D3D11_CT_CBUFFER,
|
||||
D3D11_CT_TBUFFER,
|
||||
D3D11_CT_INTERFACE_POINTERS,
|
||||
D3D11_CT_RESOURCE_BIND_INFO,
|
||||
} D3D11_CBUFFER_TYPE, *LPD3D11_CBUFFER_TYPE;
|
||||
|
||||
|
||||
typedef struct _D3D11_SIGNATURE_PARAMETER_DESC
|
||||
{
|
||||
LPCSTR SemanticName; // Name of the semantic
|
||||
UINT SemanticIndex; // Index of the semantic
|
||||
UINT Register; // Number of member variables
|
||||
D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable
|
||||
D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.)
|
||||
BYTE Mask; // Mask to indicate which components of the register
|
||||
// are used (combination of D3D10_COMPONENT_MASK values)
|
||||
BYTE ReadWriteMask; // Mask to indicate whether a given component is
|
||||
// never written (if this is an output signature) or
|
||||
// always read (if this is an input signature).
|
||||
// (combination of D3D10_COMPONENT_MASK values)
|
||||
UINT Stream; // Stream index
|
||||
} D3D11_SIGNATURE_PARAMETER_DESC;
|
||||
|
||||
typedef struct _D3D11_SHADER_BUFFER_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the constant buffer
|
||||
D3D11_CBUFFER_TYPE Type; // Indicates type of buffer content
|
||||
UINT Variables; // Number of member variables
|
||||
UINT Size; // Size of CB (in bytes)
|
||||
UINT uFlags; // Buffer description flags
|
||||
} D3D11_SHADER_BUFFER_DESC;
|
||||
|
||||
typedef struct _D3D11_SHADER_VARIABLE_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the variable
|
||||
UINT StartOffset; // Offset in constant buffer's backing store
|
||||
UINT Size; // Size of variable (in bytes)
|
||||
UINT uFlags; // Variable flags
|
||||
LPVOID DefaultValue; // Raw pointer to default value
|
||||
UINT StartTexture; // First texture index (or -1 if no textures used)
|
||||
UINT TextureSize; // Number of texture slots possibly used.
|
||||
UINT StartSampler; // First sampler index (or -1 if no textures used)
|
||||
UINT SamplerSize; // Number of sampler slots possibly used.
|
||||
} D3D11_SHADER_VARIABLE_DESC;
|
||||
|
||||
typedef struct _D3D11_SHADER_TYPE_DESC
|
||||
{
|
||||
D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
|
||||
D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
|
||||
UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
|
||||
UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
|
||||
UINT Elements; // Number of elements (0 if not an array)
|
||||
UINT Members; // Number of members (0 if not a structure)
|
||||
UINT Offset; // Offset from the start of structure (0 if not a structure member)
|
||||
LPCSTR Name; // Name of type, can be NULL
|
||||
} D3D11_SHADER_TYPE_DESC;
|
||||
|
||||
typedef enum D3D11_TESSELLATOR_DOMAIN
|
||||
{
|
||||
D3D11_TESSELLATOR_DOMAIN_UNDEFINED = 0,
|
||||
D3D11_TESSELLATOR_DOMAIN_ISOLINE = 1,
|
||||
D3D11_TESSELLATOR_DOMAIN_TRI = 2,
|
||||
D3D11_TESSELLATOR_DOMAIN_QUAD = 3
|
||||
} D3D11_TESSELLATOR_DOMAIN;
|
||||
|
||||
typedef enum D3D11_TESSELLATOR_PARTITIONING
|
||||
{
|
||||
D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = 0,
|
||||
D3D11_TESSELLATOR_PARTITIONING_INTEGER = 1,
|
||||
D3D11_TESSELLATOR_PARTITIONING_POW2 = 2,
|
||||
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3,
|
||||
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4
|
||||
} D3D11_TESSELLATOR_PARTITIONING;
|
||||
|
||||
typedef enum D3D11_TESSELLATOR_OUTPUT_PRIMITIVE
|
||||
{
|
||||
D3D11_TESSELLATOR_OUTPUT_UNDEFINED = 0,
|
||||
D3D11_TESSELLATOR_OUTPUT_POINT = 1,
|
||||
D3D11_TESSELLATOR_OUTPUT_LINE = 2,
|
||||
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3,
|
||||
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4
|
||||
} D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
|
||||
|
||||
typedef struct _D3D11_SHADER_DESC
|
||||
{
|
||||
UINT Version; // Shader version
|
||||
LPCSTR Creator; // Creator string
|
||||
UINT Flags; // Shader compilation/parse flags
|
||||
|
||||
UINT ConstantBuffers; // Number of constant buffers
|
||||
UINT BoundResources; // Number of bound resources
|
||||
UINT InputParameters; // Number of parameters in the input signature
|
||||
UINT OutputParameters; // Number of parameters in the output signature
|
||||
|
||||
UINT InstructionCount; // Number of emitted instructions
|
||||
UINT TempRegisterCount; // Number of temporary registers used
|
||||
UINT TempArrayCount; // Number of temporary arrays used
|
||||
UINT DefCount; // Number of constant defines
|
||||
UINT DclCount; // Number of declarations (input + output)
|
||||
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
|
||||
UINT TextureLoadInstructions; // Number of texture load instructions
|
||||
UINT TextureCompInstructions; // Number of texture comparison instructions
|
||||
UINT TextureBiasInstructions; // Number of texture bias instructions
|
||||
UINT TextureGradientInstructions; // Number of texture gradient instructions
|
||||
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
|
||||
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
|
||||
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
|
||||
UINT StaticFlowControlCount; // Number of static flow control instructions used
|
||||
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
|
||||
UINT MacroInstructionCount; // Number of macro instructions used
|
||||
UINT ArrayInstructionCount; // Number of array instructions used
|
||||
UINT CutInstructionCount; // Number of cut instructions used
|
||||
UINT EmitInstructionCount; // Number of emit instructions used
|
||||
D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
|
||||
UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
|
||||
D3D11_PRIMITIVE InputPrimitive; // GS/HS input primitive
|
||||
UINT PatchConstantParameters; // Number of parameters in the patch constant signature
|
||||
UINT cGSInstanceCount; // Number of Geometry shader instances
|
||||
UINT cControlPoints; // Number of control points in the HS->DS stage
|
||||
D3D11_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator
|
||||
D3D11_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator
|
||||
D3D11_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline)
|
||||
// instruction counts
|
||||
UINT cBarrierInstructions; // Number of barrier instructions in a compute shader
|
||||
UINT cInterlockedInstructions; // Number of interlocked instructions
|
||||
UINT cTextureStoreInstructions; // Number of texture writes
|
||||
} D3D11_SHADER_DESC;
|
||||
|
||||
typedef struct _D3D11_SHADER_INPUT_BIND_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the resource
|
||||
D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
|
||||
UINT BindPoint; // Starting bind point
|
||||
UINT BindCount; // Number of contiguous bind points (for arrays)
|
||||
|
||||
UINT uFlags; // Input binding flags
|
||||
D3D11_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
|
||||
D3D10_SRV_DIMENSION Dimension; // Dimension (if texture)
|
||||
UINT NumSamples; // Number of samples (0 if not MS texture)
|
||||
} D3D11_SHADER_INPUT_BIND_DESC;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Interfaces ////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3D11ShaderReflectionType ID3D11ShaderReflectionType;
|
||||
typedef interface ID3D11ShaderReflectionType *LPD3D11SHADERREFLECTIONTYPE;
|
||||
|
||||
typedef interface ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable;
|
||||
typedef interface ID3D11ShaderReflectionVariable *LPD3D11SHADERREFLECTIONVARIABLE;
|
||||
|
||||
typedef interface ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer;
|
||||
typedef interface ID3D11ShaderReflectionConstantBuffer *LPD3D11SHADERREFLECTIONCONSTANTBUFFER;
|
||||
|
||||
typedef interface ID3D11ShaderReflection ID3D11ShaderReflection;
|
||||
typedef interface ID3D11ShaderReflection *LPD3D11SHADERREFLECTION;
|
||||
|
||||
// {6E6FFA6A-9BAE-4613-A51E-91652D508C21}
|
||||
DEFINE_GUID(IID_ID3D11ShaderReflectionType,
|
||||
0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11ShaderReflectionType
|
||||
|
||||
DECLARE_INTERFACE(ID3D11ShaderReflectionType)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_TYPE_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE;
|
||||
STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT Index) PURE;
|
||||
|
||||
STDMETHOD(IsEqual)(THIS_ ID3D11ShaderReflectionType* pType) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetSubType)(THIS) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetBaseClass)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetInterfaceByIndex)(THIS_ UINT uIndex) PURE;
|
||||
STDMETHOD(IsOfType)(THIS_ ID3D11ShaderReflectionType* pType) PURE;
|
||||
STDMETHOD(ImplementsInterface)(THIS_ ID3D11ShaderReflectionType* pBase) PURE;
|
||||
};
|
||||
|
||||
// {51F23923-F3E5-4BD1-91CB-606177D8DB4C}
|
||||
DEFINE_GUID(IID_ID3D11ShaderReflectionVariable,
|
||||
0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11ShaderReflectionVariable
|
||||
|
||||
DECLARE_INTERFACE(ID3D11ShaderReflectionVariable)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_VARIABLE_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetType)(THIS) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ UINT uArrayIndex) PURE;
|
||||
};
|
||||
|
||||
// {EB62D63D-93DD-4318-8AE8-C6F83AD371B8}
|
||||
DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer,
|
||||
0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11ShaderReflectionConstantBuffer
|
||||
|
||||
DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE;
|
||||
};
|
||||
|
||||
// {17F27486-A342-4D10-8842-AB0874E7F670}
|
||||
DEFINE_GUID(IID_ID3D11ShaderReflection,
|
||||
0x17f27486, 0xa342, 0x4d10, 0x88, 0x42, 0xab, 0x08, 0x74, 0xe7, 0xf6, 0x70);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11ShaderReflection
|
||||
|
||||
DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetPatchConstantParameterDesc)(THIS_ UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ LPCSTR Name, D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(D3D10_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
|
||||
STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
|
||||
STDMETHOD(GetMinFeatureLevel)(THIS_ enum D3D_FEATURE_LEVEL* pLevel) PURE;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// APIs //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3D11SHADER_H__
|
||||
|
||||
72
common/dx11sdk/D3DX10.h
Normal file
72
common/dx11sdk/D3DX10.h
Normal file
@@ -0,0 +1,72 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
// File: d3dx10.h
|
||||
// Content: D3DX10 utility library
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __D3DX10_INTERNAL__
|
||||
#error Incorrect D3DX10 header used
|
||||
#endif
|
||||
|
||||
#ifndef __D3DX10_H__
|
||||
#define __D3DX10_H__
|
||||
|
||||
|
||||
// Defines
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
|
||||
#define D3DX10_DEFAULT ((UINT) -1)
|
||||
#define D3DX10_FROM_FILE ((UINT) -3)
|
||||
#define DXGI_FORMAT_FROM_FILE ((DXGI_FORMAT) -3)
|
||||
|
||||
#ifndef D3DX10INLINE
|
||||
#ifdef _MSC_VER
|
||||
#if (_MSC_VER >= 1200)
|
||||
#define D3DX10INLINE __forceinline
|
||||
#else
|
||||
#define D3DX10INLINE __inline
|
||||
#endif
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#define D3DX10INLINE inline
|
||||
#else
|
||||
#define D3DX10INLINE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Includes
|
||||
#include "d3d10.h"
|
||||
#include "d3dx10.h"
|
||||
#include "d3dx10math.h"
|
||||
#include "d3dx10core.h"
|
||||
#include "d3dx10tex.h"
|
||||
#include "d3dx10mesh.h"
|
||||
#include "d3dx10async.h"
|
||||
|
||||
|
||||
// Errors
|
||||
#define _FACDD 0x876
|
||||
#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
|
||||
|
||||
enum _D3DX10_ERR {
|
||||
D3DX10_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT(2900),
|
||||
D3DX10_ERR_INVALID_MESH = MAKE_DDHRESULT(2901),
|
||||
D3DX10_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT(2902),
|
||||
D3DX10_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT(2903),
|
||||
D3DX10_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT(2904),
|
||||
D3DX10_ERR_INVALID_DATA = MAKE_DDHRESULT(2905),
|
||||
D3DX10_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT(2906),
|
||||
D3DX10_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT(2907),
|
||||
D3DX10_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT(2908),
|
||||
};
|
||||
|
||||
|
||||
#endif //__D3DX10_H__
|
||||
|
||||
444
common/dx11sdk/D3DX10core.h
Normal file
444
common/dx11sdk/D3DX10core.h
Normal file
@@ -0,0 +1,444 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
// File: d3dx10core.h
|
||||
// Content: D3DX10 core types and functions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "d3dx10.h"
|
||||
|
||||
#ifndef __D3DX10CORE_H__
|
||||
#define __D3DX10CORE_H__
|
||||
|
||||
// Current name of the DLL shipped in the same SDK as this header.
|
||||
|
||||
|
||||
#define D3DX10_DLL_W L"d3dx10_41.dll"
|
||||
#define D3DX10_DLL_A "d3dx10_41.dll"
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10_DLL D3DX10_DLL_W
|
||||
#else
|
||||
#define D3DX10_DLL D3DX10_DLL_A
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3DX10_SDK_VERSION:
|
||||
// -----------------
|
||||
// This identifier is passed to D3DX10CheckVersion in order to ensure that an
|
||||
// application was built against the correct header files and lib files.
|
||||
// This number is incremented whenever a header (or other) change would
|
||||
// require applications to be rebuilt. If the version doesn't match,
|
||||
// D3DX10CreateVersion will return FALSE. (The number itself has no meaning.)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define D3DX10_SDK_VERSION 41
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3DX10CreateDevice
|
||||
// D3DX10CreateDeviceAndSwapChain
|
||||
// D3DX10GetFeatureLevel1
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
HRESULT WINAPI D3DX10CreateDevice(IDXGIAdapter *pAdapter,
|
||||
D3D10_DRIVER_TYPE DriverType,
|
||||
HMODULE Software,
|
||||
UINT Flags,
|
||||
ID3D10Device **ppDevice);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateDeviceAndSwapChain(IDXGIAdapter *pAdapter,
|
||||
D3D10_DRIVER_TYPE DriverType,
|
||||
HMODULE Software,
|
||||
UINT Flags,
|
||||
DXGI_SWAP_CHAIN_DESC *pSwapChainDesc,
|
||||
IDXGISwapChain **ppSwapChain,
|
||||
ID3D10Device **ppDevice);
|
||||
|
||||
typedef interface ID3D10Device1 ID3D10Device1;
|
||||
HRESULT WINAPI D3DX10GetFeatureLevel1(ID3D10Device *pDevice, ID3D10Device1 **ppDevice1);
|
||||
|
||||
|
||||
#ifdef D3D_DIAG_DLL
|
||||
BOOL WINAPI D3DX10DebugMute(BOOL Mute);
|
||||
#endif
|
||||
HRESULT WINAPI D3DX10CheckVersion(UINT D3DSdkVersion, UINT D3DX10SdkVersion);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// D3DX10_SPRITE flags:
|
||||
// -----------------
|
||||
// D3DX10_SPRITE_SAVE_STATE
|
||||
// Specifies device state should be saved and restored in Begin/End.
|
||||
// D3DX10SPRITE_SORT_TEXTURE
|
||||
// Sprites are sorted by texture prior to drawing. This is recommended when
|
||||
// drawing non-overlapping sprites of uniform depth. For example, drawing
|
||||
// screen-aligned text with ID3DX10Font.
|
||||
// D3DX10SPRITE_SORT_DEPTH_FRONT_TO_BACK
|
||||
// Sprites are sorted by depth front-to-back prior to drawing. This is
|
||||
// recommended when drawing opaque sprites of varying depths.
|
||||
// D3DX10SPRITE_SORT_DEPTH_BACK_TO_FRONT
|
||||
// Sprites are sorted by depth back-to-front prior to drawing. This is
|
||||
// recommended when drawing transparent sprites of varying depths.
|
||||
// D3DX10SPRITE_ADDREF_TEXTURES
|
||||
// AddRef/Release all textures passed in to DrawSpritesBuffered
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef enum _D3DX10_SPRITE_FLAG
|
||||
{
|
||||
D3DX10_SPRITE_SORT_TEXTURE = 0x01,
|
||||
D3DX10_SPRITE_SORT_DEPTH_BACK_TO_FRONT = 0x02,
|
||||
D3DX10_SPRITE_SORT_DEPTH_FRONT_TO_BACK = 0x04,
|
||||
D3DX10_SPRITE_SAVE_STATE = 0x08,
|
||||
D3DX10_SPRITE_ADDREF_TEXTURES = 0x10,
|
||||
} D3DX10_SPRITE_FLAG;
|
||||
|
||||
typedef struct _D3DX10_SPRITE
|
||||
{
|
||||
D3DXMATRIX matWorld;
|
||||
|
||||
D3DXVECTOR2 TexCoord;
|
||||
D3DXVECTOR2 TexSize;
|
||||
|
||||
D3DXCOLOR ColorModulate;
|
||||
|
||||
ID3D10ShaderResourceView *pTexture;
|
||||
UINT TextureIndex;
|
||||
} D3DX10_SPRITE;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DX10Sprite:
|
||||
// ------------
|
||||
// This object intends to provide an easy way to drawing sprites using D3D.
|
||||
//
|
||||
// Begin -
|
||||
// Prepares device for drawing sprites.
|
||||
//
|
||||
// Draw -
|
||||
// Draws a sprite
|
||||
//
|
||||
// Flush -
|
||||
// Forces all batched sprites to submitted to the device.
|
||||
//
|
||||
// End -
|
||||
// Restores device state to how it was when Begin was called.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3DX10Sprite ID3DX10Sprite;
|
||||
typedef interface ID3DX10Sprite *LPD3DX10SPRITE;
|
||||
|
||||
|
||||
// {BA0B762D-8D28-43ec-B9DC-2F84443B0614}
|
||||
DEFINE_GUID(IID_ID3DX10Sprite,
|
||||
0xba0b762d, 0x8d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14);
|
||||
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX10Sprite
|
||||
|
||||
DECLARE_INTERFACE_(ID3DX10Sprite, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DX10Sprite
|
||||
STDMETHOD(Begin)(THIS_ UINT flags) PURE;
|
||||
|
||||
STDMETHOD(DrawSpritesBuffered)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites) PURE;
|
||||
STDMETHOD(Flush)(THIS) PURE;
|
||||
|
||||
STDMETHOD(DrawSpritesImmediate)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites, UINT cbSprite, UINT flags) PURE;
|
||||
STDMETHOD(End)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE;
|
||||
STDMETHOD(SetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE;
|
||||
STDMETHOD(GetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE;
|
||||
STDMETHOD(SetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE;
|
||||
|
||||
STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateSprite(
|
||||
ID3D10Device* pDevice,
|
||||
UINT cDeviceBufferSize,
|
||||
LPD3DX10SPRITE* ppSprite);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DX10ThreadPump:
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX10DataLoader
|
||||
|
||||
DECLARE_INTERFACE(ID3DX10DataLoader)
|
||||
{
|
||||
STDMETHOD(Load)(THIS) PURE;
|
||||
STDMETHOD(Decompress)(THIS_ void **ppData, SIZE_T *pcBytes) PURE;
|
||||
STDMETHOD(Destroy)(THIS) PURE;
|
||||
};
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX10DataProcessor
|
||||
|
||||
DECLARE_INTERFACE(ID3DX10DataProcessor)
|
||||
{
|
||||
STDMETHOD(Process)(THIS_ void *pData, SIZE_T cBytes) PURE;
|
||||
STDMETHOD(CreateDeviceObject)(THIS_ void **ppDataObject) PURE;
|
||||
STDMETHOD(Destroy)(THIS) PURE;
|
||||
};
|
||||
|
||||
// {C93FECFA-6967-478a-ABBC-402D90621FCB}
|
||||
DEFINE_GUID(IID_ID3DX10ThreadPump,
|
||||
0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX10ThreadPump
|
||||
|
||||
DECLARE_INTERFACE_(ID3DX10ThreadPump, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DX10ThreadPump
|
||||
STDMETHOD(AddWorkItem)(THIS_ ID3DX10DataLoader *pDataLoader, ID3DX10DataProcessor *pDataProcessor, HRESULT *pHResult, void **ppDeviceObject) PURE;
|
||||
STDMETHOD_(UINT, GetWorkItemCount)(THIS) PURE;
|
||||
|
||||
STDMETHOD(WaitForAllItems)(THIS) PURE;
|
||||
STDMETHOD(ProcessDeviceWorkItems)(THIS_ UINT iWorkItemCount);
|
||||
|
||||
STDMETHOD(PurgeAllItems)(THIS) PURE;
|
||||
STDMETHOD(GetQueueStatus)(THIS_ UINT *pIoQueue, UINT *pProcessQueue, UINT *pDeviceQueue) PURE;
|
||||
|
||||
};
|
||||
|
||||
HRESULT WINAPI D3DX10CreateThreadPump(UINT cIoThreads, UINT cProcThreads, ID3DX10ThreadPump **ppThreadPump);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DX10Font:
|
||||
// ----------
|
||||
// Font objects contain the textures and resources needed to render a specific
|
||||
// font on a specific device.
|
||||
//
|
||||
// GetGlyphData -
|
||||
// Returns glyph cache data, for a given glyph.
|
||||
//
|
||||
// PreloadCharacters/PreloadGlyphs/PreloadText -
|
||||
// Preloads glyphs into the glyph cache textures.
|
||||
//
|
||||
// DrawText -
|
||||
// Draws formatted text on a D3D device. Some parameters are
|
||||
// surprisingly similar to those of GDI's DrawText function. See GDI
|
||||
// documentation for a detailed description of these parameters.
|
||||
// If pSprite is NULL, an internal sprite object will be used.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct _D3DX10_FONT_DESCA
|
||||
{
|
||||
INT Height;
|
||||
UINT Width;
|
||||
UINT Weight;
|
||||
UINT MipLevels;
|
||||
BOOL Italic;
|
||||
BYTE CharSet;
|
||||
BYTE OutputPrecision;
|
||||
BYTE Quality;
|
||||
BYTE PitchAndFamily;
|
||||
CHAR FaceName[LF_FACESIZE];
|
||||
|
||||
} D3DX10_FONT_DESCA, *LPD3DX10_FONT_DESCA;
|
||||
|
||||
typedef struct _D3DX10_FONT_DESCW
|
||||
{
|
||||
INT Height;
|
||||
UINT Width;
|
||||
UINT Weight;
|
||||
UINT MipLevels;
|
||||
BOOL Italic;
|
||||
BYTE CharSet;
|
||||
BYTE OutputPrecision;
|
||||
BYTE Quality;
|
||||
BYTE PitchAndFamily;
|
||||
WCHAR FaceName[LF_FACESIZE];
|
||||
|
||||
} D3DX10_FONT_DESCW, *LPD3DX10_FONT_DESCW;
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef D3DX10_FONT_DESCW D3DX10_FONT_DESC;
|
||||
typedef LPD3DX10_FONT_DESCW LPD3DX10_FONT_DESC;
|
||||
#else
|
||||
typedef D3DX10_FONT_DESCA D3DX10_FONT_DESC;
|
||||
typedef LPD3DX10_FONT_DESCA LPD3DX10_FONT_DESC;
|
||||
#endif
|
||||
|
||||
|
||||
typedef interface ID3DX10Font ID3DX10Font;
|
||||
typedef interface ID3DX10Font *LPD3DX10FONT;
|
||||
|
||||
|
||||
// {D79DBB70-5F21-4d36-BBC2-FF525C213CDC}
|
||||
DEFINE_GUID(IID_ID3DX10Font,
|
||||
0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc);
|
||||
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX10Font
|
||||
|
||||
DECLARE_INTERFACE_(ID3DX10Font, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DX10Font
|
||||
STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE;
|
||||
STDMETHOD(GetDescA)(THIS_ D3DX10_FONT_DESCA *pDesc) PURE;
|
||||
STDMETHOD(GetDescW)(THIS_ D3DX10_FONT_DESCW *pDesc) PURE;
|
||||
STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE;
|
||||
STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE;
|
||||
|
||||
STDMETHOD_(HDC, GetDC)(THIS) PURE;
|
||||
STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, ID3D10ShaderResourceView** ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE;
|
||||
|
||||
STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE;
|
||||
STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE;
|
||||
STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE;
|
||||
STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE;
|
||||
|
||||
STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DX10SPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE;
|
||||
STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DX10SPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef UNICODE
|
||||
HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCW *pDesc) { return GetDescW(pDesc); }
|
||||
HRESULT WINAPI_INLINE PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); }
|
||||
#else
|
||||
HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCA *pDesc) { return GetDescA(pDesc); }
|
||||
HRESULT WINAPI_INLINE PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); }
|
||||
#endif
|
||||
#endif //__cplusplus
|
||||
};
|
||||
|
||||
#ifndef GetTextMetrics
|
||||
#ifdef UNICODE
|
||||
#define GetTextMetrics GetTextMetricsW
|
||||
#else
|
||||
#define GetTextMetrics GetTextMetricsA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DrawText
|
||||
#ifdef UNICODE
|
||||
#define DrawText DrawTextW
|
||||
#else
|
||||
#define DrawText DrawTextA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateFontA(
|
||||
ID3D10Device* pDevice,
|
||||
INT Height,
|
||||
UINT Width,
|
||||
UINT Weight,
|
||||
UINT MipLevels,
|
||||
BOOL Italic,
|
||||
UINT CharSet,
|
||||
UINT OutputPrecision,
|
||||
UINT Quality,
|
||||
UINT PitchAndFamily,
|
||||
LPCSTR pFaceName,
|
||||
LPD3DX10FONT* ppFont);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateFontW(
|
||||
ID3D10Device* pDevice,
|
||||
INT Height,
|
||||
UINT Width,
|
||||
UINT Weight,
|
||||
UINT MipLevels,
|
||||
BOOL Italic,
|
||||
UINT CharSet,
|
||||
UINT OutputPrecision,
|
||||
UINT Quality,
|
||||
UINT PitchAndFamily,
|
||||
LPCWSTR pFaceName,
|
||||
LPD3DX10FONT* ppFont);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CreateFont D3DX10CreateFontW
|
||||
#else
|
||||
#define D3DX10CreateFont D3DX10CreateFontA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateFontIndirectA(
|
||||
ID3D10Device* pDevice,
|
||||
CONST D3DX10_FONT_DESCA* pDesc,
|
||||
LPD3DX10FONT* ppFont);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateFontIndirectW(
|
||||
ID3D10Device* pDevice,
|
||||
CONST D3DX10_FONT_DESCW* pDesc,
|
||||
LPD3DX10FONT* ppFont);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CreateFontIndirect D3DX10CreateFontIndirectW
|
||||
#else
|
||||
#define D3DX10CreateFontIndirect D3DX10CreateFontIndirectA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI D3DX10UnsetAllDeviceObjects(ID3D10Device *pDevice);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define _FACD3D 0x876
|
||||
#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code )
|
||||
#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code )
|
||||
|
||||
#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156)
|
||||
#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540)
|
||||
|
||||
#endif //__D3DX10CORE_H__
|
||||
|
||||
1866
common/dx11sdk/D3DX10math.h
Normal file
1866
common/dx11sdk/D3DX10math.h
Normal file
File diff suppressed because it is too large
Load Diff
2228
common/dx11sdk/D3DX10math.inl
Normal file
2228
common/dx11sdk/D3DX10math.inl
Normal file
File diff suppressed because it is too large
Load Diff
286
common/dx11sdk/D3DX10mesh.h
Normal file
286
common/dx11sdk/D3DX10mesh.h
Normal file
@@ -0,0 +1,286 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
// File: d3dx10mesh.h
|
||||
// Content: D3DX10 mesh types and functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "d3dx10.h"
|
||||
|
||||
#ifndef __D3DX10MESH_H__
|
||||
#define __D3DX10MESH_H__
|
||||
|
||||
// {7ED943DD-52E8-40b5-A8D8-76685C406330}
|
||||
DEFINE_GUID(IID_ID3DX10BaseMesh,
|
||||
0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30);
|
||||
|
||||
// {04B0D117-1041-46b1-AA8A-3952848BA22E}
|
||||
DEFINE_GUID(IID_ID3DX10MeshBuffer,
|
||||
0x4b0d117, 0x1041, 0x46b1, 0xaa, 0x8a, 0x39, 0x52, 0x84, 0x8b, 0xa2, 0x2e);
|
||||
|
||||
// {4020E5C2-1403-4929-883F-E2E849FAC195}
|
||||
DEFINE_GUID(IID_ID3DX10Mesh,
|
||||
0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95);
|
||||
|
||||
// {8875769A-D579-4088-AAEB-534D1AD84E96}
|
||||
DEFINE_GUID(IID_ID3DX10PMesh,
|
||||
0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96);
|
||||
|
||||
// {667EA4C7-F1CD-4386-B523-7C0290B83CC5}
|
||||
DEFINE_GUID(IID_ID3DX10SPMesh,
|
||||
0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5);
|
||||
|
||||
// {3CE6CC22-DBF2-44f4-894D-F9C34A337139}
|
||||
DEFINE_GUID(IID_ID3DX10PatchMesh,
|
||||
0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39);
|
||||
|
||||
|
||||
// Mesh options - lower 3 bytes only, upper byte used by _D3DX10MESHOPT option flags
|
||||
enum _D3DX10_MESH {
|
||||
D3DX10_MESH_32_BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices.
|
||||
D3DX10_MESH_GS_ADJACENCY = 0x004, // If set, mesh contains GS adjacency info. Not valid on input.
|
||||
|
||||
};
|
||||
|
||||
typedef struct _D3DX10_ATTRIBUTE_RANGE
|
||||
{
|
||||
UINT AttribId;
|
||||
UINT FaceStart;
|
||||
UINT FaceCount;
|
||||
UINT VertexStart;
|
||||
UINT VertexCount;
|
||||
} D3DX10_ATTRIBUTE_RANGE;
|
||||
|
||||
typedef D3DX10_ATTRIBUTE_RANGE* LPD3DX10_ATTRIBUTE_RANGE;
|
||||
|
||||
typedef enum _D3DX10_MESH_DISCARD_FLAGS
|
||||
{
|
||||
D3DX10_MESH_DISCARD_ATTRIBUTE_BUFFER = 0x01,
|
||||
D3DX10_MESH_DISCARD_ATTRIBUTE_TABLE = 0x02,
|
||||
D3DX10_MESH_DISCARD_POINTREPS = 0x04,
|
||||
D3DX10_MESH_DISCARD_ADJACENCY = 0x08,
|
||||
D3DX10_MESH_DISCARD_DEVICE_BUFFERS = 0x10,
|
||||
|
||||
} D3DX10_MESH_DISCARD_FLAGS;
|
||||
|
||||
typedef struct _D3DX10_WELD_EPSILONS
|
||||
{
|
||||
FLOAT Position; // NOTE: This does NOT replace the epsilon in GenerateAdjacency
|
||||
// in general, it should be the same value or greater than the one passed to GeneratedAdjacency
|
||||
FLOAT BlendWeights;
|
||||
FLOAT Normal;
|
||||
FLOAT PSize;
|
||||
FLOAT Specular;
|
||||
FLOAT Diffuse;
|
||||
FLOAT Texcoord[8];
|
||||
FLOAT Tangent;
|
||||
FLOAT Binormal;
|
||||
FLOAT TessFactor;
|
||||
} D3DX10_WELD_EPSILONS;
|
||||
|
||||
typedef D3DX10_WELD_EPSILONS* LPD3DX10_WELD_EPSILONS;
|
||||
|
||||
typedef struct _D3DX10_INTERSECT_INFO
|
||||
{
|
||||
UINT FaceIndex; // index of face intersected
|
||||
FLOAT U; // Barycentric Hit Coordinates
|
||||
FLOAT V; // Barycentric Hit Coordinates
|
||||
FLOAT Dist; // Ray-Intersection Parameter Distance
|
||||
} D3DX10_INTERSECT_INFO, *LPD3DX10_INTERSECT_INFO;
|
||||
|
||||
// ID3DX10MeshBuffer is used by D3DX10Mesh vertex and index buffers
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX10MeshBuffer
|
||||
|
||||
DECLARE_INTERFACE_(ID3DX10MeshBuffer, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DX10MeshBuffer
|
||||
STDMETHOD(Map)(THIS_ void **ppData, SIZE_T *pSize) PURE;
|
||||
STDMETHOD(Unmap)(THIS) PURE;
|
||||
STDMETHOD_(SIZE_T, GetSize)(THIS) PURE;
|
||||
};
|
||||
|
||||
// D3DX10 Mesh interfaces
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX10Mesh
|
||||
|
||||
DECLARE_INTERFACE_(ID3DX10Mesh, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DX10Mesh
|
||||
STDMETHOD_(UINT, GetFaceCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetVertexCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetVertexBufferCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetFlags)(THIS) PURE;
|
||||
STDMETHOD(GetVertexDescription)(THIS_ CONST D3D10_INPUT_ELEMENT_DESC **ppDesc, UINT *pDeclCount) PURE;
|
||||
|
||||
STDMETHOD(SetVertexData)(THIS_ UINT iBuffer, CONST void *pData) PURE;
|
||||
STDMETHOD(GetVertexBuffer)(THIS_ UINT iBuffer, ID3DX10MeshBuffer **ppVertexBuffer) PURE;
|
||||
|
||||
STDMETHOD(SetIndexData)(THIS_ CONST void *pData, UINT cIndices) PURE;
|
||||
STDMETHOD(GetIndexBuffer)(THIS_ ID3DX10MeshBuffer **ppIndexBuffer) PURE;
|
||||
|
||||
STDMETHOD(SetAttributeData)(THIS_ CONST UINT *pData) PURE;
|
||||
STDMETHOD(GetAttributeBuffer)(THIS_ ID3DX10MeshBuffer **ppAttributeBuffer) PURE;
|
||||
|
||||
STDMETHOD(SetAttributeTable)(THIS_ CONST D3DX10_ATTRIBUTE_RANGE *pAttribTable, UINT cAttribTableSize) PURE;
|
||||
STDMETHOD(GetAttributeTable)(THIS_ D3DX10_ATTRIBUTE_RANGE *pAttribTable, UINT *pAttribTableSize) PURE;
|
||||
|
||||
STDMETHOD(GenerateAdjacencyAndPointReps)(THIS_ FLOAT Epsilon) PURE;
|
||||
STDMETHOD(GenerateGSAdjacency)(THIS) PURE;
|
||||
|
||||
STDMETHOD(SetAdjacencyData)(THIS_ CONST UINT *pAdjacency) PURE;
|
||||
STDMETHOD(GetAdjacencyBuffer)(THIS_ ID3DX10MeshBuffer **ppAdjacency) PURE;
|
||||
|
||||
STDMETHOD(SetPointRepData)(THIS_ CONST UINT *pPointReps) PURE;
|
||||
STDMETHOD(GetPointRepBuffer)(THIS_ ID3DX10MeshBuffer **ppPointReps) PURE;
|
||||
|
||||
STDMETHOD(Discard)(THIS_ D3DX10_MESH_DISCARD_FLAGS dwDiscard) PURE;
|
||||
STDMETHOD(CloneMesh)(THIS_ UINT Flags, LPCSTR pPosSemantic, CONST D3D10_INPUT_ELEMENT_DESC *pDesc, UINT DeclCount, ID3DX10Mesh** ppCloneMesh) PURE;
|
||||
|
||||
STDMETHOD(Optimize)(THIS_ UINT Flags, UINT * pFaceRemap, LPD3D10BLOB *ppVertexRemap) PURE;
|
||||
STDMETHOD(GenerateAttributeBufferFromTable)(THIS) PURE;
|
||||
|
||||
STDMETHOD(Intersect)(THIS_ D3DXVECTOR3 *pRayPos, D3DXVECTOR3 *pRayDir,
|
||||
UINT *pHitCount, UINT *pFaceIndex, float *pU, float *pV, float *pDist, ID3D10Blob **ppAllHits);
|
||||
STDMETHOD(IntersectSubset)(THIS_ UINT AttribId, D3DXVECTOR3 *pRayPos, D3DXVECTOR3 *pRayDir,
|
||||
UINT *pHitCount, UINT *pFaceIndex, float *pU, float *pV, float *pDist, ID3D10Blob **ppAllHits);
|
||||
|
||||
// ID3DX10Mesh - Device functions
|
||||
STDMETHOD(CommitToDevice)(THIS) PURE;
|
||||
STDMETHOD(DrawSubset)(THIS_ UINT AttribId) PURE;
|
||||
STDMETHOD(DrawSubsetInstanced)(THIS_ UINT AttribId, UINT InstanceCount, UINT StartInstanceLocation) PURE;
|
||||
|
||||
STDMETHOD(GetDeviceVertexBuffer)(THIS_ UINT iBuffer, ID3D10Buffer **ppVertexBuffer) PURE;
|
||||
STDMETHOD(GetDeviceIndexBuffer)(THIS_ ID3D10Buffer **ppIndexBuffer) PURE;
|
||||
};
|
||||
|
||||
|
||||
// Flat API
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateMesh(
|
||||
ID3D10Device *pDevice,
|
||||
CONST D3D10_INPUT_ELEMENT_DESC *pDeclaration,
|
||||
UINT DeclCount,
|
||||
LPCSTR pPositionSemantic,
|
||||
UINT VertexCount,
|
||||
UINT FaceCount,
|
||||
UINT Options,
|
||||
ID3DX10Mesh **ppMesh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
// ID3DX10Mesh::Optimize options - upper byte only, lower 3 bytes used from _D3DX10MESH option flags
|
||||
enum _D3DX10_MESHOPT {
|
||||
D3DX10_MESHOPT_COMPACT = 0x01000000,
|
||||
D3DX10_MESHOPT_ATTR_SORT = 0x02000000,
|
||||
D3DX10_MESHOPT_VERTEX_CACHE = 0x04000000,
|
||||
D3DX10_MESHOPT_STRIP_REORDER = 0x08000000,
|
||||
D3DX10_MESHOPT_IGNORE_VERTS = 0x10000000, // optimize faces only, don't touch vertices
|
||||
D3DX10_MESHOPT_DO_NOT_SPLIT = 0x20000000, // do not split vertices shared between attribute groups when attribute sorting
|
||||
D3DX10_MESHOPT_DEVICE_INDEPENDENT = 0x00400000, // Only affects VCache. uses a static known good cache size for all cards
|
||||
|
||||
// D3DX10_MESHOPT_SHAREVB has been removed, please use D3DX10MESH_VB_SHARE instead
|
||||
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXSkinInfo
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// {420BD604-1C76-4a34-A466-E45D0658A32C}
|
||||
DEFINE_GUID(IID_ID3DX10SkinInfo,
|
||||
0x420bd604, 0x1c76, 0x4a34, 0xa4, 0x66, 0xe4, 0x5d, 0x6, 0x58, 0xa3, 0x2c);
|
||||
|
||||
// scaling modes for ID3DX10SkinInfo::Compact() & ID3DX10SkinInfo::UpdateMesh()
|
||||
#define D3DX10_SKININFO_NO_SCALING 0
|
||||
#define D3DX10_SKININFO_SCALE_TO_1 1
|
||||
#define D3DX10_SKININFO_SCALE_TO_TOTAL 2
|
||||
|
||||
typedef struct _D3DX10_SKINNING_CHANNEL
|
||||
{
|
||||
UINT SrcOffset;
|
||||
UINT DestOffset;
|
||||
BOOL IsNormal;
|
||||
} D3DX10_SKINNING_CHANNEL;
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX10SkinInfo
|
||||
|
||||
typedef struct ID3DX10SkinInfo *LPD3DX10SKININFO;
|
||||
|
||||
DECLARE_INTERFACE_(ID3DX10SkinInfo, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(UINT , GetNumVertices)(THIS) PURE;
|
||||
STDMETHOD_(UINT , GetNumBones)(THIS) PURE;
|
||||
STDMETHOD_(UINT , GetMaxBoneInfluences)(THIS) PURE;
|
||||
|
||||
STDMETHOD(AddVertices)(THIS_ UINT Count) PURE;
|
||||
STDMETHOD(RemapVertices)(THIS_ UINT NewVertexCount, UINT *pVertexRemap) PURE;
|
||||
|
||||
STDMETHOD(AddBones)(THIS_ UINT Count) PURE;
|
||||
STDMETHOD(RemoveBone)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD(RemapBones)(THIS_ UINT NewBoneCount, UINT *pBoneRemap) PURE;
|
||||
|
||||
STDMETHOD(AddBoneInfluences)(THIS_ UINT BoneIndex, UINT InfluenceCount, UINT *pIndices, float *pWeights) PURE;
|
||||
STDMETHOD(ClearBoneInfluences)(THIS_ UINT BoneIndex) PURE;
|
||||
STDMETHOD_(UINT , GetBoneInfluenceCount)(THIS_ UINT BoneIndex) PURE;
|
||||
STDMETHOD(GetBoneInfluences)(THIS_ UINT BoneIndex, UINT Offset, UINT Count, UINT *pDestIndices, float *pDestWeights) PURE;
|
||||
STDMETHOD(FindBoneInfluenceIndex)(THIS_ UINT BoneIndex, UINT VertexIndex, UINT *pInfluenceIndex) PURE;
|
||||
STDMETHOD(SetBoneInfluence)(THIS_ UINT BoneIndex, UINT InfluenceIndex, float Weight) PURE;
|
||||
STDMETHOD(GetBoneInfluence)(THIS_ UINT BoneIndex, UINT InfluenceIndex, float *pWeight) PURE;
|
||||
|
||||
STDMETHOD(Compact)(THIS_ UINT MaxPerVertexInfluences, UINT ScaleMode, float MinWeight) PURE;
|
||||
STDMETHOD(DoSoftwareSkinning)(UINT StartVertex, UINT VertexCount, void *pSrcVertices, UINT SrcStride, void *pDestVertices, UINT DestStride, D3DXMATRIX *pBoneMatrices, D3DXMATRIX *pInverseTransposeBoneMatrices, D3DX10_SKINNING_CHANNEL *pChannelDescs, UINT NumChannels) PURE;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateSkinInfo(LPD3DX10SKININFO* ppSkinInfo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
typedef struct _D3DX10_ATTRIBUTE_WEIGHTS
|
||||
{
|
||||
FLOAT Position;
|
||||
FLOAT Boundary;
|
||||
FLOAT Normal;
|
||||
FLOAT Diffuse;
|
||||
FLOAT Specular;
|
||||
FLOAT Texcoord[8];
|
||||
FLOAT Tangent;
|
||||
FLOAT Binormal;
|
||||
} D3DX10_ATTRIBUTE_WEIGHTS, *LPD3DX10_ATTRIBUTE_WEIGHTS;
|
||||
|
||||
#endif //__D3DX10MESH_H__
|
||||
|
||||
|
||||
766
common/dx11sdk/D3DX10tex.h
Normal file
766
common/dx11sdk/D3DX10tex.h
Normal file
@@ -0,0 +1,766 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
// File: d3dx10tex.h
|
||||
// Content: D3DX10 texturing APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "d3dx10.h"
|
||||
|
||||
#ifndef __D3DX10TEX_H__
|
||||
#define __D3DX10TEX_H__
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10_FILTER flags:
|
||||
// ------------------
|
||||
//
|
||||
// A valid filter must contain one of these values:
|
||||
//
|
||||
// D3DX10_FILTER_NONE
|
||||
// No scaling or filtering will take place. Pixels outside the bounds
|
||||
// of the source image are assumed to be transparent black.
|
||||
// D3DX10_FILTER_POINT
|
||||
// Each destination pixel is computed by sampling the nearest pixel
|
||||
// from the source image.
|
||||
// D3DX10_FILTER_LINEAR
|
||||
// Each destination pixel is computed by linearly interpolating between
|
||||
// the nearest pixels in the source image. This filter works best
|
||||
// when the scale on each axis is less than 2.
|
||||
// D3DX10_FILTER_TRIANGLE
|
||||
// Every pixel in the source image contributes equally to the
|
||||
// destination image. This is the slowest of all the filters.
|
||||
// D3DX10_FILTER_BOX
|
||||
// Each pixel is computed by averaging a 2x2(x2) box pixels from
|
||||
// the source image. Only works when the dimensions of the
|
||||
// destination are half those of the source. (as with mip maps)
|
||||
//
|
||||
// And can be OR'd with any of these optional flags:
|
||||
//
|
||||
// D3DX10_FILTER_MIRROR_U
|
||||
// Indicates that pixels off the edge of the texture on the U-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX10_FILTER_MIRROR_V
|
||||
// Indicates that pixels off the edge of the texture on the V-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX10_FILTER_MIRROR_W
|
||||
// Indicates that pixels off the edge of the texture on the W-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX10_FILTER_MIRROR
|
||||
// Same as specifying D3DX10_FILTER_MIRROR_U | D3DX10_FILTER_MIRROR_V |
|
||||
// D3DX10_FILTER_MIRROR_V
|
||||
// D3DX10_FILTER_DITHER
|
||||
// Dithers the resulting image using a 4x4 order dither pattern.
|
||||
// D3DX10_FILTER_SRGB_IN
|
||||
// Denotes that the input data is in sRGB (gamma 2.2) colorspace.
|
||||
// D3DX10_FILTER_SRGB_OUT
|
||||
// Denotes that the output data is in sRGB (gamma 2.2) colorspace.
|
||||
// D3DX10_FILTER_SRGB
|
||||
// Same as specifying D3DX10_FILTER_SRGB_IN | D3DX10_FILTER_SRGB_OUT
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX10_FILTER_FLAG
|
||||
{
|
||||
D3DX10_FILTER_NONE = (1 << 0),
|
||||
D3DX10_FILTER_POINT = (2 << 0),
|
||||
D3DX10_FILTER_LINEAR = (3 << 0),
|
||||
D3DX10_FILTER_TRIANGLE = (4 << 0),
|
||||
D3DX10_FILTER_BOX = (5 << 0),
|
||||
|
||||
D3DX10_FILTER_MIRROR_U = (1 << 16),
|
||||
D3DX10_FILTER_MIRROR_V = (2 << 16),
|
||||
D3DX10_FILTER_MIRROR_W = (4 << 16),
|
||||
D3DX10_FILTER_MIRROR = (7 << 16),
|
||||
|
||||
D3DX10_FILTER_DITHER = (1 << 19),
|
||||
D3DX10_FILTER_DITHER_DIFFUSION= (2 << 19),
|
||||
|
||||
D3DX10_FILTER_SRGB_IN = (1 << 21),
|
||||
D3DX10_FILTER_SRGB_OUT = (2 << 21),
|
||||
D3DX10_FILTER_SRGB = (3 << 21),
|
||||
} D3DX10_FILTER_FLAG;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10_NORMALMAP flags:
|
||||
// ---------------------
|
||||
// These flags are used to control how D3DX10ComputeNormalMap generates normal
|
||||
// maps. Any number of these flags may be OR'd together in any combination.
|
||||
//
|
||||
// D3DX10_NORMALMAP_MIRROR_U
|
||||
// Indicates that pixels off the edge of the texture on the U-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX10_NORMALMAP_MIRROR_V
|
||||
// Indicates that pixels off the edge of the texture on the V-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX10_NORMALMAP_MIRROR
|
||||
// Same as specifying D3DX10_NORMALMAP_MIRROR_U | D3DX10_NORMALMAP_MIRROR_V
|
||||
// D3DX10_NORMALMAP_INVERTSIGN
|
||||
// Inverts the direction of each normal
|
||||
// D3DX10_NORMALMAP_COMPUTE_OCCLUSION
|
||||
// Compute the per pixel Occlusion term and encodes it into the alpha.
|
||||
// An Alpha of 1 means that the pixel is not obscured in anyway, and
|
||||
// an alpha of 0 would mean that the pixel is completly obscured.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX10_NORMALMAP_FLAG
|
||||
{
|
||||
D3DX10_NORMALMAP_MIRROR_U = (1 << 16),
|
||||
D3DX10_NORMALMAP_MIRROR_V = (2 << 16),
|
||||
D3DX10_NORMALMAP_MIRROR = (3 << 16),
|
||||
D3DX10_NORMALMAP_INVERTSIGN = (8 << 16),
|
||||
D3DX10_NORMALMAP_COMPUTE_OCCLUSION = (16 << 16),
|
||||
} D3DX10_NORMALMAP_FLAG;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10_CHANNEL flags:
|
||||
// -------------------
|
||||
// These flags are used by functions which operate on or more channels
|
||||
// in a texture.
|
||||
//
|
||||
// D3DX10_CHANNEL_RED
|
||||
// Indicates the red channel should be used
|
||||
// D3DX10_CHANNEL_BLUE
|
||||
// Indicates the blue channel should be used
|
||||
// D3DX10_CHANNEL_GREEN
|
||||
// Indicates the green channel should be used
|
||||
// D3DX10_CHANNEL_ALPHA
|
||||
// Indicates the alpha channel should be used
|
||||
// D3DX10_CHANNEL_LUMINANCE
|
||||
// Indicates the luminaces of the red green and blue channels should be
|
||||
// used.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX10_CHANNEL_FLAG
|
||||
{
|
||||
D3DX10_CHANNEL_RED = (1 << 0),
|
||||
D3DX10_CHANNEL_BLUE = (1 << 1),
|
||||
D3DX10_CHANNEL_GREEN = (1 << 2),
|
||||
D3DX10_CHANNEL_ALPHA = (1 << 3),
|
||||
D3DX10_CHANNEL_LUMINANCE = (1 << 4),
|
||||
} D3DX10_CHANNEL_FLAG;
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10_IMAGE_FILE_FORMAT:
|
||||
// ---------------------
|
||||
// This enum is used to describe supported image file formats.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX10_IMAGE_FILE_FORMAT
|
||||
{
|
||||
D3DX10_IFF_BMP = 0,
|
||||
D3DX10_IFF_JPG = 1,
|
||||
D3DX10_IFF_PNG = 3,
|
||||
D3DX10_IFF_DDS = 4,
|
||||
D3DX10_IFF_TIFF = 10,
|
||||
D3DX10_IFF_GIF = 11,
|
||||
D3DX10_IFF_WMP = 12,
|
||||
D3DX10_IFF_FORCE_DWORD = 0x7fffffff
|
||||
|
||||
} D3DX10_IMAGE_FILE_FORMAT;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10_SAVE_TEXTURE_FLAG:
|
||||
// ---------------------
|
||||
// This enum is used to support texture saving options.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX10_SAVE_TEXTURE_FLAG
|
||||
{
|
||||
D3DX10_STF_USEINPUTBLOB = 0x0001,
|
||||
} D3DX10_SAVE_TEXTURE_FLAG;
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10_IMAGE_INFO:
|
||||
// ---------------
|
||||
// This structure is used to return a rough description of what the
|
||||
// the original contents of an image file looked like.
|
||||
//
|
||||
// Width
|
||||
// Width of original image in pixels
|
||||
// Height
|
||||
// Height of original image in pixels
|
||||
// Depth
|
||||
// Depth of original image in pixels
|
||||
// ArraySize
|
||||
// Array size in textures
|
||||
// MipLevels
|
||||
// Number of mip levels in original image
|
||||
// MiscFlags
|
||||
// Miscellaneous flags
|
||||
// Format
|
||||
// D3D format which most closely describes the data in original image
|
||||
// ResourceDimension
|
||||
// D3D10_RESOURCE_DIMENSION representing the dimension of texture stored in the file.
|
||||
// D3D10_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D
|
||||
// ImageFileFormat
|
||||
// D3DX10_IMAGE_FILE_FORMAT representing the format of the image file.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct D3DX10_IMAGE_INFO
|
||||
{
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
UINT Depth;
|
||||
UINT ArraySize;
|
||||
UINT MipLevels;
|
||||
UINT MiscFlags;
|
||||
DXGI_FORMAT Format;
|
||||
D3D10_RESOURCE_DIMENSION ResourceDimension;
|
||||
D3DX10_IMAGE_FILE_FORMAT ImageFileFormat;
|
||||
} D3DX10_IMAGE_INFO;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Image File APIs ///////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10_IMAGE_LOAD_INFO:
|
||||
// ---------------
|
||||
// This structure can be optionally passed in to texture loader APIs to
|
||||
// control how textures get loaded. Pass in D3DX10_DEFAULT for any of these
|
||||
// to have D3DX automatically pick defaults based on the source file.
|
||||
//
|
||||
// Width
|
||||
// Rescale texture to Width texels wide
|
||||
// Height
|
||||
// Rescale texture to Height texels high
|
||||
// Depth
|
||||
// Rescale texture to Depth texels deep
|
||||
// FirstMipLevel
|
||||
// First mip level to load
|
||||
// MipLevels
|
||||
// Number of mip levels to load after the first level
|
||||
// Usage
|
||||
// D3D10_USAGE flag for the new texture
|
||||
// BindFlags
|
||||
// D3D10 Bind flags for the new texture
|
||||
// CpuAccessFlags
|
||||
// D3D10 CPU Access flags for the new texture
|
||||
// MiscFlags
|
||||
// Reserved. Must be 0
|
||||
// Format
|
||||
// Resample texture to the specified format
|
||||
// Filter
|
||||
// Filter the texture using the specified filter (only when resampling)
|
||||
// MipFilter
|
||||
// Filter the texture mip levels using the specified filter (only if
|
||||
// generating mips)
|
||||
// pSrcInfo
|
||||
// (optional) pointer to a D3DX10_IMAGE_INFO structure that will get
|
||||
// populated with source image information
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
typedef struct D3DX10_IMAGE_LOAD_INFO
|
||||
{
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
UINT Depth;
|
||||
UINT FirstMipLevel;
|
||||
UINT MipLevels;
|
||||
D3D10_USAGE Usage;
|
||||
UINT BindFlags;
|
||||
UINT CpuAccessFlags;
|
||||
UINT MiscFlags;
|
||||
DXGI_FORMAT Format;
|
||||
UINT Filter;
|
||||
UINT MipFilter;
|
||||
D3DX10_IMAGE_INFO* pSrcInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
D3DX10_IMAGE_LOAD_INFO()
|
||||
{
|
||||
Width = D3DX10_DEFAULT;
|
||||
Height = D3DX10_DEFAULT;
|
||||
Depth = D3DX10_DEFAULT;
|
||||
FirstMipLevel = D3DX10_DEFAULT;
|
||||
MipLevels = D3DX10_DEFAULT;
|
||||
Usage = (D3D10_USAGE) D3DX10_DEFAULT;
|
||||
BindFlags = D3DX10_DEFAULT;
|
||||
CpuAccessFlags = D3DX10_DEFAULT;
|
||||
MiscFlags = D3DX10_DEFAULT;
|
||||
Format = DXGI_FORMAT_FROM_FILE;
|
||||
Filter = D3DX10_DEFAULT;
|
||||
MipFilter = D3DX10_DEFAULT;
|
||||
pSrcInfo = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
} D3DX10_IMAGE_LOAD_INFO;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// GetImageInfoFromFile/Resource/Memory:
|
||||
// ------------------------------
|
||||
// Fills in a D3DX10_IMAGE_INFO struct with information about an image file.
|
||||
//
|
||||
// Parameters:
|
||||
// pSrcFile
|
||||
// File name of the source image.
|
||||
// pSrcModule
|
||||
// Module where resource is located, or NULL for module associated
|
||||
// with image the os used to create the current process.
|
||||
// pSrcResource
|
||||
// Resource name.
|
||||
// pSrcData
|
||||
// Pointer to file in memory.
|
||||
// SrcDataSize
|
||||
// Size in bytes of file in memory.
|
||||
// pPump
|
||||
// Optional pointer to a thread pump object to use.
|
||||
// pSrcInfo
|
||||
// Pointer to a D3DX10_IMAGE_INFO structure to be filled in with the
|
||||
// description of the data in the source image file.
|
||||
// pHResult
|
||||
// Pointer to a memory location to receive the return value upon completion.
|
||||
// Maybe NULL if not needed.
|
||||
// If pPump != NULL, pHResult must be a valid memory location until the
|
||||
// the asynchronous execution completes.
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10GetImageInfoFromFileA(
|
||||
LPCSTR pSrcFile,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
D3DX10_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10GetImageInfoFromFileW(
|
||||
LPCWSTR pSrcFile,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
D3DX10_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileW
|
||||
#else
|
||||
#define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10GetImageInfoFromResourceA(
|
||||
HMODULE hSrcModule,
|
||||
LPCSTR pSrcResource,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
D3DX10_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10GetImageInfoFromResourceW(
|
||||
HMODULE hSrcModule,
|
||||
LPCWSTR pSrcResource,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
D3DX10_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceW
|
||||
#else
|
||||
#define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10GetImageInfoFromMemory(
|
||||
LPCVOID pSrcData,
|
||||
SIZE_T SrcDataSize,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
D3DX10_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Create/Save Texture APIs //////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10CreateTextureFromFile/Resource/Memory:
|
||||
// D3DX10CreateShaderResourceViewFromFile/Resource/Memory:
|
||||
// -----------------------------------
|
||||
// Create a texture object from a file or resource.
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// pDevice
|
||||
// The D3D device with which the texture is going to be used.
|
||||
// pSrcFile
|
||||
// File name.
|
||||
// hSrcModule
|
||||
// Module handle. if NULL, current module will be used.
|
||||
// pSrcResource
|
||||
// Resource name in module
|
||||
// pvSrcData
|
||||
// Pointer to file in memory.
|
||||
// SrcDataSize
|
||||
// Size in bytes of file in memory.
|
||||
// pLoadInfo
|
||||
// Optional pointer to a D3DX10_IMAGE_LOAD_INFO structure that
|
||||
// contains additional loader parameters.
|
||||
// pPump
|
||||
// Optional pointer to a thread pump object to use.
|
||||
// ppTexture
|
||||
// [out] Created texture object.
|
||||
// ppShaderResourceView
|
||||
// [out] Shader resource view object created.
|
||||
// pHResult
|
||||
// Pointer to a memory location to receive the return value upon completion.
|
||||
// Maybe NULL if not needed.
|
||||
// If pPump != NULL, pHResult must be a valid memory location until the
|
||||
// the asynchronous execution completes.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// FromFile
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateShaderResourceViewFromFileA(
|
||||
ID3D10Device* pDevice,
|
||||
LPCSTR pSrcFile,
|
||||
D3DX10_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateShaderResourceViewFromFileW(
|
||||
ID3D10Device* pDevice,
|
||||
LPCWSTR pSrcFile,
|
||||
D3DX10_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileW
|
||||
#else
|
||||
#define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateTextureFromFileA(
|
||||
ID3D10Device* pDevice,
|
||||
LPCSTR pSrcFile,
|
||||
D3DX10_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateTextureFromFileW(
|
||||
ID3D10Device* pDevice,
|
||||
LPCWSTR pSrcFile,
|
||||
D3DX10_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileW
|
||||
#else
|
||||
#define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileA
|
||||
#endif
|
||||
|
||||
|
||||
// FromResource (resources in dll/exes)
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateShaderResourceViewFromResourceA(
|
||||
ID3D10Device* pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCSTR pSrcResource,
|
||||
D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateShaderResourceViewFromResourceW(
|
||||
ID3D10Device* pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCWSTR pSrcResource,
|
||||
D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceW
|
||||
#else
|
||||
#define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateTextureFromResourceA(
|
||||
ID3D10Device* pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCSTR pSrcResource,
|
||||
D3DX10_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateTextureFromResourceW(
|
||||
ID3D10Device* pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCWSTR pSrcResource,
|
||||
D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceW
|
||||
#else
|
||||
#define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceA
|
||||
#endif
|
||||
|
||||
|
||||
// FromFileInMemory
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateShaderResourceViewFromMemory(
|
||||
ID3D10Device* pDevice,
|
||||
LPCVOID pSrcData,
|
||||
SIZE_T SrcDataSize,
|
||||
D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10CreateTextureFromMemory(
|
||||
ID3D10Device* pDevice,
|
||||
LPCVOID pSrcData,
|
||||
SIZE_T SrcDataSize,
|
||||
D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX10ThreadPump* pPump,
|
||||
ID3D10Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Misc Texture APIs /////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10_TEXTURE_LOAD_INFO:
|
||||
// ------------------------
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct _D3DX10_TEXTURE_LOAD_INFO
|
||||
{
|
||||
D3D10_BOX *pSrcBox;
|
||||
D3D10_BOX *pDstBox;
|
||||
UINT SrcFirstMip;
|
||||
UINT DstFirstMip;
|
||||
UINT NumMips;
|
||||
UINT SrcFirstElement;
|
||||
UINT DstFirstElement;
|
||||
UINT NumElements;
|
||||
UINT Filter;
|
||||
UINT MipFilter;
|
||||
|
||||
#ifdef __cplusplus
|
||||
_D3DX10_TEXTURE_LOAD_INFO()
|
||||
{
|
||||
pSrcBox = NULL;
|
||||
pDstBox = NULL;
|
||||
SrcFirstMip = 0;
|
||||
DstFirstMip = 0;
|
||||
NumMips = D3DX10_DEFAULT;
|
||||
SrcFirstElement = 0;
|
||||
DstFirstElement = 0;
|
||||
NumElements = D3DX10_DEFAULT;
|
||||
Filter = D3DX10_DEFAULT;
|
||||
MipFilter = D3DX10_DEFAULT;
|
||||
}
|
||||
#endif
|
||||
|
||||
} D3DX10_TEXTURE_LOAD_INFO;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10LoadTextureFromTexture:
|
||||
// ----------------------------
|
||||
// Load a texture from a texture.
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10LoadTextureFromTexture(
|
||||
ID3D10Resource *pSrcTexture,
|
||||
D3DX10_TEXTURE_LOAD_INFO *pLoadInfo,
|
||||
ID3D10Resource *pDstTexture);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10FilterTexture:
|
||||
// ------------------
|
||||
// Filters mipmaps levels of a texture.
|
||||
//
|
||||
// Parameters:
|
||||
// pBaseTexture
|
||||
// The texture object to be filtered
|
||||
// SrcLevel
|
||||
// The level whose image is used to generate the subsequent levels.
|
||||
// MipFilter
|
||||
// D3DX10_FILTER flags controlling how each miplevel is filtered.
|
||||
// Or D3DX10_DEFAULT for D3DX10_FILTER_BOX,
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10FilterTexture(
|
||||
ID3D10Resource *pTexture,
|
||||
UINT SrcLevel,
|
||||
UINT MipFilter);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10SaveTextureToFile:
|
||||
// ----------------------
|
||||
// Save a texture to a file.
|
||||
//
|
||||
// Parameters:
|
||||
// pDestFile
|
||||
// File name of the destination file
|
||||
// DestFormat
|
||||
// D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving.
|
||||
// pSrcTexture
|
||||
// Source texture, containing the image to be saved
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10SaveTextureToFileA(
|
||||
ID3D10Resource *pSrcTexture,
|
||||
D3DX10_IMAGE_FILE_FORMAT DestFormat,
|
||||
LPCSTR pDestFile);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10SaveTextureToFileW(
|
||||
ID3D10Resource *pSrcTexture,
|
||||
D3DX10_IMAGE_FILE_FORMAT DestFormat,
|
||||
LPCWSTR pDestFile);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10SaveTextureToFile D3DX10SaveTextureToFileW
|
||||
#else
|
||||
#define D3DX10SaveTextureToFile D3DX10SaveTextureToFileA
|
||||
#endif
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10SaveTextureToMemory:
|
||||
// ----------------------
|
||||
// Save a texture to a blob.
|
||||
//
|
||||
// Parameters:
|
||||
// pSrcTexture
|
||||
// Source texture, containing the image to be saved
|
||||
// DestFormat
|
||||
// D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving.
|
||||
// ppDestBuf
|
||||
// address of a d3dxbuffer pointer to return the image data
|
||||
// Flags
|
||||
// optional flags
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10SaveTextureToMemory(
|
||||
ID3D10Resource* pSrcTexture,
|
||||
D3DX10_IMAGE_FILE_FORMAT DestFormat,
|
||||
LPD3D10BLOB* ppDestBuf,
|
||||
UINT Flags);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10ComputeNormalMap:
|
||||
// ---------------------
|
||||
// Converts a height map into a normal map. The (x,y,z) components of each
|
||||
// normal are mapped to the (r,g,b) channels of the output texture.
|
||||
//
|
||||
// Parameters
|
||||
// pSrcTexture
|
||||
// Pointer to the source heightmap texture
|
||||
// Flags
|
||||
// D3DX10_NORMALMAP flags
|
||||
// Channel
|
||||
// D3DX10_CHANNEL specifying source of height information
|
||||
// Amplitude
|
||||
// The constant value which the height information is multiplied by.
|
||||
// pDestTexture
|
||||
// Pointer to the destination texture
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10ComputeNormalMap(
|
||||
ID3D10Texture2D *pSrcTexture,
|
||||
UINT Flags,
|
||||
UINT Channel,
|
||||
FLOAT Amplitude,
|
||||
ID3D10Texture2D *pDestTexture);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10SHProjectCubeMap:
|
||||
// ----------------------
|
||||
// Projects a function represented in a cube map into spherical harmonics.
|
||||
//
|
||||
// Parameters:
|
||||
// Order
|
||||
// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
|
||||
// pCubeMap
|
||||
// CubeMap that is going to be projected into spherical harmonics
|
||||
// pROut
|
||||
// Output SH vector for Red.
|
||||
// pGOut
|
||||
// Output SH vector for Green
|
||||
// pBOut
|
||||
// Output SH vector for Blue
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX10SHProjectCubeMap(
|
||||
__in_range(2,6) UINT Order,
|
||||
ID3D10Texture2D *pCubeMap,
|
||||
__out_ecount(Order*Order) FLOAT *pROut,
|
||||
__out_ecount_opt(Order*Order) FLOAT *pGOut,
|
||||
__out_ecount_opt(Order*Order) FLOAT *pBOut);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3DX10TEX_H__
|
||||
|
||||
70
common/dx11sdk/D3DX11.h
Normal file
70
common/dx11sdk/D3DX11.h
Normal file
@@ -0,0 +1,70 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
// File: d3dx11.h
|
||||
// Content: D3DX11 utility library
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __D3DX11_INTERNAL__
|
||||
#error Incorrect D3DX11 header used
|
||||
#endif
|
||||
|
||||
#ifndef __D3DX11_H__
|
||||
#define __D3DX11_H__
|
||||
|
||||
|
||||
// Defines
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
|
||||
#define D3DX11_DEFAULT ((UINT) -1)
|
||||
#define D3DX11_FROM_FILE ((UINT) -3)
|
||||
#define DXGI_FORMAT_FROM_FILE ((DXGI_FORMAT) -3)
|
||||
|
||||
#ifndef D3DX11INLINE
|
||||
#ifdef _MSC_VER
|
||||
#if (_MSC_VER >= 1200)
|
||||
#define D3DX11INLINE __forceinline
|
||||
#else
|
||||
#define D3DX11INLINE __inline
|
||||
#endif
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#define D3DX11INLINE inline
|
||||
#else
|
||||
#define D3DX11INLINE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Includes
|
||||
#include "d3d11.h"
|
||||
#include "d3dx11.h"
|
||||
#include "d3dx11core.h"
|
||||
#include "d3dx11tex.h"
|
||||
#include "d3dx11async.h"
|
||||
|
||||
|
||||
// Errors
|
||||
#define _FACDD 0x876
|
||||
#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
|
||||
|
||||
enum _D3DX11_ERR {
|
||||
D3DX11_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT(2900),
|
||||
D3DX11_ERR_INVALID_MESH = MAKE_DDHRESULT(2901),
|
||||
D3DX11_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT(2902),
|
||||
D3DX11_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT(2903),
|
||||
D3DX11_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT(2904),
|
||||
D3DX11_ERR_INVALID_DATA = MAKE_DDHRESULT(2905),
|
||||
D3DX11_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT(2906),
|
||||
D3DX11_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT(2907),
|
||||
D3DX11_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT(2908),
|
||||
};
|
||||
|
||||
|
||||
#endif //__D3DX11_H__
|
||||
|
||||
168
common/dx11sdk/D3DX11async.h
Normal file
168
common/dx11sdk/D3DX11async.h
Normal file
@@ -0,0 +1,168 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3DX11Async.h
|
||||
// Content: D3DX11 Asynchronous Effect / Shader loaders / compilers
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3DX11ASYNC_H__
|
||||
#define __D3DX11ASYNC_H__
|
||||
|
||||
#include "d3dx11.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11Compile:
|
||||
// ------------------
|
||||
// Compiles an effect or shader.
|
||||
//
|
||||
// Parameters:
|
||||
// pSrcFile
|
||||
// Source file name.
|
||||
// hSrcModule
|
||||
// Module handle. if NULL, current module will be used.
|
||||
// pSrcResource
|
||||
// Resource name in module.
|
||||
// pSrcData
|
||||
// Pointer to source code.
|
||||
// SrcDataLen
|
||||
// Size of source code, in bytes.
|
||||
// pDefines
|
||||
// Optional NULL-terminated array of preprocessor macro definitions.
|
||||
// pInclude
|
||||
// Optional interface pointer to use for handling #include directives.
|
||||
// If this parameter is NULL, #includes will be honored when compiling
|
||||
// from file, and will error when compiling from resource or memory.
|
||||
// pFunctionName
|
||||
// Name of the entrypoint function where execution should begin.
|
||||
// pProfile
|
||||
// Instruction set to be used when generating code. Currently supported
|
||||
// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0",
|
||||
// "vs_3_sw", "vs_4_0", "vs_4_1",
|
||||
// "ps_2_0", "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0",
|
||||
// "ps_3_sw", "ps_4_0", "ps_4_1",
|
||||
// "gs_4_0", "gs_4_1",
|
||||
// "tx_1_0",
|
||||
// "fx_4_0", "fx_4_1"
|
||||
// Note that this entrypoint does not compile fx_2_0 targets, for that
|
||||
// you need to use the D3DX9 function.
|
||||
// Flags1
|
||||
// See D3D10_SHADER_xxx flags.
|
||||
// Flags2
|
||||
// See D3D10_EFFECT_xxx flags.
|
||||
// ppShader
|
||||
// Returns a buffer containing the created shader. This buffer contains
|
||||
// the compiled shader code, as well as any embedded debug and symbol
|
||||
// table info. (See D3D10GetShaderConstantTable)
|
||||
// ppErrorMsgs
|
||||
// Returns a buffer containing a listing of errors and warnings that were
|
||||
// encountered during the compile. If you are running in a debugger,
|
||||
// these are the same messages you will see in your debug output.
|
||||
// pHResult
|
||||
// Pointer to a memory location to receive the return value upon completion.
|
||||
// Maybe NULL if not needed.
|
||||
// If pPump != NULL, pHResult must be a valid memory location until the
|
||||
// the asynchronous execution completes.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3DX11CompileFromFileA(LPCSTR pSrcFile,CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX11CompileFromFileW(LPCWSTR pSrcFile, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11CompileFromFile D3DX11CompileFromFileW
|
||||
#else
|
||||
#define D3DX11CompileFromFile D3DX11CompileFromFileA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI D3DX11CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX11CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11CompileFromResource D3DX11CompileFromResourceW
|
||||
#else
|
||||
#define D3DX11CompileFromResource D3DX11CompileFromResourceA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI D3DX11CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
|
||||
HRESULT WINAPI D3DX11PreprocessShaderFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX11PreprocessShaderFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX11PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX11PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX11PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11PreprocessShaderFromFile D3DX11PreprocessShaderFromFileW
|
||||
#define D3DX11PreprocessShaderFromResource D3DX11PreprocessShaderFromResourceW
|
||||
#else
|
||||
#define D3DX11PreprocessShaderFromFile D3DX11PreprocessShaderFromFileA
|
||||
#define D3DX11PreprocessShaderFromResource D3DX11PreprocessShaderFromResourceA
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Async processors
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3DX11CreateAsyncCompilerProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2,
|
||||
ID3D10Blob **ppCompiledShader, ID3D10Blob **ppErrorBuffer, ID3DX11DataProcessor **ppProcessor);
|
||||
|
||||
|
||||
HRESULT WINAPI D3DX11CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
ID3D10Blob** ppShaderText, ID3D10Blob **ppErrorBuffer, ID3DX11DataProcessor **ppProcessor);
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11 Asynchronous texture I/O (advanced mode)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3DX11CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX11DataLoader **ppDataLoader);
|
||||
HRESULT WINAPI D3DX11CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX11DataLoader **ppDataLoader);
|
||||
HRESULT WINAPI D3DX11CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX11DataLoader **ppDataLoader);
|
||||
HRESULT WINAPI D3DX11CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX11DataLoader **ppDataLoader);
|
||||
HRESULT WINAPI D3DX11CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX11DataLoader **ppDataLoader);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11CreateAsyncFileLoader D3DX11CreateAsyncFileLoaderW
|
||||
#define D3DX11CreateAsyncResourceLoader D3DX11CreateAsyncResourceLoaderW
|
||||
#else
|
||||
#define D3DX11CreateAsyncFileLoader D3DX11CreateAsyncFileLoaderA
|
||||
#define D3DX11CreateAsyncResourceLoader D3DX11CreateAsyncResourceLoaderA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI D3DX11CreateAsyncTextureProcessor(ID3D11Device *pDevice, D3DX11_IMAGE_LOAD_INFO *pLoadInfo, ID3DX11DataProcessor **ppDataProcessor);
|
||||
HRESULT WINAPI D3DX11CreateAsyncTextureInfoProcessor(D3DX11_IMAGE_INFO *pImageInfo, ID3DX11DataProcessor **ppDataProcessor);
|
||||
HRESULT WINAPI D3DX11CreateAsyncShaderResourceViewProcessor(ID3D11Device *pDevice, D3DX11_IMAGE_LOAD_INFO *pLoadInfo, ID3DX11DataProcessor **ppDataProcessor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3DX11ASYNC_H__
|
||||
|
||||
|
||||
128
common/dx11sdk/D3DX11core.h
Normal file
128
common/dx11sdk/D3DX11core.h
Normal file
@@ -0,0 +1,128 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
// File: d3dx11core.h
|
||||
// Content: D3DX11 core types and functions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "d3dx11.h"
|
||||
|
||||
#ifndef __D3DX11CORE_H__
|
||||
#define __D3DX11CORE_H__
|
||||
|
||||
// Current name of the DLL shipped in the same SDK as this header.
|
||||
|
||||
|
||||
#define D3DX11_DLL_W L"d3dx11_41.dll"
|
||||
#define D3DX11_DLL_A "d3dx11_41.dll"
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11_DLL D3DX11_DLL_W
|
||||
#else
|
||||
#define D3DX11_DLL D3DX11_DLL_A
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3DX11_SDK_VERSION:
|
||||
// -----------------
|
||||
// This identifier is passed to D3DX11CheckVersion in order to ensure that an
|
||||
// application was built against the correct header files and lib files.
|
||||
// This number is incremented whenever a header (or other) change would
|
||||
// require applications to be rebuilt. If the version doesn't match,
|
||||
// D3DX11CreateVersion will return FALSE. (The number itself has no meaning.)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define D3DX11_SDK_VERSION 41
|
||||
|
||||
|
||||
#ifdef D3D_DIAG_DLL
|
||||
BOOL WINAPI D3DX11DebugMute(BOOL Mute);
|
||||
#endif
|
||||
HRESULT WINAPI D3DX11CheckVersion(UINT D3DSdkVersion, UINT D3DX11SdkVersion);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DX11ThreadPump:
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX11DataLoader
|
||||
|
||||
DECLARE_INTERFACE(ID3DX11DataLoader)
|
||||
{
|
||||
STDMETHOD(Load)(THIS) PURE;
|
||||
STDMETHOD(Decompress)(THIS_ void **ppData, SIZE_T *pcBytes) PURE;
|
||||
STDMETHOD(Destroy)(THIS) PURE;
|
||||
};
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX11DataProcessor
|
||||
|
||||
DECLARE_INTERFACE(ID3DX11DataProcessor)
|
||||
{
|
||||
STDMETHOD(Process)(THIS_ void *pData, SIZE_T cBytes) PURE;
|
||||
STDMETHOD(CreateDeviceObject)(THIS_ void **ppDataObject) PURE;
|
||||
STDMETHOD(Destroy)(THIS) PURE;
|
||||
};
|
||||
|
||||
// {C93FECFA-6967-478a-ABBC-402D90621FCB}
|
||||
DEFINE_GUID(IID_ID3DX11ThreadPump,
|
||||
0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DX11ThreadPump
|
||||
|
||||
DECLARE_INTERFACE_(ID3DX11ThreadPump, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DX11ThreadPump
|
||||
STDMETHOD(AddWorkItem)(THIS_ ID3DX11DataLoader *pDataLoader, ID3DX11DataProcessor *pDataProcessor, HRESULT *pHResult, void **ppDeviceObject) PURE;
|
||||
STDMETHOD_(UINT, GetWorkItemCount)(THIS) PURE;
|
||||
|
||||
STDMETHOD(WaitForAllItems)(THIS) PURE;
|
||||
STDMETHOD(ProcessDeviceWorkItems)(THIS_ UINT iWorkItemCount);
|
||||
|
||||
STDMETHOD(PurgeAllItems)(THIS) PURE;
|
||||
STDMETHOD(GetQueueStatus)(THIS_ UINT *pIoQueue, UINT *pProcessQueue, UINT *pDeviceQueue) PURE;
|
||||
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
HRESULT WINAPI D3DX11CreateThreadPump(UINT cIoThreads, UINT cProcThreads, ID3DX11ThreadPump **ppThreadPump);
|
||||
|
||||
HRESULT WINAPI D3DX11UnsetAllDeviceObjects(ID3D11DeviceContext *pContext);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define _FACD3D 0x876
|
||||
#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code )
|
||||
#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code )
|
||||
|
||||
#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156)
|
||||
#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540)
|
||||
|
||||
#endif //__D3DX11CORE_H__
|
||||
|
||||
772
common/dx11sdk/D3DX11tex.h
Normal file
772
common/dx11sdk/D3DX11tex.h
Normal file
@@ -0,0 +1,772 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
// File: d3dx11tex.h
|
||||
// Content: D3DX11 texturing APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "d3dx11.h"
|
||||
|
||||
#ifndef __D3DX11TEX_H__
|
||||
#define __D3DX11TEX_H__
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11_FILTER flags:
|
||||
// ------------------
|
||||
//
|
||||
// A valid filter must contain one of these values:
|
||||
//
|
||||
// D3DX11_FILTER_NONE
|
||||
// No scaling or filtering will take place. Pixels outside the bounds
|
||||
// of the source image are assumed to be transparent black.
|
||||
// D3DX11_FILTER_POINT
|
||||
// Each destination pixel is computed by sampling the nearest pixel
|
||||
// from the source image.
|
||||
// D3DX11_FILTER_LINEAR
|
||||
// Each destination pixel is computed by linearly interpolating between
|
||||
// the nearest pixels in the source image. This filter works best
|
||||
// when the scale on each axis is less than 2.
|
||||
// D3DX11_FILTER_TRIANGLE
|
||||
// Every pixel in the source image contributes equally to the
|
||||
// destination image. This is the slowest of all the filters.
|
||||
// D3DX11_FILTER_BOX
|
||||
// Each pixel is computed by averaging a 2x2(x2) box pixels from
|
||||
// the source image. Only works when the dimensions of the
|
||||
// destination are half those of the source. (as with mip maps)
|
||||
//
|
||||
// And can be OR'd with any of these optional flags:
|
||||
//
|
||||
// D3DX11_FILTER_MIRROR_U
|
||||
// Indicates that pixels off the edge of the texture on the U-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX11_FILTER_MIRROR_V
|
||||
// Indicates that pixels off the edge of the texture on the V-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX11_FILTER_MIRROR_W
|
||||
// Indicates that pixels off the edge of the texture on the W-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX11_FILTER_MIRROR
|
||||
// Same as specifying D3DX11_FILTER_MIRROR_U | D3DX11_FILTER_MIRROR_V |
|
||||
// D3DX11_FILTER_MIRROR_V
|
||||
// D3DX11_FILTER_DITHER
|
||||
// Dithers the resulting image using a 4x4 order dither pattern.
|
||||
// D3DX11_FILTER_SRGB_IN
|
||||
// Denotes that the input data is in sRGB (gamma 2.2) colorspace.
|
||||
// D3DX11_FILTER_SRGB_OUT
|
||||
// Denotes that the output data is in sRGB (gamma 2.2) colorspace.
|
||||
// D3DX11_FILTER_SRGB
|
||||
// Same as specifying D3DX11_FILTER_SRGB_IN | D3DX11_FILTER_SRGB_OUT
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX11_FILTER_FLAG
|
||||
{
|
||||
D3DX11_FILTER_NONE = (1 << 0),
|
||||
D3DX11_FILTER_POINT = (2 << 0),
|
||||
D3DX11_FILTER_LINEAR = (3 << 0),
|
||||
D3DX11_FILTER_TRIANGLE = (4 << 0),
|
||||
D3DX11_FILTER_BOX = (5 << 0),
|
||||
|
||||
D3DX11_FILTER_MIRROR_U = (1 << 16),
|
||||
D3DX11_FILTER_MIRROR_V = (2 << 16),
|
||||
D3DX11_FILTER_MIRROR_W = (4 << 16),
|
||||
D3DX11_FILTER_MIRROR = (7 << 16),
|
||||
|
||||
D3DX11_FILTER_DITHER = (1 << 19),
|
||||
D3DX11_FILTER_DITHER_DIFFUSION= (2 << 19),
|
||||
|
||||
D3DX11_FILTER_SRGB_IN = (1 << 21),
|
||||
D3DX11_FILTER_SRGB_OUT = (2 << 21),
|
||||
D3DX11_FILTER_SRGB = (3 << 21),
|
||||
} D3DX11_FILTER_FLAG;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11_NORMALMAP flags:
|
||||
// ---------------------
|
||||
// These flags are used to control how D3DX11ComputeNormalMap generates normal
|
||||
// maps. Any number of these flags may be OR'd together in any combination.
|
||||
//
|
||||
// D3DX11_NORMALMAP_MIRROR_U
|
||||
// Indicates that pixels off the edge of the texture on the U-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX11_NORMALMAP_MIRROR_V
|
||||
// Indicates that pixels off the edge of the texture on the V-axis
|
||||
// should be mirrored, not wraped.
|
||||
// D3DX11_NORMALMAP_MIRROR
|
||||
// Same as specifying D3DX11_NORMALMAP_MIRROR_U | D3DX11_NORMALMAP_MIRROR_V
|
||||
// D3DX11_NORMALMAP_INVERTSIGN
|
||||
// Inverts the direction of each normal
|
||||
// D3DX11_NORMALMAP_COMPUTE_OCCLUSION
|
||||
// Compute the per pixel Occlusion term and encodes it into the alpha.
|
||||
// An Alpha of 1 means that the pixel is not obscured in anyway, and
|
||||
// an alpha of 0 would mean that the pixel is completly obscured.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX11_NORMALMAP_FLAG
|
||||
{
|
||||
D3DX11_NORMALMAP_MIRROR_U = (1 << 16),
|
||||
D3DX11_NORMALMAP_MIRROR_V = (2 << 16),
|
||||
D3DX11_NORMALMAP_MIRROR = (3 << 16),
|
||||
D3DX11_NORMALMAP_INVERTSIGN = (8 << 16),
|
||||
D3DX11_NORMALMAP_COMPUTE_OCCLUSION = (16 << 16),
|
||||
} D3DX11_NORMALMAP_FLAG;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11_CHANNEL flags:
|
||||
// -------------------
|
||||
// These flags are used by functions which operate on or more channels
|
||||
// in a texture.
|
||||
//
|
||||
// D3DX11_CHANNEL_RED
|
||||
// Indicates the red channel should be used
|
||||
// D3DX11_CHANNEL_BLUE
|
||||
// Indicates the blue channel should be used
|
||||
// D3DX11_CHANNEL_GREEN
|
||||
// Indicates the green channel should be used
|
||||
// D3DX11_CHANNEL_ALPHA
|
||||
// Indicates the alpha channel should be used
|
||||
// D3DX11_CHANNEL_LUMINANCE
|
||||
// Indicates the luminaces of the red green and blue channels should be
|
||||
// used.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX11_CHANNEL_FLAG
|
||||
{
|
||||
D3DX11_CHANNEL_RED = (1 << 0),
|
||||
D3DX11_CHANNEL_BLUE = (1 << 1),
|
||||
D3DX11_CHANNEL_GREEN = (1 << 2),
|
||||
D3DX11_CHANNEL_ALPHA = (1 << 3),
|
||||
D3DX11_CHANNEL_LUMINANCE = (1 << 4),
|
||||
} D3DX11_CHANNEL_FLAG;
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11_IMAGE_FILE_FORMAT:
|
||||
// ---------------------
|
||||
// This enum is used to describe supported image file formats.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX11_IMAGE_FILE_FORMAT
|
||||
{
|
||||
D3DX11_IFF_BMP = 0,
|
||||
D3DX11_IFF_JPG = 1,
|
||||
D3DX11_IFF_PNG = 3,
|
||||
D3DX11_IFF_DDS = 4,
|
||||
D3DX11_IFF_TIFF = 10,
|
||||
D3DX11_IFF_GIF = 11,
|
||||
D3DX11_IFF_WMP = 12,
|
||||
D3DX11_IFF_FORCE_DWORD = 0x7fffffff
|
||||
|
||||
} D3DX11_IMAGE_FILE_FORMAT;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11_SAVE_TEXTURE_FLAG:
|
||||
// ---------------------
|
||||
// This enum is used to support texture saving options.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DX11_SAVE_TEXTURE_FLAG
|
||||
{
|
||||
D3DX11_STF_USEINPUTBLOB = 0x0001,
|
||||
} D3DX11_SAVE_TEXTURE_FLAG;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11_IMAGE_INFO:
|
||||
// ---------------
|
||||
// This structure is used to return a rough description of what the
|
||||
// the original contents of an image file looked like.
|
||||
//
|
||||
// Width
|
||||
// Width of original image in pixels
|
||||
// Height
|
||||
// Height of original image in pixels
|
||||
// Depth
|
||||
// Depth of original image in pixels
|
||||
// ArraySize
|
||||
// Array size in textures
|
||||
// MipLevels
|
||||
// Number of mip levels in original image
|
||||
// MiscFlags
|
||||
// Miscellaneous flags
|
||||
// Format
|
||||
// D3D format which most closely describes the data in original image
|
||||
// ResourceDimension
|
||||
// D3D11_RESOURCE_DIMENSION representing the dimension of texture stored in the file.
|
||||
// D3D11_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D
|
||||
// ImageFileFormat
|
||||
// D3DX11_IMAGE_FILE_FORMAT representing the format of the image file.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct D3DX11_IMAGE_INFO
|
||||
{
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
UINT Depth;
|
||||
UINT ArraySize;
|
||||
UINT MipLevels;
|
||||
UINT MiscFlags;
|
||||
DXGI_FORMAT Format;
|
||||
D3D11_RESOURCE_DIMENSION ResourceDimension;
|
||||
D3DX11_IMAGE_FILE_FORMAT ImageFileFormat;
|
||||
} D3DX11_IMAGE_INFO;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Image File APIs ///////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11_IMAGE_LOAD_INFO:
|
||||
// ---------------
|
||||
// This structure can be optionally passed in to texture loader APIs to
|
||||
// control how textures get loaded. Pass in D3DX11_DEFAULT for any of these
|
||||
// to have D3DX automatically pick defaults based on the source file.
|
||||
//
|
||||
// Width
|
||||
// Rescale texture to Width texels wide
|
||||
// Height
|
||||
// Rescale texture to Height texels high
|
||||
// Depth
|
||||
// Rescale texture to Depth texels deep
|
||||
// FirstMipLevel
|
||||
// First mip level to load
|
||||
// MipLevels
|
||||
// Number of mip levels to load after the first level
|
||||
// Usage
|
||||
// D3D11_USAGE flag for the new texture
|
||||
// BindFlags
|
||||
// D3D11 Bind flags for the new texture
|
||||
// CpuAccessFlags
|
||||
// D3D11 CPU Access flags for the new texture
|
||||
// MiscFlags
|
||||
// Reserved. Must be 0
|
||||
// Format
|
||||
// Resample texture to the specified format
|
||||
// Filter
|
||||
// Filter the texture using the specified filter (only when resampling)
|
||||
// MipFilter
|
||||
// Filter the texture mip levels using the specified filter (only if
|
||||
// generating mips)
|
||||
// pSrcInfo
|
||||
// (optional) pointer to a D3DX11_IMAGE_INFO structure that will get
|
||||
// populated with source image information
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
typedef struct D3DX11_IMAGE_LOAD_INFO
|
||||
{
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
UINT Depth;
|
||||
UINT FirstMipLevel;
|
||||
UINT MipLevels;
|
||||
D3D11_USAGE Usage;
|
||||
UINT BindFlags;
|
||||
UINT CpuAccessFlags;
|
||||
UINT MiscFlags;
|
||||
DXGI_FORMAT Format;
|
||||
UINT Filter;
|
||||
UINT MipFilter;
|
||||
D3DX11_IMAGE_INFO* pSrcInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
D3DX11_IMAGE_LOAD_INFO()
|
||||
{
|
||||
Width = D3DX11_DEFAULT;
|
||||
Height = D3DX11_DEFAULT;
|
||||
Depth = D3DX11_DEFAULT;
|
||||
FirstMipLevel = D3DX11_DEFAULT;
|
||||
MipLevels = D3DX11_DEFAULT;
|
||||
Usage = (D3D11_USAGE) D3DX11_DEFAULT;
|
||||
BindFlags = D3DX11_DEFAULT;
|
||||
CpuAccessFlags = D3DX11_DEFAULT;
|
||||
MiscFlags = D3DX11_DEFAULT;
|
||||
Format = DXGI_FORMAT_FROM_FILE;
|
||||
Filter = D3DX11_DEFAULT;
|
||||
MipFilter = D3DX11_DEFAULT;
|
||||
pSrcInfo = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
} D3DX11_IMAGE_LOAD_INFO;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// GetImageInfoFromFile/Resource/Memory:
|
||||
// ------------------------------
|
||||
// Fills in a D3DX11_IMAGE_INFO struct with information about an image file.
|
||||
//
|
||||
// Parameters:
|
||||
// pSrcFile
|
||||
// File name of the source image.
|
||||
// pSrcModule
|
||||
// Module where resource is located, or NULL for module associated
|
||||
// with image the os used to create the current process.
|
||||
// pSrcResource
|
||||
// Resource name.
|
||||
// pSrcData
|
||||
// Pointer to file in memory.
|
||||
// SrcDataSize
|
||||
// Size in bytes of file in memory.
|
||||
// pPump
|
||||
// Optional pointer to a thread pump object to use.
|
||||
// pSrcInfo
|
||||
// Pointer to a D3DX11_IMAGE_INFO structure to be filled in with the
|
||||
// description of the data in the source image file.
|
||||
// pHResult
|
||||
// Pointer to a memory location to receive the return value upon completion.
|
||||
// Maybe NULL if not needed.
|
||||
// If pPump != NULL, pHResult must be a valid memory location until the
|
||||
// the asynchronous execution completes.
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11GetImageInfoFromFileA(
|
||||
LPCSTR pSrcFile,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
D3DX11_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11GetImageInfoFromFileW(
|
||||
LPCWSTR pSrcFile,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
D3DX11_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11GetImageInfoFromFile D3DX11GetImageInfoFromFileW
|
||||
#else
|
||||
#define D3DX11GetImageInfoFromFile D3DX11GetImageInfoFromFileA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11GetImageInfoFromResourceA(
|
||||
HMODULE hSrcModule,
|
||||
LPCSTR pSrcResource,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
D3DX11_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11GetImageInfoFromResourceW(
|
||||
HMODULE hSrcModule,
|
||||
LPCWSTR pSrcResource,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
D3DX11_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11GetImageInfoFromResource D3DX11GetImageInfoFromResourceW
|
||||
#else
|
||||
#define D3DX11GetImageInfoFromResource D3DX11GetImageInfoFromResourceA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11GetImageInfoFromMemory(
|
||||
LPCVOID pSrcData,
|
||||
SIZE_T SrcDataSize,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
D3DX11_IMAGE_INFO* pSrcInfo,
|
||||
HRESULT* pHResult);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Create/Save Texture APIs //////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11CreateTextureFromFile/Resource/Memory:
|
||||
// D3DX11CreateShaderResourceViewFromFile/Resource/Memory:
|
||||
// -----------------------------------
|
||||
// Create a texture object from a file or resource.
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// pDevice
|
||||
// The D3D device with which the texture is going to be used.
|
||||
// pSrcFile
|
||||
// File name.
|
||||
// hSrcModule
|
||||
// Module handle. if NULL, current module will be used.
|
||||
// pSrcResource
|
||||
// Resource name in module
|
||||
// pvSrcData
|
||||
// Pointer to file in memory.
|
||||
// SrcDataSize
|
||||
// Size in bytes of file in memory.
|
||||
// pLoadInfo
|
||||
// Optional pointer to a D3DX11_IMAGE_LOAD_INFO structure that
|
||||
// contains additional loader parameters.
|
||||
// pPump
|
||||
// Optional pointer to a thread pump object to use.
|
||||
// ppTexture
|
||||
// [out] Created texture object.
|
||||
// ppShaderResourceView
|
||||
// [out] Shader resource view object created.
|
||||
// pHResult
|
||||
// Pointer to a memory location to receive the return value upon completion.
|
||||
// Maybe NULL if not needed.
|
||||
// If pPump != NULL, pHResult must be a valid memory location until the
|
||||
// the asynchronous execution completes.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// FromFile
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateShaderResourceViewFromFileA(
|
||||
ID3D11Device* pDevice,
|
||||
LPCSTR pSrcFile,
|
||||
D3DX11_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateShaderResourceViewFromFileW(
|
||||
ID3D11Device* pDevice,
|
||||
LPCWSTR pSrcFile,
|
||||
D3DX11_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11CreateShaderResourceViewFromFile D3DX11CreateShaderResourceViewFromFileW
|
||||
#else
|
||||
#define D3DX11CreateShaderResourceViewFromFile D3DX11CreateShaderResourceViewFromFileA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateTextureFromFileA(
|
||||
ID3D11Device* pDevice,
|
||||
LPCSTR pSrcFile,
|
||||
D3DX11_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateTextureFromFileW(
|
||||
ID3D11Device* pDevice,
|
||||
LPCWSTR pSrcFile,
|
||||
D3DX11_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11CreateTextureFromFile D3DX11CreateTextureFromFileW
|
||||
#else
|
||||
#define D3DX11CreateTextureFromFile D3DX11CreateTextureFromFileA
|
||||
#endif
|
||||
|
||||
|
||||
// FromResource (resources in dll/exes)
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateShaderResourceViewFromResourceA(
|
||||
ID3D11Device* pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCSTR pSrcResource,
|
||||
D3DX11_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateShaderResourceViewFromResourceW(
|
||||
ID3D11Device* pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCWSTR pSrcResource,
|
||||
D3DX11_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11CreateShaderResourceViewFromResource D3DX11CreateShaderResourceViewFromResourceW
|
||||
#else
|
||||
#define D3DX11CreateShaderResourceViewFromResource D3DX11CreateShaderResourceViewFromResourceA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateTextureFromResourceA(
|
||||
ID3D11Device* pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCSTR pSrcResource,
|
||||
D3DX11_IMAGE_LOAD_INFO *pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateTextureFromResourceW(
|
||||
ID3D11Device* pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCWSTR pSrcResource,
|
||||
D3DX11_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11CreateTextureFromResource D3DX11CreateTextureFromResourceW
|
||||
#else
|
||||
#define D3DX11CreateTextureFromResource D3DX11CreateTextureFromResourceA
|
||||
#endif
|
||||
|
||||
|
||||
// FromFileInMemory
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateShaderResourceViewFromMemory(
|
||||
ID3D11Device* pDevice,
|
||||
LPCVOID pSrcData,
|
||||
SIZE_T SrcDataSize,
|
||||
D3DX11_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11ShaderResourceView** ppShaderResourceView,
|
||||
HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11CreateTextureFromMemory(
|
||||
ID3D11Device* pDevice,
|
||||
LPCVOID pSrcData,
|
||||
SIZE_T SrcDataSize,
|
||||
D3DX11_IMAGE_LOAD_INFO* pLoadInfo,
|
||||
ID3DX11ThreadPump* pPump,
|
||||
ID3D11Resource** ppTexture,
|
||||
HRESULT* pHResult);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Misc Texture APIs /////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11_TEXTURE_LOAD_INFO:
|
||||
// ------------------------
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct _D3DX11_TEXTURE_LOAD_INFO
|
||||
{
|
||||
D3D11_BOX *pSrcBox;
|
||||
D3D11_BOX *pDstBox;
|
||||
UINT SrcFirstMip;
|
||||
UINT DstFirstMip;
|
||||
UINT NumMips;
|
||||
UINT SrcFirstElement;
|
||||
UINT DstFirstElement;
|
||||
UINT NumElements;
|
||||
UINT Filter;
|
||||
UINT MipFilter;
|
||||
|
||||
#ifdef __cplusplus
|
||||
_D3DX11_TEXTURE_LOAD_INFO()
|
||||
{
|
||||
pSrcBox = NULL;
|
||||
pDstBox = NULL;
|
||||
SrcFirstMip = 0;
|
||||
DstFirstMip = 0;
|
||||
NumMips = D3DX11_DEFAULT;
|
||||
SrcFirstElement = 0;
|
||||
DstFirstElement = 0;
|
||||
NumElements = D3DX11_DEFAULT;
|
||||
Filter = D3DX11_DEFAULT;
|
||||
MipFilter = D3DX11_DEFAULT;
|
||||
}
|
||||
#endif
|
||||
|
||||
} D3DX11_TEXTURE_LOAD_INFO;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11LoadTextureFromTexture:
|
||||
// ----------------------------
|
||||
// Load a texture from a texture.
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11LoadTextureFromTexture(
|
||||
ID3D11DeviceContext *pContext,
|
||||
ID3D11Resource *pSrcTexture,
|
||||
D3DX11_TEXTURE_LOAD_INFO *pLoadInfo,
|
||||
ID3D11Resource *pDstTexture);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11FilterTexture:
|
||||
// ------------------
|
||||
// Filters mipmaps levels of a texture.
|
||||
//
|
||||
// Parameters:
|
||||
// pBaseTexture
|
||||
// The texture object to be filtered
|
||||
// SrcLevel
|
||||
// The level whose image is used to generate the subsequent levels.
|
||||
// MipFilter
|
||||
// D3DX11_FILTER flags controlling how each miplevel is filtered.
|
||||
// Or D3DX11_DEFAULT for D3DX11_FILTER_BOX,
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11FilterTexture(
|
||||
ID3D11DeviceContext *pContext,
|
||||
ID3D11Resource *pTexture,
|
||||
UINT SrcLevel,
|
||||
UINT MipFilter);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11SaveTextureToFile:
|
||||
// ----------------------
|
||||
// Save a texture to a file.
|
||||
//
|
||||
// Parameters:
|
||||
// pDestFile
|
||||
// File name of the destination file
|
||||
// DestFormat
|
||||
// D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving.
|
||||
// pSrcTexture
|
||||
// Source texture, containing the image to be saved
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11SaveTextureToFileA(
|
||||
ID3D11DeviceContext *pContext,
|
||||
ID3D11Resource *pSrcTexture,
|
||||
D3DX11_IMAGE_FILE_FORMAT DestFormat,
|
||||
LPCSTR pDestFile);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11SaveTextureToFileW(
|
||||
ID3D11DeviceContext *pContext,
|
||||
ID3D11Resource *pSrcTexture,
|
||||
D3DX11_IMAGE_FILE_FORMAT DestFormat,
|
||||
LPCWSTR pDestFile);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX11SaveTextureToFile D3DX11SaveTextureToFileW
|
||||
#else
|
||||
#define D3DX11SaveTextureToFile D3DX11SaveTextureToFileA
|
||||
#endif
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11SaveTextureToMemory:
|
||||
// ----------------------
|
||||
// Save a texture to a blob.
|
||||
//
|
||||
// Parameters:
|
||||
// pSrcTexture
|
||||
// Source texture, containing the image to be saved
|
||||
// DestFormat
|
||||
// D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving.
|
||||
// ppDestBuf
|
||||
// address of a d3dxbuffer pointer to return the image data
|
||||
// Flags
|
||||
// optional flags
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11SaveTextureToMemory(
|
||||
ID3D11DeviceContext *pContext,
|
||||
ID3D11Resource* pSrcTexture,
|
||||
D3DX11_IMAGE_FILE_FORMAT DestFormat,
|
||||
ID3D10Blob** ppDestBuf,
|
||||
UINT Flags);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11ComputeNormalMap:
|
||||
// ---------------------
|
||||
// Converts a height map into a normal map. The (x,y,z) components of each
|
||||
// normal are mapped to the (r,g,b) channels of the output texture.
|
||||
//
|
||||
// Parameters
|
||||
// pSrcTexture
|
||||
// Pointer to the source heightmap texture
|
||||
// Flags
|
||||
// D3DX11_NORMALMAP flags
|
||||
// Channel
|
||||
// D3DX11_CHANNEL specifying source of height information
|
||||
// Amplitude
|
||||
// The constant value which the height information is multiplied by.
|
||||
// pDestTexture
|
||||
// Pointer to the destination texture
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11ComputeNormalMap(
|
||||
ID3D11DeviceContext *pContext,
|
||||
ID3D11Texture2D *pSrcTexture,
|
||||
UINT Flags,
|
||||
UINT Channel,
|
||||
FLOAT Amplitude,
|
||||
ID3D11Texture2D *pDestTexture);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX11SHProjectCubeMap:
|
||||
// ----------------------
|
||||
// Projects a function represented in a cube map into spherical harmonics.
|
||||
//
|
||||
// Parameters:
|
||||
// Order
|
||||
// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
|
||||
// pCubeMap
|
||||
// CubeMap that is going to be projected into spherical harmonics
|
||||
// pROut
|
||||
// Output SH vector for Red.
|
||||
// pGOut
|
||||
// Output SH vector for Green
|
||||
// pBOut
|
||||
// Output SH vector for Blue
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DX11SHProjectCubeMap(
|
||||
ID3D11DeviceContext *pContext,
|
||||
__in_range(2,6) UINT Order,
|
||||
ID3D11Texture2D *pCubeMap,
|
||||
__out_ecount(Order*Order) FLOAT *pROut,
|
||||
__out_ecount_opt(Order*Order) FLOAT *pGOut,
|
||||
__out_ecount_opt(Order*Order) FLOAT *pBOut);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3DX11TEX_H__
|
||||
|
||||
95
common/dx11sdk/D3Dcommon.h
Normal file
95
common/dx11sdk/D3Dcommon.h
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
|
||||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
|
||||
|
||||
|
||||
/* File created by MIDL compiler version 7.00.0553 */
|
||||
/* Compiler settings for d3dcommon.idl:
|
||||
Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 7.00.0553
|
||||
protocol : all , ms_ext, c_ext, robust
|
||||
error checks: allocation ref bounds_check enum stub_data
|
||||
VC __declspec() decoration level:
|
||||
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
|
||||
DECLSPEC_UUID(), MIDL_INTERFACE()
|
||||
*/
|
||||
/* @@MIDL_FILE_HEADING( ) */
|
||||
|
||||
#pragma warning( disable: 4049 ) /* more than 64k source lines */
|
||||
|
||||
|
||||
/* verify that the <rpcndr.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCNDR_H_VERSION__
|
||||
#define __REQUIRED_RPCNDR_H_VERSION__ 475
|
||||
#endif
|
||||
|
||||
/* verify that the <rpcsal.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCSAL_H_VERSION__
|
||||
#define __REQUIRED_RPCSAL_H_VERSION__ 100
|
||||
#endif
|
||||
|
||||
#include "rpc.h"
|
||||
#include "rpcndr.h"
|
||||
|
||||
#ifndef __RPCNDR_H_VERSION__
|
||||
#error this stub requires an updated version of <rpcndr.h>
|
||||
#endif // __RPCNDR_H_VERSION__
|
||||
|
||||
|
||||
#ifndef __d3dcommon_h__
|
||||
#define __d3dcommon_h__
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/* Forward Declarations */
|
||||
|
||||
/* header files for imported files */
|
||||
#include "oaidl.h"
|
||||
#include "ocidl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3dcommon_0000_0000 */
|
||||
/* [local] */
|
||||
|
||||
typedef
|
||||
enum D3D_DRIVER_TYPE
|
||||
{ D3D_DRIVER_TYPE_UNKNOWN = 0,
|
||||
D3D_DRIVER_TYPE_HARDWARE = ( D3D_DRIVER_TYPE_UNKNOWN + 1 ) ,
|
||||
D3D_DRIVER_TYPE_REFERENCE = ( D3D_DRIVER_TYPE_HARDWARE + 1 ) ,
|
||||
D3D_DRIVER_TYPE_NULL = ( D3D_DRIVER_TYPE_REFERENCE + 1 ) ,
|
||||
D3D_DRIVER_TYPE_SOFTWARE = ( D3D_DRIVER_TYPE_NULL + 1 ) ,
|
||||
D3D_DRIVER_TYPE_WARP = ( D3D_DRIVER_TYPE_SOFTWARE + 1 )
|
||||
} D3D_DRIVER_TYPE;
|
||||
|
||||
typedef
|
||||
enum D3D_FEATURE_LEVEL
|
||||
{ D3D_FEATURE_LEVEL_9_1 = 0x9100,
|
||||
D3D_FEATURE_LEVEL_9_2 = 0x9200,
|
||||
D3D_FEATURE_LEVEL_9_3 = 0x9300,
|
||||
D3D_FEATURE_LEVEL_10_0 = 0xa000,
|
||||
D3D_FEATURE_LEVEL_10_1 = 0xa100,
|
||||
D3D_FEATURE_LEVEL_11_0 = 0xb000
|
||||
} D3D_FEATURE_LEVEL;
|
||||
|
||||
DEFINE_GUID(WKPDID_D3DDebugObjectName,0x429b8c22,0x9188,0x4b0c,0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00);
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_s_ifspec;
|
||||
|
||||
/* Additional Prototypes for ALL interfaces */
|
||||
|
||||
/* end of Additional Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
222
common/dx11sdk/D3Dcompiler.h
Normal file
222
common/dx11sdk/D3Dcompiler.h
Normal file
@@ -0,0 +1,222 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3DCompiler.h
|
||||
// Content: D3D Compilation Types and APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3DCOMPILER_H__
|
||||
#define __D3DCOMPILER_H__
|
||||
|
||||
// Current name of the DLL shipped in the same SDK as this header.
|
||||
|
||||
|
||||
#define D3DCOMPILER_DLL_W L"d3dcompiler_41.dll"
|
||||
#define D3DCOMPILER_DLL_A "d3dcompiler_41.dll"
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DCOMPILER_DLL D3DCOMPILER_DLL_W
|
||||
#else
|
||||
#define D3DCOMPILER_DLL D3DCOMPILER_DLL_A
|
||||
#endif
|
||||
|
||||
#include "d3d11shader.h"
|
||||
|
||||
// The compilation APIs are generally not tied to particular
|
||||
// versions of D3D, thus their names and types don't reflect
|
||||
// a particular version number unless it is necessary to
|
||||
// do so. However, for compatibility with previous compilation
|
||||
// API definitions some of the neutral types are simply
|
||||
// redefinitions of older types.
|
||||
typedef struct _D3D10_SHADER_MACRO D3D_SHADER_MACRO;
|
||||
typedef enum _D3D10_INCLUDE_TYPE D3D_INCLUDE_TYPE;
|
||||
typedef interface ID3D10Blob ID3DBlob;
|
||||
typedef ID3DBlob* LPD3DBLOB;
|
||||
typedef interface ID3D10Include ID3DInclude;
|
||||
typedef ID3DInclude* LPD3DINCLUDE;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// APIs //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DCompile:
|
||||
// ----------
|
||||
// Compile source text into bytecode appropriate for the given target.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DCompile(__in_bcount(SrcDataSize) LPCVOID pSrcData,
|
||||
__in SIZE_T SrcDataSize,
|
||||
__in_opt LPCSTR pSourceName,
|
||||
__in_xcount_opt(pDefines->Name != NULL) CONST D3D_SHADER_MACRO* pDefines,
|
||||
__in_opt LPD3DINCLUDE pInclude,
|
||||
__in LPCSTR pEntrypoint,
|
||||
__in LPCSTR pTarget,
|
||||
__in UINT Flags1,
|
||||
__in UINT Flags2,
|
||||
__out LPD3DBLOB* ppCode,
|
||||
__out_opt LPD3DBLOB* ppErrorMsgs);
|
||||
|
||||
typedef HRESULT (WINAPI *pD3DCompile)
|
||||
(LPCVOID pSrcData,
|
||||
SIZE_T SrcDataSize,
|
||||
LPCSTR pFileName,
|
||||
CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pEntrypoint,
|
||||
LPCSTR pTarget,
|
||||
UINT Flags1,
|
||||
UINT Flags2,
|
||||
LPD3D10BLOB* ppCode,
|
||||
LPD3D10BLOB* ppErrorMsgs);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DPreprocess:
|
||||
// ----------
|
||||
// Process source text with the compiler's preprocessor and return
|
||||
// the resulting text.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DPreprocess(__in_bcount(SrcDataSize) LPCVOID pSrcData,
|
||||
__in SIZE_T SrcDataSize,
|
||||
__in_opt LPCSTR pSourceName,
|
||||
__in_opt CONST D3D_SHADER_MACRO* pDefines,
|
||||
__in_opt LPD3DINCLUDE pInclude,
|
||||
__out LPD3DBLOB* ppCodeText,
|
||||
__out_opt LPD3DBLOB* ppErrorMsgs);
|
||||
|
||||
typedef HRESULT (WINAPI *pD3DPreprocess)
|
||||
(LPCVOID pSrcData,
|
||||
SIZE_T SrcDataSize,
|
||||
LPCSTR pFileName,
|
||||
CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude,
|
||||
LPD3D10BLOB* ppCodeText,
|
||||
LPD3D10BLOB* ppErrorMsgs);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DGetDebugInfo:
|
||||
// -----------------------
|
||||
// Gets shader debug info. Debug info is generated by D3DCompile and is
|
||||
// embedded in the body of the shader.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DGetDebugInfo(__in_bcount(SrcDataSize) LPCVOID pSrcData,
|
||||
__in SIZE_T SrcDataSize,
|
||||
__out LPD3DBLOB* ppDebugInfo);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DReflect:
|
||||
// ----------
|
||||
// Shader code contains metadata that can be inspected via the
|
||||
// reflection APIs.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DReflect(__in_bcount(SrcDataSize) LPCVOID pSrcData,
|
||||
__in SIZE_T SrcDataSize,
|
||||
__in REFIID pInterface,
|
||||
__out void** ppReflector);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DDisassemble:
|
||||
// ----------------------
|
||||
// Takes a binary shader and returns a buffer containing text assembly.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#define D3D_DISASM_ENABLE_COLOR_CODE 0x00000001
|
||||
#define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS 0x00000002
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DDisassemble(__in_bcount(SrcDataSize) LPCVOID pSrcData,
|
||||
__in SIZE_T SrcDataSize,
|
||||
__in UINT Flags,
|
||||
__in_opt LPCSTR szComments,
|
||||
__out LPD3DBLOB* ppDisassembly);
|
||||
|
||||
typedef HRESULT (WINAPI *pD3DDisassemble)
|
||||
(__in_bcount(SrcDataSize) LPCVOID pSrcData,
|
||||
__in SIZE_T SrcDataSize,
|
||||
__in UINT Flags,
|
||||
__in_opt LPCSTR szComments,
|
||||
__out LPD3DBLOB* ppDisassembly);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DDisassemble10Effect:
|
||||
// -----------------------
|
||||
// Takes a D3D10 effect interface and returns a
|
||||
// buffer containing text assembly.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DDisassemble10Effect(__in ID3D10Effect *pEffect,
|
||||
__in UINT Flags,
|
||||
__out LPD3DBLOB* ppDisassembly);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DGetInputSignatureBlob:
|
||||
// -----------------------
|
||||
// Retrieve the input signature from a compilation result.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DGetInputSignatureBlob(__in_bcount(SrcDataSize) LPCVOID pSrcData,
|
||||
__in SIZE_T SrcDataSize,
|
||||
__out LPD3DBLOB* ppSignatureBlob);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DGetOutputSignatureBlob:
|
||||
// -----------------------
|
||||
// Retrieve the output signature from a compilation result.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DGetOutputSignatureBlob(__in_bcount(SrcDataSize) LPCVOID pSrcData,
|
||||
__in SIZE_T SrcDataSize,
|
||||
__out LPD3DBLOB* ppSignatureBlob);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DGetInputAndOutputSignatureBlob:
|
||||
// -----------------------
|
||||
// Retrieve the input and output signatures from a compilation result.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DGetInputAndOutputSignatureBlob(__in_bcount(SrcDataSize) LPCVOID pSrcData,
|
||||
__in SIZE_T SrcDataSize,
|
||||
__out LPD3DBLOB* ppSignatureBlob);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DStripShader:
|
||||
// -----------------------
|
||||
// Removes unwanted blobs from a compilation result
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3DCOMPILER_STRIP_FLAGS
|
||||
{
|
||||
D3DCOMPILER_STRIP_REFLECTION_DATA = 1,
|
||||
D3DCOMPILER_STRIP_DEBUG_INFO = 2,
|
||||
D3DCOMPILER_STRIP_TEST_BLOBS = 4,
|
||||
D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff,
|
||||
} D3DCOMPILER_STRIP_FLAGS;
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DStripShader(__in_bcount(BytecodeLength) LPCVOID pShaderBytecode,
|
||||
__in SIZE_T BytecodeLength,
|
||||
__in UINT uStripFlags,
|
||||
__out LPD3DBLOB* ppStrippedBlob);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif // #ifndef __D3DCOMPILER_H__
|
||||
4855
common/dx11sdk/DWrite.h
Normal file
4855
common/dx11sdk/DWrite.h
Normal file
File diff suppressed because it is too large
Load Diff
2641
common/dx11sdk/DXGI.h
Normal file
2641
common/dx11sdk/DXGI.h
Normal file
File diff suppressed because it is too large
Load Diff
112
common/dx11sdk/DXGIFormat.h
Normal file
112
common/dx11sdk/DXGIFormat.h
Normal file
@@ -0,0 +1,112 @@
|
||||
|
||||
#ifndef __dxgiformat_h__
|
||||
#define __dxgiformat_h__
|
||||
|
||||
#define DXGI_FORMAT_DEFINED 1
|
||||
|
||||
typedef enum DXGI_FORMAT
|
||||
{
|
||||
DXGI_FORMAT_UNKNOWN = 0,
|
||||
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
|
||||
DXGI_FORMAT_R32G32B32A32_UINT = 3,
|
||||
DXGI_FORMAT_R32G32B32A32_SINT = 4,
|
||||
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
|
||||
DXGI_FORMAT_R32G32B32_FLOAT = 6,
|
||||
DXGI_FORMAT_R32G32B32_UINT = 7,
|
||||
DXGI_FORMAT_R32G32B32_SINT = 8,
|
||||
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
|
||||
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
|
||||
DXGI_FORMAT_R16G16B16A16_UINT = 12,
|
||||
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
|
||||
DXGI_FORMAT_R16G16B16A16_SINT = 14,
|
||||
DXGI_FORMAT_R32G32_TYPELESS = 15,
|
||||
DXGI_FORMAT_R32G32_FLOAT = 16,
|
||||
DXGI_FORMAT_R32G32_UINT = 17,
|
||||
DXGI_FORMAT_R32G32_SINT = 18,
|
||||
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
|
||||
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
|
||||
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
|
||||
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
|
||||
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
|
||||
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
|
||||
DXGI_FORMAT_R10G10B10A2_UINT = 25,
|
||||
DXGI_FORMAT_R11G11B10_FLOAT = 26,
|
||||
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
|
||||
DXGI_FORMAT_R8G8B8A8_UINT = 30,
|
||||
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
|
||||
DXGI_FORMAT_R8G8B8A8_SINT = 32,
|
||||
DXGI_FORMAT_R16G16_TYPELESS = 33,
|
||||
DXGI_FORMAT_R16G16_FLOAT = 34,
|
||||
DXGI_FORMAT_R16G16_UNORM = 35,
|
||||
DXGI_FORMAT_R16G16_UINT = 36,
|
||||
DXGI_FORMAT_R16G16_SNORM = 37,
|
||||
DXGI_FORMAT_R16G16_SINT = 38,
|
||||
DXGI_FORMAT_R32_TYPELESS = 39,
|
||||
DXGI_FORMAT_D32_FLOAT = 40,
|
||||
DXGI_FORMAT_R32_FLOAT = 41,
|
||||
DXGI_FORMAT_R32_UINT = 42,
|
||||
DXGI_FORMAT_R32_SINT = 43,
|
||||
DXGI_FORMAT_R24G8_TYPELESS = 44,
|
||||
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
|
||||
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
|
||||
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
|
||||
DXGI_FORMAT_R8G8_TYPELESS = 48,
|
||||
DXGI_FORMAT_R8G8_UNORM = 49,
|
||||
DXGI_FORMAT_R8G8_UINT = 50,
|
||||
DXGI_FORMAT_R8G8_SNORM = 51,
|
||||
DXGI_FORMAT_R8G8_SINT = 52,
|
||||
DXGI_FORMAT_R16_TYPELESS = 53,
|
||||
DXGI_FORMAT_R16_FLOAT = 54,
|
||||
DXGI_FORMAT_D16_UNORM = 55,
|
||||
DXGI_FORMAT_R16_UNORM = 56,
|
||||
DXGI_FORMAT_R16_UINT = 57,
|
||||
DXGI_FORMAT_R16_SNORM = 58,
|
||||
DXGI_FORMAT_R16_SINT = 59,
|
||||
DXGI_FORMAT_R8_TYPELESS = 60,
|
||||
DXGI_FORMAT_R8_UNORM = 61,
|
||||
DXGI_FORMAT_R8_UINT = 62,
|
||||
DXGI_FORMAT_R8_SNORM = 63,
|
||||
DXGI_FORMAT_R8_SINT = 64,
|
||||
DXGI_FORMAT_A8_UNORM = 65,
|
||||
DXGI_FORMAT_R1_UNORM = 66,
|
||||
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
|
||||
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
|
||||
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
|
||||
DXGI_FORMAT_BC1_TYPELESS = 70,
|
||||
DXGI_FORMAT_BC1_UNORM = 71,
|
||||
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
|
||||
DXGI_FORMAT_BC2_TYPELESS = 73,
|
||||
DXGI_FORMAT_BC2_UNORM = 74,
|
||||
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
|
||||
DXGI_FORMAT_BC3_TYPELESS = 76,
|
||||
DXGI_FORMAT_BC3_UNORM = 77,
|
||||
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
|
||||
DXGI_FORMAT_BC4_TYPELESS = 79,
|
||||
DXGI_FORMAT_BC4_UNORM = 80,
|
||||
DXGI_FORMAT_BC4_SNORM = 81,
|
||||
DXGI_FORMAT_BC5_TYPELESS = 82,
|
||||
DXGI_FORMAT_BC5_UNORM = 83,
|
||||
DXGI_FORMAT_BC5_SNORM = 84,
|
||||
DXGI_FORMAT_B5G6R5_UNORM = 85,
|
||||
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
|
||||
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
|
||||
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
|
||||
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
|
||||
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
|
||||
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
|
||||
DXGI_FORMAT_BC6H_TYPELESS = 94,
|
||||
DXGI_FORMAT_BC6H_UF16 = 95,
|
||||
DXGI_FORMAT_BC6H_SF16 = 96,
|
||||
DXGI_FORMAT_BC7_TYPELESS = 97,
|
||||
DXGI_FORMAT_BC7_UNORM = 98,
|
||||
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
|
||||
DXGI_FORMAT_FORCE_UINT = 0xffffffff
|
||||
} DXGI_FORMAT;
|
||||
|
||||
#endif // __dxgiformat_h__
|
||||
123
common/dx11sdk/DXGIType.h
Normal file
123
common/dx11sdk/DXGIType.h
Normal file
@@ -0,0 +1,123 @@
|
||||
|
||||
#ifndef __dxgitype_h__
|
||||
#define __dxgitype_h__
|
||||
|
||||
|
||||
#include "dxgiformat.h"
|
||||
|
||||
#define _FACDXGI 0x87a
|
||||
#define MAKE_DXGI_HRESULT(code) MAKE_HRESULT(1, _FACDXGI, code)
|
||||
#define MAKE_DXGI_STATUS(code) MAKE_HRESULT(0, _FACDXGI, code)
|
||||
|
||||
#define DXGI_STATUS_OCCLUDED MAKE_DXGI_STATUS(1)
|
||||
#define DXGI_STATUS_CLIPPED MAKE_DXGI_STATUS(2)
|
||||
#define DXGI_STATUS_NO_REDIRECTION MAKE_DXGI_STATUS(4)
|
||||
#define DXGI_STATUS_NO_DESKTOP_ACCESS MAKE_DXGI_STATUS(5)
|
||||
#define DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_STATUS(6)
|
||||
#define DXGI_STATUS_MODE_CHANGED MAKE_DXGI_STATUS(7)
|
||||
#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS MAKE_DXGI_STATUS(8)
|
||||
|
||||
|
||||
#define DXGI_ERROR_INVALID_CALL MAKE_DXGI_HRESULT(1)
|
||||
#define DXGI_ERROR_NOT_FOUND MAKE_DXGI_HRESULT(2)
|
||||
#define DXGI_ERROR_MORE_DATA MAKE_DXGI_HRESULT(3)
|
||||
#define DXGI_ERROR_UNSUPPORTED MAKE_DXGI_HRESULT(4)
|
||||
#define DXGI_ERROR_DEVICE_REMOVED MAKE_DXGI_HRESULT(5)
|
||||
#define DXGI_ERROR_DEVICE_HUNG MAKE_DXGI_HRESULT(6)
|
||||
#define DXGI_ERROR_DEVICE_RESET MAKE_DXGI_HRESULT(7)
|
||||
#define DXGI_ERROR_WAS_STILL_DRAWING MAKE_DXGI_HRESULT(10)
|
||||
#define DXGI_ERROR_FRAME_STATISTICS_DISJOINT MAKE_DXGI_HRESULT(11)
|
||||
#define DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_HRESULT(12)
|
||||
#define DXGI_ERROR_DRIVER_INTERNAL_ERROR MAKE_DXGI_HRESULT(32)
|
||||
#define DXGI_ERROR_NONEXCLUSIVE MAKE_DXGI_HRESULT(33)
|
||||
#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE MAKE_DXGI_HRESULT(34)
|
||||
#define DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED MAKE_DXGI_HRESULT(35)
|
||||
#define DXGI_ERROR_REMOTE_OUTOFMEMORY MAKE_DXGI_HRESULT(36)
|
||||
|
||||
|
||||
|
||||
#define DXGI_CPU_ACCESS_NONE ( 0 )
|
||||
#define DXGI_CPU_ACCESS_DYNAMIC ( 1 )
|
||||
#define DXGI_CPU_ACCESS_READ_WRITE ( 2 )
|
||||
#define DXGI_CPU_ACCESS_SCRATCH ( 3 )
|
||||
#define DXGI_CPU_ACCESS_FIELD 15
|
||||
|
||||
#define DXGI_USAGE_SHADER_INPUT ( 1L << (0 + 4) )
|
||||
#define DXGI_USAGE_RENDER_TARGET_OUTPUT ( 1L << (1 + 4) )
|
||||
#define DXGI_USAGE_BACK_BUFFER ( 1L << (2 + 4) )
|
||||
#define DXGI_USAGE_SHARED ( 1L << (3 + 4) )
|
||||
#define DXGI_USAGE_READ_ONLY ( 1L << (4 + 4) )
|
||||
#define DXGI_USAGE_DISCARD_ON_PRESENT ( 1L << (5 + 4) )
|
||||
#define DXGI_USAGE_UNORDERED_ACCESS ( 1L << (6 + 4) )
|
||||
|
||||
typedef struct DXGI_RGB
|
||||
{
|
||||
float Red;
|
||||
float Green;
|
||||
float Blue;
|
||||
} DXGI_RGB;
|
||||
|
||||
typedef struct DXGI_GAMMA_CONTROL
|
||||
{
|
||||
DXGI_RGB Scale;
|
||||
DXGI_RGB Offset;
|
||||
DXGI_RGB GammaCurve[ 1025 ];
|
||||
} DXGI_GAMMA_CONTROL;
|
||||
|
||||
typedef struct DXGI_GAMMA_CONTROL_CAPABILITIES
|
||||
{
|
||||
BOOL ScaleAndOffsetSupported;
|
||||
float MaxConvertedValue;
|
||||
float MinConvertedValue;
|
||||
UINT NumGammaControlPoints;
|
||||
float ControlPointPositions[1025];
|
||||
} DXGI_GAMMA_CONTROL_CAPABILITIES;
|
||||
|
||||
typedef struct DXGI_RATIONAL
|
||||
{
|
||||
UINT Numerator;
|
||||
UINT Denominator;
|
||||
} DXGI_RATIONAL;
|
||||
|
||||
typedef enum DXGI_MODE_SCANLINE_ORDER
|
||||
{
|
||||
DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0,
|
||||
DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1,
|
||||
DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2,
|
||||
DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3
|
||||
} DXGI_MODE_SCANLINE_ORDER;
|
||||
|
||||
typedef enum DXGI_MODE_SCALING
|
||||
{
|
||||
DXGI_MODE_SCALING_UNSPECIFIED = 0,
|
||||
DXGI_MODE_SCALING_CENTERED = 1,
|
||||
DXGI_MODE_SCALING_STRETCHED = 2
|
||||
} DXGI_MODE_SCALING;
|
||||
|
||||
typedef enum DXGI_MODE_ROTATION
|
||||
{
|
||||
DXGI_MODE_ROTATION_UNSPECIFIED = 0,
|
||||
DXGI_MODE_ROTATION_IDENTITY = 1,
|
||||
DXGI_MODE_ROTATION_ROTATE90 = 2,
|
||||
DXGI_MODE_ROTATION_ROTATE180 = 3,
|
||||
DXGI_MODE_ROTATION_ROTATE270 = 4
|
||||
} DXGI_MODE_ROTATION;
|
||||
|
||||
typedef struct DXGI_MODE_DESC
|
||||
{
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
DXGI_RATIONAL RefreshRate;
|
||||
DXGI_FORMAT Format;
|
||||
DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
|
||||
DXGI_MODE_SCALING Scaling;
|
||||
} DXGI_MODE_DESC;
|
||||
|
||||
typedef struct DXGI_SAMPLE_DESC
|
||||
{
|
||||
UINT Count;
|
||||
UINT Quality;
|
||||
} DXGI_SAMPLE_DESC;
|
||||
|
||||
#endif // __dxgitype_h__
|
||||
|
||||
75
common/dx11sdk/Dcommon.h
Normal file
75
common/dx11sdk/Dcommon.h
Normal file
@@ -0,0 +1,75 @@
|
||||
//+--------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Abstract:
|
||||
// Public API definitions for DWrite and D2D
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef DCOMMON_H_INCLUDED
|
||||
#define DCOMMON_H_INCLUDED
|
||||
|
||||
//
|
||||
//These macros are defined in the Windows 7 SDK, however to enable development using the technical preview,
|
||||
//they are included here temporarily.
|
||||
//
|
||||
#ifndef DEFINE_ENUM_FLAG_OPERATORS
|
||||
#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
|
||||
extern "C++" { \
|
||||
inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) | ((int)b)); } \
|
||||
inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
|
||||
inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) & ((int)b)); } \
|
||||
inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
|
||||
inline ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((int)a)); } \
|
||||
inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) ^ ((int)b)); } \
|
||||
inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __field_ecount_opt
|
||||
#define __field_ecount_opt(x)
|
||||
#endif
|
||||
|
||||
#ifndef __range
|
||||
#define __range(x,y)
|
||||
#endif
|
||||
|
||||
#ifndef __field_ecount
|
||||
#define __field_ecount(x)
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The measuring method used for text layout.
|
||||
/// </summary>
|
||||
typedef enum DWRITE_MEASURING_MODE
|
||||
{
|
||||
/// <summary>
|
||||
/// Text is measured using glyph ideal metrics whose values are independent to the current display resolution.
|
||||
/// </summary>
|
||||
DWRITE_MEASURING_MODE_NATURAL,
|
||||
|
||||
/// <summary>
|
||||
/// Text is measured using glyph display compatible metrics whose values tuned for the current display resolution.
|
||||
/// </summary>
|
||||
DWRITE_MEASURING_MODE_GDI_CLASSIC,
|
||||
|
||||
/// <summary>
|
||||
/// Text is measured using the same glyph display metrics as text measured by GDI using a font
|
||||
/// created with CLEARTYPE_NATURAL_QUALITY.
|
||||
/// </summary>
|
||||
DWRITE_MEASURING_MODE_GDI_NATURAL,
|
||||
|
||||
// Deprecated: These aliases are only here to ease potential merge conflicts.
|
||||
// They will be removed after January 28. BUG: 394869
|
||||
DWRITE_TEXT_MEASURING_METHOD_USE_IDEAL_METRICS = DWRITE_MEASURING_MODE_NATURAL,
|
||||
DWRITE_TEXT_MEASURING_METHOD_USE_DISPLAY_COMPATIBLE_METRICS = DWRITE_MEASURING_MODE_GDI_CLASSIC,
|
||||
DWRITE_TEXT_MEASURING_METHOD_USE_DISPLAY_NATURAL_METRICS = DWRITE_MEASURING_MODE_GDI_NATURAL
|
||||
|
||||
} DWRITE_MEASURING_MODE;
|
||||
|
||||
// Deprecated: This alias is only here to ease potential merge conflicts.
|
||||
// It will be removed after January 28. BUG: 394869
|
||||
typedef DWRITE_MEASURING_MODE DWRITE_TEXT_MEASURING_METHOD;
|
||||
|
||||
#endif /* DCOMMON_H_INCLUDED */
|
||||
99
common/dx11sdk/DxErr.h
Normal file
99
common/dx11sdk/DxErr.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/*==========================================================================;
|
||||
*
|
||||
*
|
||||
* File: dxerr.h
|
||||
* Content: DirectX Error Library Include File
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _DXERR_H_
|
||||
#define _DXERR_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
//
|
||||
// DXGetErrorString
|
||||
//
|
||||
// Desc: Converts a DirectX HRESULT to a string
|
||||
//
|
||||
// Args: HRESULT hr Can be any error code from
|
||||
// XACT D3D10 D3DX10 D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
|
||||
//
|
||||
// Return: Converted string
|
||||
//
|
||||
const char* WINAPI DXGetErrorStringA(HRESULT hr);
|
||||
const WCHAR* WINAPI DXGetErrorStringW(HRESULT hr);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define DXGetErrorString DXGetErrorStringW
|
||||
#else
|
||||
#define DXGetErrorString DXGetErrorStringA
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// DXGetErrorDescription
|
||||
//
|
||||
// Desc: Returns a string description of a DirectX HRESULT
|
||||
//
|
||||
// Args: HRESULT hr Can be any error code from
|
||||
// XACT D3D10 D3DX10 D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
|
||||
//
|
||||
// Return: String description
|
||||
//
|
||||
const char* WINAPI DXGetErrorDescriptionA(HRESULT hr);
|
||||
const WCHAR* WINAPI DXGetErrorDescriptionW(HRESULT hr);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define DXGetErrorDescription DXGetErrorDescriptionW
|
||||
#else
|
||||
#define DXGetErrorDescription DXGetErrorDescriptionA
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// DXTrace
|
||||
//
|
||||
// Desc: Outputs a formatted error message to the debug stream
|
||||
//
|
||||
// Args: CHAR* strFile The current file, typically passed in using the
|
||||
// __FILE__ macro.
|
||||
// DWORD dwLine The current line number, typically passed in using the
|
||||
// __LINE__ macro.
|
||||
// HRESULT hr An HRESULT that will be traced to the debug stream.
|
||||
// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
|
||||
// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
|
||||
//
|
||||
// Return: The hr that was passed in.
|
||||
//
|
||||
HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox );
|
||||
HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox );
|
||||
|
||||
#ifdef UNICODE
|
||||
#define DXTrace DXTraceW
|
||||
#else
|
||||
#define DXTrace DXTraceA
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Helper macros
|
||||
//
|
||||
#if defined(DEBUG) | defined(_DEBUG)
|
||||
#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
|
||||
#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
|
||||
#define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
|
||||
#else
|
||||
#define DXTRACE_MSG(str) (0L)
|
||||
#define DXTRACE_ERR(str,hr) (hr)
|
||||
#define DXTRACE_ERR_MSGBOX(str,hr) (hr)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif // _DXERR_H_
|
||||
120
common/dx11sdk/PIXPlugin.h
Normal file
120
common/dx11sdk/PIXPlugin.h
Normal file
@@ -0,0 +1,120 @@
|
||||
//==================================================================================================
|
||||
// PIXPlugin.h
|
||||
//
|
||||
// Microsoft PIX Plugin Header
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation, All rights reserved
|
||||
//==================================================================================================
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIX_PLUGIN_SYSTEM_VERSION - Indicates version of the plugin interface the plugin is built with.
|
||||
//==================================================================================================
|
||||
#define PIX_PLUGIN_SYSTEM_VERSION 0x101
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXCOUNTERID - A unique identifier for each PIX plugin counter.
|
||||
//==================================================================================================
|
||||
typedef int PIXCOUNTERID;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXCOUNTERDATATYPE - Indicates what type of data the counter produces.
|
||||
//==================================================================================================
|
||||
enum PIXCOUNTERDATATYPE
|
||||
{
|
||||
PCDT_RESERVED,
|
||||
PCDT_FLOAT,
|
||||
PCDT_INT,
|
||||
PCDT_INT64,
|
||||
PCDT_STRING,
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXPLUGININFO - This structure is filled out by PIXGetPluginInfo and passed back to PIX.
|
||||
//==================================================================================================
|
||||
struct PIXPLUGININFO
|
||||
{
|
||||
// Filled in by caller:
|
||||
HINSTANCE hinst;
|
||||
|
||||
// Filled in by PIXGetPluginInfo:
|
||||
WCHAR* pstrPluginName; // Name of plugin
|
||||
int iPluginVersion; // Version of this particular plugin
|
||||
int iPluginSystemVersion; // Version of PIX's plugin system this plugin was designed for
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXCOUNTERINFO - This structure is filled out by PIXGetCounterInfo and passed back to PIX
|
||||
// to allow PIX to determine information about the counters in the plugin.
|
||||
//==================================================================================================
|
||||
struct PIXCOUNTERINFO
|
||||
{
|
||||
PIXCOUNTERID counterID; // Used to uniquely ID this counter
|
||||
WCHAR* pstrName; // String name of the counter
|
||||
PIXCOUNTERDATATYPE pcdtDataType; // Data type returned by this counter
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXGetPluginInfo - This returns basic information about this plugin to PIX.
|
||||
//==================================================================================================
|
||||
BOOL WINAPI PIXGetPluginInfo( PIXPLUGININFO* pPIXPluginInfo );
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXGetCounterInfo - This returns an array of PIXCOUNTERINFO structs to PIX.
|
||||
// These PIXCOUNTERINFOs allow PIX to enumerate the counters contained
|
||||
// in this plugin.
|
||||
//==================================================================================================
|
||||
BOOL WINAPI PIXGetCounterInfo( DWORD* pdwReturnCounters, PIXCOUNTERINFO** ppCounterInfoList );
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXGetCounterDesc - This is called by PIX to request a description of the indicated counter.
|
||||
//==================================================================================================
|
||||
BOOL WINAPI PIXGetCounterDesc( PIXCOUNTERID id, WCHAR** ppstrCounterDesc );
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXBeginExperiment - This called by PIX once per counter when instrumentation starts.
|
||||
//==================================================================================================
|
||||
BOOL WINAPI PIXBeginExperiment( PIXCOUNTERID id, const WCHAR* pstrApplication );
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXEndFrame - This is called by PIX once per counter at the end of each frame to gather the
|
||||
// counter value for that frame. Note that the pointer to the return data must
|
||||
// continue to point to valid counter data until the next call to PIXEndFrame (or
|
||||
// PIXEndExperiment) for the same counter. So do not set *ppReturnData to the same
|
||||
// pointer for multiple counters, or point to a local variable that will go out of
|
||||
// scope. See the sample PIX plugin for an example of how to structure a plugin
|
||||
// properly.
|
||||
//==================================================================================================
|
||||
BOOL WINAPI PIXEndFrame( PIXCOUNTERID id, UINT iFrame, DWORD* pdwReturnBytes, BYTE** ppReturnData );
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// PIXEndExperiment - This is called by PIX once per counter when instrumentation ends.
|
||||
//==================================================================================================
|
||||
BOOL WINAPI PIXEndExperiment( PIXCOUNTERID id );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
//==================================================================================================
|
||||
// eof: PIXPlugin.h
|
||||
//==================================================================================================
|
||||
|
||||
316
common/dx11sdk/X3DAudio.h
Normal file
316
common/dx11sdk/X3DAudio.h
Normal file
@@ -0,0 +1,316 @@
|
||||
/*-========================================================================-_
|
||||
| - X3DAUDIO - |
|
||||
| Copyright (c) Microsoft Corporation. All rights reserved. |
|
||||
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|
||||
|PROJECT: X3DAudio MODEL: Unmanaged User-mode |
|
||||
|VERSION: 1.6 EXCEPT: No Exceptions |
|
||||
|CLASS: N / A MINREQ: WinXP, Xbox360 |
|
||||
|BASE: N / A DIALECT: MSC++ 14.00 |
|
||||
|>------------------------------------------------------------------------<|
|
||||
| DUTY: Cross-platform stand-alone 3D audio math library |
|
||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|
||||
NOTES:
|
||||
1. USE THE DEBUG DLL TO ENABLE PARAMETER VALIDATION VIA ASSERTS!
|
||||
Here's how:
|
||||
Copy X3DAudioDX_X.dll to where your application exists.
|
||||
The debug DLL can be found under %WINDIR%\system32.
|
||||
Rename X3DAudioDX_X.dll to X3DAudioX_X.dll to use the debug version.
|
||||
|
||||
Only parameters required by DSP settings being calculated as
|
||||
stipulated by the calculation control flags are validated.
|
||||
|
||||
2. Definition of terms:
|
||||
LFE: Low Frequency Effect -- always omnidirectional.
|
||||
LPF: Low Pass Filter, divided into two classifications:
|
||||
Direct -- Applied to the direct signal path,
|
||||
used for obstruction/occlusion effects.
|
||||
Reverb -- Applied to the reverb signal path,
|
||||
used for occlusion effects only.
|
||||
|
||||
3. Volume level is expressed as a linear amplitude scaler:
|
||||
1.0f represents no attenuation applied to the original signal,
|
||||
0.5f denotes an attenuation of 6dB, and 0.0f results in silence.
|
||||
Amplification (volume > 1.0f) is also allowed, and is not clamped.
|
||||
|
||||
LPF values range from 1.0f representing all frequencies pass through,
|
||||
to 0.0f which results in silence as all frequencies are filtered out.
|
||||
|
||||
4. X3DAudio uses a left-handed Cartesian coordinate system with values
|
||||
on the x-axis increasing from left to right, on the y-axis from
|
||||
bottom to top, and on the z-axis from near to far.
|
||||
Azimuths are measured clockwise from a given reference direction.
|
||||
|
||||
Distance measurement is with respect to user-defined world units.
|
||||
Applications may provide coordinates using any system of measure
|
||||
as all non-normalized calculations are scale invariant, with such
|
||||
operations natively occurring in user-defined world unit space.
|
||||
Metric constants are supplied only as a convenience.
|
||||
Distance is calculated using the Euclidean norm formula.
|
||||
|
||||
5. Only real values are permissible with functions using 32-bit
|
||||
float parameters -- NAN and infinite values are not accepted.
|
||||
All computation occurs in 32-bit precision mode. */
|
||||
|
||||
#pragma once
|
||||
//--------------<D-E-F-I-N-I-T-I-O-N-S>-------------------------------------//
|
||||
#include <windef.h> // general windows types
|
||||
#if defined(_XBOX)
|
||||
#include <vectorintrinsics.h>
|
||||
#endif
|
||||
#include <d3d9types.h> // for D3DVECTOR
|
||||
|
||||
// speaker geometry configuration flags, specifies assignment of channels to speaker positions, defined as per WAVEFORMATEXTENSIBLE.dwChannelMask
|
||||
#if !defined(_SPEAKER_POSITIONS_)
|
||||
#define _SPEAKER_POSITIONS_
|
||||
#define SPEAKER_FRONT_LEFT 0x00000001
|
||||
#define SPEAKER_FRONT_RIGHT 0x00000002
|
||||
#define SPEAKER_FRONT_CENTER 0x00000004
|
||||
#define SPEAKER_LOW_FREQUENCY 0x00000008
|
||||
#define SPEAKER_BACK_LEFT 0x00000010
|
||||
#define SPEAKER_BACK_RIGHT 0x00000020
|
||||
#define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040
|
||||
#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080
|
||||
#define SPEAKER_BACK_CENTER 0x00000100
|
||||
#define SPEAKER_SIDE_LEFT 0x00000200
|
||||
#define SPEAKER_SIDE_RIGHT 0x00000400
|
||||
#define SPEAKER_TOP_CENTER 0x00000800
|
||||
#define SPEAKER_TOP_FRONT_LEFT 0x00001000
|
||||
#define SPEAKER_TOP_FRONT_CENTER 0x00002000
|
||||
#define SPEAKER_TOP_FRONT_RIGHT 0x00004000
|
||||
#define SPEAKER_TOP_BACK_LEFT 0x00008000
|
||||
#define SPEAKER_TOP_BACK_CENTER 0x00010000
|
||||
#define SPEAKER_TOP_BACK_RIGHT 0x00020000
|
||||
#define SPEAKER_RESERVED 0x7FFC0000 // bit mask locations reserved for future use
|
||||
#define SPEAKER_ALL 0x80000000 // used to specify that any possible permutation of speaker configurations
|
||||
#endif
|
||||
|
||||
// standard speaker geometry configurations, used with X3DAudioInitialize
|
||||
#if !defined(SPEAKER_MONO)
|
||||
#define SPEAKER_MONO SPEAKER_FRONT_CENTER
|
||||
#define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT)
|
||||
#define SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY)
|
||||
#define SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER)
|
||||
#define SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||
#define SPEAKER_4POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||
#define SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||
#define SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER)
|
||||
#define SPEAKER_5POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
|
||||
#define SPEAKER_7POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
|
||||
#endif
|
||||
|
||||
// Xbox360 speaker geometry configuration, used with X3DAudioInitialize
|
||||
#if defined(_XBOX)
|
||||
#define SPEAKER_XBOX SPEAKER_5POINT1
|
||||
#endif
|
||||
|
||||
|
||||
// size of instance handle in bytes
|
||||
#define X3DAUDIO_HANDLE_BYTESIZE 20
|
||||
|
||||
// float math constants
|
||||
#define X3DAUDIO_PI 3.141592654f
|
||||
#define X3DAUDIO_2PI 6.283185307f
|
||||
|
||||
// speed of sound in meters per second for dry air at approximately 20C, used with X3DAudioInitialize
|
||||
#define X3DAUDIO_SPEED_OF_SOUND 343.5f
|
||||
|
||||
// calculation control flags, used with X3DAudioCalculate
|
||||
#define X3DAUDIO_CALCULATE_MATRIX 0x00000001 // enable matrix coefficient table calculation
|
||||
#define X3DAUDIO_CALCULATE_DELAY 0x00000002 // enable delay time array calculation (stereo final mix only)
|
||||
#define X3DAUDIO_CALCULATE_LPF_DIRECT 0x00000004 // enable LPF direct-path coefficient calculation
|
||||
#define X3DAUDIO_CALCULATE_LPF_REVERB 0x00000008 // enable LPF reverb-path coefficient calculation
|
||||
#define X3DAUDIO_CALCULATE_REVERB 0x00000010 // enable reverb send level calculation
|
||||
#define X3DAUDIO_CALCULATE_DOPPLER 0x00000020 // enable doppler shift factor calculation
|
||||
#define X3DAUDIO_CALCULATE_EMITTER_ANGLE 0x00000040 // enable emitter-to-listener interior angle calculation
|
||||
|
||||
#define X3DAUDIO_CALCULATE_ZEROCENTER 0x00010000 // do not position to front center speaker, signal positioned to remaining speakers instead, front center destination channel will be zero in returned matrix coefficient table, valid only for matrix calculations with final mix formats that have a front center channel
|
||||
#define X3DAUDIO_CALCULATE_REDIRECT_TO_LFE 0x00020000 // apply equal mix of all source channels to LFE destination channel, valid only for matrix calculations with sources that have no LFE channel and final mix formats that have an LFE channel
|
||||
|
||||
|
||||
//--------------<D-A-T-A---T-Y-P-E-S>---------------------------------------//
|
||||
#pragma pack(push, 1) // set packing alignment to ensure consistency across arbitrary build environments
|
||||
|
||||
|
||||
// primitive types
|
||||
typedef float FLOAT32; // 32-bit IEEE float
|
||||
typedef D3DVECTOR X3DAUDIO_VECTOR; // float 3D vector
|
||||
|
||||
// instance handle of precalculated constants
|
||||
typedef BYTE X3DAUDIO_HANDLE[X3DAUDIO_HANDLE_BYTESIZE];
|
||||
|
||||
|
||||
// Distance curve point:
|
||||
// Defines a DSP setting at a given normalized distance.
|
||||
typedef struct X3DAUDIO_DISTANCE_CURVE_POINT
|
||||
{
|
||||
FLOAT32 Distance; // normalized distance, must be within [0.0f, 1.0f]
|
||||
FLOAT32 DSPSetting; // DSP setting
|
||||
} X3DAUDIO_DISTANCE_CURVE_POINT, *LPX3DAUDIO_DISTANCE_CURVE_POINT;
|
||||
|
||||
// Distance curve:
|
||||
// A piecewise curve made up of linear segments used to
|
||||
// define DSP behaviour with respect to normalized distance.
|
||||
//
|
||||
// Note that curve point distances are normalized within [0.0f, 1.0f].
|
||||
// X3DAUDIO_EMITTER.CurveDistanceScaler must be used to scale the
|
||||
// normalized distances to user-defined world units.
|
||||
// For distances beyond CurveDistanceScaler * 1.0f,
|
||||
// pPoints[PointCount-1].DSPSetting is used as the DSP setting.
|
||||
//
|
||||
// All distance curve spans must be such that:
|
||||
// pPoints[k-1].DSPSetting + ((pPoints[k].DSPSetting-pPoints[k-1].DSPSetting) / (pPoints[k].Distance-pPoints[k-1].Distance)) * (pPoints[k].Distance-pPoints[k-1].Distance) != NAN or infinite values
|
||||
// For all points in the distance curve where 1 <= k < PointCount.
|
||||
typedef struct X3DAUDIO_DISTANCE_CURVE
|
||||
{
|
||||
X3DAUDIO_DISTANCE_CURVE_POINT* pPoints; // distance curve point array, must have at least PointCount elements with no duplicates and be sorted in ascending order with respect to Distance
|
||||
UINT32 PointCount; // number of distance curve points, must be >= 2 as all distance curves must have at least two endpoints, defining DSP settings at 0.0f and 1.0f normalized distance
|
||||
} X3DAUDIO_DISTANCE_CURVE, *LPX3DAUDIO_DISTANCE_CURVE;
|
||||
static const X3DAUDIO_DISTANCE_CURVE_POINT X3DAudioDefault_LinearCurvePoints[2] = { 0.0f, 1.0f, 1.0f, 0.0f };
|
||||
static const X3DAUDIO_DISTANCE_CURVE X3DAudioDefault_LinearCurve = { (X3DAUDIO_DISTANCE_CURVE_POINT*)&X3DAudioDefault_LinearCurvePoints[0], 2 };
|
||||
|
||||
// Cone:
|
||||
// Specifies directionality for a listener or single-channel emitter by
|
||||
// modifying DSP behaviour with respect to its front orientation.
|
||||
// This is modeled using two sound cones: an inner cone and an outer cone.
|
||||
// On/within the inner cone, DSP settings are scaled by the inner values.
|
||||
// On/beyond the outer cone, DSP settings are scaled by the outer values.
|
||||
// If on both the cones, DSP settings are scaled by the inner values only.
|
||||
// Between the two cones, the scaler is linearly interpolated between the
|
||||
// inner and outer values. Set both cone angles to 0 or X3DAUDIO_2PI for
|
||||
// omnidirectionality using only the outer or inner values respectively.
|
||||
typedef struct X3DAUDIO_CONE
|
||||
{
|
||||
FLOAT32 InnerAngle; // inner cone angle in radians, must be within [0.0f, X3DAUDIO_2PI]
|
||||
FLOAT32 OuterAngle; // outer cone angle in radians, must be within [InnerAngle, X3DAUDIO_2PI]
|
||||
|
||||
FLOAT32 InnerVolume; // volume level scaler on/within inner cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used
|
||||
FLOAT32 OuterVolume; // volume level scaler on/beyond outer cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used
|
||||
FLOAT32 InnerLPF; // LPF (both direct and reverb paths) coefficient subtrahend on/within inner cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used
|
||||
FLOAT32 OuterLPF; // LPF (both direct and reverb paths) coefficient subtrahend on/beyond outer cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used
|
||||
FLOAT32 InnerReverb; // reverb send level scaler on/within inner cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used
|
||||
FLOAT32 OuterReverb; // reverb send level scaler on/beyond outer cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used
|
||||
} X3DAUDIO_CONE, *LPX3DAUDIO_CONE;
|
||||
static const X3DAUDIO_CONE X3DAudioDefault_DirectionalCone = { X3DAUDIO_PI/2, X3DAUDIO_PI, 1.0f, 0.708f, 0.0f, 0.25f, 0.708f, 1.0f };
|
||||
|
||||
|
||||
// Listener:
|
||||
// Defines a point of 3D audio reception.
|
||||
//
|
||||
// The cone is directed by the listener's front orientation.
|
||||
typedef struct X3DAUDIO_LISTENER
|
||||
{
|
||||
X3DAUDIO_VECTOR OrientFront; // orientation of front direction, used only for matrix and delay calculations or listeners with cones for matrix, LPF (both direct and reverb paths), and reverb calculations, must be normalized when used
|
||||
X3DAUDIO_VECTOR OrientTop; // orientation of top direction, used only for matrix and delay calculations, must be orthonormal with OrientFront when used
|
||||
|
||||
X3DAUDIO_VECTOR Position; // position in user-defined world units, does not affect Velocity
|
||||
X3DAUDIO_VECTOR Velocity; // velocity vector in user-defined world units/second, used only for doppler calculations, does not affect Position
|
||||
|
||||
X3DAUDIO_CONE* pCone; // sound cone, used only for matrix, LPF (both direct and reverb paths), and reverb calculations, NULL specifies omnidirectionality
|
||||
} X3DAUDIO_LISTENER, *LPX3DAUDIO_LISTENER;
|
||||
|
||||
// Emitter:
|
||||
// Defines a 3D audio source, divided into two classifications:
|
||||
//
|
||||
// Single-point -- For use with single-channel sounds.
|
||||
// Positioned at the emitter base, i.e. the channel radius
|
||||
// and azimuth are ignored if the number of channels == 1.
|
||||
//
|
||||
// May be omnidirectional or directional using a cone.
|
||||
// The cone originates from the emitter base position,
|
||||
// and is directed by the emitter's front orientation.
|
||||
//
|
||||
// Multi-point -- For use with multi-channel sounds.
|
||||
// Each non-LFE channel is positioned using an
|
||||
// azimuth along the channel radius with respect to the
|
||||
// front orientation vector in the plane orthogonal to the
|
||||
// top orientation vector. An azimuth of X3DAUDIO_2PI
|
||||
// specifies a channel is an LFE. Such channels are
|
||||
// positioned at the emitter base and are calculated
|
||||
// with respect to pLFECurve only, never pVolumeCurve.
|
||||
//
|
||||
// Multi-point emitters are always omnidirectional,
|
||||
// i.e. the cone is ignored if the number of channels > 1.
|
||||
//
|
||||
// Note that many properties are shared among all channel points,
|
||||
// locking certain behaviour with respect to the emitter base position.
|
||||
// For example, doppler shift is always calculated with respect to the
|
||||
// emitter base position and so is constant for all its channel points.
|
||||
// Distance curve calculations are also with respect to the emitter base
|
||||
// position, with the curves being calculated independently of each other.
|
||||
// For instance, volume and LFE calculations do not affect one another.
|
||||
typedef struct X3DAUDIO_EMITTER
|
||||
{
|
||||
X3DAUDIO_CONE* pCone; // sound cone, used only with single-channel emitters for matrix, LPF (both direct and reverb paths), and reverb calculations, NULL specifies omnidirectionality
|
||||
X3DAUDIO_VECTOR OrientFront; // orientation of front direction, used only for emitter angle calculations or with multi-channel emitters for matrix calculations or single-channel emitters with cones for matrix, LPF (both direct and reverb paths), and reverb calculations, must be normalized when used
|
||||
X3DAUDIO_VECTOR OrientTop; // orientation of top direction, used only with multi-channel emitters for matrix calculations, must be orthonormal with OrientFront when used
|
||||
|
||||
X3DAUDIO_VECTOR Position; // position in user-defined world units, does not affect Velocity
|
||||
X3DAUDIO_VECTOR Velocity; // velocity vector in user-defined world units/second, used only for doppler calculations, does not affect Position
|
||||
|
||||
FLOAT32 InnerRadius; // inner radius, must be within [0.0f, FLT_MAX]
|
||||
FLOAT32 InnerRadiusAngle; // inner radius angle, must be within [0.0f, X3DAUDIO_PI/4.0)
|
||||
|
||||
UINT32 ChannelCount; // number of sound channels, must be > 0
|
||||
FLOAT32 ChannelRadius; // channel radius, used only with multi-channel emitters for matrix calculations, must be >= 0.0f when used
|
||||
FLOAT32* pChannelAzimuths; // channel azimuth array, used only with multi-channel emitters for matrix calculations, contains positions of each channel expressed in radians along the channel radius with respect to the front orientation vector in the plane orthogonal to the top orientation vector, or X3DAUDIO_2PI to specify an LFE channel, must have at least ChannelCount elements, all within [0.0f, X3DAUDIO_2PI] when used
|
||||
|
||||
X3DAUDIO_DISTANCE_CURVE* pVolumeCurve; // volume level distance curve, used only for matrix calculations, NULL specifies a default curve that conforms to the inverse square law, calculated in user-defined world units with distances <= CurveDistanceScaler clamped to no attenuation
|
||||
X3DAUDIO_DISTANCE_CURVE* pLFECurve; // LFE level distance curve, used only for matrix calculations, NULL specifies a default curve that conforms to the inverse square law, calculated in user-defined world units with distances <= CurveDistanceScaler clamped to no attenuation
|
||||
X3DAUDIO_DISTANCE_CURVE* pLPFDirectCurve; // LPF direct-path coefficient distance curve, used only for LPF direct-path calculations, NULL specifies the default curve: [0.0f,1.0f], [1.0f,0.75f]
|
||||
X3DAUDIO_DISTANCE_CURVE* pLPFReverbCurve; // LPF reverb-path coefficient distance curve, used only for LPF reverb-path calculations, NULL specifies the default curve: [0.0f,0.75f], [1.0f,0.75f]
|
||||
X3DAUDIO_DISTANCE_CURVE* pReverbCurve; // reverb send level distance curve, used only for reverb calculations, NULL specifies the default curve: [0.0f,1.0f], [1.0f,0.0f]
|
||||
|
||||
FLOAT32 CurveDistanceScaler; // curve distance scaler, used to scale normalized distance curves to user-defined world units and/or exaggerate their effect, used only for matrix, LPF (both direct and reverb paths), and reverb calculations, must be within [FLT_MIN, FLT_MAX] when used
|
||||
FLOAT32 DopplerScaler; // doppler shift scaler, used to exaggerate doppler shift effect, used only for doppler calculations, must be within [0.0f, FLT_MAX] when used
|
||||
} X3DAUDIO_EMITTER, *LPX3DAUDIO_EMITTER;
|
||||
|
||||
|
||||
// DSP settings:
|
||||
// Receives results from a call to X3DAudioCalculate to be sent
|
||||
// to the low-level audio rendering API for 3D signal processing.
|
||||
//
|
||||
// The user is responsible for allocating the matrix coefficient table,
|
||||
// delay time array, and initializing the channel counts when used.
|
||||
typedef struct X3DAUDIO_DSP_SETTINGS
|
||||
{
|
||||
FLOAT32* pMatrixCoefficients; // [inout] matrix coefficient table, receives an array representing the volume level used to send from source channel S to destination channel D, stored as pMatrixCoefficients[SrcChannelCount * D + S], must have at least SrcChannelCount*DstChannelCount elements
|
||||
FLOAT32* pDelayTimes; // [inout] delay time array, receives delays for each destination channel in milliseconds, must have at least DstChannelCount elements (stereo final mix only)
|
||||
UINT32 SrcChannelCount; // [in] number of source channels, must equal number of channels in respective emitter
|
||||
UINT32 DstChannelCount; // [in] number of destination channels, must equal number of channels of the final mix
|
||||
|
||||
FLOAT32 LPFDirectCoefficient; // [out] LPF direct-path coefficient
|
||||
FLOAT32 LPFReverbCoefficient; // [out] LPF reverb-path coefficient
|
||||
FLOAT32 ReverbLevel; // [out] reverb send level
|
||||
FLOAT32 DopplerFactor; // [out] doppler shift factor, scales resampler ratio for doppler shift effect, where the effective frequency = DopplerFactor * original frequency
|
||||
FLOAT32 EmitterToListenerAngle; // [out] emitter-to-listener interior angle, expressed in radians with respect to the emitter's front orientation
|
||||
|
||||
FLOAT32 EmitterToListenerDistance; // [out] distance in user-defined world units from the emitter base to listener position, always calculated
|
||||
FLOAT32 EmitterVelocityComponent; // [out] component of emitter velocity vector projected onto emitter->listener vector in user-defined world units/second, calculated only for doppler
|
||||
FLOAT32 ListenerVelocityComponent; // [out] component of listener velocity vector projected onto emitter->listener vector in user-defined world units/second, calculated only for doppler
|
||||
} X3DAUDIO_DSP_SETTINGS, *LPX3DAUDIO_DSP_SETTINGS;
|
||||
|
||||
|
||||
//--------------<M-A-C-R-O-S>-----------------------------------------------//
|
||||
// function storage-class attribute and calltype
|
||||
#if defined(_XBOX) || defined(X3DAUDIOSTATIC)
|
||||
#define X3DAUDIO_API_(type) EXTERN_C type STDAPIVCALLTYPE
|
||||
#else
|
||||
#if defined(X3DEXPORT)
|
||||
#define X3DAUDIO_API_(type) EXTERN_C __declspec(dllexport) type STDAPIVCALLTYPE
|
||||
#else
|
||||
#define X3DAUDIO_API_(type) EXTERN_C __declspec(dllimport) type STDAPIVCALLTYPE
|
||||
#endif
|
||||
#endif
|
||||
#define X3DAUDIO_IMP_(type) type STDMETHODVCALLTYPE
|
||||
|
||||
|
||||
//--------------<F-U-N-C-T-I-O-N-S>-----------------------------------------//
|
||||
// initializes instance handle
|
||||
X3DAUDIO_API_(void) X3DAudioInitialize (UINT32 SpeakerChannelMask, FLOAT32 SpeedOfSound, __out X3DAUDIO_HANDLE Instance);
|
||||
|
||||
// calculates DSP settings with respect to 3D parameters
|
||||
X3DAUDIO_API_(void) X3DAudioCalculate (__in const X3DAUDIO_HANDLE Instance, __in const X3DAUDIO_LISTENER* pListener, __in const X3DAUDIO_EMITTER* pEmitter, UINT32 Flags, __inout X3DAUDIO_DSP_SETTINGS* pDSPSettings);
|
||||
|
||||
|
||||
#pragma pack(pop) // revert packing alignment
|
||||
//---------------------------------<-EOF->----------------------------------//
|
||||
645
common/dx11sdk/XAPO.h
Normal file
645
common/dx11sdk/XAPO.h
Normal file
@@ -0,0 +1,645 @@
|
||||
/*-========================================================================-_
|
||||
| - XAPO - |
|
||||
| Copyright (c) Microsoft Corporation. All rights reserved. |
|
||||
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|
||||
|PROJECT: XAPO MODEL: Unmanaged User-mode |
|
||||
|VERSION: 1.0 EXCEPT: No Exceptions |
|
||||
|CLASS: N / A MINREQ: WinXP, Xbox360 |
|
||||
|BASE: N / A DIALECT: MSC++ 14.00 |
|
||||
|>------------------------------------------------------------------------<|
|
||||
| DUTY: Cross-platform Audio Processing Object interfaces |
|
||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|
||||
NOTES:
|
||||
1. Definition of terms:
|
||||
DSP: Digital Signal Processing.
|
||||
|
||||
CBR: Constant BitRate -- DSP that consumes a constant number of
|
||||
input samples to produce an output sample.
|
||||
For example, a 22kHz to 44kHz resampler is CBR DSP.
|
||||
Even though the number of input to output samples differ,
|
||||
the ratio between input to output rate remains constant.
|
||||
All user-defined XAPOs are assumed to be CBR as
|
||||
XAudio2 only allows CBR DSP to be added to an effect chain.
|
||||
|
||||
XAPO: Cross-platform Audio Processing Object --
|
||||
a thin wrapper that manages DSP code, allowing it
|
||||
to be easily plugged into an XAudio2 effect chain.
|
||||
|
||||
Frame: A block of samples, one per channel,
|
||||
to be played simultaneously.
|
||||
|
||||
In-Place: Processing such that the input buffer equals the
|
||||
output buffer (i.e. input data modified directly).
|
||||
This form of processing is generally more efficient
|
||||
than using separate memory for input and output.
|
||||
However, an XAPO may not perform format conversion
|
||||
when processing in-place.
|
||||
|
||||
2. XAPO member variables are divided into three classifications:
|
||||
Immutable: Set once via IXAPO::Initialize and remain
|
||||
constant during the lifespan of the XAPO.
|
||||
|
||||
Locked: May change before the XAPO is locked via
|
||||
IXAPO::LockForProcess but remain constant
|
||||
until IXAPO::UnlockForProcess is called.
|
||||
|
||||
Dynamic: May change from one processing pass to the next,
|
||||
usually via IXAPOParameters::SetParameters.
|
||||
XAPOs should assign reasonable defaults to their dynamic
|
||||
variables during IXAPO::Initialize/LockForProcess so
|
||||
that calling IXAPOParameters::SetParameters is not
|
||||
required before processing begins.
|
||||
|
||||
When implementing an XAPO, determine the type of each variable and
|
||||
initialize them in the appropriate method. Immutable variables are
|
||||
generally preferable over locked which are preferable over dynamic.
|
||||
That is, one should strive to minimize XAPO state changes for
|
||||
best performance, maintainability, and ease of use.
|
||||
|
||||
3. To minimize glitches, the realtime audio processing thread must
|
||||
not block. XAPO methods called by the realtime thread are commented
|
||||
as non-blocking and therefore should not use blocking synchronization,
|
||||
allocate memory, access the disk, etc. The XAPO interfaces were
|
||||
designed to allow an effect implementer to move such operations
|
||||
into other methods called on an application controlled thread.
|
||||
|
||||
4. Extending functionality is accomplished through the addition of new
|
||||
COM interfaces. For example, if a new member is added to a parameter
|
||||
structure, a new interface using the new structure should be added,
|
||||
leaving the original interface unchanged.
|
||||
This ensures consistent communication between future versions of
|
||||
XAudio2 and various versions of XAPOs that may exist in an application.
|
||||
|
||||
5. All audio data is interleaved in XAudio2.
|
||||
The default audio format for an effect chain is WAVE_FORMAT_IEEE_FLOAT.
|
||||
|
||||
6. User-defined XAPOs should assume all input and output buffers are
|
||||
16-byte aligned.
|
||||
|
||||
7. See XAPOBase.h for an XAPO base class which provides a default
|
||||
implementation for most of the interface methods defined below. */
|
||||
|
||||
#pragma once
|
||||
//--------------<D-E-F-I-N-I-T-I-O-N-S>-------------------------------------//
|
||||
#include "comdecl.h" // for DEFINE_IID
|
||||
|
||||
// XAPO interface IDs
|
||||
DEFINE_IID(IXAPO, A90BC001, E897, E897, 55, E4, 9E, 47, 00, 00, 00, 00);
|
||||
DEFINE_IID(IXAPOParameters, A90BC001, E897, E897, 55, E4, 9E, 47, 00, 00, 00, 01);
|
||||
|
||||
|
||||
#if !defined(GUID_DEFS_ONLY) // ignore rest if only GUID definitions requested
|
||||
#if defined(_XBOX) // general windows and COM declarations
|
||||
#include <xtl.h>
|
||||
#include <xobjbase.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <objbase.h>
|
||||
#endif
|
||||
#include "audiodefs.h" // for WAVEFORMATEX etc.
|
||||
|
||||
// XAPO error codes
|
||||
#define FACILITY_XAPO 0x897
|
||||
#define XAPO_E_FORMAT_UNSUPPORTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XAPO, 0x01) // requested audio format unsupported
|
||||
|
||||
// supported number of channels (samples per frame) range
|
||||
#define XAPO_MIN_CHANNELS 1
|
||||
#define XAPO_MAX_CHANNELS 64
|
||||
|
||||
// supported framerate range
|
||||
#define XAPO_MIN_FRAMERATE 1000
|
||||
#define XAPO_MAX_FRAMERATE 200000
|
||||
|
||||
// unicode string length, including terminator, used with XAPO_REGISTRATION_PROPERTIES
|
||||
#define XAPO_REGISTRATION_STRING_LENGTH 256
|
||||
|
||||
|
||||
// XAPO property flags, used with XAPO_REGISTRATION_PROPERTIES.Flags:
|
||||
// Number of channels of input and output buffers must match,
|
||||
// applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat.
|
||||
#define XAPO_FLAG_CHANNELS_MUST_MATCH 0x00000001
|
||||
|
||||
// Framerate of input and output buffers must match,
|
||||
// applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat.
|
||||
#define XAPO_FLAG_FRAMERATE_MUST_MATCH 0x00000002
|
||||
|
||||
// Bit depth of input and output buffers must match,
|
||||
// applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat.
|
||||
// Container size of input and output buffers must also match if
|
||||
// XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat is WAVEFORMATEXTENSIBLE.
|
||||
#define XAPO_FLAG_BITSPERSAMPLE_MUST_MATCH 0x00000004
|
||||
|
||||
// Number of input and output buffers must match,
|
||||
// applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.
|
||||
//
|
||||
// Also, XAPO_REGISTRATION_PROPERTIES.MinInputBufferCount must
|
||||
// equal XAPO_REGISTRATION_PROPERTIES.MinOutputBufferCount and
|
||||
// XAPO_REGISTRATION_PROPERTIES.MaxInputBufferCount must equal
|
||||
// XAPO_REGISTRATION_PROPERTIES.MaxOutputBufferCount when used.
|
||||
#define XAPO_FLAG_BUFFERCOUNT_MUST_MATCH 0x00000008
|
||||
|
||||
// XAPO must be run in-place. Use this flag only if your DSP
|
||||
// implementation cannot process separate input and output buffers.
|
||||
// If set, the following flags must also be set:
|
||||
// XAPO_FLAG_CHANNELS_MUST_MATCH
|
||||
// XAPO_FLAG_FRAMERATE_MUST_MATCH
|
||||
// XAPO_FLAG_BITSPERSAMPLE_MUST_MATCH
|
||||
// XAPO_FLAG_BUFFERCOUNT_MUST_MATCH
|
||||
// XAPO_FLAG_INPLACE_SUPPORTED
|
||||
//
|
||||
// Multiple input and output buffers may be used with in-place XAPOs,
|
||||
// though the input buffer count must equal the output buffer count.
|
||||
// When multiple input/output buffers are used, the XAPO may assume
|
||||
// input buffer [N] equals output buffer [N] for in-place processing.
|
||||
#define XAPO_FLAG_INPLACE_REQUIRED 0x00000020
|
||||
|
||||
// XAPO may be run in-place. If the XAPO is used in a chain
|
||||
// such that the requirements for XAPO_FLAG_INPLACE_REQUIRED are met,
|
||||
// XAudio2 will ensure the XAPO is run in-place. If not met, XAudio2
|
||||
// will still run the XAPO albeit with separate input and output buffers.
|
||||
//
|
||||
// For example, consider an effect which may be ran in stereo->5.1 mode or
|
||||
// mono->mono mode. When set to stereo->5.1, it will be run with separate
|
||||
// input and output buffers as format conversion is not permitted in-place.
|
||||
// However, if configured to run mono->mono, the same XAPO can be run
|
||||
// in-place. Thus the same implementation may be conveniently reused
|
||||
// for various input/output configurations, while taking advantage of
|
||||
// in-place processing when possible.
|
||||
#define XAPO_FLAG_INPLACE_SUPPORTED 0x00000010
|
||||
|
||||
|
||||
//--------------<D-A-T-A---T-Y-P-E-S>---------------------------------------//
|
||||
#pragma pack(push, 1) // set packing alignment to ensure consistency across arbitrary build environments
|
||||
|
||||
|
||||
// XAPO registration properties, describes general XAPO characteristics, used with IXAPO::GetRegistrationProperties
|
||||
typedef struct XAPO_REGISTRATION_PROPERTIES {
|
||||
CLSID clsid; // COM class ID, used with CoCreate
|
||||
WCHAR FriendlyName[XAPO_REGISTRATION_STRING_LENGTH]; // friendly name unicode string
|
||||
WCHAR CopyrightInfo[XAPO_REGISTRATION_STRING_LENGTH]; // copyright information unicode string
|
||||
UINT32 MajorVersion; // major version
|
||||
UINT32 MinorVersion; // minor version
|
||||
UINT32 Flags; // XAPO property flags, describes supported input/output configuration
|
||||
UINT32 MinInputBufferCount; // minimum number of input buffers required for processing, can be 0
|
||||
UINT32 MaxInputBufferCount; // maximum number of input buffers supported for processing, must be >= MinInputBufferCount
|
||||
UINT32 MinOutputBufferCount; // minimum number of output buffers required for processing, can be 0, must match MinInputBufferCount when XAPO_FLAG_BUFFERCOUNT_MUST_MATCH used
|
||||
UINT32 MaxOutputBufferCount; // maximum number of output buffers supported for processing, must be >= MinOutputBufferCount, must match MaxInputBufferCount when XAPO_FLAG_BUFFERCOUNT_MUST_MATCH used
|
||||
} XAPO_REGISTRATION_PROPERTIES;
|
||||
|
||||
|
||||
// LockForProcess buffer parameters:
|
||||
// Defines buffer parameters that remain constant while an XAPO is locked.
|
||||
// Used with IXAPO::LockForProcess.
|
||||
//
|
||||
// For CBR XAPOs, MaxFrameCount is the only number of frames
|
||||
// IXAPO::Process would have to handle for the respective buffer.
|
||||
typedef struct XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS {
|
||||
const WAVEFORMATEX* pFormat; // buffer audio format
|
||||
UINT32 MaxFrameCount; // maximum number of frames in respective buffer that IXAPO::Process would have to handle, irrespective of dynamic variable settings, can be 0
|
||||
} XAPO_LOCKFORPROCESS_PARAMETERS;
|
||||
|
||||
// Buffer flags:
|
||||
// Describes assumed content of the respective buffer.
|
||||
// Used with XAPO_PROCESS_BUFFER_PARAMETERS.BufferFlags.
|
||||
//
|
||||
// This meta-data can be used by an XAPO to implement
|
||||
// optimizations that require knowledge of a buffer's content.
|
||||
//
|
||||
// For example, XAPOs that always produce silent output from silent input
|
||||
// can check the flag on the input buffer to determine if any signal
|
||||
// processing is necessary. If silent, the XAPO may simply set the flag
|
||||
// on the output buffer to silent and return, optimizing out the work of
|
||||
// processing silent data: XAPOs that generate silence for any reason may
|
||||
// set the buffer's flag accordingly rather than writing out silent
|
||||
// frames to the buffer itself.
|
||||
//
|
||||
// The flags represent what should be assumed is in the respective buffer.
|
||||
// The flags may not reflect what is actually stored in memory.
|
||||
typedef enum XAPO_BUFFER_FLAGS {
|
||||
XAPO_BUFFER_SILENT, // silent data should be assumed, respective memory may be uninitialized
|
||||
XAPO_BUFFER_VALID, // arbitrary data should be assumed (may or may not be silent frames), respective memory initialized
|
||||
} XAPO_BUFFER_FLAGS;
|
||||
|
||||
// Process buffer parameters:
|
||||
// Defines buffer parameters that may change from one
|
||||
// processing pass to the next. Used with IXAPO::Process.
|
||||
//
|
||||
// Note the byte size of the respective buffer must be at least:
|
||||
// XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount * XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat->nBlockAlign
|
||||
//
|
||||
// Although the audio format and maximum size of the respective
|
||||
// buffer is locked (defined by XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS),
|
||||
// the actual memory address of the buffer given is permitted to change
|
||||
// from one processing pass to the next.
|
||||
//
|
||||
// For CBR XAPOs, ValidFrameCount is constant while locked and equals
|
||||
// the respective XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount.
|
||||
typedef struct XAPO_PROCESS_BUFFER_PARAMETERS {
|
||||
void* pBuffer; // audio data buffer, must be non-NULL
|
||||
XAPO_BUFFER_FLAGS BufferFlags; // describes assumed content of pBuffer, does not affect ValidFrameCount
|
||||
UINT32 ValidFrameCount; // number of frames of valid data, must be within respective [0, XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount], always XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount for CBR/user-defined XAPOs, does not affect BufferFlags
|
||||
} XAPO_PROCESS_BUFFER_PARAMETERS;
|
||||
|
||||
|
||||
//--------------<M-A-C-R-O-S>-----------------------------------------------//
|
||||
// Memory allocation macros that allow one module to allocate memory and
|
||||
// another to free it, by guaranteeing that the same heap manager is used
|
||||
// regardless of differences between build environments of the two modules.
|
||||
//
|
||||
// Used by IXAPO methods that must allocate arbitrary sized structures
|
||||
// such as WAVEFORMATEX that are subsequently returned to the application.
|
||||
#if defined(_XBOX)
|
||||
#define XAPO_ALLOC_ATTRIBUTES MAKE_XALLOC_ATTRIBUTES ( \
|
||||
0, /* ObjectType */ \
|
||||
FALSE, /* HeapTracksAttributes */ \
|
||||
FALSE, /* MustSucceed */ \
|
||||
FALSE, /* FixedSize */ \
|
||||
eXALLOCAllocatorId_XAUDIO2, /* AllocatorId */ \
|
||||
XALLOC_ALIGNMENT_DEFAULT, /* Alignment */ \
|
||||
XALLOC_MEMPROTECT_READWRITE, /* MemoryProtect */ \
|
||||
FALSE, /* ZeroInitialize */ \
|
||||
XALLOC_MEMTYPE_HEAP /* MemoryType */ \
|
||||
)
|
||||
#define XAPOAlloc(size) XMemAlloc(size, XAPO_ALLOC_ATTRIBUTES)
|
||||
#define XAPOFree(p) XMemFree(p, XAPO_ALLOC_ATTRIBUTES)
|
||||
#else
|
||||
#define XAPOAlloc(size) CoTaskMemAlloc(size)
|
||||
#define XAPOFree(p) CoTaskMemFree(p)
|
||||
#endif
|
||||
|
||||
|
||||
//--------------<I-N-T-E-R-F-A-C-E-S>---------------------------------------//
|
||||
// IXAPO:
|
||||
// The only mandatory XAPO COM interface -- a thin wrapper that manages
|
||||
// DSP code, allowing it to be easily plugged into an XAudio2 effect chain.
|
||||
#undef INTERFACE
|
||||
#define INTERFACE IXAPO
|
||||
DECLARE_INTERFACE_(IXAPO, IUnknown) {
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Allocates a copy of the registration properties of the XAPO.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// ppRegistrationProperties - [out] receives pointer to copy of registration properties, use XAPOFree to free structure, left untouched on failure
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// COM error code
|
||||
////
|
||||
STDMETHOD(GetRegistrationProperties) (THIS_ __deref_out XAPO_REGISTRATION_PROPERTIES** ppRegistrationProperties) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Queries if an input/output configuration is supported.
|
||||
//
|
||||
// REMARKS:
|
||||
// This method allows XAPOs to express dependency of input format
|
||||
// with respect to output format.
|
||||
//
|
||||
// If the input/output format pair configuration is unsupported,
|
||||
// this method also determines the nearest input format supported.
|
||||
// Nearest meaning closest bit depth, framerate, and channel count,
|
||||
// in that order of importance.
|
||||
//
|
||||
// The behaviour of this method should remain constant after the
|
||||
// XAPO has been initialized.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pOutputFormat - [in] output format known to be supported
|
||||
// pRequestedInputFormat - [in] input format to examine
|
||||
// ppSupportedInputFormat - [out] receives pointer to nearest input format supported if not NULL and input/output configuration unsupported, use XAPOFree to free structure, left untouched on any failure except XAPO_E_FORMAT_UNSUPPORTED
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// COM error code, including:
|
||||
// S_OK - input/output configuration supported, ppSupportedInputFormat left untouched
|
||||
// XAPO_E_FORMAT_UNSUPPORTED - input/output configuration unsupported, ppSupportedInputFormat receives pointer to nearest input format supported if not NULL
|
||||
// E_INVALIDARG - either audio format invalid, ppSupportedInputFormat left untouched
|
||||
////
|
||||
STDMETHOD(IsInputFormatSupported) (THIS_ const WAVEFORMATEX* pOutputFormat, const WAVEFORMATEX* pRequestedInputFormat, __deref_opt_out WAVEFORMATEX** ppSupportedInputFormat) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Queries if an input/output configuration is supported.
|
||||
//
|
||||
// REMARKS:
|
||||
// This method allows XAPOs to express dependency of output format
|
||||
// with respect to input format.
|
||||
//
|
||||
// If the input/output format pair configuration is unsupported,
|
||||
// this method also determines the nearest output format supported.
|
||||
// Nearest meaning closest bit depth, framerate, and channel count,
|
||||
// in that order of importance.
|
||||
//
|
||||
// The behaviour of this method should remain constant after the
|
||||
// XAPO has been initialized.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pInputFormat - [in] input format known to be supported
|
||||
// pRequestedOutputFormat - [in] output format to examine
|
||||
// ppSupportedOutputFormat - [out] receives pointer to nearest output format supported if not NULL and input/output configuration unsupported, use XAPOFree to free structure, left untouched on any failure except XAPO_E_FORMAT_UNSUPPORTED
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// COM error code, including:
|
||||
// S_OK - input/output configuration supported, ppSupportedOutputFormat left untouched
|
||||
// XAPO_E_FORMAT_UNSUPPORTED - input/output configuration unsupported, ppSupportedOutputFormat receives pointer to nearest output format supported if not NULL
|
||||
// E_INVALIDARG - either audio format invalid, ppSupportedOutputFormat left untouched
|
||||
////
|
||||
STDMETHOD(IsOutputFormatSupported) (THIS_ const WAVEFORMATEX* pInputFormat, const WAVEFORMATEX* pRequestedOutputFormat, __deref_opt_out WAVEFORMATEX** ppSupportedOutputFormat) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Performs any effect-specific initialization if required.
|
||||
//
|
||||
// REMARKS:
|
||||
// The contents of pData are defined by the XAPO.
|
||||
// Immutable variables (constant during the lifespan of the XAPO)
|
||||
// should be set once via this method.
|
||||
// Once initialized, an XAPO cannot be initialized again.
|
||||
//
|
||||
// An XAPO should be initialized before passing it to XAudio2
|
||||
// as part of an effect chain. XAudio2 will not call this method;
|
||||
// it exists for future content-driven initialization by XACT.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pData - [in] effect-specific initialization parameters, may be NULL if DataByteSize == 0
|
||||
// DataByteSize - [in] size of pData in bytes, may be 0 if DataByteSize is NULL
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// COM error code
|
||||
////
|
||||
STDMETHOD(Initialize) (THIS_ __in_bcount_opt(DataByteSize) const void* pData, UINT32 DataByteSize) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Resets variables dependent on frame history.
|
||||
//
|
||||
// REMARKS:
|
||||
// All other variables remain unchanged, including variables set by
|
||||
// IXAPOParameters::SetParameters.
|
||||
//
|
||||
// For example, an effect with delay should zero out its delay line
|
||||
// during this method, but should not reallocate anything as the
|
||||
// XAPO remains locked with a constant input/output configuration.
|
||||
//
|
||||
// XAudio2 calls this method only if the XAPO is locked.
|
||||
// This method should not block as it is called from the
|
||||
// realtime thread.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// void
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
STDMETHOD_(void, Reset) (THIS) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Locks the XAPO to a specific input/output configuration,
|
||||
// allowing it to do any final initialization before Process
|
||||
// is called on the realtime thread.
|
||||
//
|
||||
// REMARKS:
|
||||
// Once locked, the input/output configuration and any other locked
|
||||
// variables remain constant until UnlockForProcess is called.
|
||||
//
|
||||
// XAPOs should assert the input/output configuration is supported
|
||||
// and that any required effect-specific initialization is complete.
|
||||
// IsInputFormatSupported, IsOutputFormatSupported, and Initialize
|
||||
// should be called as necessary before this method is called.
|
||||
//
|
||||
// All internal memory buffers required for Process should be
|
||||
// allocated by the time this method returns successfully
|
||||
// as Process is non-blocking and should not allocate memory.
|
||||
//
|
||||
// Once locked, an XAPO cannot be locked again until
|
||||
// UnLockForProcess is called.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// InputLockedParameterCount - [in] number of input buffers, must be within [XAPO_REGISTRATION_PROPERTIES.MinInputBufferCount, XAPO_REGISTRATION_PROPERTIES.MaxInputBufferCount]
|
||||
// pInputLockedParameters - [in] array of input locked buffer parameter structures, may be NULL if InputLockedParameterCount == 0, otherwise must have InputLockedParameterCount elements
|
||||
// OutputLockedParameterCount - [in] number of output buffers, must be within [XAPO_REGISTRATION_PROPERTIES.MinOutputBufferCount, XAPO_REGISTRATION_PROPERTIES.MaxOutputBufferCount], must match InputLockedParameterCount when XAPO_FLAG_BUFFERCOUNT_MUST_MATCH used
|
||||
// pOutputLockedParameters - [in] array of output locked buffer parameter structures, may be NULL if OutputLockedParameterCount == 0, otherwise must have OutputLockedParameterCount elements
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// COM error code
|
||||
////
|
||||
STDMETHOD(LockForProcess) (THIS_ UINT32 InputLockedParameterCount, __in_ecount_opt(InputLockedParameterCount) const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS* pInputLockedParameters, UINT32 OutputLockedParameterCount, __in_ecount_opt(OutputLockedParameterCount) const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS* pOutputLockedParameters) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Opposite of LockForProcess. Variables allocated during
|
||||
// LockForProcess should be deallocated by this method.
|
||||
//
|
||||
// REMARKS:
|
||||
// Unlocking an XAPO allows an XAPO instance to be reused with
|
||||
// different input/output configurations.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// void
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
STDMETHOD_(void, UnlockForProcess) (THIS) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Runs the XAPO's DSP code on the given input/output buffers.
|
||||
//
|
||||
// REMARKS:
|
||||
// In addition to writing to the output buffers as appropriate,
|
||||
// an XAPO must set the BufferFlags and ValidFrameCount members
|
||||
// of all elements in pOutputProcessParameters accordingly.
|
||||
//
|
||||
// ppInputProcessParameters will not necessarily be the same as
|
||||
// ppOutputProcessParameters for in-place processing, rather
|
||||
// the pBuffer members of each will point to the same memory.
|
||||
//
|
||||
// Multiple input/output buffers may be used with in-place XAPOs,
|
||||
// though the input buffer count must equal the output buffer count.
|
||||
// When multiple input/output buffers are used with in-place XAPOs,
|
||||
// the XAPO may assume input buffer [N] equals output buffer [N].
|
||||
//
|
||||
// When IsEnabled is FALSE, the XAPO should process thru.
|
||||
// Thru processing means an XAPO should not apply its normal
|
||||
// processing to the given input/output buffers during Process.
|
||||
// It should instead pass data from input to output with as little
|
||||
// modification possible. Effects that perform format conversion
|
||||
// should continue to do so. The effect must ensure transitions
|
||||
// between normal and thru processing do not introduce
|
||||
// discontinuities into the signal.
|
||||
//
|
||||
// XAudio2 calls this method only if the XAPO is locked.
|
||||
// This method should not block as it is called from the
|
||||
// realtime thread.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// InputProcessParameterCount - [in] number of input buffers, matches respective InputLockedParameterCount parameter given to LockForProcess
|
||||
// pInputProcessParameters - [in] array of input process buffer parameter structures, may be NULL if InputProcessParameterCount == 0, otherwise must have InputProcessParameterCount elements
|
||||
// OutputProcessParameterCount - [in] number of output buffers, matches respective OutputLockedParameterCount parameter given to LockForProcess
|
||||
// pOutputProcessParameters - [in/out] array of output process buffer parameter structures, may be NULL if OutputProcessParameterCount == 0, otherwise must have OutputProcessParameterCount elements
|
||||
// IsEnabled - [in] TRUE to process normally, FALSE to process thru
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
STDMETHOD_(void, Process) (THIS_ UINT32 InputProcessParameterCount, __in_ecount_opt(InputProcessParameterCount) const XAPO_PROCESS_BUFFER_PARAMETERS* pInputProcessParameters, UINT32 OutputProcessParameterCount, __inout_ecount_opt(OutputProcessParameterCount) XAPO_PROCESS_BUFFER_PARAMETERS* pOutputProcessParameters, BOOL IsEnabled) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Returns the number of input frames required to generate the
|
||||
// requested number of output frames.
|
||||
//
|
||||
// REMARKS:
|
||||
// XAudio2 may call this method to determine how many input frames
|
||||
// an XAPO requires. This is constant for locked CBR XAPOs;
|
||||
// this method need only be called once while an XAPO is locked.
|
||||
//
|
||||
// XAudio2 calls this method only if the XAPO is locked.
|
||||
// This method should not block as it is called from the
|
||||
// realtime thread.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// OutputFrameCount - [in] requested number of output frames, must be within respective [0, XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount], always XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount for CBR/user-defined XAPOs
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// number of input frames required
|
||||
////
|
||||
STDMETHOD_(UINT32, CalcInputFrames) (THIS_ UINT32 OutputFrameCount) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Returns the number of output frames generated for the
|
||||
// requested number of input frames.
|
||||
//
|
||||
// REMARKS:
|
||||
// XAudio2 may call this method to determine how many output frames
|
||||
// an XAPO will generate. This is constant for locked CBR XAPOs;
|
||||
// this method need only be called once while an XAPO is locked.
|
||||
//
|
||||
// XAudio2 calls this method only if the XAPO is locked.
|
||||
// This method should not block as it is called from the
|
||||
// realtime thread.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// InputFrameCount - [in] requested number of input frames, must be within respective [0, XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount], always XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount for CBR/user-defined XAPOs
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// number of output frames generated
|
||||
////
|
||||
STDMETHOD_(UINT32, CalcOutputFrames) (THIS_ UINT32 InputFrameCount) PURE;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// IXAPOParameters:
|
||||
// Optional XAPO COM interface that allows an XAPO to use
|
||||
// effect-specific parameters.
|
||||
#undef INTERFACE
|
||||
#define INTERFACE IXAPOParameters
|
||||
DECLARE_INTERFACE_(IXAPOParameters, IUnknown) {
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Sets effect-specific parameters.
|
||||
//
|
||||
// REMARKS:
|
||||
// This method may only be called on the realtime thread;
|
||||
// no synchronization between it and IXAPO::Process is necessary.
|
||||
//
|
||||
// This method should not block as it is called from the
|
||||
// realtime thread.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pParameters - [in] effect-specific parameter block, must be != NULL
|
||||
// ParameterByteSize - [in] size of pParameters in bytes, must be > 0
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
STDMETHOD_(void, SetParameters) (THIS_ __in_bcount(ParameterByteSize) const void* pParameters, UINT32 ParameterByteSize) PURE;
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Gets effect-specific parameters.
|
||||
//
|
||||
// REMARKS:
|
||||
// Unlike SetParameters, XAudio2 does not call this method on the
|
||||
// realtime thread. Thus, the XAPO must protect variables shared
|
||||
// with SetParameters/Process using appropriate synchronization.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pParameters - [out] receives effect-specific parameter block, must be != NULL
|
||||
// ParameterByteSize - [in] size of pParameters in bytes, must be > 0
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
STDMETHOD_(void, GetParameters) (THIS_ __out_bcount(ParameterByteSize) void* pParameters, UINT32 ParameterByteSize) PURE;
|
||||
};
|
||||
|
||||
|
||||
//--------------<M-A-C-R-O-S>-----------------------------------------------//
|
||||
// macros to allow XAPO interfaces to be used in C code
|
||||
#if !defined(__cplusplus)
|
||||
// IXAPO
|
||||
#define IXAPO_QueryInterface(This, riid, ppInterface) \
|
||||
( (This)->lpVtbl->QueryInterface(This, riid, ppInterface) )
|
||||
|
||||
#define IXAPO_AddRef(This) \
|
||||
( (This)->lpVtbl->AddRef(This) )
|
||||
|
||||
#define IXAPO_Release(This) \
|
||||
( (This)->lpVtbl->Release(This) )
|
||||
|
||||
#define IXAPO_GetRegistrationProperties(This, ppRegistrationProperties) \
|
||||
( (This)->lpVtbl->GetRegistrationProperties(This, ppRegistrationProperties) )
|
||||
|
||||
#define IXAPO_IsInputFormatSupported(This, pOutputFormat, pRequestedInputFormat, ppSupportedInputFormat) \
|
||||
( (This)->lpVtbl->IsInputFormatSupported(This, pOutputFormat, pRequestedInputFormat, ppSupportedInputFormat) )
|
||||
|
||||
#define IXAPO_IsOutputFormatSupported(This, pInputFormat, pRequestedOutputFormat, ppSupportedOutputFormat) \
|
||||
( (This)->lpVtbl->IsOutputFormatSupported(This, pInputFormat, pRequestedOutputFormat, ppSupportedOutputFormat) )
|
||||
|
||||
#define IXAPO_Initialize(This, pData, DataByteSize) \
|
||||
( (This)->lpVtbl->Initialize(This, pData, DataByteSize) )
|
||||
|
||||
#define IXAPO_Reset(This) \
|
||||
( (This)->lpVtbl->Reset(This) )
|
||||
|
||||
#define IXAPO_LockForProcess(This, InputLockedParameterCount, pInputLockedParameters, OutputLockedParameterCount, pOutputLockedParameters) \
|
||||
( (This)->lpVtbl->LockForProcess(This, InputLockedParameterCount, pInputLockedParameters, OutputLockedParameterCount, pOutputLockedParameters) )
|
||||
|
||||
#define IXAPO_UnlockForProcess(This) \
|
||||
( (This)->lpVtbl->UnlockForProcess(This) )
|
||||
|
||||
#define IXAPO_Process(This, InputProcessParameterCount, pInputProcessParameters, OutputProcessParameterCount, pOutputProcessParameters, IsEnabled) \
|
||||
( (This)->lpVtbl->Process(This, InputProcessParameterCount, pInputProcessParameters, OutputProcessParameterCount, pOutputProcessParameters, IsEnabled) )
|
||||
|
||||
#define IXAPO_CalcInputFrames(This, OutputFrameCount) \
|
||||
( (This)->lpVtbl->CalcInputFrames(This, OutputFrameCount) )
|
||||
|
||||
#define IXAPO_CalcOutputFrames(This, InputFrameCount) \
|
||||
( (This)->lpVtbl->CalcOutputFrames(This, InputFrameCount) )
|
||||
|
||||
|
||||
// IXAPOParameters
|
||||
#define IXAPOParameters_QueryInterface(This, riid, ppInterface) \
|
||||
( (This)->lpVtbl->QueryInterface(This, riid, ppInterface) )
|
||||
|
||||
#define IXAPOParameters_AddRef(This) \
|
||||
( (This)->lpVtbl->AddRef(This) )
|
||||
|
||||
#define IXAPOParameters_Release(This) \
|
||||
( (This)->lpVtbl->Release(This) )
|
||||
|
||||
#define IXAPOParameters_SetParameters(This, pParameters, ParameterByteSize) \
|
||||
( (This)->lpVtbl->SetParameters(This, pParameters, ParameterByteSize) )
|
||||
|
||||
#define IXAPOParameters_GetParameters(This, pParameters, ParameterByteSize) \
|
||||
( (This)->lpVtbl->GetParameters(This, pParameters, ParameterByteSize) )
|
||||
#endif // !defined(__cplusplus)
|
||||
|
||||
|
||||
#pragma pack(pop) // revert packing alignment
|
||||
#endif // !defined(GUID_DEFS_ONLY)
|
||||
//---------------------------------<-EOF->----------------------------------//
|
||||
324
common/dx11sdk/XAPOBase.h
Normal file
324
common/dx11sdk/XAPOBase.h
Normal file
@@ -0,0 +1,324 @@
|
||||
/*-========================================================================-_
|
||||
| - XAPO - |
|
||||
| Copyright (c) Microsoft Corporation. All rights reserved. |
|
||||
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|
||||
|PROJECT: XAPO MODEL: Unmanaged User-mode |
|
||||
|VERSION: 1.0 EXCEPT: No Exceptions |
|
||||
|CLASS: N / A MINREQ: WinXP, Xbox360 |
|
||||
|BASE: N / A DIALECT: MSC++ 14.00 |
|
||||
|>------------------------------------------------------------------------<|
|
||||
| DUTY: XAPO base classes |
|
||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|
||||
NOTES:
|
||||
1. See XAPO.h for the rules governing XAPO interface behaviour. */
|
||||
|
||||
#pragma once
|
||||
//--------------<D-E-F-I-N-I-T-I-O-N-S>-------------------------------------//
|
||||
#include "XAPO.h"
|
||||
|
||||
// default audio format ranges supported, applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat
|
||||
#define XAPOBASE_DEFAULT_FORMAT_TAG WAVE_FORMAT_IEEE_FLOAT // 32-bit float only, applies to WAVEFORMATEX.wFormatTag or WAVEFORMATEXTENSIBLE.SubFormat when used
|
||||
#define XAPOBASE_DEFAULT_FORMAT_MIN_CHANNELS XAPO_MIN_CHANNELS // minimum channel count, applies to WAVEFORMATEX.nChannels
|
||||
#define XAPOBASE_DEFAULT_FORMAT_MAX_CHANNELS XAPO_MAX_CHANNELS // maximum channel count, applies to WAVEFORMATEX.nChannels
|
||||
#define XAPOBASE_DEFAULT_FORMAT_MIN_FRAMERATE XAPO_MIN_FRAMERATE // minimum framerate, applies to WAVEFORMATEX.nSamplesPerSec
|
||||
#define XAPOBASE_DEFAULT_FORMAT_MAX_FRAMERATE XAPO_MAX_FRAMERATE // maximum framerate, applies to WAVEFORMATEX.nSamplesPerSec
|
||||
#define XAPOBASE_DEFAULT_FORMAT_BITSPERSAMPLE 32 // 32-bit float only, applies to WAVEFORMATEX.wBitsPerSample and WAVEFORMATEXTENSIBLE.wValidBitsPerSample when used
|
||||
|
||||
// default XAPO property flags supported, applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
|
||||
#define XAPOBASE_DEFAULT_FLAG (XAPO_FLAG_CHANNELS_MUST_MATCH | XAPO_FLAG_FRAMERATE_MUST_MATCH | XAPO_FLAG_BITSPERSAMPLE_MUST_MATCH | XAPO_FLAG_BUFFERCOUNT_MUST_MATCH | XAPO_FLAG_INPLACE_SUPPORTED)
|
||||
|
||||
// default number of input and output buffers supported, applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
|
||||
#define XAPOBASE_DEFAULT_BUFFER_COUNT 1
|
||||
|
||||
|
||||
//--------------<D-A-T-A---T-Y-P-E-S>---------------------------------------//
|
||||
#pragma pack(push, 8) // set packing alignment to ensure consistency across arbitrary build environments
|
||||
|
||||
|
||||
// primitive types
|
||||
typedef float FLOAT32; // 32-bit IEEE float
|
||||
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Default implementation of the IXAPO and IUnknown interfaces.
|
||||
// Provides overridable implementations for all methods save IXAPO::Process.
|
||||
////
|
||||
class __declspec(novtable) CXAPOBase: public IXAPO {
|
||||
private:
|
||||
const XAPO_REGISTRATION_PROPERTIES* m_pRegistrationProperties; // pointer to registration properties of the XAPO, set via constructor
|
||||
|
||||
void* m_pfnMatrixMixFunction; // optimal matrix function pointer, used for thru processing
|
||||
FLOAT32* m_pfl32MatrixCoefficients; // matrix coefficient table, used for thru processing
|
||||
UINT32 m_nSrcFormatType; // input format type, used for thru processing
|
||||
BOOL m_fIsScalarMatrix; // TRUE if m_pfl32MatrixCoefficients is diagonal matrix with all main diagonal entries equal, i.e. m_pfnMatrixMixFunction only used for type conversion (no channel conversion), used for thru processing
|
||||
BOOL m_fIsLocked; // TRUE if XAPO locked via CXAPOBase.LockForProcess
|
||||
|
||||
|
||||
protected:
|
||||
LONG m_lReferenceCount; // COM reference count, must be aligned for atomic operations
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Verifies an audio format falls within the default ranges supported.
|
||||
//
|
||||
// REMARKS:
|
||||
// If pFormat is unsupported, and fOverwrite is TRUE,
|
||||
// pFormat is overwritten with the nearest format supported.
|
||||
// Nearest meaning closest bit depth, framerate, and channel count,
|
||||
// in that order of importance.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pFormat - [in/out] audio format to examine
|
||||
// fOverwrite - [in] TRUE to overwrite pFormat if audio format unsupported
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// COM error code, including:
|
||||
// S_OK - audio format supported, pFormat left untouched
|
||||
// XAPO_E_FORMAT_UNSUPPORTED - audio format unsupported, pFormat overwritten with nearest audio format supported if fOverwrite TRUE
|
||||
// E_INVALIDARG - audio format invalid, pFormat left untouched
|
||||
////
|
||||
virtual HRESULT ValidateFormatDefault (__inout WAVEFORMATEX* pFormat, BOOL fOverwrite);
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Verifies that an input/output format pair configuration is supported
|
||||
// with respect to the XAPO property flags.
|
||||
//
|
||||
// REMARKS:
|
||||
// If pRequestedFormat is unsupported, and fOverwrite is TRUE,
|
||||
// pRequestedFormat is overwritten with the nearest format supported.
|
||||
// Nearest meaning closest bit depth, framerate, and channel count,
|
||||
// in that order of importance.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pSupportedFormat - [in] audio format known to be supported
|
||||
// pRequestedFormat - [in/out] audio format to examine, must be WAVEFORMATEXTENSIBLE if fOverwrite TRUE
|
||||
// fOverwrite - [in] TRUE to overwrite pRequestedFormat if input/output configuration unsupported
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// COM error code, including:
|
||||
// S_OK - input/output configuration supported, pRequestedFormat left untouched
|
||||
// XAPO_E_FORMAT_UNSUPPORTED - input/output configuration unsupported, pRequestedFormat overwritten with nearest audio format supported if fOverwrite TRUE
|
||||
// E_INVALIDARG - either audio format invalid, pRequestedFormat left untouched
|
||||
////
|
||||
HRESULT ValidateFormatPair (const WAVEFORMATEX* pSupportedFormat, __inout WAVEFORMATEX* pRequestedFormat, BOOL fOverwrite);
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// This method may be called by an IXAPO::Process implementation
|
||||
// for thru processing. It copies/mixes data from source to
|
||||
// destination, making as few changes as possible to the audio data.
|
||||
//
|
||||
// REMARKS:
|
||||
// However, this method is capable of channel upmix/downmix and uses
|
||||
// the same matrix coefficient table used by windows Vista to do so.
|
||||
//
|
||||
// For in-place processing (input buffer == output buffer)
|
||||
// this method does nothing.
|
||||
//
|
||||
// This method should be called only if the XAPO is locked and
|
||||
// XAPO_FLAG_FRAMERATE_MUST_MATCH is used.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pInputBuffer - [in] input buffer, format may be INT8, INT16, INT20 (contained in 24 or 32 bits), INT24 (contained in 24 or 32 bits), INT32, or FLOAT32
|
||||
// pOutputBuffer - [out] output buffer, format must be FLOAT32
|
||||
// FrameCount - [in] number of frames to process
|
||||
// InputChannelCount - [in] number of input channels
|
||||
// OutputChannelCount - [in] number of output channels
|
||||
// MixWithOutput - [in] TRUE to mix with output, FALSE to overwrite output
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
void ProcessThru (__in void* pInputBuffer, __inout FLOAT32* pOutputBuffer, UINT32 FrameCount, WORD InputChannelCount, WORD OutputChannelCount, BOOL MixWithOutput);
|
||||
|
||||
// accessors
|
||||
const XAPO_REGISTRATION_PROPERTIES* GetRegistrationPropertiesInternal () { return m_pRegistrationProperties; }
|
||||
BOOL IsLocked () { return m_fIsLocked; }
|
||||
|
||||
|
||||
public:
|
||||
CXAPOBase (const XAPO_REGISTRATION_PROPERTIES* pRegistrationProperties);
|
||||
virtual ~CXAPOBase ();
|
||||
|
||||
// IUnknown methods:
|
||||
// retrieves the requested interface pointer if supported
|
||||
STDMETHOD(QueryInterface) (REFIID riid, __deref_out void** ppInterface)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (riid == __uuidof(IXAPO)) {
|
||||
*ppInterface = static_cast<IXAPO*>(this);
|
||||
AddRef();
|
||||
} else if (riid == __uuidof(IUnknown)) {
|
||||
*ppInterface = static_cast<IUnknown*>(this);
|
||||
AddRef();
|
||||
} else {
|
||||
*ppInterface = NULL;
|
||||
hr = E_NOINTERFACE;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
// increments reference count
|
||||
STDMETHOD_(ULONG, AddRef) ()
|
||||
{
|
||||
return (ULONG)InterlockedIncrement(&m_lReferenceCount);
|
||||
}
|
||||
|
||||
// decrements reference count and deletes the object if the reference count falls to zero
|
||||
STDMETHOD_(ULONG, Release) ()
|
||||
{
|
||||
ULONG uTmpReferenceCount = (ULONG)InterlockedDecrement(&m_lReferenceCount);
|
||||
if (uTmpReferenceCount == 0) {
|
||||
delete this;
|
||||
}
|
||||
return uTmpReferenceCount;
|
||||
}
|
||||
|
||||
// IXAPO methods:
|
||||
// Allocates a copy of the registration properties of the XAPO.
|
||||
// This default implementation returns a copy of the registration
|
||||
// properties given to the constructor, allocated via XAPOAlloc.
|
||||
STDMETHOD(GetRegistrationProperties) (__deref_out XAPO_REGISTRATION_PROPERTIES** ppRegistrationProperties);
|
||||
|
||||
// Queries if a specific input format is supported for a given output format.
|
||||
// This default implementation assumes only the format described by the
|
||||
// XAPOBASE_DEFAULT_FORMAT values are supported for both input and output.
|
||||
STDMETHOD(IsInputFormatSupported) (const WAVEFORMATEX* pOutputFormat, const WAVEFORMATEX* pRequestedInputFormat, __deref_opt_out WAVEFORMATEX** ppSupportedInputFormat);
|
||||
|
||||
// Queries if a specific output format is supported for a given input format.
|
||||
// This default implementation assumes only the format described by the
|
||||
// XAPOBASE_DEFAULT_FORMAT values are supported for both input and output.
|
||||
STDMETHOD(IsOutputFormatSupported) (const WAVEFORMATEX* pInputFormat, const WAVEFORMATEX* pRequestedOutputFormat, __deref_opt_out WAVEFORMATEX** ppSupportedOutputFormat);
|
||||
|
||||
// Performs any effect-specific initialization.
|
||||
// This default implementation is a no-op and only returns S_OK.
|
||||
STDMETHOD(Initialize) (__in_bcount_opt(DataByteSize) const void*, UINT32 DataByteSize)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(DataByteSize);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Resets variables dependent on frame history.
|
||||
// This default implementation is a no-op: this base class contains no
|
||||
// relevant state to reset.
|
||||
STDMETHOD_(void, Reset) () { return; }
|
||||
|
||||
// Notifies XAPO of buffer formats Process() will be given.
|
||||
// This default implementation performs basic input/output format
|
||||
// validation against the XAPO's registration properties.
|
||||
// Derived XAPOs should call the base implementation first.
|
||||
STDMETHOD(LockForProcess) (UINT32 InputLockedParameterCount, __in_ecount_opt(InputLockedParameterCount) const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS* pInputLockedParameters, UINT32 OutputLockedParameterCount, __in_ecount_opt(OutputLockedParameterCount) const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS* pOutputLockedParameters);
|
||||
|
||||
// Opposite of LockForProcess.
|
||||
// Derived XAPOs should call the base implementation first.
|
||||
STDMETHOD_(void, UnlockForProcess) ();
|
||||
|
||||
// Returns the number of input frames required to generate the requested number of output frames.
|
||||
// By default, this method returns the same number of frames it was passed.
|
||||
STDMETHOD_(UINT32, CalcInputFrames) (UINT32 OutputFrameCount) { return OutputFrameCount; }
|
||||
|
||||
// Returns the number of output frames generated for the requested number of input frames.
|
||||
// By default, this method returns the same number of frames it was passed.
|
||||
STDMETHOD_(UINT32, CalcOutputFrames) (UINT32 InputFrameCount) { return InputFrameCount; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------//
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Extends CXAPOBase, providing a default implementation of the
|
||||
// IXAPOParameters interface with appropriate synchronization to
|
||||
// protect variables shared between IXAPOParameters::GetParameters
|
||||
// and IXAPOParameters::SetParameters/IXAPO::Process.
|
||||
//
|
||||
// This class is for parameter blocks whose size is larger than 4 bytes.
|
||||
// For smaller parameter blocks, use atomic operations directly
|
||||
// on the parameters for synchronization.
|
||||
////
|
||||
class __declspec(novtable) CXAPOParametersBase: public CXAPOBase, public IXAPOParameters {
|
||||
private:
|
||||
BYTE* m_pParameterBlocks; // three contiguous process parameter blocks used for synchronization, user responsible for initialization of parameter blocks before IXAPO::Process/SetParameters/GetParameters called
|
||||
BYTE* m_pCurrentParameters; // pointer to current process parameters, must be aligned for atomic operations
|
||||
BYTE* m_pCurrentParametersInternal; // pointer to current process parameters (temp pointer read by SetParameters/BeginProcess/EndProcess)
|
||||
UINT32 m_uCurrentParametersIndex; // index of current process parameters
|
||||
UINT32 m_uParameterBlockByteSize; // size of a single parameter block in bytes, must be > 0
|
||||
BOOL m_fNewerResultsReady; // TRUE if there exists new processing results not yet picked up by GetParameters(), must be aligned for atomic operations
|
||||
BOOL m_fProducer; // IXAPO::Process produces data to be returned by GetParameters(); SetParameters() disallowed
|
||||
|
||||
|
||||
public:
|
||||
////
|
||||
// PARAMETERS:
|
||||
// pRegistrationProperties - [in] registration properties of the XAPO
|
||||
// pParameterBlocks - [in] three contiguous process parameter blocks used for synchronization
|
||||
// uParameterBlockByteSize - [in] size of one of the parameter blocks, must be > 0
|
||||
// fProducer - [in] TRUE if IXAPO::Process produces data to be returned by GetParameters() (SetParameters() and ParametersChanged() disallowed)
|
||||
////
|
||||
CXAPOParametersBase (const XAPO_REGISTRATION_PROPERTIES* pRegistrationProperties, BYTE* pParameterBlocks, UINT32 uParameterBlockByteSize, BOOL fProducer);
|
||||
virtual ~CXAPOParametersBase ();
|
||||
|
||||
// IUnknown methods:
|
||||
// retrieves the requested interface pointer if supported
|
||||
STDMETHOD(QueryInterface) (REFIID riid, __deref_out void** ppInterface)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (riid == __uuidof(IXAPOParameters)) {
|
||||
*ppInterface = static_cast<IXAPOParameters*>(this);
|
||||
CXAPOBase::AddRef();
|
||||
} else {
|
||||
hr = CXAPOBase::QueryInterface(riid, ppInterface);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
// increments reference count
|
||||
STDMETHOD_(ULONG, AddRef)() { return CXAPOBase::AddRef(); }
|
||||
|
||||
// decrements reference count and deletes the object if the reference count falls to zero
|
||||
STDMETHOD_(ULONG, Release)() { return CXAPOBase::Release(); }
|
||||
|
||||
// IXAPOParameters methods:
|
||||
// Sets effect-specific parameters.
|
||||
// This method may only be called on the realtime audio processing thread.
|
||||
STDMETHOD_(void, SetParameters) (__in_bcount(ParameterByteSize) const void* pParameters, UINT32 ParameterByteSize);
|
||||
|
||||
// Gets effect-specific parameters.
|
||||
// This method may block and should not be called from the realtime thread.
|
||||
// Get the current parameters via BeginProcess.
|
||||
STDMETHOD_(void, GetParameters) (__out_bcount(ParameterByteSize) void* pParameters, UINT32 ParameterByteSize);
|
||||
|
||||
// Called by SetParameters() to allow for user-defined parameter validation.
|
||||
// SetParameters validates that ParameterByteSize == m_uParameterBlockByteSize
|
||||
// so the user may assume/assert ParameterByteSize == m_uParameterBlockByteSize.
|
||||
// This method should not block as it is called from the realtime thread.
|
||||
virtual void OnSetParameters (const void*, UINT32) { }
|
||||
|
||||
// Returns TRUE if SetParameters() has been called since the last processing pass.
|
||||
// May only be used within the XAPO's IXAPO::Process implementation,
|
||||
// before BeginProcess is called.
|
||||
BOOL ParametersChanged ();
|
||||
|
||||
// Returns latest process parameters.
|
||||
// XAPOs must call this method within their IXAPO::Process
|
||||
// implementation to access latest process parameters in threadsafe manner.
|
||||
BYTE* BeginProcess ();
|
||||
|
||||
// Notifies CXAPOParametersBase that the XAPO has finished accessing
|
||||
// the latest process parameters.
|
||||
// XAPOs must call this method within their IXAPO::Process
|
||||
// implementation to access latest process parameters in threadsafe manner.
|
||||
void EndProcess ();
|
||||
};
|
||||
|
||||
|
||||
#pragma pack(pop) // revert packing alignment
|
||||
//---------------------------------<-EOF->----------------------------------//
|
||||
167
common/dx11sdk/XAPOFX.h
Normal file
167
common/dx11sdk/XAPOFX.h
Normal file
@@ -0,0 +1,167 @@
|
||||
/*-========================================================================-_
|
||||
| - XAPOFX - |
|
||||
| Copyright (c) Microsoft Corporation. All rights reserved. |
|
||||
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|
||||
|PROJECT: XAPOFX MODEL: Unmanaged User-mode |
|
||||
|VERSION: 1.3 EXCEPT: No Exceptions |
|
||||
|CLASS: N / A MINREQ: WinXP, Xbox360 |
|
||||
|BASE: N / A DIALECT: MSC++ 14.00 |
|
||||
|>------------------------------------------------------------------------<|
|
||||
| DUTY: Cross-platform Audio Processing Objects |
|
||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|
||||
NOTES:
|
||||
1. USE THE DEBUG DLL TO ENABLE PARAMETER VALIDATION VIA ASSERTS!
|
||||
Here's how:
|
||||
Copy XAPOFXDX_X.dll to where your application exists.
|
||||
The debug DLL can be found under %WINDIR%\system32.
|
||||
Rename XAPOFXDX_X.dll to XAPOFXX_X.dll to use the debug version. */
|
||||
|
||||
#pragma once
|
||||
//--------------<D-E-F-I-N-I-T-I-O-N-S>-------------------------------------//
|
||||
#include "comdecl.h" // for DEFINE_CLSID
|
||||
|
||||
// FX class IDs
|
||||
DEFINE_CLSID(FXEQ, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 00);
|
||||
DEFINE_CLSID(FXMasteringLimiter, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 01);
|
||||
DEFINE_CLSID(FXReverb, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 02);
|
||||
DEFINE_CLSID(FXEcho, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 03);
|
||||
|
||||
|
||||
#if !defined(GUID_DEFS_ONLY) // ignore rest if only GUID definitions requested
|
||||
#if defined(_XBOX) // general windows and COM declarations
|
||||
#include <xtl.h>
|
||||
#include <xobjbase.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <objbase.h>
|
||||
#endif
|
||||
#include <float.h> // float bounds
|
||||
|
||||
|
||||
// EQ parameter bounds (inclusive), used with XEQ:
|
||||
#define FXEQ_MIN_FRAMERATE 22000
|
||||
#define FXEQ_MAX_FRAMERATE 48000
|
||||
|
||||
#define FXEQ_MIN_FREQUENCY_CENTER 20.0f
|
||||
#define FXEQ_MAX_FREQUENCY_CENTER 20000.0f
|
||||
#define FXEQ_DEFAULT_FREQUENCY_CENTER_0 100.0f // band 0
|
||||
#define FXEQ_DEFAULT_FREQUENCY_CENTER_1 800.0f // band 1
|
||||
#define FXEQ_DEFAULT_FREQUENCY_CENTER_2 2000.0f // band 2
|
||||
#define FXEQ_DEFAULT_FREQUENCY_CENTER_3 10000.0f // band 3
|
||||
|
||||
#define FXEQ_MIN_GAIN 0.126f // -18dB
|
||||
#define FXEQ_MAX_GAIN 7.94f // +18dB
|
||||
#define FXEQ_DEFAULT_GAIN 1.0f // 0dB change, all bands
|
||||
|
||||
#define FXEQ_MIN_BANDWIDTH 0.1f
|
||||
#define FXEQ_MAX_BANDWIDTH 2.0f
|
||||
#define FXEQ_DEFAULT_BANDWIDTH 1.0f // all bands
|
||||
|
||||
|
||||
// Mastering limiter parameter bounds (inclusive), used with XMasteringLimiter:
|
||||
#define FXMASTERINGLIMITER_MIN_RELEASE 1
|
||||
#define FXMASTERINGLIMITER_MAX_RELEASE 20
|
||||
#define FXMASTERINGLIMITER_DEFAULT_RELEASE 6
|
||||
|
||||
#define FXMASTERINGLIMITER_MIN_LOUDNESS 1
|
||||
#define FXMASTERINGLIMITER_MAX_LOUDNESS 1800
|
||||
#define FXMASTERINGLIMITER_DEFAULT_LOUDNESS 1000
|
||||
|
||||
|
||||
// Reverb parameter bounds (inclusive), used with XReverb:
|
||||
#define FXREVERB_MIN_DIFFUSION 0.0f
|
||||
#define FXREVERB_MAX_DIFFUSION 1.0f
|
||||
#define FXREVERB_DEFAULT_DIFFUSION 0.9f
|
||||
|
||||
#define FXREVERB_MIN_ROOMSIZE 0.0001f
|
||||
#define FXREVERB_MAX_ROOMSIZE 1.0f
|
||||
#define FXREVERB_DEFAULT_ROOMSIZE 0.6f
|
||||
|
||||
|
||||
// Echo parameter bounds (inclusive), used with XEcho:
|
||||
#define FXECHO_MIN_WETDRYMIX 0.0f
|
||||
#define FXECHO_MAX_WETDRYMIX 1.0f
|
||||
#define FXECHO_DEFAULT_WETDRYMIX 0.5f
|
||||
|
||||
#define FXECHO_MIN_FEEDBACK 0.0f
|
||||
#define FXECHO_MAX_FEEDBACK 1.0f
|
||||
#define FXECHO_DEFAULT_FEEDBACK 0.5f
|
||||
|
||||
#define FXECHO_MIN_DELAY 1.0f
|
||||
#define FXECHO_MAX_DELAY 2000.0f
|
||||
#define FXECHO_DEFAULT_DELAY 500.0f
|
||||
|
||||
|
||||
//--------------<D-A-T-A---T-Y-P-E-S>---------------------------------------//
|
||||
#pragma pack(push, 1) // set packing alignment to ensure consistency across arbitrary build environments
|
||||
|
||||
|
||||
// EQ parameters (4 bands), used with IXAPOParameters::SetParameters:
|
||||
// The EQ supports only FLOAT32 audio foramts.
|
||||
// The framerate must be within [22000, 48000] Hz.
|
||||
typedef struct FXEQ_PARAMETERS {
|
||||
float FrequencyCenter0; // center frequency in Hz, band 0
|
||||
float Gain0; // boost/cut
|
||||
float Bandwidth0; // bandwidth, region of EQ is center frequency +/- bandwidth/2
|
||||
float FrequencyCenter1; // band 1
|
||||
float Gain1;
|
||||
float Bandwidth1;
|
||||
float FrequencyCenter2; // band 2
|
||||
float Gain2;
|
||||
float Bandwidth2;
|
||||
float FrequencyCenter3; // band 3
|
||||
float Gain3;
|
||||
float Bandwidth3;
|
||||
} FXEQ_PARAMETERS;
|
||||
|
||||
|
||||
// Mastering limiter parameters, used with IXAPOParameters::SetParameters:
|
||||
// The mastering limiter supports only FLOAT32 audio formats.
|
||||
typedef struct FXMASTERINGLIMITER_PARAMETERS {
|
||||
UINT32 Release; // release time (tuning factor with no specific units)
|
||||
UINT32 Loudness; // loudness target (threshold)
|
||||
} FXMASTERINGLIMITER_PARAMETERS;
|
||||
|
||||
|
||||
// Reverb parameters, used with IXAPOParameters::SetParameters:
|
||||
// The reverb supports only FLOAT32 audio formats with the following
|
||||
// channel configurations:
|
||||
// Input: Mono Output: Mono
|
||||
// Input: Stereo Output: Stereo
|
||||
typedef struct FXREVERB_PARAMETERS {
|
||||
float Diffusion; // diffusion
|
||||
float RoomSize; // room size
|
||||
} FXREVERB_PARAMETERS;
|
||||
|
||||
|
||||
// Echo parameters, used with IXAPOParameters::SetParameters:
|
||||
// The echo supports only FLOAT32 audio formats.
|
||||
typedef struct FXECHO_PARAMETERS {
|
||||
float WetDryMix; // ratio of wet (processed) signal to dry (original) signal
|
||||
float Feedback; // amount of output fed back into input
|
||||
float Delay; // delay (all channels) in milliseconds
|
||||
} FXECHO_PARAMETERS;
|
||||
|
||||
|
||||
//--------------<M-A-C-R-O-S>-----------------------------------------------//
|
||||
// function storage-class attribute and calltype
|
||||
#if defined(_XBOX) || !defined(FXDLL)
|
||||
#define FX_API_(type) EXTERN_C type STDAPIVCALLTYPE
|
||||
#else
|
||||
#if defined(FXEXPORT)
|
||||
#define FX_API_(type) EXTERN_C __declspec(dllexport) type STDAPIVCALLTYPE
|
||||
#else
|
||||
#define FX_API_(type) EXTERN_C __declspec(dllimport) type STDAPIVCALLTYPE
|
||||
#endif
|
||||
#endif
|
||||
#define FX_IMP_(type) type STDMETHODVCALLTYPE
|
||||
|
||||
|
||||
//--------------<F-U-N-C-T-I-O-N-S>-----------------------------------------//
|
||||
// creates instance of requested XAPO, use Release to free instance
|
||||
FX_API_(HRESULT) CreateFX (REFCLSID clsid, __deref_out IUnknown** pEffect);
|
||||
|
||||
|
||||
#pragma pack(pop) // revert packing alignment
|
||||
#endif // !defined(GUID_DEFS_ONLY)
|
||||
//---------------------------------<-EOF->----------------------------------//
|
||||
527
common/dx11sdk/XDSP.h
Normal file
527
common/dx11sdk/XDSP.h
Normal file
@@ -0,0 +1,527 @@
|
||||
/*-========================================================================-_
|
||||
| - XDSP - |
|
||||
| Copyright (c) Microsoft Corporation. All rights reserved. |
|
||||
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|
||||
|PROJECT: XDSP MODEL: Unmanaged User-mode |
|
||||
|VERSION: 1.0 EXCEPT: No Exceptions |
|
||||
|CLASS: N / A MINREQ: WinXP, Xbox360 |
|
||||
|BASE: N / A DIALECT: MSC++ 14.00 |
|
||||
|>------------------------------------------------------------------------<|
|
||||
| DUTY: DSP functions with CPU extension specific optimizations |
|
||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|
||||
NOTES:
|
||||
1. Definition of terms:
|
||||
DSP: Digital Signal Processing.
|
||||
FFT: Fast Fourier Transform.
|
||||
|
||||
2. All buffer parameters must be 16-byte aligned.
|
||||
|
||||
3. All FFT functions support only FLOAT32 mono audio. */
|
||||
|
||||
#pragma once
|
||||
//--------------<D-E-F-I-N-I-T-I-O-N-S>-------------------------------------//
|
||||
#include <windef.h> // general windows types
|
||||
#include <math.h> // trigonometric functions
|
||||
#if defined(_XBOX) // SIMD intrinsics
|
||||
#include <ppcintrinsics.h>
|
||||
#else
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
|
||||
//--------------<M-A-C-R-O-S>-----------------------------------------------//
|
||||
// assertion
|
||||
#if !defined(DSPASSERT)
|
||||
#if DBG
|
||||
#define DSPASSERT(exp) if (!(exp)) { OutputDebugStringA("XDSP ASSERT: " #exp ", {" __FUNCTION__ "}\n"); __debugbreak(); }
|
||||
#else
|
||||
#define DSPASSERT(exp) __assume(exp)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// true if n is a power of 2
|
||||
#if !defined(ISPOWEROF2)
|
||||
#define ISPOWEROF2(n) ( ((n)&((n)-1)) == 0 && (n) != 0 )
|
||||
#endif
|
||||
|
||||
|
||||
//--------------<H-E-L-P-E-R-S>---------------------------------------------//
|
||||
namespace XDSP {
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4328 4640) // disable "indirection alignment of formal parameter", "construction of local static object is not thread-safe" compile warnings
|
||||
|
||||
|
||||
// Helper functions, used by the FFT functions.
|
||||
// The application need not call them directly.
|
||||
|
||||
// primitive types
|
||||
typedef __m128 XVECTOR;
|
||||
typedef XVECTOR& XVECTORREF;
|
||||
|
||||
|
||||
// Parallel multiplication of four complex numbers, assuming
|
||||
// real and imaginary values are stored in separate vectors.
|
||||
__forceinline void vmulComplex (__out XVECTORREF rResult, __out XVECTORREF iResult, __in XVECTORREF r1, __in XVECTORREF i1, __in XVECTORREF r2, __in XVECTORREF i2)
|
||||
{
|
||||
// (r1, i1) * (r2, i2) = (r1r2 - i1i2, r1i2 + r2i1)
|
||||
XVECTOR vi1i2 = _mm_mul_ps(i1, i2);
|
||||
XVECTOR vr1r2 = _mm_mul_ps(r1, r2);
|
||||
XVECTOR vr1i2 = _mm_mul_ps(r1, i2);
|
||||
XVECTOR vr2i1 = _mm_mul_ps(r2, i1);
|
||||
rResult = _mm_sub_ps(vr1r2, vi1i2); // real: (r1*r2 - i1*i2)
|
||||
iResult = _mm_add_ps(vr1i2, vr2i1); // imaginary: (r1*i2 + r2*i1)
|
||||
}
|
||||
__forceinline void vmulComplex (__inout XVECTORREF r1, __inout XVECTORREF i1, __in XVECTORREF r2, __in XVECTORREF i2)
|
||||
{
|
||||
// (r1, i1) * (r2, i2) = (r1r2 - i1i2, r1i2 + r2i1)
|
||||
XVECTOR vi1i2 = _mm_mul_ps(i1, i2);
|
||||
XVECTOR vr1r2 = _mm_mul_ps(r1, r2);
|
||||
XVECTOR vr1i2 = _mm_mul_ps(r1, i2);
|
||||
XVECTOR vr2i1 = _mm_mul_ps(r2, i1);
|
||||
r1 = _mm_sub_ps(vr1r2, vi1i2); // real: (r1*r2 - i1*i2)
|
||||
i1 = _mm_add_ps(vr1i2, vr2i1); // imaginary: (r1*i2 + r2*i1)
|
||||
}
|
||||
|
||||
|
||||
// Radix-4 decimation-in-time FFT butterfly.
|
||||
// This version assumes that all four elements of the butterfly are
|
||||
// adjacent in a single vector.
|
||||
//
|
||||
// Compute the product of the complex input vector and the
|
||||
// 4-element DFT matrix:
|
||||
// | 1 1 1 1 | | (r1X,i1X) |
|
||||
// | 1 -j -1 j | | (r1Y,i1Y) |
|
||||
// | 1 -1 1 -1 | | (r1Z,i1Z) |
|
||||
// | 1 j -1 -j | | (r1W,i1W) |
|
||||
//
|
||||
// This matrix can be decomposed into two simpler ones to reduce the
|
||||
// number of additions needed. The decomposed matrices look like this:
|
||||
// | 1 0 1 0 | | 1 0 1 0 |
|
||||
// | 0 1 0 -j | | 1 0 -1 0 |
|
||||
// | 1 0 -1 0 | | 0 1 0 1 |
|
||||
// | 0 1 0 j | | 0 1 0 -1 |
|
||||
//
|
||||
// Combine as follows:
|
||||
// | 1 0 1 0 | | (r1X,i1X) | | (r1X + r1Z, i1X + i1Z) |
|
||||
// Temp = | 1 0 -1 0 | * | (r1Y,i1Y) | = | (r1X - r1Z, i1X - i1Z) |
|
||||
// | 0 1 0 1 | | (r1Z,i1Z) | | (r1Y + r1W, i1Y + i1W) |
|
||||
// | 0 1 0 -1 | | (r1W,i1W) | | (r1Y - r1W, i1Y - i1W) |
|
||||
//
|
||||
// | 1 0 1 0 | | (rTempX,iTempX) | | (rTempX + rTempZ, iTempX + iTempZ) |
|
||||
// Result = | 0 1 0 -j | * | (rTempY,iTempY) | = | (rTempY + iTempW, iTempY - rTempW) |
|
||||
// | 1 0 -1 0 | | (rTempZ,iTempZ) | | (rTempX - rTempZ, iTempX - iTempZ) |
|
||||
// | 0 1 0 j | | (rTempW,iTempW) | | (rTempY - iTempW, iTempY + rTempW) |
|
||||
__forceinline void ButterflyDIT4_1 (__inout XVECTORREF r1, __inout XVECTORREF i1)
|
||||
{
|
||||
// sign constants for radix-4 butterflies
|
||||
const static XVECTOR vDFT4SignBits1 = { 0.0f, -0.0f, 0.0f, -0.0f };
|
||||
const static XVECTOR vDFT4SignBits2 = { 0.0f, 0.0f, -0.0f, -0.0f };
|
||||
const static XVECTOR vDFT4SignBits3 = { 0.0f, -0.0f, -0.0f, 0.0f };
|
||||
|
||||
|
||||
// calculating Temp
|
||||
XVECTOR rTemp = _mm_add_ps( _mm_shuffle_ps(r1, r1, _MM_SHUFFLE(1, 1, 0, 0)), // [r1X| r1X|r1Y| r1Y] +
|
||||
_mm_xor_ps(_mm_shuffle_ps(r1, r1, _MM_SHUFFLE(3, 3, 2, 2)), vDFT4SignBits1) ); // [r1Z|-r1Z|r1W|-r1W]
|
||||
XVECTOR iTemp = _mm_add_ps( _mm_shuffle_ps(i1, i1, _MM_SHUFFLE(1, 1, 0, 0)), // [i1X| i1X|i1Y| i1Y] +
|
||||
_mm_xor_ps(_mm_shuffle_ps(i1, i1, _MM_SHUFFLE(3, 3, 2, 2)), vDFT4SignBits1) ); // [i1Z|-i1Z|i1W|-i1W]
|
||||
|
||||
// calculating Result
|
||||
XVECTOR rZrWiZiW = _mm_shuffle_ps(rTemp, iTemp, _MM_SHUFFLE(3, 2, 3, 2)); // [rTempZ|rTempW|iTempZ|iTempW]
|
||||
XVECTOR rZiWrZiW = _mm_shuffle_ps(rZrWiZiW, rZrWiZiW, _MM_SHUFFLE(3, 0, 3, 0)); // [rTempZ|iTempW|rTempZ|iTempW]
|
||||
XVECTOR iZrWiZrW = _mm_shuffle_ps(rZrWiZiW, rZrWiZiW, _MM_SHUFFLE(1, 2, 1, 2)); // [rTempZ|iTempW|rTempZ|iTempW]
|
||||
r1 = _mm_add_ps( _mm_shuffle_ps(rTemp, rTemp, _MM_SHUFFLE(1, 0, 1, 0)), // [rTempX| rTempY| rTempX| rTempY] +
|
||||
_mm_xor_ps(rZiWrZiW, vDFT4SignBits2) ); // [rTempZ| iTempW|-rTempZ|-iTempW]
|
||||
i1 = _mm_add_ps( _mm_shuffle_ps(iTemp, iTemp, _MM_SHUFFLE(1, 0, 1, 0)), // [iTempX| iTempY| iTempX| iTempY] +
|
||||
_mm_xor_ps(iZrWiZrW, vDFT4SignBits3) ); // [iTempZ|-rTempW|-iTempZ| rTempW]
|
||||
}
|
||||
|
||||
// Radix-4 decimation-in-time FFT butterfly.
|
||||
// This version assumes that elements of the butterfly are
|
||||
// in different vectors, so that each vector in the input
|
||||
// contains elements from four different butterflies.
|
||||
// The four separate butterflies are processed in parallel.
|
||||
//
|
||||
// The calculations here are the same as the ones in the single-vector
|
||||
// radix-4 DFT, but instead of being done on a single vector (X,Y,Z,W)
|
||||
// they are done in parallel on sixteen independent complex values.
|
||||
// There is no interdependence between the vector elements:
|
||||
// | 1 0 1 0 | | (rIn0,iIn0) | | (rIn0 + rIn2, iIn0 + iIn2) |
|
||||
// | 1 0 -1 0 | * | (rIn1,iIn1) | = Temp = | (rIn0 - rIn2, iIn0 - iIn2) |
|
||||
// | 0 1 0 1 | | (rIn2,iIn2) | | (rIn1 + rIn3, iIn1 + iIn3) |
|
||||
// | 0 1 0 -1 | | (rIn3,iIn3) | | (rIn1 - rIn3, iIn1 - iIn3) |
|
||||
//
|
||||
// | 1 0 1 0 | | (rTemp0,iTemp0) | | (rTemp0 + rTemp2, iTemp0 + iTemp2) |
|
||||
// Result = | 0 1 0 -j | * | (rTemp1,iTemp1) | = | (rTemp1 + iTemp3, iTemp1 - rTemp3) |
|
||||
// | 1 0 -1 0 | | (rTemp2,iTemp2) | | (rTemp0 - rTemp2, iTemp0 - iTemp2) |
|
||||
// | 0 1 0 j | | (rTemp3,iTemp3) | | (rTemp1 - iTemp3, iTemp1 + rTemp3) |
|
||||
__forceinline void ButterflyDIT4_4 (__inout XVECTORREF r0,
|
||||
__inout XVECTORREF r1,
|
||||
__inout XVECTORREF r2,
|
||||
__inout XVECTORREF r3,
|
||||
__inout XVECTORREF i0,
|
||||
__inout XVECTORREF i1,
|
||||
__inout XVECTORREF i2,
|
||||
__inout XVECTORREF i3,
|
||||
__in_ecount(uStride*4) XVECTOR* __restrict pUnityTableReal,
|
||||
__in_ecount(uStride*4) XVECTOR* __restrict pUnityTableImaginary,
|
||||
const UINT32 uStride, const BOOL fLast)
|
||||
{
|
||||
DSPASSERT(pUnityTableReal != NULL);
|
||||
DSPASSERT(pUnityTableImaginary != NULL);
|
||||
DSPASSERT((UINT_PTR)pUnityTableReal % 16 == 0);
|
||||
DSPASSERT((UINT_PTR)pUnityTableImaginary % 16 == 0);
|
||||
DSPASSERT(ISPOWEROF2(uStride));
|
||||
|
||||
XVECTOR rTemp0, rTemp1, rTemp2, rTemp3, rTemp4, rTemp5, rTemp6, rTemp7;
|
||||
XVECTOR iTemp0, iTemp1, iTemp2, iTemp3, iTemp4, iTemp5, iTemp6, iTemp7;
|
||||
|
||||
|
||||
// calculating Temp
|
||||
rTemp0 = _mm_add_ps(r0, r2); iTemp0 = _mm_add_ps(i0, i2);
|
||||
rTemp2 = _mm_add_ps(r1, r3); iTemp2 = _mm_add_ps(i1, i3);
|
||||
rTemp1 = _mm_sub_ps(r0, r2); iTemp1 = _mm_sub_ps(i0, i2);
|
||||
rTemp3 = _mm_sub_ps(r1, r3); iTemp3 = _mm_sub_ps(i1, i3);
|
||||
rTemp4 = _mm_add_ps(rTemp0, rTemp2); iTemp4 = _mm_add_ps(iTemp0, iTemp2);
|
||||
rTemp5 = _mm_add_ps(rTemp1, iTemp3); iTemp5 = _mm_sub_ps(iTemp1, rTemp3);
|
||||
rTemp6 = _mm_sub_ps(rTemp0, rTemp2); iTemp6 = _mm_sub_ps(iTemp0, iTemp2);
|
||||
rTemp7 = _mm_sub_ps(rTemp1, iTemp3); iTemp7 = _mm_add_ps(iTemp1, rTemp3);
|
||||
|
||||
// calculating Result
|
||||
// vmulComplex(rTemp0, iTemp0, rTemp0, iTemp0, pUnityTableReal[0], pUnityTableImaginary[0]); // first one is always trivial
|
||||
vmulComplex(rTemp5, iTemp5, pUnityTableReal[uStride], pUnityTableImaginary[uStride]);
|
||||
vmulComplex(rTemp6, iTemp6, pUnityTableReal[uStride*2], pUnityTableImaginary[uStride*2]);
|
||||
vmulComplex(rTemp7, iTemp7, pUnityTableReal[uStride*3], pUnityTableImaginary[uStride*3]);
|
||||
if (fLast) {
|
||||
ButterflyDIT4_1(rTemp4, iTemp4);
|
||||
ButterflyDIT4_1(rTemp5, iTemp5);
|
||||
ButterflyDIT4_1(rTemp6, iTemp6);
|
||||
ButterflyDIT4_1(rTemp7, iTemp7);
|
||||
}
|
||||
|
||||
|
||||
r0 = rTemp4; i0 = iTemp4;
|
||||
r1 = rTemp5; i1 = iTemp5;
|
||||
r2 = rTemp6; i2 = iTemp6;
|
||||
r3 = rTemp7; i3 = iTemp7;
|
||||
}
|
||||
|
||||
//--------------<F-U-N-C-T-I-O-N-S>-----------------------------------------//
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// 4-sample FFT.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pReal - [inout] real components, must have at least uCount elements
|
||||
// pImaginary - [inout] imaginary components, must have at least uCount elements
|
||||
// uCount - [in] number of FFT iterations
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
__forceinline void FFT4 (__inout_ecount(uCount) XVECTOR* __restrict pReal, __inout_ecount(uCount) XVECTOR* __restrict pImaginary, const UINT32 uCount=1)
|
||||
{
|
||||
DSPASSERT(pReal != NULL);
|
||||
DSPASSERT(pImaginary != NULL);
|
||||
DSPASSERT((UINT_PTR)pReal % 16 == 0);
|
||||
DSPASSERT((UINT_PTR)pImaginary % 16 == 0);
|
||||
DSPASSERT(ISPOWEROF2(uCount));
|
||||
|
||||
for (UINT32 uIndex=0; uIndex<uCount; ++uIndex) {
|
||||
ButterflyDIT4_1(pReal[uIndex], pImaginary[uIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// 8-sample FFT.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pReal - [inout] real components, must have at least uCount*2 elements
|
||||
// pImaginary - [inout] imaginary components, must have at least uCount*2 elements
|
||||
// uCount - [in] number of FFT iterations
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
__forceinline void FFT8 (__inout_ecount(uCount*2) XVECTOR* __restrict pReal, __inout_ecount(uCount*2) XVECTOR* __restrict pImaginary, const UINT32 uCount=1)
|
||||
{
|
||||
DSPASSERT(pReal != NULL);
|
||||
DSPASSERT(pImaginary != NULL);
|
||||
DSPASSERT((UINT_PTR)pReal % 16 == 0);
|
||||
DSPASSERT((UINT_PTR)pImaginary % 16 == 0);
|
||||
DSPASSERT(ISPOWEROF2(uCount));
|
||||
|
||||
static XVECTOR wr1 = { 1.0f, 0.707168f, 0.0f, -0.707168f };
|
||||
static XVECTOR wi1 = { 0.0f, -0.707168f, -1.0f, -0.707168f };
|
||||
static XVECTOR wr2 = { -1.0f, -0.707168f, 0.0f, 0.707168f };
|
||||
static XVECTOR wi2 = { 0.0f, 0.707168f, 1.0f, 0.707168f };
|
||||
|
||||
|
||||
for (UINT32 uIndex=0; uIndex<uCount; ++uIndex) {
|
||||
XVECTOR* __restrict pR = pReal + uIndex*2;
|
||||
XVECTOR* __restrict pI = pImaginary + uIndex*2;
|
||||
|
||||
XVECTOR oddsR = _mm_shuffle_ps(pR[0], pR[1], _MM_SHUFFLE(3, 1, 3, 1));
|
||||
XVECTOR evensR = _mm_shuffle_ps(pR[0], pR[1], _MM_SHUFFLE(2, 0, 2, 0));
|
||||
XVECTOR oddsI = _mm_shuffle_ps(pI[0], pI[1], _MM_SHUFFLE(3, 1, 3, 1));
|
||||
XVECTOR evensI = _mm_shuffle_ps(pI[0], pI[1], _MM_SHUFFLE(2, 0, 2, 0));
|
||||
ButterflyDIT4_1(oddsR, oddsI);
|
||||
ButterflyDIT4_1(evensR, evensI);
|
||||
|
||||
XVECTOR r, i;
|
||||
vmulComplex(r, i, oddsR, oddsI, wr1, wi1);
|
||||
pR[0] = _mm_add_ps(evensR, r);
|
||||
pI[0] = _mm_add_ps(evensI, i);
|
||||
|
||||
vmulComplex(r, i, oddsR, oddsI, wr2, wi2);
|
||||
pR[1] = _mm_add_ps(evensR, r);
|
||||
pI[1] = _mm_add_ps(evensI, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// 16-sample FFT.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pReal - [inout] real components, must have at least uCount*4 elements
|
||||
// pImaginary - [inout] imaginary components, must have at least uCount*4 elements
|
||||
// uCount - [in] number of FFT iterations
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
__forceinline void FFT16 (__inout_ecount(uCount*4) XVECTOR* __restrict pReal, __inout_ecount(uCount*4) XVECTOR* __restrict pImaginary, const UINT32 uCount=1)
|
||||
{
|
||||
DSPASSERT(pReal != NULL);
|
||||
DSPASSERT(pImaginary != NULL);
|
||||
DSPASSERT((UINT_PTR)pReal % 16 == 0);
|
||||
DSPASSERT((UINT_PTR)pImaginary % 16 == 0);
|
||||
DSPASSERT(ISPOWEROF2(uCount));
|
||||
|
||||
XVECTOR aUnityTableReal[4] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.92387950f, 0.70710677f, 0.38268343f, 1.0f, 0.70710677f, -4.3711388e-008f, -0.70710677f, 1.0f, 0.38268343f, -0.70710677f, -0.92387950f };
|
||||
XVECTOR aUnityTableImaginary[4] = { -0.0f, -0.0f, -0.0f, -0.0f, -0.0f, -0.38268343f, -0.70710677f, -0.92387950f, -0.0f, -0.70710677f, -1.0f, -0.70710677f, -0.0f, -0.92387950f, -0.70710677f, 0.38268343f };
|
||||
|
||||
|
||||
for (UINT32 uIndex=0; uIndex<uCount; ++uIndex) {
|
||||
ButterflyDIT4_4(pReal[uIndex*4],
|
||||
pReal[uIndex*4 + 1],
|
||||
pReal[uIndex*4 + 2],
|
||||
pReal[uIndex*4 + 3],
|
||||
pImaginary[uIndex*4],
|
||||
pImaginary[uIndex*4 + 1],
|
||||
pImaginary[uIndex*4 + 2],
|
||||
pImaginary[uIndex*4 + 3],
|
||||
aUnityTableReal,
|
||||
aUnityTableImaginary,
|
||||
1, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// 2^N-sample FFT.
|
||||
//
|
||||
// REMARKS:
|
||||
// For FFTs length 16 and below, call FFT16(), FFT8(), or FFT4().
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pReal - [inout] real components, must have at least (uLength*uCount)/4 elements
|
||||
// pImaginary - [inout] imaginary components, must have at least (uLength*uCount)/4 elements
|
||||
// pUnityTable - [in] unity table, must have at least uLength*uCount elements, see FFTInitializeUnityTable()
|
||||
// uLength - [in] FFT length in samples, must be a power of 2 > 16
|
||||
// uCount - [in] number of FFT iterations
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
inline void FFT (__inout_ecount((uLength*uCount)/4) XVECTOR* __restrict pReal, __inout_ecount((uLength*uCount)/4) XVECTOR* __restrict pImaginary, __in_ecount(uLength*uCount) XVECTOR* __restrict pUnityTable, const UINT32 uLength, const UINT32 uCount=1)
|
||||
{
|
||||
DSPASSERT(pReal != NULL);
|
||||
DSPASSERT(pImaginary != NULL);
|
||||
DSPASSERT(pUnityTable != NULL);
|
||||
DSPASSERT((UINT_PTR)pReal % 16 == 0);
|
||||
DSPASSERT((UINT_PTR)pImaginary % 16 == 0);
|
||||
DSPASSERT((UINT_PTR)pUnityTable % 16 == 0);
|
||||
DSPASSERT(uLength > 16);
|
||||
DSPASSERT(ISPOWEROF2(uLength));
|
||||
DSPASSERT(ISPOWEROF2(uCount));
|
||||
|
||||
XVECTOR* __restrict pUnityTableReal = pUnityTable;
|
||||
XVECTOR* __restrict pUnityTableImaginary = pUnityTable + (uLength>>2);
|
||||
const UINT32 uTotal = uCount * uLength;
|
||||
const UINT32 uTotal_vectors = uTotal >> 2;
|
||||
const UINT32 uStage_vectors = uLength >> 2;
|
||||
const UINT32 uStride = uStage_vectors >> 2; // stride between butterfly elements
|
||||
const UINT32 uSkip = uStage_vectors - uStride;
|
||||
|
||||
|
||||
for (UINT32 uIndex=0; uIndex<(uTotal_vectors>>2); ++uIndex) {
|
||||
UINT32 n = (uIndex/uStride) * (uStride + uSkip) + (uIndex % uStride);
|
||||
ButterflyDIT4_4(pReal[n],
|
||||
pReal[n + uStride],
|
||||
pReal[n + uStride*2],
|
||||
pReal[n + uStride*3],
|
||||
pImaginary[n ],
|
||||
pImaginary[n + uStride],
|
||||
pImaginary[n + uStride*2],
|
||||
pImaginary[n + uStride*3],
|
||||
pUnityTableReal + n % uStage_vectors,
|
||||
pUnityTableImaginary + n % uStage_vectors,
|
||||
uStride, FALSE);
|
||||
}
|
||||
|
||||
|
||||
if (uLength > 16*4) {
|
||||
FFT(pReal, pImaginary, pUnityTable+(uLength>>1), uLength>>2, uCount*4);
|
||||
} else if (uLength == 16*4) {
|
||||
FFT16(pReal, pImaginary, uCount*4);
|
||||
} else if (uLength == 8*4) {
|
||||
FFT8(pReal, pImaginary, uCount*4);
|
||||
} else if (uLength == 4*4) {
|
||||
FFT4(pReal, pImaginary, uCount*4);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------//
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Initializes unity roots lookup table used by FFT functions.
|
||||
// Once initialized, the table need not be initialized again unless a
|
||||
// different FFT length is desired.
|
||||
//
|
||||
// REMARKS:
|
||||
// The unity tables of FFT length 16 and below are hard coded into the
|
||||
// respective FFT functions and so need not be initialized.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pUnityTable - [out] unity table, receives unity roots lookup table, must have at least uLength XVECTORs
|
||||
// uLength - [in] FFT length in samples, must be a power of 2 > 16
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
inline void FFTInitializeUnityTable (__out_bcount(uLength*sizeof(XVECTOR)) FLOAT32* __restrict pUnityTable, UINT32 uLength)
|
||||
{
|
||||
DSPASSERT(pUnityTable != NULL);
|
||||
DSPASSERT(uLength > 16);
|
||||
DSPASSERT(ISPOWEROF2(uLength));
|
||||
|
||||
// initialize unity table for recursive FFT lengths: uLength, uLength/4, uLength/16... > 16
|
||||
do {
|
||||
FLOAT32 flStep = 6.283185307f / uLength; // 2PI / FFT length
|
||||
uLength >>= 2;
|
||||
|
||||
// pUnityTable[0 to uLength*4-1] contains real components for current FFT length
|
||||
// pUnityTable[uLength*4 to uLength*8-1] contains imaginary components for current FFT length
|
||||
for (UINT32 i=0; i<4; ++i) {
|
||||
for (UINT32 j=0; j<uLength; ++j) {
|
||||
UINT32 uIndex = (i*uLength) + j;
|
||||
pUnityTable[uIndex] = cosf(FLOAT32(i)*FLOAT32(j)*flStep); // real component
|
||||
pUnityTable[uIndex + uLength*4] = -sinf(FLOAT32(i)*FLOAT32(j)*flStep); // imaginary component
|
||||
}
|
||||
}
|
||||
pUnityTable += uLength*8;
|
||||
} while (uLength > 16);
|
||||
}
|
||||
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// The FFT functions generate output in bit reversed order.
|
||||
// Use this function to re-arrange them into order of increasing frequency.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pOutput - [out] output buffer, receives samples in order of increasing frequency, must have at least (1<<uLog2Length) elements
|
||||
// pInput - [in] input buffer, samples in bit reversed order as generated by FFT functions, must have at least (1<<uLog2Length) elements
|
||||
// uLog2Length - [in] LOG (base 2) of FFT length in samples, must be > 0
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
inline void FFTUnswizzle (__out_ecount(1<<uLog2Length) FLOAT32* __restrict pOutput, __in_ecount(1<<uLog2Length) const FLOAT32* __restrict pInput, UINT32 uLog2Length)
|
||||
{
|
||||
DSPASSERT(pOutput != NULL);
|
||||
DSPASSERT(pInput != NULL);
|
||||
DSPASSERT(uLog2Length > 0);
|
||||
|
||||
UINT32 uLength = UINT32(1 << uLog2Length);
|
||||
|
||||
|
||||
if ((uLog2Length & 0x1) == 0) {
|
||||
// even powers of two
|
||||
for (UINT32 uIndex=0; uIndex<uLength; ++uIndex) {
|
||||
UINT32 n = uIndex;
|
||||
n = ( (n & 0xcccccccc) >> 2 ) | ( (n & 0x33333333) << 2 );
|
||||
n = ( (n & 0xf0f0f0f0) >> 4 ) | ( (n & 0x0f0f0f0f) << 4 );
|
||||
n = ( (n & 0xff00ff00) >> 8 ) | ( (n & 0x00ff00ff) << 8 );
|
||||
n = ( (n & 0xffff0000) >> 16 ) | ( (n & 0x0000ffff) << 16 );
|
||||
n >>= (32 - uLog2Length);
|
||||
pOutput[n] = pInput[uIndex];
|
||||
}
|
||||
} else {
|
||||
// odd powers of two
|
||||
for (UINT32 uIndex=0; uIndex<uLength; ++uIndex) {
|
||||
UINT32 n = (uIndex>>3);
|
||||
n = ( (n & 0xcccccccc) >> 2 ) | ( (n & 0x33333333) << 2 );
|
||||
n = ( (n & 0xf0f0f0f0) >> 4 ) | ( (n & 0x0f0f0f0f) << 4 );
|
||||
n = ( (n & 0xff00ff00) >> 8 ) | ( (n & 0x00ff00ff) << 8 );
|
||||
n = ( (n & 0xffff0000) >> 16 ) | ( (n & 0x0000ffff) << 16 );
|
||||
n >>= (32 - (uLog2Length-3));
|
||||
n |= ((uIndex & 0x7) << (uLog2Length - 3));
|
||||
pOutput[n] = pInput[uIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////
|
||||
// DESCRIPTION:
|
||||
// Convert complex components to polar form.
|
||||
//
|
||||
// PARAMETERS:
|
||||
// pOutput - [out] output buffer, receives samples in polar form, must have at least uLength/4 elements
|
||||
// pInputReal - [in] input buffer (real components), must have at least uLength/4 elements
|
||||
// pInputImaginary - [in] input buffer (imaginary components), must have at least uLength/4 elements
|
||||
// uLength - [in] FFT length in samples, must be a power of 2 >= 4
|
||||
//
|
||||
// RETURN VALUE:
|
||||
// void
|
||||
////
|
||||
inline void FFTPolar (__out_ecount(uLength/4) XVECTOR* __restrict pOutput, __in_ecount(uLength/4) const XVECTOR* __restrict pInputReal, __in_ecount(uLength/4) const XVECTOR* __restrict pInputImaginary, UINT32 uLength)
|
||||
{
|
||||
DSPASSERT(pOutput != NULL);
|
||||
DSPASSERT(pInputReal != NULL);
|
||||
DSPASSERT(pInputImaginary != NULL);
|
||||
DSPASSERT(uLength >= 4);
|
||||
DSPASSERT(ISPOWEROF2(uLength));
|
||||
|
||||
FLOAT32 flOneOverLength = 1.0f / uLength;
|
||||
|
||||
|
||||
// result = sqrtf((real/uLength)^2 + (imaginary/uLength)^2) * 2
|
||||
XVECTOR vOneOverLength = _mm_set_ps1(flOneOverLength);
|
||||
|
||||
for (UINT32 uIndex=0; uIndex<(uLength>>2); ++uIndex) {
|
||||
XVECTOR vReal = _mm_mul_ps(pInputReal[uIndex], vOneOverLength);
|
||||
XVECTOR vImaginary = _mm_mul_ps(pInputImaginary[uIndex], vOneOverLength);
|
||||
XVECTOR vRR = _mm_mul_ps(vReal, vReal);
|
||||
XVECTOR vII = _mm_mul_ps(vImaginary, vImaginary);
|
||||
XVECTOR vRRplusII = _mm_add_ps(vRR, vII);
|
||||
XVECTOR vTotal = _mm_sqrt_ps(vRRplusII);
|
||||
pOutput[uIndex] = _mm_add_ps(vTotal, vTotal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma warning(pop)
|
||||
}; // namespace XDSP
|
||||
//---------------------------------<-EOF->----------------------------------//
|
||||
|
||||
258
common/dx11sdk/XInput.h
Normal file
258
common/dx11sdk/XInput.h
Normal file
@@ -0,0 +1,258 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* XInput.h -- This module defines XBOX controller APIs *
|
||||
* and constansts for the Windows platform. *
|
||||
* *
|
||||
* Copyright (c) Microsoft Corp. All rights reserved. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#ifndef _XINPUT_H_
|
||||
#define _XINPUT_H_
|
||||
|
||||
#include <windef.h>
|
||||
|
||||
// Current name of the DLL shipped in the same SDK as this header.
|
||||
// The name reflects the current version
|
||||
#define XINPUT_DLL_A "xinput1_3.dll"
|
||||
#define XINPUT_DLL_W L"xinput1_3.dll"
|
||||
#ifdef UNICODE
|
||||
#define XINPUT_DLL XINPUT_DLL_W
|
||||
#else
|
||||
#define XINPUT_DLL XINPUT_DLL_A
|
||||
#endif
|
||||
|
||||
//
|
||||
// Device types available in XINPUT_CAPABILITIES
|
||||
//
|
||||
#define XINPUT_DEVTYPE_GAMEPAD 0x01
|
||||
|
||||
//
|
||||
// Device subtypes available in XINPUT_CAPABILITIES
|
||||
//
|
||||
#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
|
||||
#define XINPUT_DEVSUBTYPE_WHEEL 0x02
|
||||
#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
|
||||
#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
|
||||
#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
|
||||
#define XINPUT_DEVSUBTYPE_GUITAR 0x06
|
||||
#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
|
||||
|
||||
//
|
||||
// Flags for XINPUT_CAPABILITIES
|
||||
//
|
||||
#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
|
||||
|
||||
//
|
||||
// Constants for gamepad buttons
|
||||
//
|
||||
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||
#define XINPUT_GAMEPAD_START 0x0010
|
||||
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||
#define XINPUT_GAMEPAD_A 0x1000
|
||||
#define XINPUT_GAMEPAD_B 0x2000
|
||||
#define XINPUT_GAMEPAD_X 0x4000
|
||||
#define XINPUT_GAMEPAD_Y 0x8000
|
||||
|
||||
|
||||
//
|
||||
// Gamepad thresholds
|
||||
//
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
|
||||
#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
|
||||
|
||||
//
|
||||
// Flags to pass to XInputGetCapabilities
|
||||
//
|
||||
#define XINPUT_FLAG_GAMEPAD 0x00000001
|
||||
|
||||
//
|
||||
// Devices that support batteries
|
||||
//
|
||||
#define BATTERY_DEVTYPE_GAMEPAD 0x00
|
||||
#define BATTERY_DEVTYPE_HEADSET 0x01
|
||||
|
||||
//
|
||||
// Flags for battery status level
|
||||
//
|
||||
#define BATTERY_TYPE_DISCONNECTED 0x00 // This device is not connected
|
||||
#define BATTERY_TYPE_WIRED 0x01 // Wired device, no battery
|
||||
#define BATTERY_TYPE_ALKALINE 0x02 // Alkaline battery source
|
||||
#define BATTERY_TYPE_NIMH 0x03 // Nickel Metal Hydride battery source
|
||||
#define BATTERY_TYPE_UNKNOWN 0xFF // Cannot determine the battery type
|
||||
|
||||
// These are only valid for wireless, connected devices, with known battery types
|
||||
// The amount of use time remaining depends on the type of device.
|
||||
#define BATTERY_LEVEL_EMPTY 0x00
|
||||
#define BATTERY_LEVEL_LOW 0x01
|
||||
#define BATTERY_LEVEL_MEDIUM 0x02
|
||||
#define BATTERY_LEVEL_FULL 0x03
|
||||
|
||||
// User index definitions
|
||||
#define XUSER_MAX_COUNT 4
|
||||
|
||||
#define XUSER_INDEX_ANY 0x000000FF
|
||||
|
||||
|
||||
//
|
||||
// Codes returned for the gamepad keystroke
|
||||
//
|
||||
|
||||
#define VK_PAD_A 0x5800
|
||||
#define VK_PAD_B 0x5801
|
||||
#define VK_PAD_X 0x5802
|
||||
#define VK_PAD_Y 0x5803
|
||||
#define VK_PAD_RSHOULDER 0x5804
|
||||
#define VK_PAD_LSHOULDER 0x5805
|
||||
#define VK_PAD_LTRIGGER 0x5806
|
||||
#define VK_PAD_RTRIGGER 0x5807
|
||||
|
||||
#define VK_PAD_DPAD_UP 0x5810
|
||||
#define VK_PAD_DPAD_DOWN 0x5811
|
||||
#define VK_PAD_DPAD_LEFT 0x5812
|
||||
#define VK_PAD_DPAD_RIGHT 0x5813
|
||||
#define VK_PAD_START 0x5814
|
||||
#define VK_PAD_BACK 0x5815
|
||||
#define VK_PAD_LTHUMB_PRESS 0x5816
|
||||
#define VK_PAD_RTHUMB_PRESS 0x5817
|
||||
|
||||
#define VK_PAD_LTHUMB_UP 0x5820
|
||||
#define VK_PAD_LTHUMB_DOWN 0x5821
|
||||
#define VK_PAD_LTHUMB_RIGHT 0x5822
|
||||
#define VK_PAD_LTHUMB_LEFT 0x5823
|
||||
#define VK_PAD_LTHUMB_UPLEFT 0x5824
|
||||
#define VK_PAD_LTHUMB_UPRIGHT 0x5825
|
||||
#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
|
||||
#define VK_PAD_LTHUMB_DOWNLEFT 0x5827
|
||||
|
||||
#define VK_PAD_RTHUMB_UP 0x5830
|
||||
#define VK_PAD_RTHUMB_DOWN 0x5831
|
||||
#define VK_PAD_RTHUMB_RIGHT 0x5832
|
||||
#define VK_PAD_RTHUMB_LEFT 0x5833
|
||||
#define VK_PAD_RTHUMB_UPLEFT 0x5834
|
||||
#define VK_PAD_RTHUMB_UPRIGHT 0x5835
|
||||
#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
|
||||
#define VK_PAD_RTHUMB_DOWNLEFT 0x5837
|
||||
|
||||
//
|
||||
// Flags used in XINPUT_KEYSTROKE
|
||||
//
|
||||
#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
|
||||
#define XINPUT_KEYSTROKE_KEYUP 0x0002
|
||||
#define XINPUT_KEYSTROKE_REPEAT 0x0004
|
||||
|
||||
//
|
||||
// Structures used by XInput APIs
|
||||
//
|
||||
typedef struct _XINPUT_GAMEPAD
|
||||
{
|
||||
WORD wButtons;
|
||||
BYTE bLeftTrigger;
|
||||
BYTE bRightTrigger;
|
||||
SHORT sThumbLX;
|
||||
SHORT sThumbLY;
|
||||
SHORT sThumbRX;
|
||||
SHORT sThumbRY;
|
||||
} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
|
||||
|
||||
typedef struct _XINPUT_STATE
|
||||
{
|
||||
DWORD dwPacketNumber;
|
||||
XINPUT_GAMEPAD Gamepad;
|
||||
} XINPUT_STATE, *PXINPUT_STATE;
|
||||
|
||||
typedef struct _XINPUT_VIBRATION
|
||||
{
|
||||
WORD wLeftMotorSpeed;
|
||||
WORD wRightMotorSpeed;
|
||||
} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
|
||||
|
||||
typedef struct _XINPUT_CAPABILITIES
|
||||
{
|
||||
BYTE Type;
|
||||
BYTE SubType;
|
||||
WORD Flags;
|
||||
XINPUT_GAMEPAD Gamepad;
|
||||
XINPUT_VIBRATION Vibration;
|
||||
} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
|
||||
|
||||
typedef struct _XINPUT_BATTERY_INFORMATION
|
||||
{
|
||||
BYTE BatteryType;
|
||||
BYTE BatteryLevel;
|
||||
} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;
|
||||
|
||||
typedef struct _XINPUT_KEYSTROKE
|
||||
{
|
||||
WORD VirtualKey;
|
||||
WCHAR Unicode;
|
||||
WORD Flags;
|
||||
BYTE UserIndex;
|
||||
BYTE HidCode;
|
||||
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
|
||||
|
||||
//
|
||||
// XInput APIs
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DWORD WINAPI XInputGetState
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
XINPUT_STATE* pState // [out] Receives the current state
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputSetState
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
XINPUT_VIBRATION* pVibration // [in, out] The vibration information to send to the controller
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputGetCapabilities
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
DWORD dwFlags, // [in] Input flags that identify the device type
|
||||
XINPUT_CAPABILITIES* pCapabilities // [out] Receives the capabilities
|
||||
);
|
||||
|
||||
void WINAPI XInputEnable
|
||||
(
|
||||
BOOL enable // [in] Indicates whether xinput is enabled or disabled.
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputGetDSoundAudioDeviceGuids
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
GUID* pDSoundRenderGuid, // [out] DSound device ID for render
|
||||
GUID* pDSoundCaptureGuid // [out] DSound device ID for capture
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputGetBatteryInformation
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
BYTE devType, // [in] Which device on this user index
|
||||
XINPUT_BATTERY_INFORMATION* pBatteryInformation // [out] Contains the level and types of batteries
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputGetKeystroke
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
DWORD dwReserved, // [in] Reserved for future use
|
||||
PXINPUT_KEYSTROKE pKeystroke // [out] Pointer to an XINPUT_KEYSTROKE structure that receives an input event.
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_XINPUT_H_
|
||||
|
||||
263
common/dx11sdk/audiodefs.h
Normal file
263
common/dx11sdk/audiodefs.h
Normal file
@@ -0,0 +1,263 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
* File: audiodefs.h
|
||||
* Content: Basic constants and data types for audio work.
|
||||
*
|
||||
* Remarks: This header file defines all of the audio format constants and
|
||||
* structures required for XAudio2 and XACT work. Providing these
|
||||
* in a single location avoids certain dependency problems in the
|
||||
* legacy audio headers (mmreg.h, mmsystem.h, ksmedia.h).
|
||||
*
|
||||
* NOTE: Including the legacy headers after this one may cause a
|
||||
* compilation error, because they define some of the same types
|
||||
* defined here without preprocessor guards to avoid multiple
|
||||
* definitions. If a source file needs one of the old headers,
|
||||
* it must include it before including audiodefs.h.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __AUDIODEFS_INCLUDED__
|
||||
#define __AUDIODEFS_INCLUDED__
|
||||
|
||||
#include <windef.h> // For WORD, DWORD, etc.
|
||||
|
||||
#pragma pack(push, 1) // Pack structures to 1-byte boundaries
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* WAVEFORMATEX: Base structure for many audio formats. Format-specific
|
||||
* extensions can be defined for particular formats by using a non-zero
|
||||
* cbSize value and adding extra fields to the end of this structure.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _WAVEFORMATEX_
|
||||
|
||||
#define _WAVEFORMATEX_
|
||||
typedef struct tWAVEFORMATEX
|
||||
{
|
||||
WORD wFormatTag; // Integer identifier of the format
|
||||
WORD nChannels; // Number of audio channels
|
||||
DWORD nSamplesPerSec; // Audio sample rate
|
||||
DWORD nAvgBytesPerSec; // Bytes per second (possibly approximate)
|
||||
WORD nBlockAlign; // Size in bytes of a sample block (all channels)
|
||||
WORD wBitsPerSample; // Size in bits of a single per-channel sample
|
||||
WORD cbSize; // Bytes of extra data appended to this struct
|
||||
} WAVEFORMATEX;
|
||||
|
||||
#endif
|
||||
|
||||
// Defining pointer types outside of the #if block to make sure they are
|
||||
// defined even if mmreg.h or mmsystem.h is #included before this file
|
||||
|
||||
typedef WAVEFORMATEX *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
|
||||
typedef const WAVEFORMATEX *PCWAVEFORMATEX, *LPCWAVEFORMATEX;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* WAVEFORMATEXTENSIBLE: Extended version of WAVEFORMATEX that should be
|
||||
* used as a basis for all new audio formats. The format tag is replaced
|
||||
* with a GUID, allowing new formats to be defined without registering a
|
||||
* format tag with Microsoft. There are also new fields that can be used
|
||||
* to specify the spatial positions for each channel and the bit packing
|
||||
* used for wide samples (e.g. 24-bit PCM samples in 32-bit containers).
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _WAVEFORMATEXTENSIBLE_
|
||||
|
||||
#define _WAVEFORMATEXTENSIBLE_
|
||||
typedef struct
|
||||
{
|
||||
WAVEFORMATEX Format; // Base WAVEFORMATEX data
|
||||
union
|
||||
{
|
||||
WORD wValidBitsPerSample; // Valid bits in each sample container
|
||||
WORD wSamplesPerBlock; // Samples per block of audio data; valid
|
||||
// if wBitsPerSample=0 (but rarely used).
|
||||
WORD wReserved; // Zero if neither case above applies.
|
||||
} Samples;
|
||||
DWORD dwChannelMask; // Positions of the audio channels
|
||||
GUID SubFormat; // Format identifier GUID
|
||||
} WAVEFORMATEXTENSIBLE;
|
||||
|
||||
#endif
|
||||
|
||||
typedef WAVEFORMATEXTENSIBLE *PWAVEFORMATEXTENSIBLE, *LPWAVEFORMATEXTENSIBLE;
|
||||
typedef const WAVEFORMATEXTENSIBLE *PCWAVEFORMATEXTENSIBLE, *LPCWAVEFORMATEXTENSIBLE;
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Define the most common wave format tags used in WAVEFORMATEX formats.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef WAVE_FORMAT_PCM // Pulse Code Modulation
|
||||
|
||||
// If WAVE_FORMAT_PCM is not defined, we need to define some legacy types
|
||||
// for compatibility with the Windows mmreg.h / mmsystem.h header files.
|
||||
|
||||
// Old general format structure (information common to all formats)
|
||||
typedef struct waveformat_tag
|
||||
{
|
||||
WORD wFormatTag;
|
||||
WORD nChannels;
|
||||
DWORD nSamplesPerSec;
|
||||
DWORD nAvgBytesPerSec;
|
||||
WORD nBlockAlign;
|
||||
} WAVEFORMAT, *PWAVEFORMAT, NEAR *NPWAVEFORMAT, FAR *LPWAVEFORMAT;
|
||||
|
||||
// Specific format structure for PCM data
|
||||
typedef struct pcmwaveformat_tag
|
||||
{
|
||||
WAVEFORMAT wf;
|
||||
WORD wBitsPerSample;
|
||||
} PCMWAVEFORMAT, *PPCMWAVEFORMAT, NEAR *NPPCMWAVEFORMAT, FAR *LPPCMWAVEFORMAT;
|
||||
|
||||
#define WAVE_FORMAT_PCM 0x0001
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_ADPCM // Microsoft Adaptive Differental PCM
|
||||
|
||||
// Replicate the Microsoft ADPCM type definitions from mmreg.h.
|
||||
|
||||
typedef struct adpcmcoef_tag
|
||||
{
|
||||
short iCoef1;
|
||||
short iCoef2;
|
||||
} ADPCMCOEFSET;
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4200) // Disable zero-sized array warnings
|
||||
|
||||
typedef struct adpcmwaveformat_tag {
|
||||
WAVEFORMATEX wfx;
|
||||
WORD wSamplesPerBlock;
|
||||
WORD wNumCoef;
|
||||
ADPCMCOEFSET aCoef[]; // Always 7 coefficient pairs for MS ADPCM
|
||||
} ADPCMWAVEFORMAT;
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
#define WAVE_FORMAT_ADPCM 0x0002
|
||||
|
||||
#endif
|
||||
|
||||
// Other frequently used format tags
|
||||
|
||||
#ifndef WAVE_FORMAT_UNKNOWN
|
||||
#define WAVE_FORMAT_UNKNOWN 0x0000 // Unknown or invalid format tag
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_IEEE_FLOAT
|
||||
#define WAVE_FORMAT_IEEE_FLOAT 0x0003 // 32-bit floating-point
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_MPEGLAYER3
|
||||
#define WAVE_FORMAT_MPEGLAYER3 0x0055 // ISO/MPEG Layer3
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF
|
||||
#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 // Dolby Audio Codec 3 over S/PDIF
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_WMAUDIO2
|
||||
#define WAVE_FORMAT_WMAUDIO2 0x0161 // Windows Media Audio
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_WMAUDIO3
|
||||
#define WAVE_FORMAT_WMAUDIO3 0x0162 // Windows Media Audio Pro
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_WMASPDIF
|
||||
#define WAVE_FORMAT_WMASPDIF 0x0164 // Windows Media Audio over S/PDIF
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_EXTENSIBLE
|
||||
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE // All WAVEFORMATEXTENSIBLE formats
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Define the most common wave format GUIDs used in WAVEFORMATEXTENSIBLE
|
||||
* formats. Note that including the Windows ksmedia.h header after this
|
||||
* one will cause build problems; this cannot be avoided, since ksmedia.h
|
||||
* defines these macros without preprocessor guards.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef __cplusplus // uuid() and __uuidof() are only available in C++
|
||||
|
||||
#ifndef KSDATAFORMAT_SUBTYPE_PCM
|
||||
struct __declspec(uuid("00000001-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_PCM_STRUCT;
|
||||
#define KSDATAFORMAT_SUBTYPE_PCM __uuidof(KSDATAFORMAT_SUBTYPE_PCM_STRUCT)
|
||||
#endif
|
||||
|
||||
#ifndef KSDATAFORMAT_SUBTYPE_ADPCM
|
||||
struct __declspec(uuid("00000002-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT;
|
||||
#define KSDATAFORMAT_SUBTYPE_ADPCM __uuidof(KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT)
|
||||
#endif
|
||||
|
||||
#ifndef KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
|
||||
struct __declspec(uuid("00000003-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT;
|
||||
#define KSDATAFORMAT_SUBTYPE_IEEE_FLOAT __uuidof(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Speaker positions used in the WAVEFORMATEXTENSIBLE dwChannelMask field.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SPEAKER_FRONT_LEFT
|
||||
#define SPEAKER_FRONT_LEFT 0x00000001
|
||||
#define SPEAKER_FRONT_RIGHT 0x00000002
|
||||
#define SPEAKER_FRONT_CENTER 0x00000004
|
||||
#define SPEAKER_LOW_FREQUENCY 0x00000008
|
||||
#define SPEAKER_BACK_LEFT 0x00000010
|
||||
#define SPEAKER_BACK_RIGHT 0x00000020
|
||||
#define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040
|
||||
#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080
|
||||
#define SPEAKER_BACK_CENTER 0x00000100
|
||||
#define SPEAKER_SIDE_LEFT 0x00000200
|
||||
#define SPEAKER_SIDE_RIGHT 0x00000400
|
||||
#define SPEAKER_TOP_CENTER 0x00000800
|
||||
#define SPEAKER_TOP_FRONT_LEFT 0x00001000
|
||||
#define SPEAKER_TOP_FRONT_CENTER 0x00002000
|
||||
#define SPEAKER_TOP_FRONT_RIGHT 0x00004000
|
||||
#define SPEAKER_TOP_BACK_LEFT 0x00008000
|
||||
#define SPEAKER_TOP_BACK_CENTER 0x00010000
|
||||
#define SPEAKER_TOP_BACK_RIGHT 0x00020000
|
||||
#define SPEAKER_RESERVED 0x7FFC0000
|
||||
#define SPEAKER_ALL 0x80000000
|
||||
#define _SPEAKER_POSITIONS_
|
||||
#endif
|
||||
|
||||
#ifndef SPEAKER_STEREO
|
||||
#define SPEAKER_MONO (SPEAKER_FRONT_CENTER)
|
||||
#define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT)
|
||||
#define SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY)
|
||||
#define SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER)
|
||||
#define SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||
#define SPEAKER_4POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||
#define SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||
#define SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER)
|
||||
#define SPEAKER_5POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
|
||||
#define SPEAKER_7POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
|
||||
#endif
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif // #ifndef __AUDIODEFS_INCLUDED__
|
||||
59
common/dx11sdk/comdecl.h
Normal file
59
common/dx11sdk/comdecl.h
Normal file
@@ -0,0 +1,59 @@
|
||||
// comdecl.h: Macros to facilitate COM interface and GUID declarations.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
#ifndef _COMDECL_H_
|
||||
#define _COMDECL_H_
|
||||
|
||||
#ifndef _XBOX
|
||||
#include <basetyps.h> // For standard COM interface macros
|
||||
#else
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4061)
|
||||
#include <xtl.h> // Required by xobjbase.h
|
||||
#include <xobjbase.h> // Special definitions for Xbox build
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// The DEFINE_CLSID() and DEFINE_IID() macros defined below allow COM GUIDs to
|
||||
// be declared and defined in such a way that clients can obtain the GUIDs using
|
||||
// either the __uuidof() extension or the old-style CLSID_Foo / IID_IFoo names.
|
||||
// If using the latter approach, the client can also choose whether to get the
|
||||
// GUID definitions by defining the INITGUID preprocessor constant or by linking
|
||||
// to a GUID library. This works in either C or C++.
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x))
|
||||
#ifdef INITGUID
|
||||
|
||||
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \
|
||||
EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_##className = __uuidof(className)
|
||||
|
||||
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \
|
||||
EXTERN_C const GUID DECLSPEC_SELECTANY IID_##interfaceName = __uuidof(interfaceName)
|
||||
|
||||
#else // INITGUID
|
||||
|
||||
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \
|
||||
EXTERN_C const GUID CLSID_##className
|
||||
|
||||
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \
|
||||
EXTERN_C const GUID IID_##interfaceName
|
||||
|
||||
#endif // INITGUID
|
||||
|
||||
#else // __cplusplus
|
||||
|
||||
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
|
||||
|
||||
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // #ifndef _COMDECL_H_
|
||||
175
common/dx11sdk/d3d10misc.h
Normal file
175
common/dx11sdk/d3d10misc.h
Normal file
@@ -0,0 +1,175 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3D10Misc.h
|
||||
// Content: D3D10 Device Creation APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3D10MISC_H__
|
||||
#define __D3D10MISC_H__
|
||||
|
||||
#include "d3d10.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ID3D10Blob:
|
||||
// ------------
|
||||
// The buffer object is used by D3D10 to return arbitrary size data.
|
||||
//
|
||||
// GetBufferPointer -
|
||||
// Returns a pointer to the beginning of the buffer.
|
||||
//
|
||||
// GetBufferSize -
|
||||
// Returns the size of the buffer, in bytes.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3D10Blob ID3D10Blob;
|
||||
typedef interface ID3D10Blob *LPD3D10BLOB;
|
||||
|
||||
// {8BA5FB08-5195-40e2-AC58-0D989C3A0102}
|
||||
DEFINE_GUID(IID_ID3D10Blob,
|
||||
0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D10Blob
|
||||
|
||||
DECLARE_INTERFACE_(ID3D10Blob, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3D10Blob
|
||||
STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
|
||||
STDMETHOD_(SIZE_T, GetBufferSize)(THIS) PURE;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3D10_DRIVER_TYPE
|
||||
// ----------------
|
||||
//
|
||||
// This identifier is used to determine the implementation of Direct3D10
|
||||
// to be used.
|
||||
//
|
||||
// Pass one of these values to D3D10CreateDevice
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
typedef enum D3D10_DRIVER_TYPE
|
||||
{
|
||||
D3D10_DRIVER_TYPE_HARDWARE = 0,
|
||||
D3D10_DRIVER_TYPE_REFERENCE = 1,
|
||||
D3D10_DRIVER_TYPE_NULL = 2,
|
||||
D3D10_DRIVER_TYPE_SOFTWARE = 3,
|
||||
D3D10_DRIVER_TYPE_WARP = 5,
|
||||
} D3D10_DRIVER_TYPE;
|
||||
|
||||
DEFINE_GUID(GUID_DeviceType,
|
||||
0xd722fb4d, 0x7a68, 0x437a, 0xb2, 0x0c, 0x58, 0x04, 0xee, 0x24, 0x94, 0xa6);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3D10CreateDevice
|
||||
// ------------------
|
||||
//
|
||||
// pAdapter
|
||||
// If NULL, D3D10CreateDevice will choose the primary adapter and
|
||||
// create a new instance from a temporarily created IDXGIFactory.
|
||||
// If non-NULL, D3D10CreateDevice will register the appropriate
|
||||
// device, if necessary (via IDXGIAdapter::RegisterDrver), before
|
||||
// creating the device.
|
||||
// DriverType
|
||||
// Specifies the driver type to be created: hardware, reference or
|
||||
// null.
|
||||
// Software
|
||||
// HMODULE of a DLL implementing a software rasterizer. Must be NULL for
|
||||
// non-Software driver types.
|
||||
// Flags
|
||||
// Any of those documented for D3D10CreateDevice.
|
||||
// SDKVersion
|
||||
// SDK version. Use the D3D10_SDK_VERSION macro.
|
||||
// ppDevice
|
||||
// Pointer to returned interface.
|
||||
//
|
||||
// Return Values
|
||||
// Any of those documented for
|
||||
// CreateDXGIFactory
|
||||
// IDXGIFactory::EnumAdapters
|
||||
// IDXGIAdapter::RegisterDriver
|
||||
// D3D10CreateDevice
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
HRESULT WINAPI D3D10CreateDevice(
|
||||
IDXGIAdapter *pAdapter,
|
||||
D3D10_DRIVER_TYPE DriverType,
|
||||
HMODULE Software,
|
||||
UINT Flags,
|
||||
UINT SDKVersion,
|
||||
ID3D10Device **ppDevice);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3D10CreateDeviceAndSwapChain
|
||||
// ------------------------------
|
||||
//
|
||||
// ppAdapter
|
||||
// If NULL, D3D10CreateDevice will choose the primary adapter and
|
||||
// create a new instance from a temporarily created IDXGIFactory.
|
||||
// If non-NULL, D3D10CreateDevice will register the appropriate
|
||||
// device, if necessary (via IDXGIAdapter::RegisterDrver), before
|
||||
// creating the device.
|
||||
// DriverType
|
||||
// Specifies the driver type to be created: hardware, reference or
|
||||
// null.
|
||||
// Software
|
||||
// HMODULE of a DLL implementing a software rasterizer. Must be NULL for
|
||||
// non-Software driver types.
|
||||
// Flags
|
||||
// Any of those documented for D3D10CreateDevice.
|
||||
// SDKVersion
|
||||
// SDK version. Use the D3D10_SDK_VERSION macro.
|
||||
// pSwapChainDesc
|
||||
// Swap chain description, may be NULL.
|
||||
// ppSwapChain
|
||||
// Pointer to returned interface. May be NULL.
|
||||
// ppDevice
|
||||
// Pointer to returned interface.
|
||||
//
|
||||
// Return Values
|
||||
// Any of those documented for
|
||||
// CreateDXGIFactory
|
||||
// IDXGIFactory::EnumAdapters
|
||||
// IDXGIAdapter::RegisterDriver
|
||||
// D3D10CreateDevice
|
||||
// IDXGIFactory::CreateSwapChain
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
HRESULT WINAPI D3D10CreateDeviceAndSwapChain(
|
||||
IDXGIAdapter *pAdapter,
|
||||
D3D10_DRIVER_TYPE DriverType,
|
||||
HMODULE Software,
|
||||
UINT Flags,
|
||||
UINT SDKVersion,
|
||||
DXGI_SWAP_CHAIN_DESC *pSwapChainDesc,
|
||||
IDXGISwapChain **ppSwapChain,
|
||||
ID3D10Device **ppDevice);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3D10CreateBlob:
|
||||
// -----------------
|
||||
// Creates a Buffer of n Bytes
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
HRESULT WINAPI D3D10CreateBlob(SIZE_T NumBytes, LPD3D10BLOB *ppBuffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3D10EFFECT_H__
|
||||
|
||||
|
||||
1358
common/dx11sdk/d3d10sdklayers.h
Normal file
1358
common/dx11sdk/d3d10sdklayers.h
Normal file
File diff suppressed because it is too large
Load Diff
2582
common/dx11sdk/d3d9.h
Normal file
2582
common/dx11sdk/d3d9.h
Normal file
File diff suppressed because it is too large
Load Diff
512
common/dx11sdk/d3d9caps.h
Normal file
512
common/dx11sdk/d3d9caps.h
Normal file
@@ -0,0 +1,512 @@
|
||||
/*==========================================================================;
|
||||
*
|
||||
* Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
*
|
||||
* File: d3d9caps.h
|
||||
* Content: Direct3D capabilities include file
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _d3d9CAPS_H
|
||||
#define _d3d9CAPS_H
|
||||
|
||||
#ifndef DIRECT3D_VERSION
|
||||
#define DIRECT3D_VERSION 0x0900
|
||||
#endif //DIRECT3D_VERSION
|
||||
|
||||
// include this file content only if compiling for DX9 interfaces
|
||||
#if(DIRECT3D_VERSION >= 0x0900)
|
||||
|
||||
#if defined(_X86_) || defined(_IA64_)
|
||||
#pragma pack(4)
|
||||
#endif
|
||||
|
||||
typedef struct _D3DVSHADERCAPS2_0
|
||||
{
|
||||
DWORD Caps;
|
||||
INT DynamicFlowControlDepth;
|
||||
INT NumTemps;
|
||||
INT StaticFlowControlDepth;
|
||||
} D3DVSHADERCAPS2_0;
|
||||
|
||||
#define D3DVS20CAPS_PREDICATION (1<<0)
|
||||
|
||||
#define D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH 24
|
||||
#define D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH 0
|
||||
#define D3DVS20_MAX_NUMTEMPS 32
|
||||
#define D3DVS20_MIN_NUMTEMPS 12
|
||||
#define D3DVS20_MAX_STATICFLOWCONTROLDEPTH 4
|
||||
#define D3DVS20_MIN_STATICFLOWCONTROLDEPTH 1
|
||||
|
||||
typedef struct _D3DPSHADERCAPS2_0
|
||||
{
|
||||
DWORD Caps;
|
||||
INT DynamicFlowControlDepth;
|
||||
INT NumTemps;
|
||||
INT StaticFlowControlDepth;
|
||||
INT NumInstructionSlots;
|
||||
} D3DPSHADERCAPS2_0;
|
||||
|
||||
#define D3DPS20CAPS_ARBITRARYSWIZZLE (1<<0)
|
||||
#define D3DPS20CAPS_GRADIENTINSTRUCTIONS (1<<1)
|
||||
#define D3DPS20CAPS_PREDICATION (1<<2)
|
||||
#define D3DPS20CAPS_NODEPENDENTREADLIMIT (1<<3)
|
||||
#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT (1<<4)
|
||||
|
||||
#define D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH 24
|
||||
#define D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH 0
|
||||
#define D3DPS20_MAX_NUMTEMPS 32
|
||||
#define D3DPS20_MIN_NUMTEMPS 12
|
||||
#define D3DPS20_MAX_STATICFLOWCONTROLDEPTH 4
|
||||
#define D3DPS20_MIN_STATICFLOWCONTROLDEPTH 0
|
||||
#define D3DPS20_MAX_NUMINSTRUCTIONSLOTS 512
|
||||
#define D3DPS20_MIN_NUMINSTRUCTIONSLOTS 96
|
||||
|
||||
#define D3DMIN30SHADERINSTRUCTIONS 512
|
||||
#define D3DMAX30SHADERINSTRUCTIONS 32768
|
||||
|
||||
typedef struct _D3DCAPS9
|
||||
{
|
||||
/* Device Info */
|
||||
D3DDEVTYPE DeviceType;
|
||||
UINT AdapterOrdinal;
|
||||
|
||||
/* Caps from DX7 Draw */
|
||||
DWORD Caps;
|
||||
DWORD Caps2;
|
||||
DWORD Caps3;
|
||||
DWORD PresentationIntervals;
|
||||
|
||||
/* Cursor Caps */
|
||||
DWORD CursorCaps;
|
||||
|
||||
/* 3D Device Caps */
|
||||
DWORD DevCaps;
|
||||
|
||||
DWORD PrimitiveMiscCaps;
|
||||
DWORD RasterCaps;
|
||||
DWORD ZCmpCaps;
|
||||
DWORD SrcBlendCaps;
|
||||
DWORD DestBlendCaps;
|
||||
DWORD AlphaCmpCaps;
|
||||
DWORD ShadeCaps;
|
||||
DWORD TextureCaps;
|
||||
DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's
|
||||
DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture9's
|
||||
DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture9's
|
||||
DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture9's
|
||||
DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture9's
|
||||
|
||||
DWORD LineCaps; // D3DLINECAPS
|
||||
|
||||
DWORD MaxTextureWidth, MaxTextureHeight;
|
||||
DWORD MaxVolumeExtent;
|
||||
|
||||
DWORD MaxTextureRepeat;
|
||||
DWORD MaxTextureAspectRatio;
|
||||
DWORD MaxAnisotropy;
|
||||
float MaxVertexW;
|
||||
|
||||
float GuardBandLeft;
|
||||
float GuardBandTop;
|
||||
float GuardBandRight;
|
||||
float GuardBandBottom;
|
||||
|
||||
float ExtentsAdjust;
|
||||
DWORD StencilCaps;
|
||||
|
||||
DWORD FVFCaps;
|
||||
DWORD TextureOpCaps;
|
||||
DWORD MaxTextureBlendStages;
|
||||
DWORD MaxSimultaneousTextures;
|
||||
|
||||
DWORD VertexProcessingCaps;
|
||||
DWORD MaxActiveLights;
|
||||
DWORD MaxUserClipPlanes;
|
||||
DWORD MaxVertexBlendMatrices;
|
||||
DWORD MaxVertexBlendMatrixIndex;
|
||||
|
||||
float MaxPointSize;
|
||||
|
||||
DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call
|
||||
DWORD MaxVertexIndex;
|
||||
DWORD MaxStreams;
|
||||
DWORD MaxStreamStride; // max stride for SetStreamSource
|
||||
|
||||
DWORD VertexShaderVersion;
|
||||
DWORD MaxVertexShaderConst; // number of vertex shader constant registers
|
||||
|
||||
DWORD PixelShaderVersion;
|
||||
float PixelShader1xMaxValue; // max value storable in registers of ps.1.x shaders
|
||||
|
||||
// Here are the DX9 specific ones
|
||||
DWORD DevCaps2;
|
||||
|
||||
float MaxNpatchTessellationLevel;
|
||||
DWORD Reserved5;
|
||||
|
||||
UINT MasterAdapterOrdinal; // ordinal of master adaptor for adapter group
|
||||
UINT AdapterOrdinalInGroup; // ordinal inside the adapter group
|
||||
UINT NumberOfAdaptersInGroup; // number of adapters in this adapter group (only if master)
|
||||
DWORD DeclTypes; // Data types, supported in vertex declarations
|
||||
DWORD NumSimultaneousRTs; // Will be at least 1
|
||||
DWORD StretchRectFilterCaps; // Filter caps supported by StretchRect
|
||||
D3DVSHADERCAPS2_0 VS20Caps;
|
||||
D3DPSHADERCAPS2_0 PS20Caps;
|
||||
DWORD VertexTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's for texture, used in vertex shaders
|
||||
DWORD MaxVShaderInstructionsExecuted; // maximum number of vertex shader instructions that can be executed
|
||||
DWORD MaxPShaderInstructionsExecuted; // maximum number of pixel shader instructions that can be executed
|
||||
DWORD MaxVertexShader30InstructionSlots;
|
||||
DWORD MaxPixelShader30InstructionSlots;
|
||||
} D3DCAPS9;
|
||||
|
||||
//
|
||||
// BIT DEFINES FOR D3DCAPS9 DWORD MEMBERS
|
||||
//
|
||||
|
||||
//
|
||||
// Caps
|
||||
//
|
||||
#define D3DCAPS_READ_SCANLINE 0x00020000L
|
||||
|
||||
//
|
||||
// Caps2
|
||||
//
|
||||
#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L
|
||||
#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L
|
||||
#define D3DCAPS2_RESERVED 0x02000000L
|
||||
#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L
|
||||
#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L
|
||||
#define D3DCAPS2_CANAUTOGENMIPMAP 0x40000000L
|
||||
|
||||
/* D3D9Ex only -- */
|
||||
#if !defined(D3D_DISABLE_9EX)
|
||||
|
||||
#define D3DCAPS2_CANSHARERESOURCE 0x80000000L
|
||||
|
||||
#endif // !D3D_DISABLE_9EX
|
||||
/* -- D3D9Ex only */
|
||||
|
||||
//
|
||||
// Caps3
|
||||
//
|
||||
#define D3DCAPS3_RESERVED 0x8000001fL
|
||||
|
||||
// Indicates that the device can respect the ALPHABLENDENABLE render state
|
||||
// when fullscreen while using the FLIP or DISCARD swap effect.
|
||||
// COPY and COPYVSYNC swap effects work whether or not this flag is set.
|
||||
#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L
|
||||
|
||||
// Indicates that the device can perform a gamma correction from
|
||||
// a windowed back buffer containing linear content to the sRGB desktop.
|
||||
#define D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION 0x00000080L
|
||||
|
||||
#define D3DCAPS3_COPY_TO_VIDMEM 0x00000100L /* Device can acclerate copies from sysmem to local vidmem */
|
||||
#define D3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200L /* Device can acclerate copies from local vidmem to sysmem */
|
||||
|
||||
|
||||
//
|
||||
// PresentationIntervals
|
||||
//
|
||||
#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000L
|
||||
#define D3DPRESENT_INTERVAL_ONE 0x00000001L
|
||||
#define D3DPRESENT_INTERVAL_TWO 0x00000002L
|
||||
#define D3DPRESENT_INTERVAL_THREE 0x00000004L
|
||||
#define D3DPRESENT_INTERVAL_FOUR 0x00000008L
|
||||
#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000L
|
||||
|
||||
//
|
||||
// CursorCaps
|
||||
//
|
||||
// Driver supports HW color cursor in at least hi-res modes(height >=400)
|
||||
#define D3DCURSORCAPS_COLOR 0x00000001L
|
||||
// Driver supports HW cursor also in low-res modes(height < 400)
|
||||
#define D3DCURSORCAPS_LOWRES 0x00000002L
|
||||
|
||||
//
|
||||
// DevCaps
|
||||
//
|
||||
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */
|
||||
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */
|
||||
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */
|
||||
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */
|
||||
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */
|
||||
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */
|
||||
#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */
|
||||
#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */
|
||||
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */
|
||||
#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */
|
||||
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */
|
||||
#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/
|
||||
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */
|
||||
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */
|
||||
#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */
|
||||
#define D3DDEVCAPS_PUREDEVICE 0x00100000L /* Device supports D3DCREATE_PUREDEVICE */
|
||||
#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000L /* Device supports quintic Beziers and BSplines */
|
||||
#define D3DDEVCAPS_RTPATCHES 0x00400000L /* Device supports Rect and Tri patches */
|
||||
#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000L /* Indicates that RT Patches may be drawn efficiently using handle 0 */
|
||||
#define D3DDEVCAPS_NPATCHES 0x01000000L /* Device supports N-Patches */
|
||||
|
||||
//
|
||||
// PrimitiveMiscCaps
|
||||
//
|
||||
#define D3DPMISCCAPS_MASKZ 0x00000002L
|
||||
#define D3DPMISCCAPS_CULLNONE 0x00000010L
|
||||
#define D3DPMISCCAPS_CULLCW 0x00000020L
|
||||
#define D3DPMISCCAPS_CULLCCW 0x00000040L
|
||||
#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L
|
||||
#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L /* Device correctly clips scaled points to clip planes */
|
||||
#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L /* device will clip post-transformed vertex primitives */
|
||||
#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L /* device supports D3DTA_TEMP for temporary register */
|
||||
#define D3DPMISCCAPS_BLENDOP 0x00000800L /* device supports D3DRS_BLENDOP */
|
||||
#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L /* Reference Device that doesnt render */
|
||||
#define D3DPMISCCAPS_INDEPENDENTWRITEMASKS 0x00004000L /* Device supports independent write masks for MET or MRT */
|
||||
#define D3DPMISCCAPS_PERSTAGECONSTANT 0x00008000L /* Device supports per-stage constants */
|
||||
#define D3DPMISCCAPS_FOGANDSPECULARALPHA 0x00010000L /* Device supports separate fog and specular alpha (many devices
|
||||
use the specular alpha channel to store fog factor) */
|
||||
#define D3DPMISCCAPS_SEPARATEALPHABLEND 0x00020000L /* Device supports separate blend settings for the alpha channel */
|
||||
#define D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS 0x00040000L /* Device supports different bit depths for MRT */
|
||||
#define D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000L /* Device supports post-pixel shader operations for MRT */
|
||||
#define D3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000L /* Device clamps fog blend factor per vertex */
|
||||
|
||||
/* D3D9Ex only -- */
|
||||
#if !defined(D3D_DISABLE_9EX)
|
||||
|
||||
#define D3DPMISCCAPS_POSTBLENDSRGBCONVERT 0x00200000L /* Indicates device can perform conversion to sRGB after blending. */
|
||||
|
||||
#endif // !D3D_DISABLE_9EX
|
||||
/* -- D3D9Ex only */
|
||||
|
||||
|
||||
//
|
||||
// LineCaps
|
||||
//
|
||||
#define D3DLINECAPS_TEXTURE 0x00000001L
|
||||
#define D3DLINECAPS_ZTEST 0x00000002L
|
||||
#define D3DLINECAPS_BLEND 0x00000004L
|
||||
#define D3DLINECAPS_ALPHACMP 0x00000008L
|
||||
#define D3DLINECAPS_FOG 0x00000010L
|
||||
#define D3DLINECAPS_ANTIALIAS 0x00000020L
|
||||
|
||||
//
|
||||
// RasterCaps
|
||||
//
|
||||
#define D3DPRASTERCAPS_DITHER 0x00000001L
|
||||
#define D3DPRASTERCAPS_ZTEST 0x00000010L
|
||||
#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L
|
||||
#define D3DPRASTERCAPS_FOGTABLE 0x00000100L
|
||||
#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L
|
||||
#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L
|
||||
#define D3DPRASTERCAPS_FOGRANGE 0x00010000L
|
||||
#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L
|
||||
#define D3DPRASTERCAPS_WBUFFER 0x00040000L
|
||||
#define D3DPRASTERCAPS_WFOG 0x00100000L
|
||||
#define D3DPRASTERCAPS_ZFOG 0x00200000L
|
||||
#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L /* Device iterates colors perspective correct */
|
||||
#define D3DPRASTERCAPS_SCISSORTEST 0x01000000L
|
||||
#define D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS 0x02000000L
|
||||
#define D3DPRASTERCAPS_DEPTHBIAS 0x04000000L
|
||||
#define D3DPRASTERCAPS_MULTISAMPLE_TOGGLE 0x08000000L
|
||||
|
||||
//
|
||||
// ZCmpCaps, AlphaCmpCaps
|
||||
//
|
||||
#define D3DPCMPCAPS_NEVER 0x00000001L
|
||||
#define D3DPCMPCAPS_LESS 0x00000002L
|
||||
#define D3DPCMPCAPS_EQUAL 0x00000004L
|
||||
#define D3DPCMPCAPS_LESSEQUAL 0x00000008L
|
||||
#define D3DPCMPCAPS_GREATER 0x00000010L
|
||||
#define D3DPCMPCAPS_NOTEQUAL 0x00000020L
|
||||
#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L
|
||||
#define D3DPCMPCAPS_ALWAYS 0x00000080L
|
||||
|
||||
//
|
||||
// SourceBlendCaps, DestBlendCaps
|
||||
//
|
||||
#define D3DPBLENDCAPS_ZERO 0x00000001L
|
||||
#define D3DPBLENDCAPS_ONE 0x00000002L
|
||||
#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L
|
||||
#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L
|
||||
#define D3DPBLENDCAPS_SRCALPHA 0x00000010L
|
||||
#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L
|
||||
#define D3DPBLENDCAPS_DESTALPHA 0x00000040L
|
||||
#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L
|
||||
#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L
|
||||
#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L
|
||||
#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L
|
||||
#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L
|
||||
#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L
|
||||
#define D3DPBLENDCAPS_BLENDFACTOR 0x00002000L /* Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR */
|
||||
|
||||
/* D3D9Ex only -- */
|
||||
#if !defined(D3D_DISABLE_9EX)
|
||||
|
||||
#define D3DPBLENDCAPS_SRCCOLOR2 0x00004000L
|
||||
#define D3DPBLENDCAPS_INVSRCCOLOR2 0x00008000L
|
||||
|
||||
#endif // !D3D_DISABLE_9EX
|
||||
/* -- D3D9Ex only */
|
||||
|
||||
|
||||
//
|
||||
// ShadeCaps
|
||||
//
|
||||
#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L
|
||||
#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L
|
||||
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L
|
||||
#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L
|
||||
|
||||
//
|
||||
// TextureCaps
|
||||
//
|
||||
#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L /* Perspective-correct texturing is supported */
|
||||
#define D3DPTEXTURECAPS_POW2 0x00000002L /* Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. */
|
||||
#define D3DPTEXTURECAPS_ALPHA 0x00000004L /* Alpha in texture pixels is supported */
|
||||
#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L /* Only square textures are supported */
|
||||
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L /* Texture indices are not scaled by the texture size prior to interpolation */
|
||||
#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L /* Device can draw alpha from texture palettes */
|
||||
// Device can use non-POW2 textures if:
|
||||
// 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
|
||||
// 2) D3DRS_WRAP(N) is zero for this texture's coordinates
|
||||
// 3) mip mapping is not enabled (use magnification filter only)
|
||||
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L
|
||||
#define D3DPTEXTURECAPS_PROJECTED 0x00000400L /* Device can do D3DTTFF_PROJECTED */
|
||||
#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L /* Device can do cubemap textures */
|
||||
#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L /* Device can do volume textures */
|
||||
#define D3DPTEXTURECAPS_MIPMAP 0x00004000L /* Device can do mipmapped textures */
|
||||
#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L /* Device can do mipmapped volume textures */
|
||||
#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L /* Device can do mipmapped cube maps */
|
||||
#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L /* Device requires that cubemaps be power-of-2 dimension */
|
||||
#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L /* Device requires that volume maps be power-of-2 dimension */
|
||||
#define D3DPTEXTURECAPS_NOPROJECTEDBUMPENV 0x00200000L /* Device does not support projected bump env lookup operation
|
||||
in programmable and fixed function pixel shaders */
|
||||
|
||||
//
|
||||
// TextureFilterCaps, StretchRectFilterCaps
|
||||
//
|
||||
#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */
|
||||
#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L
|
||||
#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L
|
||||
#define D3DPTFILTERCAPS_MINFPYRAMIDALQUAD 0x00000800L
|
||||
#define D3DPTFILTERCAPS_MINFGAUSSIANQUAD 0x00001000L
|
||||
#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */
|
||||
#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L
|
||||
|
||||
/* D3D9Ex only -- */
|
||||
#if !defined(D3D_DISABLE_9EX)
|
||||
|
||||
#define D3DPTFILTERCAPS_CONVOLUTIONMONO 0x00040000L /* Min and Mag for the convolution mono filter */
|
||||
|
||||
#endif // !D3D_DISABLE_9EX
|
||||
/* -- D3D9Ex only */
|
||||
|
||||
#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */
|
||||
#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L
|
||||
#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L
|
||||
#define D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD 0x08000000L
|
||||
#define D3DPTFILTERCAPS_MAGFGAUSSIANQUAD 0x10000000L
|
||||
|
||||
//
|
||||
// TextureAddressCaps
|
||||
//
|
||||
#define D3DPTADDRESSCAPS_WRAP 0x00000001L
|
||||
#define D3DPTADDRESSCAPS_MIRROR 0x00000002L
|
||||
#define D3DPTADDRESSCAPS_CLAMP 0x00000004L
|
||||
#define D3DPTADDRESSCAPS_BORDER 0x00000008L
|
||||
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L
|
||||
#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020L
|
||||
|
||||
//
|
||||
// StencilCaps
|
||||
//
|
||||
#define D3DSTENCILCAPS_KEEP 0x00000001L
|
||||
#define D3DSTENCILCAPS_ZERO 0x00000002L
|
||||
#define D3DSTENCILCAPS_REPLACE 0x00000004L
|
||||
#define D3DSTENCILCAPS_INCRSAT 0x00000008L
|
||||
#define D3DSTENCILCAPS_DECRSAT 0x00000010L
|
||||
#define D3DSTENCILCAPS_INVERT 0x00000020L
|
||||
#define D3DSTENCILCAPS_INCR 0x00000040L
|
||||
#define D3DSTENCILCAPS_DECR 0x00000080L
|
||||
#define D3DSTENCILCAPS_TWOSIDED 0x00000100L
|
||||
|
||||
//
|
||||
// TextureOpCaps
|
||||
//
|
||||
#define D3DTEXOPCAPS_DISABLE 0x00000001L
|
||||
#define D3DTEXOPCAPS_SELECTARG1 0x00000002L
|
||||
#define D3DTEXOPCAPS_SELECTARG2 0x00000004L
|
||||
#define D3DTEXOPCAPS_MODULATE 0x00000008L
|
||||
#define D3DTEXOPCAPS_MODULATE2X 0x00000010L
|
||||
#define D3DTEXOPCAPS_MODULATE4X 0x00000020L
|
||||
#define D3DTEXOPCAPS_ADD 0x00000040L
|
||||
#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L
|
||||
#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L
|
||||
#define D3DTEXOPCAPS_SUBTRACT 0x00000200L
|
||||
#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L
|
||||
#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L
|
||||
#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L
|
||||
#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L
|
||||
#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L
|
||||
#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L
|
||||
#define D3DTEXOPCAPS_PREMODULATE 0x00010000L
|
||||
#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L
|
||||
#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L
|
||||
#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L
|
||||
#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L
|
||||
#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L
|
||||
#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L
|
||||
#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L
|
||||
#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000L
|
||||
#define D3DTEXOPCAPS_LERP 0x02000000L
|
||||
|
||||
//
|
||||
// FVFCaps
|
||||
//
|
||||
#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */
|
||||
#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */
|
||||
#define D3DFVFCAPS_PSIZE 0x00100000L /* Device can receive point size */
|
||||
|
||||
//
|
||||
// VertexProcessingCaps
|
||||
//
|
||||
#define D3DVTXPCAPS_TEXGEN 0x00000001L /* device can do texgen */
|
||||
#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L /* device can do DX7-level colormaterialsource ops */
|
||||
#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L /* device can do directional lights */
|
||||
#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L /* device can do positional lights (includes point and spot) */
|
||||
#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L /* device can do local viewer */
|
||||
#define D3DVTXPCAPS_TWEENING 0x00000040L /* device can do vertex tweening */
|
||||
#define D3DVTXPCAPS_TEXGEN_SPHEREMAP 0x00000100L /* device supports D3DTSS_TCI_SPHEREMAP */
|
||||
#define D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER 0x00000200L /* device does not support TexGen in non-local
|
||||
viewer mode */
|
||||
|
||||
//
|
||||
// DevCaps2
|
||||
//
|
||||
#define D3DDEVCAPS2_STREAMOFFSET 0x00000001L /* Device supports offsets in streams. Must be set by DX9 drivers */
|
||||
#define D3DDEVCAPS2_DMAPNPATCH 0x00000002L /* Device supports displacement maps for N-Patches*/
|
||||
#define D3DDEVCAPS2_ADAPTIVETESSRTPATCH 0x00000004L /* Device supports adaptive tesselation of RT-patches*/
|
||||
#define D3DDEVCAPS2_ADAPTIVETESSNPATCH 0x00000008L /* Device supports adaptive tesselation of N-patches*/
|
||||
#define D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES 0x00000010L /* Device supports StretchRect calls with a texture as the source*/
|
||||
#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH 0x00000020L /* Device supports presampled displacement maps for N-Patches */
|
||||
#define D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET 0x00000040L /* Vertex elements in a vertex declaration can share the same stream offset */
|
||||
|
||||
//
|
||||
// DeclTypes
|
||||
//
|
||||
#define D3DDTCAPS_UBYTE4 0x00000001L
|
||||
#define D3DDTCAPS_UBYTE4N 0x00000002L
|
||||
#define D3DDTCAPS_SHORT2N 0x00000004L
|
||||
#define D3DDTCAPS_SHORT4N 0x00000008L
|
||||
#define D3DDTCAPS_USHORT2N 0x00000010L
|
||||
#define D3DDTCAPS_USHORT4N 0x00000020L
|
||||
#define D3DDTCAPS_UDEC3 0x00000040L
|
||||
#define D3DDTCAPS_DEC3N 0x00000080L
|
||||
#define D3DDTCAPS_FLOAT16_2 0x00000100L
|
||||
#define D3DDTCAPS_FLOAT16_4 0x00000200L
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif /* (DIRECT3D_VERSION >= 0x0900) */
|
||||
#endif /* _d3d9CAPS_H_ */
|
||||
|
||||
2012
common/dx11sdk/d3d9types.h
Normal file
2012
common/dx11sdk/d3d9types.h
Normal file
File diff suppressed because it is too large
Load Diff
290
common/dx11sdk/d3dx10async.h
Normal file
290
common/dx11sdk/d3dx10async.h
Normal file
@@ -0,0 +1,290 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3DX10Async.h
|
||||
// Content: D3DX10 Asynchronous Effect / Shader loaders / compilers
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3DX10ASYNC_H__
|
||||
#define __D3DX10ASYNC_H__
|
||||
|
||||
#include "d3dx10.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10Compile:
|
||||
// ------------------
|
||||
// Compiles an effect or shader.
|
||||
//
|
||||
// Parameters:
|
||||
// pSrcFile
|
||||
// Source file name.
|
||||
// hSrcModule
|
||||
// Module handle. if NULL, current module will be used.
|
||||
// pSrcResource
|
||||
// Resource name in module.
|
||||
// pSrcData
|
||||
// Pointer to source code.
|
||||
// SrcDataLen
|
||||
// Size of source code, in bytes.
|
||||
// pDefines
|
||||
// Optional NULL-terminated array of preprocessor macro definitions.
|
||||
// pInclude
|
||||
// Optional interface pointer to use for handling #include directives.
|
||||
// If this parameter is NULL, #includes will be honored when compiling
|
||||
// from file, and will error when compiling from resource or memory.
|
||||
// pFunctionName
|
||||
// Name of the entrypoint function where execution should begin.
|
||||
// pProfile
|
||||
// Instruction set to be used when generating code. Currently supported
|
||||
// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0",
|
||||
// "vs_3_sw", "vs_4_0", "vs_4_1",
|
||||
// "ps_2_0", "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0",
|
||||
// "ps_3_sw", "ps_4_0", "ps_4_1",
|
||||
// "gs_4_0", "gs_4_1",
|
||||
// "tx_1_0",
|
||||
// "fx_4_0", "fx_4_1"
|
||||
// Note that this entrypoint does not compile fx_2_0 targets, for that
|
||||
// you need to use the D3DX9 function.
|
||||
// Flags1
|
||||
// See D3D10_SHADER_xxx flags.
|
||||
// Flags2
|
||||
// See D3D10_EFFECT_xxx flags.
|
||||
// ppShader
|
||||
// Returns a buffer containing the created shader. This buffer contains
|
||||
// the compiled shader code, as well as any embedded debug and symbol
|
||||
// table info. (See D3D10GetShaderConstantTable)
|
||||
// ppErrorMsgs
|
||||
// Returns a buffer containing a listing of errors and warnings that were
|
||||
// encountered during the compile. If you are running in a debugger,
|
||||
// these are the same messages you will see in your debug output.
|
||||
// pHResult
|
||||
// Pointer to a memory location to receive the return value upon completion.
|
||||
// Maybe NULL if not needed.
|
||||
// If pPump != NULL, pHResult must be a valid memory location until the
|
||||
// the asynchronous execution completes.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3DX10CompileFromFileA(LPCSTR pSrcFile,CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CompileFromFileW(LPCWSTR pSrcFile, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CompileFromFile D3DX10CompileFromFileW
|
||||
#else
|
||||
#define D3DX10CompileFromFile D3DX10CompileFromFileA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI D3DX10CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CompileFromResource D3DX10CompileFromResourceW
|
||||
#else
|
||||
#define D3DX10CompileFromResource D3DX10CompileFromResourceA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI D3DX10CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10CreateEffectFromXXXX:
|
||||
// --------------------------
|
||||
// Creates an effect from a binary effect or file
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// [in]
|
||||
//
|
||||
//
|
||||
// pFileName
|
||||
// Name of the ASCII (uncompiled) or binary (compiled) Effect file to load
|
||||
//
|
||||
// hModule
|
||||
// Handle to the module containing the resource to compile from
|
||||
// pResourceName
|
||||
// Name of the resource within hModule to compile from
|
||||
//
|
||||
// pData
|
||||
// Blob of effect data, either ASCII (uncompiled) or binary (compiled)
|
||||
// DataLength
|
||||
// Length of the data blob
|
||||
//
|
||||
// pDefines
|
||||
// Optional NULL-terminated array of preprocessor macro definitions.
|
||||
// pInclude
|
||||
// Optional interface pointer to use for handling #include directives.
|
||||
// If this parameter is NULL, #includes will be honored when compiling
|
||||
// from file, and will error when compiling from resource or memory.
|
||||
// pProfile
|
||||
// Profile to use when compiling the effect.
|
||||
// HLSLFlags
|
||||
// Compilation flags pertaining to shaders and data types, honored by
|
||||
// the HLSL compiler
|
||||
// FXFlags
|
||||
// Compilation flags pertaining to Effect compilation, honored
|
||||
// by the Effect compiler
|
||||
// pDevice
|
||||
// Pointer to the D3D10 device on which to create Effect resources
|
||||
// pEffectPool
|
||||
// Pointer to an Effect pool to share variables with or NULL
|
||||
//
|
||||
// [out]
|
||||
//
|
||||
// ppEffect
|
||||
// Address of the newly created Effect interface
|
||||
// ppEffectPool
|
||||
// Address of the newly created Effect pool interface
|
||||
// ppErrors
|
||||
// If non-NULL, address of a buffer with error messages that occurred
|
||||
// during parsing or compilation
|
||||
// pHResult
|
||||
// Pointer to a memory location to receive the return value upon completion.
|
||||
// Maybe NULL if not needed.
|
||||
// If pPump != NULL, pHResult must be a valid memory location until the
|
||||
// the asynchronous execution completes.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectFromMemory(LPCVOID pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CreateEffectFromFile D3DX10CreateEffectFromFileW
|
||||
#define D3DX10CreateEffectFromResource D3DX10CreateEffectFromResourceW
|
||||
#else
|
||||
#define D3DX10CreateEffectFromFile D3DX10CreateEffectFromFileA
|
||||
#define D3DX10CreateEffectFromResource D3DX10CreateEffectFromResourceA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectPoolFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3DX10ThreadPump* pPump,
|
||||
ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectPoolFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3DX10ThreadPump* pPump,
|
||||
ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectPoolFromMemory(LPCVOID pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectPoolFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateEffectPoolFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,
|
||||
ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CreateEffectPoolFromFile D3DX10CreateEffectPoolFromFileW
|
||||
#define D3DX10CreateEffectPoolFromResource D3DX10CreateEffectPoolFromResourceW
|
||||
#else
|
||||
#define D3DX10CreateEffectPoolFromFile D3DX10CreateEffectPoolFromFileA
|
||||
#define D3DX10CreateEffectPoolFromResource D3DX10CreateEffectPoolFromResourceA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI D3DX10PreprocessShaderFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10PreprocessShaderFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
HRESULT WINAPI D3DX10PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,
|
||||
LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10PreprocessShaderFromFile D3DX10PreprocessShaderFromFileW
|
||||
#define D3DX10PreprocessShaderFromResource D3DX10PreprocessShaderFromResourceW
|
||||
#else
|
||||
#define D3DX10PreprocessShaderFromFile D3DX10PreprocessShaderFromFileA
|
||||
#define D3DX10PreprocessShaderFromResource D3DX10PreprocessShaderFromResourceA
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Async processors
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncCompilerProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2,
|
||||
ID3D10Blob **ppCompiledShader, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncEffectCreateProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pProfile, UINT Flags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3D10EffectPool *pPool, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncEffectPoolCreateProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
LPCSTR pProfile, UINT Flags, UINT FXFlags, ID3D10Device *pDevice,
|
||||
ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
|
||||
ID3D10Blob** ppShaderText, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor);
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX10 Asynchronous texture I/O (advanced mode)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX10DataLoader **ppDataLoader);
|
||||
HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX10DataLoader **ppDataLoader);
|
||||
HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX10DataLoader **ppDataLoader);
|
||||
HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX10DataLoader **ppDataLoader);
|
||||
HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX10DataLoader **ppDataLoader);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DX10CreateAsyncFileLoader D3DX10CreateAsyncFileLoaderW
|
||||
#define D3DX10CreateAsyncResourceLoader D3DX10CreateAsyncResourceLoaderW
|
||||
#else
|
||||
#define D3DX10CreateAsyncFileLoader D3DX10CreateAsyncFileLoaderA
|
||||
#define D3DX10CreateAsyncResourceLoader D3DX10CreateAsyncResourceLoaderA
|
||||
#endif
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncTextureProcessor(ID3D10Device *pDevice, D3DX10_IMAGE_LOAD_INFO *pLoadInfo, ID3DX10DataProcessor **ppDataProcessor);
|
||||
HRESULT WINAPI D3DX10CreateAsyncTextureInfoProcessor(D3DX10_IMAGE_INFO *pImageInfo, ID3DX10DataProcessor **ppDataProcessor);
|
||||
HRESULT WINAPI D3DX10CreateAsyncShaderResourceViewProcessor(ID3D10Device *pDevice, D3DX10_IMAGE_LOAD_INFO *pLoadInfo, ID3DX10DataProcessor **ppDataProcessor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3DX10ASYNC_H__
|
||||
|
||||
|
||||
76
common/dx11sdk/d3dx9.h
Normal file
76
common/dx11sdk/d3dx9.h
Normal file
@@ -0,0 +1,76 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
// File: d3dx9.h
|
||||
// Content: D3DX utility library
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __D3DX_INTERNAL__
|
||||
#error Incorrect D3DX header used
|
||||
#endif
|
||||
|
||||
#ifndef __D3DX9_H__
|
||||
#define __D3DX9_H__
|
||||
|
||||
|
||||
// Defines
|
||||
#include <limits.h>
|
||||
|
||||
#define D3DX_DEFAULT ((UINT) -1)
|
||||
#define D3DX_DEFAULT_NONPOW2 ((UINT) -2)
|
||||
#define D3DX_DEFAULT_FLOAT FLT_MAX
|
||||
#define D3DX_FROM_FILE ((UINT) -3)
|
||||
#define D3DFMT_FROM_FILE ((D3DFORMAT) -3)
|
||||
|
||||
#ifndef D3DXINLINE
|
||||
#ifdef _MSC_VER
|
||||
#if (_MSC_VER >= 1200)
|
||||
#define D3DXINLINE __forceinline
|
||||
#else
|
||||
#define D3DXINLINE __inline
|
||||
#endif
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#define D3DXINLINE inline
|
||||
#else
|
||||
#define D3DXINLINE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Includes
|
||||
#include "d3d9.h"
|
||||
#include "d3dx9math.h"
|
||||
#include "d3dx9core.h"
|
||||
#include "d3dx9xof.h"
|
||||
#include "d3dx9mesh.h"
|
||||
#include "d3dx9shader.h"
|
||||
#include "d3dx9effect.h"
|
||||
#include "d3dx9tex.h"
|
||||
#include "d3dx9shape.h"
|
||||
#include "d3dx9anim.h"
|
||||
|
||||
|
||||
// Errors
|
||||
#define _FACDD 0x876
|
||||
#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
|
||||
|
||||
enum _D3DXERR {
|
||||
D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900),
|
||||
D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901),
|
||||
D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902),
|
||||
D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903),
|
||||
D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904),
|
||||
D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905),
|
||||
D3DXERR_LOADEDMESHASNODATA = MAKE_DDHRESULT(2906),
|
||||
D3DXERR_DUPLICATENAMEDFRAGMENT = MAKE_DDHRESULT(2907),
|
||||
D3DXERR_CANNOTREMOVELASTITEM = MAKE_DDHRESULT(2908),
|
||||
};
|
||||
|
||||
|
||||
#endif //__D3DX9_H__
|
||||
|
||||
1114
common/dx11sdk/d3dx9anim.h
Normal file
1114
common/dx11sdk/d3dx9anim.h
Normal file
File diff suppressed because it is too large
Load Diff
753
common/dx11sdk/d3dx9core.h
Normal file
753
common/dx11sdk/d3dx9core.h
Normal file
@@ -0,0 +1,753 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
// File: d3dx9core.h
|
||||
// Content: D3DX core types and functions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "d3dx9.h"
|
||||
|
||||
#ifndef __D3DX9CORE_H__
|
||||
#define __D3DX9CORE_H__
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3DX_SDK_VERSION:
|
||||
// -----------------
|
||||
// This identifier is passed to D3DXCheckVersion in order to ensure that an
|
||||
// application was built against the correct header files and lib files.
|
||||
// This number is incremented whenever a header (or other) change would
|
||||
// require applications to be rebuilt. If the version doesn't match,
|
||||
// D3DXCheckVersion will return FALSE. (The number itself has no meaning.)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define D3DX_VERSION 0x0902
|
||||
|
||||
#define D3DX_SDK_VERSION 41
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
BOOL WINAPI
|
||||
D3DXCheckVersion(UINT D3DSdkVersion, UINT D3DXSdkVersion);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3DXDebugMute
|
||||
// Mutes D3DX and D3D debug spew (TRUE - mute, FALSE - not mute)
|
||||
//
|
||||
// returns previous mute value
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
BOOL WINAPI
|
||||
D3DXDebugMute(BOOL Mute);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3DXGetDriverLevel:
|
||||
// Returns driver version information:
|
||||
//
|
||||
// 700 - DX7 level driver
|
||||
// 800 - DX8 level driver
|
||||
// 900 - DX9 level driver
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
UINT WINAPI
|
||||
D3DXGetDriverLevel(LPDIRECT3DDEVICE9 pDevice);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXBuffer:
|
||||
// ------------
|
||||
// The buffer object is used by D3DX to return arbitrary size data.
|
||||
//
|
||||
// GetBufferPointer -
|
||||
// Returns a pointer to the beginning of the buffer.
|
||||
//
|
||||
// GetBufferSize -
|
||||
// Returns the size of the buffer, in bytes.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3DXBuffer ID3DXBuffer;
|
||||
typedef interface ID3DXBuffer *LPD3DXBUFFER;
|
||||
|
||||
// {8BA5FB08-5195-40e2-AC58-0D989C3A0102}
|
||||
DEFINE_GUID(IID_ID3DXBuffer,
|
||||
0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXBuffer
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXBuffer, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DXBuffer
|
||||
STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
|
||||
STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// D3DXSPRITE flags:
|
||||
// -----------------
|
||||
// D3DXSPRITE_DONOTSAVESTATE
|
||||
// Specifies device state is not to be saved and restored in Begin/End.
|
||||
// D3DXSPRITE_DONOTMODIFY_RENDERSTATE
|
||||
// Specifies device render state is not to be changed in Begin. The device
|
||||
// is assumed to be in a valid state to draw vertices containing POSITION0,
|
||||
// TEXCOORD0, and COLOR0 data.
|
||||
// D3DXSPRITE_OBJECTSPACE
|
||||
// The WORLD, VIEW, and PROJECTION transforms are NOT modified. The
|
||||
// transforms currently set to the device are used to transform the sprites
|
||||
// when the batch is drawn (at Flush or End). If this is not specified,
|
||||
// WORLD, VIEW, and PROJECTION transforms are modified so that sprites are
|
||||
// drawn in screenspace coordinates.
|
||||
// D3DXSPRITE_BILLBOARD
|
||||
// Rotates each sprite about its center so that it is facing the viewer.
|
||||
// D3DXSPRITE_ALPHABLEND
|
||||
// Enables ALPHABLEND(SRCALPHA, INVSRCALPHA) and ALPHATEST(alpha > 0).
|
||||
// ID3DXFont expects this to be set when drawing text.
|
||||
// D3DXSPRITE_SORT_TEXTURE
|
||||
// Sprites are sorted by texture prior to drawing. This is recommended when
|
||||
// drawing non-overlapping sprites of uniform depth. For example, drawing
|
||||
// screen-aligned text with ID3DXFont.
|
||||
// D3DXSPRITE_SORT_DEPTH_FRONTTOBACK
|
||||
// Sprites are sorted by depth front-to-back prior to drawing. This is
|
||||
// recommended when drawing opaque sprites of varying depths.
|
||||
// D3DXSPRITE_SORT_DEPTH_BACKTOFRONT
|
||||
// Sprites are sorted by depth back-to-front prior to drawing. This is
|
||||
// recommended when drawing transparent sprites of varying depths.
|
||||
// D3DXSPRITE_DO_NOT_ADDREF_TEXTURE
|
||||
// Disables calling AddRef() on every draw, and Release() on Flush() for
|
||||
// better performance.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define D3DXSPRITE_DONOTSAVESTATE (1 << 0)
|
||||
#define D3DXSPRITE_DONOTMODIFY_RENDERSTATE (1 << 1)
|
||||
#define D3DXSPRITE_OBJECTSPACE (1 << 2)
|
||||
#define D3DXSPRITE_BILLBOARD (1 << 3)
|
||||
#define D3DXSPRITE_ALPHABLEND (1 << 4)
|
||||
#define D3DXSPRITE_SORT_TEXTURE (1 << 5)
|
||||
#define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK (1 << 6)
|
||||
#define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT (1 << 7)
|
||||
#define D3DXSPRITE_DO_NOT_ADDREF_TEXTURE (1 << 8)
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXSprite:
|
||||
// ------------
|
||||
// This object intends to provide an easy way to drawing sprites using D3D.
|
||||
//
|
||||
// Begin -
|
||||
// Prepares device for drawing sprites.
|
||||
//
|
||||
// Draw -
|
||||
// Draws a sprite. Before transformation, the sprite is the size of
|
||||
// SrcRect, with its top-left corner specified by Position. The color
|
||||
// and alpha channels are modulated by Color.
|
||||
//
|
||||
// Flush -
|
||||
// Forces all batched sprites to submitted to the device.
|
||||
//
|
||||
// End -
|
||||
// Restores device state to how it was when Begin was called.
|
||||
//
|
||||
// OnLostDevice, OnResetDevice -
|
||||
// Call OnLostDevice() on this object before calling Reset() on the
|
||||
// device, so that this object can release any stateblocks and video
|
||||
// memory resources. After Reset(), the call OnResetDevice().
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3DXSprite ID3DXSprite;
|
||||
typedef interface ID3DXSprite *LPD3DXSPRITE;
|
||||
|
||||
|
||||
// {BA0B762D-7D28-43ec-B9DC-2F84443B0614}
|
||||
DEFINE_GUID(IID_ID3DXSprite,
|
||||
0xba0b762d, 0x7d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14);
|
||||
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXSprite
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXSprite, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DXSprite
|
||||
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
|
||||
|
||||
STDMETHOD(GetTransform)(THIS_ D3DXMATRIX *pTransform) PURE;
|
||||
STDMETHOD(SetTransform)(THIS_ CONST D3DXMATRIX *pTransform) PURE;
|
||||
|
||||
STDMETHOD(SetWorldViewRH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE;
|
||||
STDMETHOD(SetWorldViewLH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE;
|
||||
|
||||
STDMETHOD(Begin)(THIS_ DWORD Flags) PURE;
|
||||
STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE9 pTexture, CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pCenter, CONST D3DXVECTOR3 *pPosition, D3DCOLOR Color) PURE;
|
||||
STDMETHOD(Flush)(THIS) PURE;
|
||||
STDMETHOD(End)(THIS) PURE;
|
||||
|
||||
STDMETHOD(OnLostDevice)(THIS) PURE;
|
||||
STDMETHOD(OnResetDevice)(THIS) PURE;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateSprite(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
LPD3DXSPRITE* ppSprite);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXFont:
|
||||
// ----------
|
||||
// Font objects contain the textures and resources needed to render a specific
|
||||
// font on a specific device.
|
||||
//
|
||||
// GetGlyphData -
|
||||
// Returns glyph cache data, for a given glyph.
|
||||
//
|
||||
// PreloadCharacters/PreloadGlyphs/PreloadText -
|
||||
// Preloads glyphs into the glyph cache textures.
|
||||
//
|
||||
// DrawText -
|
||||
// Draws formatted text on a D3D device. Some parameters are
|
||||
// surprisingly similar to those of GDI's DrawText function. See GDI
|
||||
// documentation for a detailed description of these parameters.
|
||||
// If pSprite is NULL, an internal sprite object will be used.
|
||||
//
|
||||
// OnLostDevice, OnResetDevice -
|
||||
// Call OnLostDevice() on this object before calling Reset() on the
|
||||
// device, so that this object can release any stateblocks and video
|
||||
// memory resources. After Reset(), the call OnResetDevice().
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct _D3DXFONT_DESCA
|
||||
{
|
||||
INT Height;
|
||||
UINT Width;
|
||||
UINT Weight;
|
||||
UINT MipLevels;
|
||||
BOOL Italic;
|
||||
BYTE CharSet;
|
||||
BYTE OutputPrecision;
|
||||
BYTE Quality;
|
||||
BYTE PitchAndFamily;
|
||||
CHAR FaceName[LF_FACESIZE];
|
||||
|
||||
} D3DXFONT_DESCA, *LPD3DXFONT_DESCA;
|
||||
|
||||
typedef struct _D3DXFONT_DESCW
|
||||
{
|
||||
INT Height;
|
||||
UINT Width;
|
||||
UINT Weight;
|
||||
UINT MipLevels;
|
||||
BOOL Italic;
|
||||
BYTE CharSet;
|
||||
BYTE OutputPrecision;
|
||||
BYTE Quality;
|
||||
BYTE PitchAndFamily;
|
||||
WCHAR FaceName[LF_FACESIZE];
|
||||
|
||||
} D3DXFONT_DESCW, *LPD3DXFONT_DESCW;
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef D3DXFONT_DESCW D3DXFONT_DESC;
|
||||
typedef LPD3DXFONT_DESCW LPD3DXFONT_DESC;
|
||||
#else
|
||||
typedef D3DXFONT_DESCA D3DXFONT_DESC;
|
||||
typedef LPD3DXFONT_DESCA LPD3DXFONT_DESC;
|
||||
#endif
|
||||
|
||||
|
||||
typedef interface ID3DXFont ID3DXFont;
|
||||
typedef interface ID3DXFont *LPD3DXFONT;
|
||||
|
||||
|
||||
// {D79DBB70-5F21-4d36-BBC2-FF525C213CDC}
|
||||
DEFINE_GUID(IID_ID3DXFont,
|
||||
0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc);
|
||||
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXFont
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXFont, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DXFont
|
||||
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE;
|
||||
STDMETHOD(GetDescA)(THIS_ D3DXFONT_DESCA *pDesc) PURE;
|
||||
STDMETHOD(GetDescW)(THIS_ D3DXFONT_DESCW *pDesc) PURE;
|
||||
STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE;
|
||||
STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE;
|
||||
|
||||
STDMETHOD_(HDC, GetDC)(THIS) PURE;
|
||||
STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE;
|
||||
|
||||
STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE;
|
||||
STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE;
|
||||
STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE;
|
||||
STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE;
|
||||
|
||||
STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
|
||||
STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
|
||||
|
||||
STDMETHOD(OnLostDevice)(THIS) PURE;
|
||||
STDMETHOD(OnResetDevice)(THIS) PURE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef UNICODE
|
||||
HRESULT GetDesc(D3DXFONT_DESCW *pDesc) { return GetDescW(pDesc); }
|
||||
HRESULT PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); }
|
||||
#else
|
||||
HRESULT GetDesc(D3DXFONT_DESCA *pDesc) { return GetDescA(pDesc); }
|
||||
HRESULT PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); }
|
||||
#endif
|
||||
#endif //__cplusplus
|
||||
};
|
||||
|
||||
#ifndef GetTextMetrics
|
||||
#ifdef UNICODE
|
||||
#define GetTextMetrics GetTextMetricsW
|
||||
#else
|
||||
#define GetTextMetrics GetTextMetricsA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DrawText
|
||||
#ifdef UNICODE
|
||||
#define DrawText DrawTextW
|
||||
#else
|
||||
#define DrawText DrawTextA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateFontA(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
INT Height,
|
||||
UINT Width,
|
||||
UINT Weight,
|
||||
UINT MipLevels,
|
||||
BOOL Italic,
|
||||
DWORD CharSet,
|
||||
DWORD OutputPrecision,
|
||||
DWORD Quality,
|
||||
DWORD PitchAndFamily,
|
||||
LPCSTR pFaceName,
|
||||
LPD3DXFONT* ppFont);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateFontW(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
INT Height,
|
||||
UINT Width,
|
||||
UINT Weight,
|
||||
UINT MipLevels,
|
||||
BOOL Italic,
|
||||
DWORD CharSet,
|
||||
DWORD OutputPrecision,
|
||||
DWORD Quality,
|
||||
DWORD PitchAndFamily,
|
||||
LPCWSTR pFaceName,
|
||||
LPD3DXFONT* ppFont);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DXCreateFont D3DXCreateFontW
|
||||
#else
|
||||
#define D3DXCreateFont D3DXCreateFontA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateFontIndirectA(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
CONST D3DXFONT_DESCA* pDesc,
|
||||
LPD3DXFONT* ppFont);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateFontIndirectW(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
CONST D3DXFONT_DESCW* pDesc,
|
||||
LPD3DXFONT* ppFont);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DXCreateFontIndirect D3DXCreateFontIndirectW
|
||||
#else
|
||||
#define D3DXCreateFontIndirect D3DXCreateFontIndirectA
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXRenderToSurface:
|
||||
// ---------------------
|
||||
// This object abstracts rendering to surfaces. These surfaces do not
|
||||
// necessarily need to be render targets. If they are not, a compatible
|
||||
// render target is used, and the result copied into surface at end scene.
|
||||
//
|
||||
// BeginScene, EndScene -
|
||||
// Call BeginScene() and EndScene() at the beginning and ending of your
|
||||
// scene. These calls will setup and restore render targets, viewports,
|
||||
// etc..
|
||||
//
|
||||
// OnLostDevice, OnResetDevice -
|
||||
// Call OnLostDevice() on this object before calling Reset() on the
|
||||
// device, so that this object can release any stateblocks and video
|
||||
// memory resources. After Reset(), the call OnResetDevice().
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct _D3DXRTS_DESC
|
||||
{
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
D3DFORMAT Format;
|
||||
BOOL DepthStencil;
|
||||
D3DFORMAT DepthStencilFormat;
|
||||
|
||||
} D3DXRTS_DESC, *LPD3DXRTS_DESC;
|
||||
|
||||
|
||||
typedef interface ID3DXRenderToSurface ID3DXRenderToSurface;
|
||||
typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE;
|
||||
|
||||
|
||||
// {6985F346-2C3D-43b3-BE8B-DAAE8A03D894}
|
||||
DEFINE_GUID(IID_ID3DXRenderToSurface,
|
||||
0x6985f346, 0x2c3d, 0x43b3, 0xbe, 0x8b, 0xda, 0xae, 0x8a, 0x3, 0xd8, 0x94);
|
||||
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXRenderToSurface
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DXRenderToSurface
|
||||
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
|
||||
STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE;
|
||||
|
||||
STDMETHOD(BeginScene)(THIS_ LPDIRECT3DSURFACE9 pSurface, CONST D3DVIEWPORT9* pViewport) PURE;
|
||||
STDMETHOD(EndScene)(THIS_ DWORD MipFilter) PURE;
|
||||
|
||||
STDMETHOD(OnLostDevice)(THIS) PURE;
|
||||
STDMETHOD(OnResetDevice)(THIS) PURE;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateRenderToSurface(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
UINT Width,
|
||||
UINT Height,
|
||||
D3DFORMAT Format,
|
||||
BOOL DepthStencil,
|
||||
D3DFORMAT DepthStencilFormat,
|
||||
LPD3DXRENDERTOSURFACE* ppRenderToSurface);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXRenderToEnvMap:
|
||||
// --------------------
|
||||
// This object abstracts rendering to environment maps. These surfaces
|
||||
// do not necessarily need to be render targets. If they are not, a
|
||||
// compatible render target is used, and the result copied into the
|
||||
// environment map at end scene.
|
||||
//
|
||||
// BeginCube, BeginSphere, BeginHemisphere, BeginParabolic -
|
||||
// This function initiates the rendering of the environment map. As
|
||||
// parameters, you pass the textures in which will get filled in with
|
||||
// the resulting environment map.
|
||||
//
|
||||
// Face -
|
||||
// Call this function to initiate the drawing of each face. For each
|
||||
// environment map, you will call this six times.. once for each face
|
||||
// in D3DCUBEMAP_FACES.
|
||||
//
|
||||
// End -
|
||||
// This will restore all render targets, and if needed compose all the
|
||||
// rendered faces into the environment map surfaces.
|
||||
//
|
||||
// OnLostDevice, OnResetDevice -
|
||||
// Call OnLostDevice() on this object before calling Reset() on the
|
||||
// device, so that this object can release any stateblocks and video
|
||||
// memory resources. After Reset(), the call OnResetDevice().
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct _D3DXRTE_DESC
|
||||
{
|
||||
UINT Size;
|
||||
UINT MipLevels;
|
||||
D3DFORMAT Format;
|
||||
BOOL DepthStencil;
|
||||
D3DFORMAT DepthStencilFormat;
|
||||
|
||||
} D3DXRTE_DESC, *LPD3DXRTE_DESC;
|
||||
|
||||
|
||||
typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap;
|
||||
typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap;
|
||||
|
||||
|
||||
// {313F1B4B-C7B0-4fa2-9D9D-8D380B64385E}
|
||||
DEFINE_GUID(IID_ID3DXRenderToEnvMap,
|
||||
0x313f1b4b, 0xc7b0, 0x4fa2, 0x9d, 0x9d, 0x8d, 0x38, 0xb, 0x64, 0x38, 0x5e);
|
||||
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXRenderToEnvMap
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DXRenderToEnvMap
|
||||
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
|
||||
STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE;
|
||||
|
||||
STDMETHOD(BeginCube)(THIS_
|
||||
LPDIRECT3DCUBETEXTURE9 pCubeTex) PURE;
|
||||
|
||||
STDMETHOD(BeginSphere)(THIS_
|
||||
LPDIRECT3DTEXTURE9 pTex) PURE;
|
||||
|
||||
STDMETHOD(BeginHemisphere)(THIS_
|
||||
LPDIRECT3DTEXTURE9 pTexZPos,
|
||||
LPDIRECT3DTEXTURE9 pTexZNeg) PURE;
|
||||
|
||||
STDMETHOD(BeginParabolic)(THIS_
|
||||
LPDIRECT3DTEXTURE9 pTexZPos,
|
||||
LPDIRECT3DTEXTURE9 pTexZNeg) PURE;
|
||||
|
||||
STDMETHOD(Face)(THIS_ D3DCUBEMAP_FACES Face, DWORD MipFilter) PURE;
|
||||
STDMETHOD(End)(THIS_ DWORD MipFilter) PURE;
|
||||
|
||||
STDMETHOD(OnLostDevice)(THIS) PURE;
|
||||
STDMETHOD(OnResetDevice)(THIS) PURE;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateRenderToEnvMap(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
UINT Size,
|
||||
UINT MipLevels,
|
||||
D3DFORMAT Format,
|
||||
BOOL DepthStencil,
|
||||
D3DFORMAT DepthStencilFormat,
|
||||
LPD3DXRenderToEnvMap* ppRenderToEnvMap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXLine:
|
||||
// ------------
|
||||
// This object intends to provide an easy way to draw lines using D3D.
|
||||
//
|
||||
// Begin -
|
||||
// Prepares device for drawing lines
|
||||
//
|
||||
// Draw -
|
||||
// Draws a line strip in screen-space.
|
||||
// Input is in the form of a array defining points on the line strip. of D3DXVECTOR2
|
||||
//
|
||||
// DrawTransform -
|
||||
// Draws a line in screen-space with a specified input transformation matrix.
|
||||
//
|
||||
// End -
|
||||
// Restores device state to how it was when Begin was called.
|
||||
//
|
||||
// SetPattern -
|
||||
// Applies a stipple pattern to the line. Input is one 32-bit
|
||||
// DWORD which describes the stipple pattern. 1 is opaque, 0 is
|
||||
// transparent.
|
||||
//
|
||||
// SetPatternScale -
|
||||
// Stretches the stipple pattern in the u direction. Input is one
|
||||
// floating-point value. 0.0f is no scaling, whereas 1.0f doubles
|
||||
// the length of the stipple pattern.
|
||||
//
|
||||
// SetWidth -
|
||||
// Specifies the thickness of the line in the v direction. Input is
|
||||
// one floating-point value.
|
||||
//
|
||||
// SetAntialias -
|
||||
// Toggles line antialiasing. Input is a BOOL.
|
||||
// TRUE = Antialiasing on.
|
||||
// FALSE = Antialiasing off.
|
||||
//
|
||||
// SetGLLines -
|
||||
// Toggles non-antialiased OpenGL line emulation. Input is a BOOL.
|
||||
// TRUE = OpenGL line emulation on.
|
||||
// FALSE = OpenGL line emulation off.
|
||||
//
|
||||
// OpenGL line: Regular line:
|
||||
// *\ *\
|
||||
// | \ / \
|
||||
// | \ *\ \
|
||||
// *\ \ \ \
|
||||
// \ \ \ \
|
||||
// \ * \ *
|
||||
// \ | \ /
|
||||
// \| *
|
||||
// *
|
||||
//
|
||||
// OnLostDevice, OnResetDevice -
|
||||
// Call OnLostDevice() on this object before calling Reset() on the
|
||||
// device, so that this object can release any stateblocks and video
|
||||
// memory resources. After Reset(), the call OnResetDevice().
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
typedef interface ID3DXLine ID3DXLine;
|
||||
typedef interface ID3DXLine *LPD3DXLINE;
|
||||
|
||||
|
||||
// {D379BA7F-9042-4ac4-9F5E-58192A4C6BD8}
|
||||
DEFINE_GUID(IID_ID3DXLine,
|
||||
0xd379ba7f, 0x9042, 0x4ac4, 0x9f, 0x5e, 0x58, 0x19, 0x2a, 0x4c, 0x6b, 0xd8);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXLine
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXLine, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// ID3DXLine
|
||||
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
|
||||
|
||||
STDMETHOD(Begin)(THIS) PURE;
|
||||
|
||||
STDMETHOD(Draw)(THIS_ CONST D3DXVECTOR2 *pVertexList,
|
||||
DWORD dwVertexListCount, D3DCOLOR Color) PURE;
|
||||
|
||||
STDMETHOD(DrawTransform)(THIS_ CONST D3DXVECTOR3 *pVertexList,
|
||||
DWORD dwVertexListCount, CONST D3DXMATRIX* pTransform,
|
||||
D3DCOLOR Color) PURE;
|
||||
|
||||
STDMETHOD(SetPattern)(THIS_ DWORD dwPattern) PURE;
|
||||
STDMETHOD_(DWORD, GetPattern)(THIS) PURE;
|
||||
|
||||
STDMETHOD(SetPatternScale)(THIS_ FLOAT fPatternScale) PURE;
|
||||
STDMETHOD_(FLOAT, GetPatternScale)(THIS) PURE;
|
||||
|
||||
STDMETHOD(SetWidth)(THIS_ FLOAT fWidth) PURE;
|
||||
STDMETHOD_(FLOAT, GetWidth)(THIS) PURE;
|
||||
|
||||
STDMETHOD(SetAntialias)(THIS_ BOOL bAntialias) PURE;
|
||||
STDMETHOD_(BOOL, GetAntialias)(THIS) PURE;
|
||||
|
||||
STDMETHOD(SetGLLines)(THIS_ BOOL bGLLines) PURE;
|
||||
STDMETHOD_(BOOL, GetGLLines)(THIS) PURE;
|
||||
|
||||
STDMETHOD(End)(THIS) PURE;
|
||||
|
||||
STDMETHOD(OnLostDevice)(THIS) PURE;
|
||||
STDMETHOD(OnResetDevice)(THIS) PURE;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateLine(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
LPD3DXLINE* ppLine);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3DX9CORE_H__
|
||||
|
||||
873
common/dx11sdk/d3dx9effect.h
Normal file
873
common/dx11sdk/d3dx9effect.h
Normal file
@@ -0,0 +1,873 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: d3dx9effect.h
|
||||
// Content: D3DX effect types and Shaders
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "d3dx9.h"
|
||||
|
||||
#ifndef __D3DX9EFFECT_H__
|
||||
#define __D3DX9EFFECT_H__
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXFX_DONOTSAVESTATE
|
||||
// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag
|
||||
// is specified, device state is not saved or restored in Begin/End.
|
||||
// D3DXFX_DONOTSAVESHADERSTATE
|
||||
// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag
|
||||
// is specified, shader device state is not saved or restored in Begin/End.
|
||||
// This includes pixel/vertex shaders and shader constants
|
||||
// D3DXFX_DONOTSAVESAMPLERSTATE
|
||||
// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag
|
||||
// is specified, sampler device state is not saved or restored in Begin/End.
|
||||
// D3DXFX_NOT_CLONEABLE
|
||||
// This flag is used as a parameter to the D3DXCreateEffect family of APIs.
|
||||
// When this flag is specified, the effect will be non-cloneable and will not
|
||||
// contain any shader binary data.
|
||||
// Furthermore, GetPassDesc will not return shader function pointers.
|
||||
// Setting this flag reduces effect memory usage by about 50%.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#define D3DXFX_DONOTSAVESTATE (1 << 0)
|
||||
#define D3DXFX_DONOTSAVESHADERSTATE (1 << 1)
|
||||
#define D3DXFX_DONOTSAVESAMPLERSTATE (1 << 2)
|
||||
|
||||
#define D3DXFX_NOT_CLONEABLE (1 << 11)
|
||||
#define D3DXFX_LARGEADDRESSAWARE (1 << 17)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DX_PARAMETER_SHARED
|
||||
// Indicates that the value of a parameter will be shared with all effects
|
||||
// which share the same namespace. Changing the value in one effect will
|
||||
// change it in all.
|
||||
//
|
||||
// D3DX_PARAMETER_LITERAL
|
||||
// Indicates that the value of this parameter can be treated as literal.
|
||||
// Literal parameters can be marked when the effect is compiled, and their
|
||||
// cannot be changed after the effect is compiled. Shared parameters cannot
|
||||
// be literal.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#define D3DX_PARAMETER_SHARED (1 << 0)
|
||||
#define D3DX_PARAMETER_LITERAL (1 << 1)
|
||||
#define D3DX_PARAMETER_ANNOTATION (1 << 2)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXEFFECT_DESC:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct _D3DXEFFECT_DESC
|
||||
{
|
||||
LPCSTR Creator; // Creator string
|
||||
UINT Parameters; // Number of parameters
|
||||
UINT Techniques; // Number of techniques
|
||||
UINT Functions; // Number of function entrypoints
|
||||
|
||||
} D3DXEFFECT_DESC;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXPARAMETER_DESC:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct _D3DXPARAMETER_DESC
|
||||
{
|
||||
LPCSTR Name; // Parameter name
|
||||
LPCSTR Semantic; // Parameter semantic
|
||||
D3DXPARAMETER_CLASS Class; // Class
|
||||
D3DXPARAMETER_TYPE Type; // Component type
|
||||
UINT Rows; // Number of rows
|
||||
UINT Columns; // Number of columns
|
||||
UINT Elements; // Number of array elements
|
||||
UINT Annotations; // Number of annotations
|
||||
UINT StructMembers; // Number of structure member sub-parameters
|
||||
DWORD Flags; // D3DX_PARAMETER_* flags
|
||||
UINT Bytes; // Parameter size, in bytes
|
||||
|
||||
} D3DXPARAMETER_DESC;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXTECHNIQUE_DESC:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct _D3DXTECHNIQUE_DESC
|
||||
{
|
||||
LPCSTR Name; // Technique name
|
||||
UINT Passes; // Number of passes
|
||||
UINT Annotations; // Number of annotations
|
||||
|
||||
} D3DXTECHNIQUE_DESC;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXPASS_DESC:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct _D3DXPASS_DESC
|
||||
{
|
||||
LPCSTR Name; // Pass name
|
||||
UINT Annotations; // Number of annotations
|
||||
|
||||
CONST DWORD *pVertexShaderFunction; // Vertex shader function
|
||||
CONST DWORD *pPixelShaderFunction; // Pixel shader function
|
||||
|
||||
} D3DXPASS_DESC;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXFUNCTION_DESC:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct _D3DXFUNCTION_DESC
|
||||
{
|
||||
LPCSTR Name; // Function name
|
||||
UINT Annotations; // Number of annotations
|
||||
|
||||
} D3DXFUNCTION_DESC;
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXEffectPool ///////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3DXEffectPool ID3DXEffectPool;
|
||||
typedef interface ID3DXEffectPool *LPD3DXEFFECTPOOL;
|
||||
|
||||
// {9537AB04-3250-412e-8213-FCD2F8677933}
|
||||
DEFINE_GUID(IID_ID3DXEffectPool,
|
||||
0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33);
|
||||
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXEffectPool
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXEffectPool, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// No public methods
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXBaseEffect ///////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3DXBaseEffect ID3DXBaseEffect;
|
||||
typedef interface ID3DXBaseEffect *LPD3DXBASEEFFECT;
|
||||
|
||||
// {017C18AC-103F-4417-8C51-6BF6EF1E56BE}
|
||||
DEFINE_GUID(IID_ID3DXBaseEffect,
|
||||
0x17c18ac, 0x103f, 0x4417, 0x8c, 0x51, 0x6b, 0xf6, 0xef, 0x1e, 0x56, 0xbe);
|
||||
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXBaseEffect
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown)
|
||||
{
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// Descs
|
||||
STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE;
|
||||
|
||||
// Handle operations
|
||||
STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE;
|
||||
|
||||
// Get/Set Parameters
|
||||
STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE;
|
||||
STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE;
|
||||
STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE;
|
||||
STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE;
|
||||
STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE;
|
||||
STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE;
|
||||
STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE;
|
||||
STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE;
|
||||
STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE;
|
||||
STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE;
|
||||
STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE;
|
||||
STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE;
|
||||
STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE;
|
||||
STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE;
|
||||
STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE;
|
||||
STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE;
|
||||
STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
|
||||
STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE;
|
||||
STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE;
|
||||
STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE;
|
||||
STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE;
|
||||
STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE;
|
||||
STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE;
|
||||
|
||||
//Set Range of an Array to pass to device
|
||||
//Useful for sending only a subrange of an array down to the device
|
||||
STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ID3DXEffectStateManager:
|
||||
// ------------------------
|
||||
// This is a user implemented interface that can be used to manage device
|
||||
// state changes made by an Effect.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef interface ID3DXEffectStateManager ID3DXEffectStateManager;
|
||||
typedef interface ID3DXEffectStateManager *LPD3DXEFFECTSTATEMANAGER;
|
||||
|
||||
// {79AAB587-6DBC-4fa7-82DE-37FA1781C5CE}
|
||||
DEFINE_GUID(IID_ID3DXEffectStateManager,
|
||||
0x79aab587, 0x6dbc, 0x4fa7, 0x82, 0xde, 0x37, 0xfa, 0x17, 0x81, 0xc5, 0xce);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXEffectStateManager
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown)
|
||||
{
|
||||
// The user must correctly implement QueryInterface, AddRef, and Release.
|
||||
|
||||
// IUnknown
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// The following methods are called by the Effect when it wants to make
|
||||
// the corresponding device call. Note that:
|
||||
// 1. Users manage the state and are therefore responsible for making the
|
||||
// the corresponding device calls themselves inside their callbacks.
|
||||
// 2. Effects pay attention to the return values of the callbacks, and so
|
||||
// users must pay attention to what they return in their callbacks.
|
||||
|
||||
STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) PURE;
|
||||
STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9 *pMaterial) PURE;
|
||||
STDMETHOD(SetLight)(THIS_ DWORD Index, CONST D3DLIGHT9 *pLight) PURE;
|
||||
STDMETHOD(LightEnable)(THIS_ DWORD Index, BOOL Enable) PURE;
|
||||
STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State, DWORD Value) PURE;
|
||||
STDMETHOD(SetTexture)(THIS_ DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture) PURE;
|
||||
STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) PURE;
|
||||
STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) PURE;
|
||||
STDMETHOD(SetNPatchMode)(THIS_ FLOAT NumSegments) PURE;
|
||||
STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
|
||||
STDMETHOD(SetVertexShader)(THIS_ LPDIRECT3DVERTEXSHADER9 pShader) PURE;
|
||||
STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE;
|
||||
STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE;
|
||||
STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE;
|
||||
STDMETHOD(SetPixelShader)(THIS_ LPDIRECT3DPIXELSHADER9 pShader) PURE;
|
||||
STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE;
|
||||
STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE;
|
||||
STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXEffect ///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3DXEffect ID3DXEffect;
|
||||
typedef interface ID3DXEffect *LPD3DXEFFECT;
|
||||
|
||||
// {F6CEB4B3-4E4C-40dd-B883-8D8DE5EA0CD5}
|
||||
DEFINE_GUID(IID_ID3DXEffect,
|
||||
0xf6ceb4b3, 0x4e4c, 0x40dd, 0xb8, 0x83, 0x8d, 0x8d, 0xe5, 0xea, 0xc, 0xd5);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXEffect
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect)
|
||||
{
|
||||
// ID3DXBaseEffect
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// Descs
|
||||
STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE;
|
||||
|
||||
// Handle operations
|
||||
STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE;
|
||||
|
||||
// Get/Set Parameters
|
||||
STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE;
|
||||
STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE;
|
||||
STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE;
|
||||
STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE;
|
||||
STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE;
|
||||
STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE;
|
||||
STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE;
|
||||
STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE;
|
||||
STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE;
|
||||
STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE;
|
||||
STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE;
|
||||
STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE;
|
||||
STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE;
|
||||
STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE;
|
||||
STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE;
|
||||
STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE;
|
||||
STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
|
||||
STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE;
|
||||
STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE;
|
||||
STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE;
|
||||
STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE;
|
||||
STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE;
|
||||
STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE;
|
||||
|
||||
//Set Range of an Array to pass to device
|
||||
//Usefull for sending only a subrange of an array down to the device
|
||||
STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE;
|
||||
// ID3DXBaseEffect
|
||||
|
||||
|
||||
// Pool
|
||||
STDMETHOD(GetPool)(THIS_ LPD3DXEFFECTPOOL* ppPool) PURE;
|
||||
|
||||
// Selecting and setting a technique
|
||||
STDMETHOD(SetTechnique)(THIS_ D3DXHANDLE hTechnique) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetCurrentTechnique)(THIS) PURE;
|
||||
STDMETHOD(ValidateTechnique)(THIS_ D3DXHANDLE hTechnique) PURE;
|
||||
STDMETHOD(FindNextValidTechnique)(THIS_ D3DXHANDLE hTechnique, D3DXHANDLE *pTechnique) PURE;
|
||||
STDMETHOD_(BOOL, IsParameterUsed)(THIS_ D3DXHANDLE hParameter, D3DXHANDLE hTechnique) PURE;
|
||||
|
||||
// Using current technique
|
||||
// Begin starts active technique
|
||||
// BeginPass begins a pass
|
||||
// CommitChanges updates changes to any set calls in the pass. This should be called before
|
||||
// any DrawPrimitive call to d3d
|
||||
// EndPass ends a pass
|
||||
// End ends active technique
|
||||
STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE;
|
||||
STDMETHOD(BeginPass)(THIS_ UINT Pass) PURE;
|
||||
STDMETHOD(CommitChanges)(THIS) PURE;
|
||||
STDMETHOD(EndPass)(THIS) PURE;
|
||||
STDMETHOD(End)(THIS) PURE;
|
||||
|
||||
// Managing D3D Device
|
||||
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
|
||||
STDMETHOD(OnLostDevice)(THIS) PURE;
|
||||
STDMETHOD(OnResetDevice)(THIS) PURE;
|
||||
|
||||
// Logging device calls
|
||||
STDMETHOD(SetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER pManager) PURE;
|
||||
STDMETHOD(GetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER *ppManager) PURE;
|
||||
|
||||
// Parameter blocks
|
||||
STDMETHOD(BeginParameterBlock)(THIS) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, EndParameterBlock)(THIS) PURE;
|
||||
STDMETHOD(ApplyParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE;
|
||||
STDMETHOD(DeleteParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE;
|
||||
|
||||
// Cloning
|
||||
STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE9 pDevice, LPD3DXEFFECT* ppEffect) PURE;
|
||||
|
||||
// Fast path for setting variables directly in ID3DXEffect
|
||||
STDMETHOD(SetRawValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT ByteOffset, UINT Bytes) PURE;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ID3DXEffectCompiler ///////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3DXEffectCompiler ID3DXEffectCompiler;
|
||||
typedef interface ID3DXEffectCompiler *LPD3DXEFFECTCOMPILER;
|
||||
|
||||
// {51B8A949-1A31-47e6-BEA0-4B30DB53F1E0}
|
||||
DEFINE_GUID(IID_ID3DXEffectCompiler,
|
||||
0x51b8a949, 0x1a31, 0x47e6, 0xbe, 0xa0, 0x4b, 0x30, 0xdb, 0x53, 0xf1, 0xe0);
|
||||
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXEffectCompiler
|
||||
|
||||
DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect)
|
||||
{
|
||||
// ID3DXBaseEffect
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// Descs
|
||||
STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE;
|
||||
STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE;
|
||||
|
||||
// Handle operations
|
||||
STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE;
|
||||
STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE;
|
||||
|
||||
// Get/Set Parameters
|
||||
STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE;
|
||||
STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE;
|
||||
STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE;
|
||||
STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE;
|
||||
STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE;
|
||||
STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE;
|
||||
STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE;
|
||||
STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE;
|
||||
STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE;
|
||||
STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE;
|
||||
STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE;
|
||||
STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE;
|
||||
STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE;
|
||||
STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE;
|
||||
STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE;
|
||||
STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE;
|
||||
STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
|
||||
STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
|
||||
STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE;
|
||||
STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE;
|
||||
STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE;
|
||||
STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE;
|
||||
STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE;
|
||||
STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE;
|
||||
|
||||
//Set Range of an Array to pass to device
|
||||
//Usefull for sending only a subrange of an array down to the device
|
||||
STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE;
|
||||
// ID3DXBaseEffect
|
||||
|
||||
// Parameter sharing, specialization, and information
|
||||
STDMETHOD(SetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL Literal) PURE;
|
||||
STDMETHOD(GetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL *pLiteral) PURE;
|
||||
|
||||
// Compilation
|
||||
STDMETHOD(CompileEffect)(THIS_ DWORD Flags,
|
||||
LPD3DXBUFFER* ppEffect, LPD3DXBUFFER* ppErrorMsgs) PURE;
|
||||
|
||||
STDMETHOD(CompileShader)(THIS_ D3DXHANDLE hFunction, LPCSTR pTarget, DWORD Flags,
|
||||
LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs, LPD3DXCONSTANTTABLE* ppConstantTable) PURE;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// APIs //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXCreateEffectPool:
|
||||
// ---------------------
|
||||
// Creates an effect pool. Pools are used for sharing parameters between
|
||||
// multiple effects. For all effects within a pool, shared parameters of the
|
||||
// same name all share the same value.
|
||||
//
|
||||
// Parameters:
|
||||
// ppPool
|
||||
// Returns the created pool.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectPool(
|
||||
LPD3DXEFFECTPOOL* ppPool);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXCreateEffect:
|
||||
// -----------------
|
||||
// Creates an effect from an ascii or binary effect description.
|
||||
//
|
||||
// Parameters:
|
||||
// pDevice
|
||||
// Pointer of the device on which to create the effect
|
||||
// pSrcFile
|
||||
// Name of the file containing the effect description
|
||||
// hSrcModule
|
||||
// Module handle. if NULL, current module will be used.
|
||||
// pSrcResource
|
||||
// Resource name in module
|
||||
// pSrcData
|
||||
// Pointer to effect description
|
||||
// SrcDataSize
|
||||
// Size of the effect description in bytes
|
||||
// pDefines
|
||||
// Optional NULL-terminated array of preprocessor macro definitions.
|
||||
// Flags
|
||||
// See D3DXSHADER_xxx flags.
|
||||
// pSkipConstants
|
||||
// A list of semi-colon delimited variable names. The effect will
|
||||
// not set these variables to the device when they are referenced
|
||||
// by a shader. NOTE: the variables specified here must be
|
||||
// register bound in the file and must not be used in expressions
|
||||
// in passes or samplers or the file will not load.
|
||||
// pInclude
|
||||
// Optional interface pointer to use for handling #include directives.
|
||||
// If this parameter is NULL, #includes will be honored when compiling
|
||||
// from file, and will error when compiling from resource or memory.
|
||||
// pPool
|
||||
// Pointer to ID3DXEffectPool object to use for shared parameters.
|
||||
// If NULL, no parameters will be shared.
|
||||
// ppEffect
|
||||
// Returns a buffer containing created effect.
|
||||
// ppCompilationErrors
|
||||
// Returns a buffer containing any error messages which occurred during
|
||||
// compile. Or NULL if you do not care about the error messages.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectFromFileA(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
LPCSTR pSrcFile,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectFromFileW(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
LPCWSTR pSrcFile,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW
|
||||
#else
|
||||
#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectFromResourceA(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCSTR pSrcResource,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectFromResourceW(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCWSTR pSrcResource,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW
|
||||
#else
|
||||
#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffect(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
LPCVOID pSrcData,
|
||||
UINT SrcDataLen,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
//
|
||||
// Ex functions that accept pSkipConstants in addition to other parameters
|
||||
//
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectFromFileExA(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
LPCSTR pSrcFile,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
LPCSTR pSkipConstants,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectFromFileExW(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
LPCWSTR pSrcFile,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
LPCSTR pSkipConstants,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExW
|
||||
#else
|
||||
#define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectFromResourceExA(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCSTR pSrcResource,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
LPCSTR pSkipConstants,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectFromResourceExW(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
HMODULE hSrcModule,
|
||||
LPCWSTR pSrcResource,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
LPCSTR pSkipConstants,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExW
|
||||
#else
|
||||
#define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectEx(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
LPCVOID pSrcData,
|
||||
UINT SrcDataLen,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
LPCSTR pSkipConstants,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTPOOL pPool,
|
||||
LPD3DXEFFECT* ppEffect,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXCreateEffectCompiler:
|
||||
// -------------------------
|
||||
// Creates an effect from an ascii or binary effect description.
|
||||
//
|
||||
// Parameters:
|
||||
// pSrcFile
|
||||
// Name of the file containing the effect description
|
||||
// hSrcModule
|
||||
// Module handle. if NULL, current module will be used.
|
||||
// pSrcResource
|
||||
// Resource name in module
|
||||
// pSrcData
|
||||
// Pointer to effect description
|
||||
// SrcDataSize
|
||||
// Size of the effect description in bytes
|
||||
// pDefines
|
||||
// Optional NULL-terminated array of preprocessor macro definitions.
|
||||
// pInclude
|
||||
// Optional interface pointer to use for handling #include directives.
|
||||
// If this parameter is NULL, #includes will be honored when compiling
|
||||
// from file, and will error when compiling from resource or memory.
|
||||
// pPool
|
||||
// Pointer to ID3DXEffectPool object to use for shared parameters.
|
||||
// If NULL, no parameters will be shared.
|
||||
// ppCompiler
|
||||
// Returns a buffer containing created effect compiler.
|
||||
// ppParseErrors
|
||||
// Returns a buffer containing any error messages which occurred during
|
||||
// parse. Or NULL if you do not care about the error messages.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectCompilerFromFileA(
|
||||
LPCSTR pSrcFile,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTCOMPILER* ppCompiler,
|
||||
LPD3DXBUFFER* ppParseErrors);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectCompilerFromFileW(
|
||||
LPCWSTR pSrcFile,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTCOMPILER* ppCompiler,
|
||||
LPD3DXBUFFER* ppParseErrors);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileW
|
||||
#else
|
||||
#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectCompilerFromResourceA(
|
||||
HMODULE hSrcModule,
|
||||
LPCSTR pSrcResource,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTCOMPILER* ppCompiler,
|
||||
LPD3DXBUFFER* ppParseErrors);
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectCompilerFromResourceW(
|
||||
HMODULE hSrcModule,
|
||||
LPCWSTR pSrcResource,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTCOMPILER* ppCompiler,
|
||||
LPD3DXBUFFER* ppParseErrors);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceW
|
||||
#else
|
||||
#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceA
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXCreateEffectCompiler(
|
||||
LPCSTR pSrcData,
|
||||
UINT SrcDataLen,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXEFFECTCOMPILER* ppCompiler,
|
||||
LPD3DXBUFFER* ppParseErrors);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3DXDisassembleEffect:
|
||||
// -----------------------
|
||||
//
|
||||
// Parameters:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXDisassembleEffect(
|
||||
LPD3DXEFFECT pEffect,
|
||||
BOOL EnableColorCode,
|
||||
LPD3DXBUFFER *ppDisassembly);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3DX9EFFECT_H__
|
||||
|
||||
|
||||
1796
common/dx11sdk/d3dx9math.h
Normal file
1796
common/dx11sdk/d3dx9math.h
Normal file
File diff suppressed because it is too large
Load Diff
2251
common/dx11sdk/d3dx9math.inl
Normal file
2251
common/dx11sdk/d3dx9math.inl
Normal file
File diff suppressed because it is too large
Load Diff
3007
common/dx11sdk/d3dx9mesh.h
Normal file
3007
common/dx11sdk/d3dx9mesh.h
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user