diff --git a/Ashita.dll b/Ashita.dll index f748585..f4df7f2 100644 Binary files a/Ashita.dll and b/Ashita.dll differ diff --git a/ffxi-bootmod/pol.exe b/ffxi-bootmod/pol.exe new file mode 100644 index 0000000..78a6b02 Binary files /dev/null and b/ffxi-bootmod/pol.exe differ diff --git a/injector.exe b/injector.exe new file mode 100644 index 0000000..1635670 Binary files /dev/null and b/injector.exe differ diff --git a/plugins/ADK/AS_BinaryData.h b/plugins/ADK/AS_BinaryData.h new file mode 100644 index 0000000..8e4a1df --- /dev/null +++ b/plugins/ADK/AS_BinaryData.h @@ -0,0 +1,267 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_BINARYDATA_H_INCLUDED__ +#define __ASHITA_AS_BINARYDATA_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/** + * Credits to the original ProjectXI team for these functions which is where they have + * originated from. (See CBasePacket of the ProjectXI source code base.) + */ + +namespace Ashita +{ + class BinaryData + { + public: + /** + * Packs data into the given buffer. (Big Endian) + */ + static uint32_t PackBitsBE(uint8_t* data, uint64_t value, uint32_t offset, uint8_t len) + { + return PackBitsBE(data, value, 0, offset, len); + } + + /** + * Packs data into the given buffer. (Big Endian) + */ + static uint32_t PackBitsBE(uint8_t* data, uint64_t value, uint32_t byteOffset, uint32_t bitOffset, uint8_t len) + { + byteOffset += bitOffset >> 3; + bitOffset %= 8; + + auto bitmask = (uint64_t)0xFFFFFFFFFFFFFFFFLL; + bitmask >>= 64 - len; + bitmask <<= bitOffset; + value <<= bitOffset; + value &= bitmask; + bitmask ^= 0xFFFFFFFFFFFFFFFFLL; + + if (len + bitOffset <= 8) + { + auto dataPointer = (uint8_t*)&data[byteOffset]; + auto bitmaskUC = (uint8_t)bitmask; + auto valueUC = (uint8_t)value; + *dataPointer &= bitmaskUC; + *dataPointer |= valueUC; + } + else if (len + bitOffset <= 16) + { + auto dataPointer = (uint16_t*)&data[byteOffset]; + auto bitmaskUC = (uint16_t)bitmask; + auto valueUC = (uint16_t)value; + *dataPointer &= bitmaskUC; + *dataPointer |= valueUC; + } + else if (len + bitOffset <= 32) + { + auto dataPointer = (uint32_t*)&data[byteOffset]; + auto bitmaskUC = (uint32_t)bitmask; + auto valueUC = (uint32_t)value; + *dataPointer &= bitmaskUC; + *dataPointer |= valueUC; + } + else if (len + bitOffset <= 64) + { + auto dataPointer = (uint64_t*)&data[byteOffset]; + *dataPointer &= bitmask; + *dataPointer |= value; + } + else + { + // We should not get here.. an error occurred.. + // data size > 64bits + } + + return (byteOffset << 3) + bitOffset + len; + } + + /** + * Unpacks data from the given buffer. (Big Endian) + */ + static uint64_t UnpackBitsBE(uint8_t* data, uint32_t offset, uint8_t len) + { + return UnpackBitsBE(data, 0, offset, len); + } + + /** + * Unpacks data from the given buffer. (Big Endian) + */ + static uint64_t UnpackBitsBE(uint8_t* data, uint32_t byteOffset, uint32_t bitOffset, uint8_t len) + { + byteOffset += (bitOffset >> 3); + bitOffset %= 8; + + uint64_t retVal; + auto bitmask = (uint64_t)0xFFFFFFFFFFFFFFFFLL; + bitmask >>= (64 - len); + bitmask <<= bitOffset; + + if (len + bitOffset <= 8) + { + auto dataPointer = (uint8_t*)&data[byteOffset]; + retVal = (*dataPointer&(uint8_t)bitmask) >> bitOffset; + } + else if (len + bitOffset <= 16) + { + auto dataPointer = (uint16_t*)&data[byteOffset]; + retVal = (*dataPointer&(uint16_t)bitmask) >> bitOffset; + } + else if (len + bitOffset <= 32) + { + auto dataPointer = (uint32_t*)&data[byteOffset]; + retVal = (*dataPointer&(uint32_t)bitmask) >> bitOffset; + } + else if (len + bitOffset <= 64) + { + auto dataPointer = (uint64_t*)&data[byteOffset]; + retVal = (*dataPointer&(uint64_t)bitmask) >> bitOffset; + } + else + { + // We should not get here.. an error occurred.. + // data size > 64bits + return 0; + } + + return retVal; + } + + /** + * Packs data into the given buffer. (Little Endian) + */ + static uint32_t PackBitsLE(uint8_t* data, uint64_t value, uint32_t offset, uint8_t len) + { + return PackBitsLE(data, value, 0, offset, len); + } + + /** + * Packs data into the given buffer. (Little Endian) + */ + static uint32_t PackBitsLE(uint8_t* data, uint64_t value, uint32_t byteOffset, uint32_t bitOffset, uint8_t len) + { + byteOffset += bitOffset >> 3; + bitOffset %= 8; + + uint8_t bytesNeeded; + if (bitOffset + len <= 8) + bytesNeeded = 1; + else if (bitOffset + len <= 16) + bytesNeeded = 2; + else if (bitOffset + len <= 32) + bytesNeeded = 4; + else if (bitOffset + len <= 64) + bytesNeeded = 8; + else + { + // We should not get here.. an error occurred.. + // data size > 64bits + return 0; + } + + auto modifieddata = new uint8_t[bytesNeeded]; + for (uint8_t curByte = 0; curByte < bytesNeeded; ++curByte) + { + modifieddata[curByte] = data[byteOffset + (bytesNeeded - 1) - curByte]; + } + + int newBitOffset = (bytesNeeded << 3) - (bitOffset + len); + PackBitsBE(&modifieddata[0], value, 0, newBitOffset, len); + + for (uint8_t curByte = 0; curByte < bytesNeeded; ++curByte) + { + data[byteOffset + (bytesNeeded - 1) - curByte] = modifieddata[curByte]; + } + + if (modifieddata) + delete[] modifieddata; + + return (byteOffset << 3) + bitOffset + len; + } + + /** + * Unpacks data from the given buffer. (Little Endian) + */ + static uint64_t UnpackBitsLE(uint8_t* data, uint32_t offset, uint8_t len) + { + return UnpackBitsLE(data, 0, offset, len); + } + + /** + * Unpacks data from the given buffer. (Little Endian) + */ + static uint64_t UnpackBitsLE(uint8_t* data, uint32_t byteOffset, uint32_t bitOffset, uint8_t len) + { + byteOffset += bitOffset >> 3; + bitOffset %= 8; + + uint8_t bytesNeeded; + if (bitOffset + len <= 8) + bytesNeeded = 1; + else if (bitOffset + len <= 16) + bytesNeeded = 2; + else if (bitOffset + len <= 32) + bytesNeeded = 4; + else if (bitOffset + len <= 64) + bytesNeeded = 8; + else + { + // We should not get here.. an error occurred.. + // data size > 64bits + return 0; + } + + uint64_t retVal; + + auto modifieddata = new uint8_t[bytesNeeded]; + for (uint8_t curByte = 0; curByte < bytesNeeded; ++curByte) + { + modifieddata[curByte] = data[byteOffset + (bytesNeeded - 1) - curByte]; + } + + if (bytesNeeded == 1) + { + uint8_t bitmask = 0xFF >> bitOffset; + retVal = (modifieddata[0] & bitmask) >> (8 - (len + bitOffset)); + } + else + { + int newBitOffset = (bytesNeeded * 8) - (bitOffset + len); + retVal = UnpackBitsBE(&modifieddata[0], 0, newBitOffset, len); + } + + if (modifieddata) + delete[] modifieddata; + + return retVal; + } + }; +}; // Ashita + +#endif // __ASHITA_AS_BINARYDATA_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/AS_CommandParser.h b/plugins/ADK/AS_CommandParser.h new file mode 100644 index 0000000..87bf6d2 --- /dev/null +++ b/plugins/ADK/AS_CommandParser.h @@ -0,0 +1,232 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_COMMANDPARSER_H_INCLUDED__ +#define __ASHITA_AS_COMMANDPARSER_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include +#include + +// Helper Macros +#define HANDLECOMMAND_GA(arg1, arg2, arg3, arg4, arg5, arg6, ...) arg6 +#define HANDLECOMMAND_01(a) Ashita::CommandParser::__command_parse(args[0].c_str(), a) +#define HANDLECOMMAND_02(a, b) Ashita::CommandParser::__command_parse(args[0].c_str(), a, b) +#define HANDLECOMMAND_03(a, b, c) Ashita::CommandParser::__command_parse(args[0].c_str(), a, b, c) +#define HANDLECOMMAND_04(a, b, c, d) Ashita::CommandParser::__command_parse(args[0].c_str(), a, b, c, d) +#define HANDLECOMMAND_05(a, b, c, d, e) Ashita::CommandParser::__command_parse(args[0].c_str(), a, b, c, d, e) +#define HANDLECOMMAND_CC(...) HANDLECOMMAND_GA(__VA_ARGS__, HANDLECOMMAND_05, HANDLECOMMAND_04, HANDLECOMMAND_03, HANDLECOMMAND_02, HANDLECOMMAND_01,) +#define HANDLECOMMAND(...) if(args.size() > 0 && HANDLECOMMAND_CC(__VA_ARGS__)(__VA_ARGS__)) + +namespace Ashita +{ + namespace CommandParser + { + /** + * Compares a command to a subarg to determine if they match. + * + * @param {const char*} cmd - The command to compare against + * @param {const char*} arg1 - The argument to compare to. + * @returns {bool} True if matches, false otherwise. + */ + static bool __forceinline __command_cmp(const char* cmd, const char* arg1) + { + if (cmd == nullptr || arg1 == nullptr) + return false; + return (_stricmp(cmd, arg1) == 0); + } + + /** + * Compares a command to a subarg to determine if they match. + * + * @param {const char*} cmd - The command to compare against + * @param {const char*} arg1 - The argument to compare to. + * @returns {bool} True if matches, false otherwise. + */ + template + static bool __command_parse(T cmd, T arg1) + { + return __command_cmp(cmd, arg1); + } + + /** + * Compares a command to subargs to determine if either match. + * + * @param {const char*} cmd - The command to compare against + * @param {const char*} arg1 - The argument to compare to. + * @param {const char*} arg2 - The argument to compare to. + * @returns {bool} True if matches, false otherwise. + */ + template + static bool __command_parse(T cmd, T arg1, T arg2) + { + return __command_cmp(cmd, arg1) || __command_cmp(cmd, arg2); + } + + /** + * Compares a command to subargs to determine if either match. + * + * @param {const char*} cmd - The command to compare against + * @param {const char*} arg1 - The argument to compare to. + * @param {const char*} arg2 - The argument to compare to. + * @param {const char*} arg3 - The argument to compare to. + * @returns {bool} True if matches, false otherwise. + */ + template + static bool __command_parse(T cmd, T arg1, T arg2, T arg3) + { + return __command_cmp(cmd, arg1) || __command_cmp(cmd, arg2) || __command_cmp(cmd, arg3); + } + + /** + * Compares a command to subargs to determine if either match. + * + * @param {const char*} cmd - The command to compare against + * @param {const char*} arg1 - The argument to compare to. + * @param {const char*} arg2 - The argument to compare to. + * @param {const char*} arg3 - The argument to compare to. + * @param {const char*} arg4 - The argument to compare to. + * @returns {bool} True if matches, false otherwise. + */ + template + static bool __command_parse(T cmd, T arg1, T arg2, T arg3, T arg4) + { + return __command_cmp(cmd, arg1) || __command_cmp(cmd, arg2) || __command_cmp(cmd, arg3) || __command_cmp(cmd, arg4); + } + + /** + * Compares a command to subargs to determine if either match. + * + * @param {const char*} cmd - The command to compare against + * @param {const char*} arg1 - The argument to compare to. + * @param {const char*} arg2 - The argument to compare to. + * @param {const char*} arg3 - The argument to compare to. + * @param {const char*} arg4 - The argument to compare to. + * @param {const char*} arg5 - The argument to compare to. + * @returns {bool} True if matches, false otherwise. + */ + template + static bool __command_parse(T cmd, T arg1, T arg2, T arg3, T arg4, T arg5) + { + return __command_cmp(cmd, arg1) || __command_cmp(cmd, arg2) || __command_cmp(cmd, arg3) || __command_cmp(cmd, arg4) || __command_cmp(cmd, arg5); + } + }; // namespace CommandParser + + namespace Commands + { + /** + * Determines if the given character is a space character. + * (Used to avoid CRT asserts.) + * + * @param {char} c - The character to check. + * @returns {bool} True if a space char, false otherwise. + */ + static __forceinline bool _isspace(char c) + { + auto num = (int32_t)c; + + // Checks for the following: ' ', \t \n \v \f \r + if (num == 0x20 || num == 0x09 || num == 0x0A || num == 0x0B || num == 0x0C || num == 0x0D) + return true; + return false; + } + + /** + * Obtains the command arguments from the given raw command. + * + * @param {const char*} command - The command to parse for arguments. + * @param {std::vector} args - The return vector to hold the found arguments. + * @returns {uint32_t} The number of arguments parsed from the command. + */ + static uint32_t GetCommandArgs(const char* command, std::vector* args) + { + // The current parsing state we are in.. + enum { NONE, IN_WORD, IN_STRING } state = NONE; + + char currentArgument[255] = { 0 }; + auto p = command; + char *pStart = nullptr; + + // Walk the string to locate arguments.. + for (; *p != 0; ++p) + { + // Obtain the current character.. + auto currChar = (char)*p; + + // Handle the current state.. + switch (state) + { + case NONE: + if (Ashita::Commands::_isspace(currChar)) + continue; + if (currChar == '"') + { + state = IN_STRING; + pStart = (char*)p + 1; + continue; + } + state = IN_WORD; + pStart = (char*)p; + continue; + + case IN_STRING: + if (currChar == '"') + { + strncpy_s(currentArgument, pStart, p - pStart); + args->push_back(std::string(currentArgument)); + state = NONE; + pStart = nullptr; + } + continue; + + case IN_WORD: + if (Ashita::Commands::_isspace(currChar)) + { + strncpy_s(currentArgument, pStart, p - pStart); + args->push_back(std::string(currentArgument)); + state = NONE; + pStart = nullptr; + } + continue; + } + } + + // Add any left-over words.. + if (pStart != nullptr) + { + strncpy_s(currentArgument, pStart, p - pStart); + args->push_back(std::string(currentArgument)); + } + + // Return the number of found arguments.. + return args->size(); + } + }; // namespace Commands +}; // namespace Ashita + +#endif // __ASHITA_AS_COMMANDPARSER_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/AS_Event.h b/plugins/ADK/AS_Event.h new file mode 100644 index 0000000..c813e5c --- /dev/null +++ b/plugins/ADK/AS_Event.h @@ -0,0 +1,103 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_EVENT_H_INCLUDED__ +#define __ASHITA_AS_EVENT_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include + +namespace Ashita +{ + namespace Threading + { + class AS_Event + { + HANDLE m_EventHandle; + + public: + /** + * Constructor and Deconstructor + */ + explicit AS_Event(bool manualReset = true) + { + this->m_EventHandle = ::CreateEvent(nullptr, manualReset, FALSE, nullptr); + } + virtual AS_Event::~AS_Event(void) + { + if (this->m_EventHandle != nullptr) + ::CloseHandle(this->m_EventHandle); + this->m_EventHandle = nullptr; + } + + public: + /** + * Resets the event to its default state. + * + * @returns {bool} True on success, false otherwise. + */ + bool Reset(void) + { + return ::ResetEvent(this->m_EventHandle) ? true : false; + } + + /** + * Raises the events signal. + * + * @returns {bool} True on success, false otherwise. + */ + bool Raise(void) + { + return (::SetEvent(this->m_EventHandle) ? true : false); + } + + /** + * Determines if the event is signaled. + * + * @returns {bool} True on success, false otherwise. + */ + bool IsSignaled(void) const + { + return (::WaitForSingleObject(this->m_EventHandle, 0) == WAIT_OBJECT_0); + } + + /** + * Waits for the event to be signaled. + * + * @param {uint32_t} milliseconds - The amount of time, in milliseconds, to wait. + * @returns {bool} True on success, false otherwise. + */ + bool WaitForEvent(uint32_t milliseconds) const + { + return (::WaitForSingleObject(this->m_EventHandle, milliseconds) == WAIT_OBJECT_0); + } + }; + }; // namespace Threading +}; // namespace Ashita + +#endif // __ASHITA_AS_EVENT_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/AS_Exception.h b/plugins/ADK/AS_Exception.h new file mode 100644 index 0000000..083e5b7 --- /dev/null +++ b/plugins/ADK/AS_Exception.h @@ -0,0 +1,149 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_EXCEPTION_H_INCLUDED__ +#define __ASHITA_AS_EXCEPTION_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include +#include + +// Missing Status Code Defines +#ifndef STATUS_POSSIBLE_DEADLOCK +#define STATUS_POSSIBLE_DEADLOCK 0xC0000194 +#endif + +// Macro For Handling Exception Cases +#define CASE(Exception) \ + case Exception: \ + this->m_Exception = #Exception; \ + break; + +namespace Ashita +{ + namespace Exception + { + class AS_Exception + { + uint32_t m_ExceptionId; + const char* m_Exception; + + public: + /** + * Constructor and Deconstructor + */ + explicit AS_Exception(uint32_t id) + : m_ExceptionId(id) + , m_Exception(nullptr) + { + switch (this->m_ExceptionId) + { + CASE(EXCEPTION_ACCESS_VIOLATION); + CASE(EXCEPTION_ARRAY_BOUNDS_EXCEEDED); + CASE(EXCEPTION_BREAKPOINT); + CASE(EXCEPTION_DATATYPE_MISALIGNMENT); + CASE(EXCEPTION_FLT_DENORMAL_OPERAND); + CASE(EXCEPTION_FLT_DIVIDE_BY_ZERO); + CASE(EXCEPTION_FLT_INEXACT_RESULT); + CASE(EXCEPTION_FLT_INVALID_OPERATION); + CASE(EXCEPTION_FLT_OVERFLOW); + CASE(EXCEPTION_FLT_STACK_CHECK); + CASE(EXCEPTION_FLT_UNDERFLOW); + CASE(EXCEPTION_GUARD_PAGE); + CASE(EXCEPTION_ILLEGAL_INSTRUCTION); + CASE(EXCEPTION_IN_PAGE_ERROR); + CASE(EXCEPTION_INT_DIVIDE_BY_ZERO); + CASE(EXCEPTION_INT_OVERFLOW); + CASE(EXCEPTION_INVALID_DISPOSITION); + CASE(EXCEPTION_INVALID_HANDLE); + CASE(EXCEPTION_NONCONTINUABLE_EXCEPTION); + CASE(EXCEPTION_POSSIBLE_DEADLOCK); + CASE(EXCEPTION_PRIV_INSTRUCTION); + CASE(EXCEPTION_SINGLE_STEP); + CASE(EXCEPTION_STACK_OVERFLOW); + + default: + this->m_Exception = "Unknown exception occurred."; + break; + } + } + ~AS_Exception(void) { } + + public: + /** + * Returns the exception id of the current wrapped exception. + * + * @returns {uint32_t} The exception id. + */ + uint32_t GetExceptionId(void) const + { + return this->m_ExceptionId; + } + const char* GetException(void) const + { + return this->m_Exception; + } + }; + + class ScopedTranslator + { + _se_translator_function m_Function; + + public: + /** + * Constructor and Deconstructor + */ + ScopedTranslator(void) + { + this->m_Function = ::_set_se_translator(&ScopedTranslator::ScopedTranslatorFunc); + } + ~ScopedTranslator(void) + { + if (this->m_Function != nullptr) + ::_set_se_translator(this->m_Function); + this->m_Function = nullptr; + } + + private: + /** + * Exception translation function used to convert a C structured exception to a C++ typed exception. + * (Used to wrap the exception into our custom exception object.) + * + * @param {uint32_t} id - The id of the exception being wrapped. + * @param {EXCEPTION_POINTERS*} pointers - The pointer information of the exception being handled. + */ + static void ScopedTranslatorFunc(uint32_t id, struct _EXCEPTION_POINTERS* pointers) + { + UNREFERENCED_PARAMETER(pointers); + throw AS_Exception(id); + } + }; + }; // namespace Exception +}; // namespace Ashita + +#endif // __ASHITA_AS_EXCEPTION_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/AS_LockableObject.h b/plugins/ADK/AS_LockableObject.h new file mode 100644 index 0000000..027f619 --- /dev/null +++ b/plugins/ADK/AS_LockableObject.h @@ -0,0 +1,79 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_LOCKABLEOBJECT_H_INCLUDED__ +#define __ASHITA_AS_LOCKABLEOBJECT_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include + +namespace Ashita +{ + namespace Threading + { + class AS_LockableObject + { + CRITICAL_SECTION m_CriticalSection; + + // Delete the copy constructor. + AS_LockableObject(const AS_LockableObject& obj) = delete; + + public: + /** + * Constructor and Deconstructor + */ + AS_LockableObject(void) + { + ::InitializeCriticalSection(&this->m_CriticalSection); + } + virtual AS_LockableObject::~AS_LockableObject(void) + { + ::DeleteCriticalSection(&this->m_CriticalSection); + } + + public: + /** + * Locks the object for exclusive usage. + */ + void Lock(void) + { + ::EnterCriticalSection(&this->m_CriticalSection); + } + + /** + * Unlocks the object from exclusive usage. + */ + void Unlock(void) + { + ::LeaveCriticalSection(&this->m_CriticalSection); + } + }; + }; // namespace Threading +}; // namespace Ashita + +#endif // __ASHITA_AS_LOCKABLEOBJECT_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/AS_Memory.h b/plugins/ADK/AS_Memory.h new file mode 100644 index 0000000..763b0f2 --- /dev/null +++ b/plugins/ADK/AS_Memory.h @@ -0,0 +1,126 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_MEMORY_H_INCLUDED__ +#define __ASHITA_AS_MEMORY_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include +#include +#include +#include + +namespace Ashita +{ + class Memory + { + public: + /** + * Locates a pattern of data within a large block of memory. + * + * @param {std::vector} data - The data to scan for the pattern within. + * @param {uintptr_t} baseAddress - The base address to add to the offset when the pattern is found. + * @param {const char*} pattern - The pattern to scan for. + * @param {uintptr_t} offset - The offset to add after the pattern has been found. + * @param {uintptr_t} count - The result count to use if the pattern is found multiple times. + * @returns {uintptr_t} The address where the pattern was located, 0 otherwise. + */ + static uintptr_t FindPattern(std::vector data, uintptr_t baseAddress, const char* pattern, uintptr_t offset, uintptr_t count) + { + // Ensure the incoming pattern is properly aligned.. + if (strlen(pattern) % 2 > 0) + return 0; + + // Convert the pattern to a vector of data.. + std::vector> vpattern; + for (size_t x = 0, y = strlen(pattern) / 2; x < y; x++) + { + // Obtain the current byte.. + std::stringstream stream(std::string(pattern + (x * 2), 2)); + + // Check if this is a wildcard.. + if (stream.str() == "??") + vpattern.push_back(std::make_pair(00, false)); + else + { + auto byte = strtol(stream.str().c_str(), nullptr, 16); + vpattern.push_back(std::make_pair((uint8_t)byte, true)); + } + } + + auto scanStart = data.begin(); + auto result = (uintptr_t)0; + + while (true) + { + // Search for the pattern.. + auto ret = std::search(scanStart, data.end(), vpattern.begin(), vpattern.end(), + [&](uint8_t curr, std::pair currPattern) + { + return (!currPattern.second) || curr == currPattern.first; + }); + + // Did we find a match.. + if (ret != data.end()) + { + // If we hit the usage count, return the result.. + if (result == count || count == 0) + return (std::distance(data.begin(), ret) + baseAddress) + offset; + + // Increment the found count and scan again.. + ++result; + scanStart = ++ret; + } + else + break; + } + + return 0; + } + + /** + * Obtains the calling module handle for the given address. + * + * @param {uintptr_t} returnAddress - The address to locate the module owner of. + * @returns {HMODULE} The module handle if found, nullptr otherwise. + */ + static HMODULE __stdcall GetCallingModule(uintptr_t returnAddress) + { + if (returnAddress == 0) + return nullptr; + + MEMORY_BASIC_INFORMATION mbi = { 0 }; + if (::VirtualQuery((LPCVOID)returnAddress, &mbi, sizeof(MEMORY_BASIC_INFORMATION)) == sizeof(MEMORY_BASIC_INFORMATION)) + return (HMODULE)mbi.AllocationBase; + + return nullptr; + } + }; +}; // namespace Ashita + +#endif // __ASHITA_AS_MEMORY_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/AS_Objects.h b/plugins/ADK/AS_Objects.h new file mode 100644 index 0000000..dcb08e9 --- /dev/null +++ b/plugins/ADK/AS_Objects.h @@ -0,0 +1,128 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_OBJECTS_H_INCLUDED__ +#define __ASHITA_AS_OBJECTS_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include + +namespace Ashita +{ + typedef struct tagAS_Rect + { + uint32_t x, y, w, h; + + tagAS_Rect(void) + : x(0), y(0), w(0), h(0) + { } + tagAS_Rect(uint32_t nW, uint32_t nH) + : x(0), y(0), w(nW), h(nH) + { } + tagAS_Rect(uint32_t nX, uint32_t nY, uint32_t nW, uint32_t nH) + : x(nX), y(nY), w(nW), h(nH) + { } + explicit tagAS_Rect(const RECT& r) + : x(r.left), y(r.top), w(r.right - r.left), h(r.bottom - r.top) + { } + + // Assignment operator overload. + tagAS_Rect operator= (const tagAS_Rect& r) + { + this->x = r.x; + this->y = r.y; + this->w = r.w; + this->h = r.h; + + return *this; + } + // Addition operator overload. + tagAS_Rect operator+ (const tagAS_Rect& r) + { + this->x += r.x; + this->y += r.y; + this->w += r.w; + this->h += r.h; + + return *this; + } + // Subtraction operator overload. + tagAS_Rect operator- (const tagAS_Rect& r) + { + this->x -= r.x; + this->y -= r.y; + this->w -= r.w; + this->h -= r.h; + + return *this; + } + + // Equality operator overload. + bool operator== (const tagAS_Rect& r) const + { + return this->x == r.x && this->y == r.y && this->w == r.w && this->h == r.h; + } + + // Non-Equality opreator overload. + bool operator!= (const tagAS_Rect& r) const + { + return !(*this == r); + } + } asrect_t; + + typedef struct tagAS_WindowInfo + { + HWND Hwnd; + uint32_t Style; + uint32_t StyleEx; + asrect_t WindowRect; + + tagAS_WindowInfo(void) + : Hwnd(nullptr), Style(0), StyleEx(0), WindowRect(0, 0, 0, 0) + { } + tagAS_WindowInfo(HWND hWnd, uint32_t dwStyle, uint32_t dwStyleEx, int32_t x, int32_t y, int32_t w, int32_t h) + : Hwnd(hWnd), Style(dwStyle), StyleEx(dwStyleEx), WindowRect(x, y, w, h) + { } + + /** + * Resets the window information class. + */ + void Reset(void) + { + this->Hwnd = nullptr; + this->Style = 0; + this->StyleEx = 0; + this->WindowRect.x = 0; + this->WindowRect.y = 0; + this->WindowRect.w = 0; + this->WindowRect.h = 0; + } + } aswindowinfo_t; +}; // namespace Ashita + +#endif // __ASHITA_AS_OBJECTS_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/AS_Registry.h b/plugins/ADK/AS_Registry.h new file mode 100644 index 0000000..93348ce --- /dev/null +++ b/plugins/ADK/AS_Registry.h @@ -0,0 +1,141 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_REGISTRY_H_INCLUDED__ +#define __ASHITA_AS_REGISTRY_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include + +namespace Ashita +{ + /** + * Language Id Enumeration + */ + enum class LanguageId : uint32_t { + Default = 0, + Japanese = 1, + English = 2, + European = 3 + }; + + /** + * Install Path Id Enumeration + */ + enum class SquareEnixEntity : uint32_t { + PlayOnline = 0, + FinalFantasyXI = 1, + FinalFantasyXI_TestClient = 2, + TetraMaster = 3 + }; + + class Registry + { + public: + /** + * Obtains the install path for the given Square Enix entity. + * + * @param {LanguageId} langId - The language id to use for looking up the proper registry key parent. + * @param {SquareEnixEntity} entity - The Square Enix entity id to lookup. + * @param {LPSTR} buffer - The output buffer to hold the path. + * @param {uint32_t} - The maximum size of the buffer. + * @returns {bool} True on success, false otherwise. + */ + static bool GetInstallPath(LanguageId langId, SquareEnixEntity entity, LPSTR buffer, uint32_t bufferSize) + { + // Ensure the language id is within a valid range.. + if ((uint32_t)langId < 0 || (uint32_t)langId > 4) + return false; + + const char languageTags[4][255] = { "US", "", "US", "EU" }; + const char installFolder[4][255] = { "1000", "0001", "0015", "0002" }; + + // Build the registry key to read from.. + char registryPath[MAX_PATH] = { 0 }; + sprintf_s(registryPath, MAX_PATH, "SOFTWARE\\PlayOnline%s\\InstallFolder", languageTags[(uint32_t)langId]); + + // Open the key for reading.. + HKEY key = nullptr; + if (!(::RegOpenKeyExA(HKEY_LOCAL_MACHINE, registryPath, 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &key) == ERROR_SUCCESS)) + return false; + + // Read the install path from the registry.. + char installPath[MAX_PATH] = { 0 }; + DWORD size = MAX_PATH; + DWORD type = REG_DWORD; + if (!(::RegQueryValueExA(key, installFolder[(uint32_t)entity], nullptr, &type, (LPBYTE)installPath, &size) == ERROR_SUCCESS)) + { + ::RegCloseKey(key); + return false; + } + ::RegCloseKey(key); + + // Ensure our buffer is large enough.. + if (strlen(installPath) > bufferSize) + return false; + + memcpy_s(buffer, bufferSize, installPath, size); + return true; + } + + /** + * Sets a value in the registry. + * + * @param {LanguageId} langId - The language id to use for writing to the proper registry key parent. + * @param {const char*} parent - The inner parent that holds the key we want to write to. + * @param {const char*} keyName - The key name to write the value to. + * @param {uint32_t} value - The value to write to the key. + * @returns {bool} True on success, false otherwise. + */ + static bool SetValue(LanguageId langId, const char* parent, const char* keyName, uint32_t value) + { + // Ensure the language id is within a valid range.. + if ((uint32_t)langId < 0 || (uint32_t)langId > 4) + return false; + + const char languageTags[4][255] = { "US", "", "US", "EU" }; + + // Build the registry key to read from.. + char registryPath[MAX_PATH] = { 0 }; + sprintf_s(registryPath, MAX_PATH, "SOFTWARE\\PlayOnline%s\\%s", languageTags[(uint32_t)langId], parent); + + // Open the key for writing.. + HKEY key = nullptr; + if (!(::RegOpenKeyExA(HKEY_LOCAL_MACHINE, registryPath, 0, KEY_WRITE | KEY_QUERY_VALUE | KEY_WOW64_32KEY, &key) == ERROR_SUCCESS)) + return false; + + // Write the value.. + auto ret = ::RegSetValueExA(key, keyName, NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD)); + ::RegCloseKey(key); + + return ret == ERROR_SUCCESS; + } + }; +}; // namespace Ashita + +#endif // __ASHITA_AS_REGISTRY_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/AS_Thread.h b/plugins/ADK/AS_Thread.h new file mode 100644 index 0000000..1813aec --- /dev/null +++ b/plugins/ADK/AS_Thread.h @@ -0,0 +1,236 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_THREAD_H_INCLUDED__ +#define __ASHITA_AS_THREAD_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include +#include "AS_Event.h" + +namespace Ashita +{ + namespace Threading + { + /** + * Thread Priority Enumeration + */ + enum class ThreadPriority : int32_t { + Lowest = -2, + BelowNormal = -1, + Normal = 0, + AboveNormal = 1, + Highest = 2 + }; + + class AS_Thread + { + HANDLE m_ThreadHandle; + uint32_t m_ThreadId; + AS_Event m_StartEvent; + AS_Event m_EndEvent; + + public: + AS_Thread(void) + : m_ThreadHandle(nullptr) + , m_ThreadId(0) + , m_StartEvent(true) + , m_EndEvent(true) + { } + virtual ~AS_Thread(void) + { + if (this->m_ThreadHandle != nullptr) + this->Stop(); + } + + public: + /** + * Thread entry function the inheriting class must implement. + * + * @returns {uint32_t} The thread functions return value. + */ + virtual uint32_t ThreadEntry(void) = 0; + + public: + /** + * Thread entry function used to signal the thread and run the inheriting + * classes thread entry function. + * + * @returns {uint32_t} The thread functions return value. + */ + uint32_t InternalEntry(void) + { + if (this->IsTerminated()) + return 0; + + this->m_EndEvent.Reset(); + ::Sleep(10); + this->m_StartEvent.Raise(); + + return this->ThreadEntry(); + } + + /** + * Starts the thread. + */ + void Start() + { + this->m_StartEvent.Reset(); + this->m_ThreadHandle = ::CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)ThreadCallback, (LPVOID)this, 0, (LPDWORD)&this->m_ThreadId); + } + + /** + * Stops the thread. + */ + void Stop(void) + { + this->RaiseEnd(); + + if (this->WaitForFinish(INFINITE)) + { + ::CloseHandle(this->m_ThreadHandle); + this->m_ThreadHandle = nullptr; + this->m_ThreadId = 0; + } + } + + /** + * Waits the given amount of milliseconds for the thread handle to signal. + * + * @param {uint32_t} milliseconds - The amount of time, in milliseconds, to wait. + * @returns {uint32_t} True on success, false otherwise. + */ + bool WaitForFinish(uint32_t milliseconds = INFINITE) const + { + if (this->m_ThreadHandle == nullptr) + return false; + + return ::WaitForSingleObject(this->m_ThreadHandle, milliseconds) != WAIT_TIMEOUT; + } + + /** + * Sets the threads priority. + * + * @param {ThreadPriority} p - The thread priority to set the thread to. + */ + void SetPriority(ThreadPriority p) const + { + if (this->m_ThreadHandle != nullptr) + ::SetThreadPriority(this->m_ThreadHandle, (int32_t)p); + } + + /** + * Gets the threads priority. + * + * @returns {ThreadPriority} The threads priority. + */ + ThreadPriority GetPriority(void) const + { + if (this->m_ThreadHandle == nullptr) + return (ThreadPriority)0; + + return (ThreadPriority)::GetThreadPriority(this->m_ThreadHandle); + } + + /** + * Signals the end event telling the thread it should stop. + */ + void RaiseEnd(void) + { + this->m_EndEvent.Raise(); + } + + /** + * Resets the end event signal. + */ + void ResetEnd(void) + { + this->m_EndEvent.Reset(); + } + + /** + * Returns if the thread has been terminated or not. + * + * @returns {bool} True if the thread is terminated, false otherwise. + */ + bool IsTerminated(void) const + { + return this->m_EndEvent.IsSignaled(); + } + + public: + /** + * Returns the threads handle. + * + * @returns {HANDLE} This threads handle. + */ + HANDLE GetHandle(void) const { return this->m_ThreadHandle; } + + /** + * Returns the threads id. + * + * @returns {uint32_t} This threads id. + */ + uint32_t GetId(void) const { return this->m_ThreadId; } + + /** + * Returns the threads exit code. + * + * @returns {uint32_t} This threads exit code. + */ + uint32_t GetExitCode(void) const + { + if (this->m_ThreadHandle == nullptr) + return 0; + + uint32_t exitCode = 0; + ::GetExitCodeThread(this->m_ThreadHandle, (LPDWORD)&exitCode); + + return exitCode; + } + + private: + /** + * Internal thread callback to invoke the inheriting objects thread handler. + * + * @param {LPVOID} param - The AS_Thread object passed to this callback. + * @returns {uint32_t} The internal threads return value, 0 otherwise. + */ + static uint32_t __stdcall ThreadCallback(LPVOID param) + { + auto thread = (AS_Thread*)param; + if (thread != nullptr) + return thread->InternalEntry(); + + return 0; + } + }; + }; // namespace Threading +}; // namespace Ashita + +#endif // __ASHITA_AS_THREAD_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/Ashita.h b/plugins/ADK/Ashita.h new file mode 100644 index 0000000..b54614b --- /dev/null +++ b/plugins/ADK/Ashita.h @@ -0,0 +1,1532 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_ADK_H_INCLUDED__ +#define __ASHITA_ADK_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ReSharper Specific Disables (Please do not edit these!) +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ReSharper disable CppUnusedIncludeDirective +// ReSharper disable CppPolymorphicClassWithNonVirtualPublicDestructor +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Ashita Interface Version +// +// Defines the current interface version that Ashita is compiled against. This version must match +// when a plugin is loaded for it to work properly. Invalid versions will result in the plugin +// not loading and printing an error. +// +// DO NOT EDIT THIS! +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +#define ASHITA_INTERFACE_VERSION 3.0 + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Direct Input SDK Version Definition +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION 0x0800 +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// General Includes +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +#include +#include +#include "d3d8/includes/d3d8.h" +#include "d3d8/includes/d3dx8.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Ashita SDK Includes +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +#include "newIDirectInputDevice8A.h" +#include "AS_BinaryData.h" +#include "AS_CommandParser.h" +#include "AS_Event.h" +#include "AS_Exception.h" +#include "AS_LockableObject.h" +#include "AS_Memory.h" +#include "AS_Objects.h" +#include "AS_Registry.h" +#include "AS_Thread.h" +#include "ffxi/entity.h" +#include "ffxi/enums.h" +#include "ffxi/inventory.h" +#include "ffxi/party.h" +#include "ffxi/player.h" +#include "ffxi/target.h" +#include "imgui.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Forward Declarations +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +struct IEntity; // IEntity forward-declaration. +struct IInventory; // IInventory forward-declaration. +struct IParty; // IParty forward-declaration. +struct IPlayer; // IPlayer forward-declaration. +struct ITarget; // ITarget forward-declaration. +struct IFontObject; // IFontObject forward declaration. +struct IPrimitiveObject; // IPrimitiveObject forward declaration. +struct IKeyboard; // IKeyboard forward declaration. +struct IMouse; // IMouse forward declaration. + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Ashita Version Return Object +// +// Used with the GetVersion export of the Ashita.dll file, this can be used to read the +// current version of Ashita from the file properly. +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma warning(disable : 4201) +union ashitaversion_t +{ + // The raw version value. + uint64_t Version; + + // Union based data parts of Version. + struct { + uint16_t Major; + uint16_t Minor; + uint16_t Build; + uint16_t Revision; + }; +}; +#pragma warning(default : 4201) + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Ashita Install Parameters +// +// Used with the Install export of Ashita.dll file. These are the parameters Ashita expects +// to be passed to the install call when it is first being prepared for usage. +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +struct ashitainstallparams_t +{ + HMODULE ModuleInstance; // The module instance of Ashita.dll. + uint32_t LanguageId; // The language id to use. + char BootScript[MAX_PATH]; // The boot script to load for the boot configurations. +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Forward Declarations +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +struct lua_State { }; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Ashita Enumerations +// +// Enumerations used within Ashita's various interfaces and functions. +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +namespace Ashita +{ + /** + * Command Input Type Enumeration + * + * Used with the Ashita ChatManager command functions. + */ + enum class CommandInputType : int32_t { + ForceHandle = -3, // Informs Ashita to handle the command by force. + Script = -2, // Informs Ashita to handle the command as an Ashita based script command. + Parse = -1, // Informs Ashita to handle the command as an Ashita based command. + Menu = 0, // Informs Ashita to handle the command as if it were input via an in-game menu. + Typed = 1, // Informs Ashita to handle the command as if it were typed into the chat window by the player. + Macro = 2 // Informs Ashita to handle the command as if it were invoked from a macro. + }; + + /** + * Frame Anchor Enumeration + * + * Used with Ashita's custom font objects. + */ + enum class FrameAnchor : uint32_t { + TopLeft = 0, // Anchors the font object to the top-left. + TopRight = 1, // Anchors the font object to the top-right. + BottomLeft = 2, // Anchors the font object to the bottom-left. + BottomRight = 3, // Anchors the font object to the bottom-right. + Right = 1, // Anchors the font object to the right. + Bottom = 2 // Anchors the font object to the bottom. + }; + + /** + * FrameAnchor bitwise AND operator override. + * + * @param {FrameAnchor} a - The first frame anchor value. + * @param {FrameAnchor} b - The second frame anchor value. + * @returns {uint32_t} The AND value of a and b. + */ + inline uint32_t operator& (const FrameAnchor& a, const FrameAnchor& b) + { + return (uint32_t)((uint32_t)a & (uint32_t)b); + } + + /** + * Mouse Input Enumeration + * + * Used with Ashita's custom font objects mouse event callback. + */ + enum class MouseInput : uint32_t { + LeftClick = 0, // Left mouse button was clicked. + RightClick = 1, // Right mouse button was clicked. + MiddleClick = 2, // Middle mouse button was clicked. + X1Click = 3, // X1 mouse button was clicked. + X2Click = 4, // X2 mouse button was clicked. + MouseWheelUp = 5, // Mouse wheel was scrolled up. + MouseWheelDown = 6, // Mouse wheel was scrolled down. + MouseMove = 7 // Mouse was moved over the object. + }; + + /** + * Log Level Enumeration + * + * Used with Ashita's logging manager. + */ + enum class LogLevel : uint32_t { + None = 0, + Information = 1, + Warning = 2, + Error = 3, + Debug = 4 + }; +}; // namespace Ashita + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Input Defines +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef HRESULT /**/(__stdcall *getdatacallback_t)(DWORD, LPDIDEVICEOBJECTDATA, DWORD, LPDWORD, DWORD); +typedef HRESULT /**/(__stdcall *getstatecallback_t)(DWORD, LPVOID); +typedef BOOL /**/(__stdcall *keyboardcallback_t)(WPARAM, LPARAM); +typedef BOOL /**/(__stdcall *mousecallback_t)(WPARAM, LPARAM); + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Font Object Defines +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef std::function MOUSEEVENT; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Resource File Definitions +// +// IAbility +// +// An ability entry parsed from the games data files. Contatins information on how the +// ability works, requirements, and other useful information. +// +// ISpell +// +// A spell entry parsed from the games data files. Contains information on how the spell +// works, requirements, and other useful information. +// +// IMonstrosityAbility +// +// A monstrosity ability entry. Contains info on the abilities requirements. (Used for items.) +// +// IItem +// +// An item entry parsed from the games data files. Contains information on how the item +// works, can be used, requirements, and other useful information. Also contains the items +// bitmap icon used and displayed in-game. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +struct IAbility +{ + uint16_t Id; // The abilities id. (Not the same as its recast id!) + uint8_t Type; // The abilities type. (Type & 7) + uint8_t Element; // The abilities element. + uint16_t ListIconId; // The abilities list icon id. + uint16_t ManaCost; // The abilities mana cost. + uint16_t TimerId; // The abilities timer id. + uint16_t ValidTargets; // The abilities valid targets. + int16_t TP; // The abilities TP cost. + uint8_t Unknown0000; // Unknown. + uint8_t MonsterLevel; // The abilities monster level. + int8_t Range; // The abilities usage range. (Range % 0x0F) + uint8_t Unknown0001[30]; // Unknown. + uint8_t EOE; // EOE (End of entry. 0xFF) + + const char* Name[3]; // The abilities name. (0 = Default, 1 = Japanese, 2 = English) + const char* Description[3]; // The abilities description. (0 = Default, 1 = Japanese, 2 = English) +}; + +struct ISpell +{ + uint16_t Index; // The spells index. (Used with recast.) + uint16_t Type; // The spells magic type. + uint16_t Element; // The spells element type. + uint16_t ValidTargets; // The spells valid targets. + uint16_t Skill; // The spells magic skill type. + uint16_t ManaCost; // The spells mana coast. + uint8_t CastTime; // The spells cast time. (CastTime / 4.0) + uint8_t RecastDelay; // The spells recast delay. (RecastDelay / 4.0) + int16_t LevelRequired[24]; // The spells level requirements. (Per-job, if 0xFF, cannot be learned.) + uint16_t Id; // The spells id. + uint16_t ListIcon1; // The spells icon id (1). + uint16_t ListIcon2; // The spells icon id (2). + uint8_t Requirements; // The spells requirements. + int8_t Range; // The spells casting range. (Range % 0x0F) + uint8_t Unknown0000[29]; // Unknown. + uint8_t EOE; // EOE (End of entry. 0xFF) + + const char* Name[3]; // The spells name. (0 = Default, 1 = Japanese, 2 = English) + const char* Description[3]; // The spells description. (0 = Default, 1 = Japanese, 2 = English) +}; + +struct IMonstrosityAbility +{ + uint16_t MoveId; // The monster move id of the ability. + int8_t Level; // The monster level of the ability. + uint8_t Unknown0000; // Unknown. +}; + +struct IItem +{ + uint32_t ItemId; // The items id. + uint16_t Flags; // The items flags. + uint16_t StackSize; // The items stack size. + uint16_t ItemType; // The items type. + uint16_t ResourceId; // The items resource id. (Mainly used for AH sorting.) + uint16_t ValidTargets; // The items valid targets for use. + + uint16_t Level; // The items level requirement to use. + uint16_t Slots; // The items equipment slots where the item can be equipped to. + uint16_t Races; // The items races that can use the item. + uint32_t Jobs; // The items jobs that can use the item. + uint8_t SuperiorLevel; // The items superior level. + uint16_t ShieldSize; // The items shield size. + uint8_t MaxCharges; // The items max charges. + uint16_t CastTime; // The items cast time. + uint16_t CastDelay; // The items cast delay. + uint32_t RecastDelay; // The items recast delay. + uint16_t BaseItemId; // The items base item id used for upgrades. + uint16_t ItemLevel; // The items item level. + uint16_t Damage; // The items damage. + uint16_t Delay; // The items delay. + uint16_t DPS; // The items damae per second. + uint8_t Skill; // The items skill type. + uint8_t JugSize; // The items jug size. + + uint16_t InstinctCost; // The items instinct cost. + + uint16_t MonstrosityId; // The items monstrosity id. + char MonstrosityName[32]; // The items monstrosity name. + IMonstrosityAbility MonstrosityAbilities[16]; // The items monstrosity abilities. + + uint16_t PuppetSlotId; // The items slot id (for PUP). + uint32_t PuppetElements; // The items elements (for PUP). + + const char* Name[3]; // The items name. + const char* Description[3]; // The items description. + const char* LogNameSingular[3]; // The items log name (singular). + const char* LogNamePlural[3]; // The items log name (plural). + + uint32_t ImageSize; // The items image size. + uint8_t ImageType; // The items image type. + uint8_t ImageName[0x10]; // The items image name. + uint8_t Bitmap[0x980]; // The items bitmap data. +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Chat Manager +// +// Ashita chat manager that interacts with the games chat and command systems. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IChatManager +{ + // Command Functions + virtual void ParseCommand(const char* command, int32_t type) = 0; + virtual void QueueCommand(const char* command, int32_t type) = 0; + + // Chat Functions + virtual void AddChatMessage(int32_t mode, const char* message) = 0; + virtual int32_t ParseAutoTranslate(const char* message, char* buffer, int32_t bufferSize, bool useBrackets) = 0; + + // Script Functions + virtual void RunScript(bool useTaskQueue, const char* file) = 0; + + // Input Text Functions + virtual const char* GetInputText(void) const = 0; + virtual void SetInputText(const char* message) = 0; + virtual bool IsInputOpen(void) = 0; + + // Chat Functions (Helpers) + virtual void Write(const char* msg) = 0; + virtual void Writef(const char* format, ...) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Configuration Manager +// +// Ashita configuration manager that interacts with simple XML based configuration files. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IConfigurationManager +{ + // Configuration File Functions + virtual bool Load(const char* alias, const char* file) = 0; + virtual bool Save(const char* alias, const char* file) = 0; + virtual void Remove(const char* alias) = 0; + + // Value Related Functions + virtual void set_value(const char* alias, const char* name, const char* value) = 0; + virtual const char* get_string(const char* alias, const char* name) = 0; + virtual bool get_bool(const char* alias, const char* name, bool defaultValue) = 0; + virtual uint8_t get_uint8(const char* alias, const char* name, uint8_t defaultValue) = 0; + virtual uint16_t get_uint16(const char* alias, const char* name, uint16_t defaultValue) = 0; + virtual uint32_t get_uint32(const char* alias, const char* name, uint32_t defaultValue) = 0; + virtual uint64_t get_uint64(const char* alias, const char* name, uint64_t defaultValue) = 0; + virtual int8_t get_int8(const char* alias, const char* name, int8_t defaultValue) = 0; + virtual int16_t get_int16(const char* alias, const char* name, int16_t defaultValue) = 0; + virtual int32_t get_int32(const char* alias, const char* name, int32_t defaultValue) = 0; + virtual int64_t get_int64(const char* alias, const char* name, int64_t defaultValue) = 0; + virtual float get_float(const char* alias, const char* name, float defaultValue) = 0; + virtual double get_double(const char* alias, const char* name, double defaultValue) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Data Manager +// +// Ashita data manager that interacts with various in-game memory structures such as +// inventory, player, party, target, etc. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IDataManager +{ + virtual IEntity* GetEntity(void) = 0; + virtual IInventory* GetInventory(void) = 0; + virtual IParty* GetParty(void) = 0; + virtual IPlayer* GetPlayer(void) = 0; + virtual ITarget* GetTarget(void) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Font Manager +// +// Ashita font manager that interacts with Ashitas built-in highly customizable font objects. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IFontManager +{ + virtual IFontObject* Create(const char* alias) = 0; + virtual IFontObject* Get(const char* alias) = 0; + virtual void Delete(const char* alias) = 0; + virtual bool GetHideObjects(void) const = 0; + virtual void SetHideObjects(bool hide) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Font Object +// +// Ashita font object interface that allows interaction with the highly customizable font objects. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IFontObject +{ + // Helper Functions + virtual bool HitTest(int32_t x, int32_t y) = 0; + + // Property Getters + virtual const char* GetAlias(void) const = 0; + virtual bool GetVisibility(void) const = 0; + virtual const char* GetFontFamily(void) const = 0; + virtual int32_t GetFontHeight(void) const = 0; + virtual float GetPositionX(void) const = 0; + virtual float GetPositionY(void) const = 0; + virtual bool GetLocked(void) const = 0; + virtual float GetPadding(void) const = 0; + virtual uint32_t GetAnchor(void) const = 0; + virtual uint32_t GetAnchorParent(void) const = 0; + virtual D3DCOLOR GetColor(void) const = 0; + virtual uint32_t GetCreateFlags(void) const = 0; + virtual uint32_t GetDrawFlags(void) const = 0; + virtual bool GetBold(void) const = 0; + virtual bool GetItalic(void) const = 0; + virtual bool GetRightJustified(void) const = 0; + virtual const char* GetText(void) const = 0; + virtual bool GetDirtyFlag(void) const = 0; + virtual bool GetAutoResize(void) const = 0; + virtual float GetWindowWidth(void) const = 0; + virtual float GetWindowHeight(void) const = 0; + virtual float GetRealPositionX(void) const = 0; + virtual float GetRealPositionY(void) const = 0; + virtual MOUSEEVENT GetMouseEventFunction(void) const = 0; + virtual void GetTextSize(SIZE* size) const = 0; + virtual IFontObject* GetParent(void) const = 0; + + virtual IPrimitiveObject* GetBackground(void) const = 0; + + // Property Setters + virtual void SetAlias(const char* alias) = 0; + virtual void SetVisibility(bool visible) = 0; + virtual void SetFontFamily(const char* family) = 0; + virtual void SetFontHeight(int32_t height) = 0; + virtual void SetPositionX(float x) = 0; + virtual void SetPositionY(float y) = 0; + virtual void SetLocked(bool locked) = 0; + virtual void SetPadding(float size) = 0; + virtual void SetAnchor(uint32_t anchor) = 0; + virtual void SetAnchorParent(uint32_t anchor) = 0; + virtual void SetColor(D3DCOLOR color) = 0; + virtual void SetCreateFlags(uint32_t flags) = 0; + virtual void SetDrawFlags(uint32_t flags) = 0; + virtual void SetBold(bool bold) = 0; + virtual void SetItalic(bool italic) = 0; + virtual void SetRightJustified(bool justified) = 0; + virtual void SetText(const char* text) = 0; + virtual void SetDirtyFlag(bool dirty) = 0; + virtual void SetAutoResize(bool resize) = 0; + virtual void SetWindowWidth(float width) = 0; + virtual void SetWindowHeight(float height) = 0; + virtual void SetMouseEventFunction(MOUSEEVENT func) = 0; + virtual void SetParent(IFontObject* parent) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Input Manager +// +// Ashita input manager that interacts with the hooked keyboard and mouse devices. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IInputManager +{ + virtual IKeyboard* GetKeyboard(void) const = 0; + virtual IMouse* GetMouse(void) const = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Log Manager +// +// Ashita log manager that interacts with the per-instance created log file that Ashita uses to +// record various information about its operation. This file can be used to help debug issues +// with addons and plugins. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface ILogManager +{ + virtual bool Log(uint32_t level, const char* source, const char* msg) = 0; + virtual bool Logf(uint32_t level, const char* source, const char* fmt, ...) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Packet Manager +// +// Ashita packet manager that interacts with the games packet system. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IPacketManager +{ + virtual void AddIncomingPacket(uint16_t id, uint32_t len, void* data) = 0; + virtual void AddOutgoingPacket(uint16_t id, uint32_t len, void* data) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Plugin Manager +// +// Ashita plugin manager that interacts with Ashitas internal plugin system. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IPluginManager +{ + virtual bool Load(const char* name) = 0; + virtual bool Unload(const char* name) = 0; + virtual void UnloadAll(void) = 0; + virtual void* GetPlugin(const char* name) = 0; + virtual void* GetPlugin(uint32_t index) = 0; + virtual uint32_t GetPluginCount(void) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Pointer Manager +// +// Ashita pointer manager that interacts with Ashitas internal pointer system. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IPointerManager +{ + virtual uintptr_t GetPointer(const char* name) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Primitive Object +// +// Ashita primitive object interface that allows interaction with the primitive objects created +// within Ashita via the Font Manager. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IPrimitiveObject +{ + // Helper Functions + virtual void SetTextureFromFile(const char* file) = 0; + virtual void SetTextureFromResource(const char* moduleName, const char* resource) = 0; + virtual bool HitTest(int32_t x, int32_t y) = 0; + + // Property Getters + virtual bool GetVisibility(void) const = 0; + virtual float GetPositionX(void) const = 0; + virtual float GetPositionY(void) const = 0; + virtual float GetWidth(void) const = 0; + virtual float GetHeight(void) const = 0; + virtual D3DCOLOR GetColor(void) const = 0; + virtual bool GetBorderVisibility(void) const = 0; + virtual D3DCOLOR GetBorderColor(void) const = 0; + virtual uint32_t GetBorderFlags(void) const = 0; + virtual Ashita::asrect_t GetBorderSizes(void) const = 0; + + // Property Setters + virtual void SetVisibility(bool isVisible) = 0; + virtual void SetPositionX(float x) = 0; + virtual void SetPositionY(float y) = 0; + virtual void SetWidth(float width) = 0; + virtual void SetHeight(float height) = 0; + virtual void SetColor(D3DCOLOR color) = 0; + virtual void SetBorderVisibility(bool isVisible) = 0; + virtual void SetBorderColor(D3DCOLOR color) = 0; + virtual void SetBorderFlags(uint32_t flags) = 0; + virtual void SetBorderSizes(uint32_t top, uint32_t right, uint32_t bottom, uint32_t left) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Resource Manager +// +// Ashita resource manager interface that interacts with the internal DAT file parser to obtain +// various information about the games content. (Abilities, Spells, Items, Various Strings, etc.) +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IResourceManager +{ + // Ability Functions + virtual IAbility* GetAbilityById(uint32_t id) = 0; + virtual IAbility* GetAbilityByName(const char* name, uint32_t languageId) = 0; + virtual IAbility* GetAbilityByTimerId(uint32_t id) = 0; + + // Spell Functions + virtual ISpell* GetSpellById(uint32_t id) = 0; + virtual ISpell* GetSpellByName(const char* name, uint32_t languageId) = 0; + + // Item Functions + virtual IItem* GetItemById(uint32_t id) = 0; + virtual IItem* GetItemByName(const char* name, uint32_t languageId) = 0; + + // String Functions + virtual const char* GetString(const char* table, uint32_t index) = 0; + virtual const char* GetString(const char* table, uint32_t index, uint32_t languageId) = 0; + virtual int32_t GetString(const char* table, const char* name) = 0; + virtual int32_t GetString(const char* table, const char* name, uint32_t languageId) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Data Related Interfaces +// +// IEntity +// +// Exposes functions to interact with the games various entities. (Players, Monsters, NPCs, etc.) +// +// IInventory +// +// Exposes functions to interact with the inventory block of the games data. This includes the +// players inventory and storage, the players equipment, and the treasure pool. +// +// IParty +// +// Exposes functions to interact with the games party data. +// +// IPlayer +// +// Exposes functions to interact with the local players information. (Level, job, skills, etc.) +// +// ITarget +// +// Exposes functions to interact with the current target information. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IEntity +{ + // WARNING: Plugins should not use this function! + // + // Use the Get/Set functions instead to help ensure your plugin does not + // break between updates of Ashita! + virtual Ashita::FFXI::ffxi_entity_t* GetEntity(uint32_t index) const = 0; + + // Property Getters + virtual float GetLocalX(uint32_t index) const = 0; + virtual float GetLocalY(uint32_t index) const = 0; + virtual float GetLocalZ(uint32_t index) const = 0; + virtual float GetLocalRoll(uint32_t index) const = 0; + virtual float GetLocalYaw(uint32_t index) const = 0; + virtual float GetLocalPitch(uint32_t index) const = 0; + virtual float GetLastX(uint32_t index) const = 0; + virtual float GetLastY(uint32_t index) const = 0; + virtual float GetLastZ(uint32_t index) const = 0; + virtual float GetLastRoll(uint32_t index) const = 0; + virtual float GetLastYaw(uint32_t index) const = 0; + virtual float GetLastPitch(uint32_t index) const = 0; + virtual float GetMoveX(uint32_t index) const = 0; + virtual float GetMoveY(uint32_t index) const = 0; + virtual float GetMoveZ(uint32_t index) const = 0; + virtual uint32_t GetTargetIndex(uint32_t index) const = 0; + virtual uint32_t GetServerId(uint32_t index) const = 0; + virtual const char* GetName(uint32_t index) const = 0; + virtual float GetSpeed(uint32_t index) const = 0; + virtual float GetAnimationSpeed(uint32_t index) const = 0; + virtual uintptr_t GetWarpPointer(uint32_t index) const = 0; + virtual float GetDistance(uint32_t index) const = 0; + virtual float GetHeading(uint32_t index) const = 0; + virtual uintptr_t GetPetOwnerId(uint32_t index) const = 0; + virtual uint8_t GetHealthPercent(uint32_t index) const = 0; + virtual uint8_t GetManaPercent(uint32_t index) const = 0; + virtual uint8_t GetEntityType(uint32_t index) const = 0; + virtual uint8_t GetRace(uint32_t index) const = 0; + virtual uint16_t GetModelFade(uint32_t index) const = 0; + virtual uint16_t GetLookHair(uint32_t index) const = 0; + virtual uint16_t GetLookHead(uint32_t index) const = 0; + virtual uint16_t GetLookBody(uint32_t index) const = 0; + virtual uint16_t GetLookHands(uint32_t index) const = 0; + virtual uint16_t GetLookLegs(uint32_t index) const = 0; + virtual uint16_t GetLookFeet(uint32_t index) const = 0; + virtual uint16_t GetLookMain(uint32_t index) const = 0; + virtual uint16_t GetLookSub(uint32_t index) const = 0; + virtual uint16_t GetLookRanged(uint32_t index) const = 0; + virtual uint16_t GetActionTimer1(uint32_t index) const = 0; + virtual uint16_t GetActionTimer2(uint32_t index) const = 0; + virtual uint32_t GetRenderFlags0(uint32_t index) const = 0; + virtual uint32_t GetRenderFlags1(uint32_t index) const = 0; + virtual uint32_t GetRenderFlags2(uint32_t index) const = 0; + virtual uint32_t GetRenderFlags3(uint32_t index) const = 0; + virtual uint32_t GetRenderFlags4(uint32_t index) const = 0; + virtual uint16_t GetNpcSpeechLoop(uint32_t index) const = 0; + virtual uint16_t GetNpcSpeechFrame(uint32_t index) const = 0; + virtual float GetSpeed2(uint32_t index) const = 0; + virtual uint16_t GetNpcWalkPosition1(uint32_t index) const = 0; + virtual uint16_t GetNpcWalkPosition2(uint32_t index) const = 0; + virtual uint16_t GetNpcWalkMode(uint32_t index) const = 0; + virtual uint16_t GetCostumeId(uint32_t index) const = 0; + virtual uint32_t GetStatus(uint32_t index) const = 0; + virtual uint32_t GetStatusServer(uint32_t index) const = 0; + virtual uint32_t GetStatusNpcChat(uint32_t index) const = 0; + virtual uint32_t GetClaimServerId(uint32_t index) const = 0; + virtual uint8_t* GetAnimations(uint32_t index) const = 0; + virtual uint16_t GetAnimationTick(uint32_t index) const = 0; + virtual uint16_t GetAnimationStep(uint32_t index) const = 0; + virtual uint8_t GetAnimationPlay(uint32_t index) const = 0; + virtual uint16_t GetEmoteTargetIndex(uint32_t index) const = 0; + virtual uint16_t GetEmoteId(uint32_t index) const = 0; + virtual uint32_t GetEmoteIdString(uint32_t index) const = 0; + virtual uintptr_t GetEmoteTargetWarpPointer(uint32_t index) const = 0; + virtual uint32_t GetSpawnFlags(uint32_t index) const = 0; + virtual uint32_t GetLinkshellColor(uint32_t index) const = 0; + virtual uint16_t GetNameColor(uint32_t index) const = 0; + virtual uint16_t GetCampaignNameFlag(uint32_t index) const = 0; + virtual uint16_t GetFishingTimer(uint32_t index) const = 0; + virtual uint16_t GetFishingCastTimer(uint32_t index) const = 0; + virtual uint32_t GetFishingUnknown0000(uint32_t index) const = 0; + virtual uint32_t GetFishingUnknown0001(uint32_t index) const = 0; + virtual uint16_t GetFishingUnknown0002(uint32_t index) const = 0; + virtual uint16_t GetTargetedIndex(uint32_t index) const = 0; + virtual uint16_t GetPetTargetIndex(uint32_t index) const = 0; + virtual uint8_t GetBallistaScoreFlag(uint32_t index) const = 0; + virtual uint8_t GetPankrationEnabled(uint32_t index) const = 0; + virtual uint8_t GetPankrationFlagFlip(uint32_t index) const = 0; + virtual float GetModelSize(uint32_t index) const = 0; + virtual uint16_t GetMonstrosityFlag(uint32_t index) const = 0; + virtual uint16_t GetMonstrosityNameId(uint32_t index) const = 0; + virtual const char* GetMonstrosityName(uint32_t index) const = 0; + + // Property Setters + virtual void SetLocalX(uint32_t index, float x) const = 0; + virtual void SetLocalY(uint32_t index, float y) const = 0; + virtual void SetLocalZ(uint32_t index, float z) const = 0; + virtual void SetLocalRoll(uint32_t index, float roll) const = 0; + virtual void SetLocalYaw(uint32_t index, float yaw) const = 0; + virtual void SetLocalPitch(uint32_t index, float pitch) const = 0; + virtual void SetLastX(uint32_t index, float x) const = 0; + virtual void SetLastY(uint32_t index, float y) const = 0; + virtual void SetLastZ(uint32_t index, float z) const = 0; + virtual void SetLastRoll(uint32_t index, float roll) const = 0; + virtual void SetLastYaw(uint32_t index, float yaw) const = 0; + virtual void SetLastPitch(uint32_t index, float pitch) const = 0; + virtual void SetMoveX(uint32_t index, float x) const = 0; + virtual void SetMoveY(uint32_t index, float y) const = 0; + virtual void SetMoveZ(uint32_t index, float z) const = 0; + virtual void SetTargetIndex(uint32_t index, uint32_t targetIndex) const = 0; + virtual void SetServerId(uint32_t index, uint32_t serverId) const = 0; + virtual void SetName(uint32_t index, const char* name) const = 0; + virtual void SetSpeed(uint32_t index, float speed) const = 0; + virtual void SetAnimationSpeed(uint32_t index, float speed) const = 0; + virtual void SetWarpPointer(uint32_t index, uintptr_t ptr) const = 0; + virtual void SetDistance(uint32_t index, float distance) const = 0; + virtual void SetHeading(uint32_t index, float heading) const = 0; + virtual void SetPetOwnerId(uint32_t index, uintptr_t petOwnerId) const = 0; + virtual void SetHealthPercent(uint32_t index, uint8_t hpp) const = 0; + virtual void SetManaPercent(uint32_t index, uint8_t mpp) const = 0; + virtual void SetEntityType(uint32_t index, uint8_t type) const = 0; + virtual void SetRace(uint32_t index, uint8_t race) const = 0; + virtual void SetModelFade(uint32_t index, uint16_t fade) const = 0; + virtual void SetLookHair(uint32_t index, uint16_t hair) const = 0; + virtual void SetLookHead(uint32_t index, uint16_t head) const = 0; + virtual void SetLookBody(uint32_t index, uint16_t body) const = 0; + virtual void SetLookHands(uint32_t index, uint16_t hands) const = 0; + virtual void SetLookLegs(uint32_t index, uint16_t legs) const = 0; + virtual void SetLookFeet(uint32_t index, uint16_t feet) const = 0; + virtual void SetLookMain(uint32_t index, uint16_t main) const = 0; + virtual void SetLookSub(uint32_t index, uint16_t sub) const = 0; + virtual void SetLookRanged(uint32_t index, uint16_t ranged) const = 0; + virtual void SetActionTimer1(uint32_t index, uint16_t time) const = 0; + virtual void SetActionTimer2(uint32_t index, uint16_t time) const = 0; + virtual void SetRenderFlags0(uint32_t index, uint32_t flags) const = 0; + virtual void SetRenderFlags1(uint32_t index, uint32_t flags) const = 0; + virtual void SetRenderFlags2(uint32_t index, uint32_t flags) const = 0; + virtual void SetRenderFlags3(uint32_t index, uint32_t flags) const = 0; + virtual void SetRenderFlags4(uint32_t index, uint32_t flags) const = 0; + virtual void SetNpcSpeechLoop(uint32_t index, uint16_t loop) const = 0; + virtual void SetNpcSpeechFrame(uint32_t index, uint16_t frame) const = 0; + virtual void SetSpeed2(uint32_t index, float speed) const = 0; + virtual void SetNpcWalkPosition1(uint32_t index, uint16_t pos) const = 0; + virtual void SetNpcWalkPosition2(uint32_t index, uint16_t pos) const = 0; + virtual void SetNpcWalkMode(uint32_t index, uint16_t mode) const = 0; + virtual void SetCostumeId(uint32_t index, uint16_t costume) const = 0; + virtual void SetStatus(uint32_t index, uint32_t status) const = 0; + virtual void SetStatusServer(uint32_t index, uint32_t status) const = 0; + virtual void SetStatusNpcChat(uint32_t index, uint32_t status) const = 0; + virtual void SetClaimServerId(uint32_t index, uint32_t claimid) const = 0; + virtual void SetAnimations(uint32_t index, uint8_t* data) const = 0; + virtual void SetAnimationTick(uint32_t index, uint16_t tick) const = 0; + virtual void SetAnimationStep(uint32_t index, uint16_t step) const = 0; + virtual void SetAnimationPlay(uint32_t index, uint8_t play) const = 0; + virtual void SetEmoteTargetIndex(uint32_t index, uint16_t targetIndex) const = 0; + virtual void SetEmoteId(uint32_t index, uint16_t emoteid) const = 0; + virtual void SetEmoteIdString(uint32_t index, uint32_t emoteid) const = 0; + virtual void SetEmoteTargetWarpPointer(uint32_t index, uintptr_t warpPointer) const = 0; + virtual void SetSpawnFlags(uint32_t index, uint32_t flags) const = 0; + virtual void SetLinkshellColor(uint32_t index, uint32_t color) const = 0; + virtual void SetNameColor(uint32_t index, uint16_t color) const = 0; + virtual void SetCampaignNameFlag(uint32_t index, uint16_t flags) const = 0; + virtual void SetFishingTimer(uint32_t index, uint16_t timer) const = 0; + virtual void SetFishingCastTimer(uint32_t index, uint16_t timer) const = 0; + virtual void SetFishingUnknown0000(uint32_t index, uint32_t unk) const = 0; + virtual void SetFishingUnknown0001(uint32_t index, uint32_t unk) const = 0; + virtual void SetFishingUnknown0002(uint32_t index, uint16_t unk) const = 0; + virtual void SetTargetedIndex(uint32_t index, uint16_t targetedIndex) const = 0; + virtual void SetPetTargetIndex(uint32_t index, uint16_t petIndex) const = 0; + virtual void SetBallistaScoreFlag(uint32_t index, uint8_t flag) const = 0; + virtual void SetPankrationEnabled(uint32_t index, uint8_t enabled) const = 0; + virtual void SetPankrationFlagFlip(uint32_t index, uint8_t flagflip) const = 0; + virtual void SetModelSize(uint32_t index, float size) const = 0; + virtual void SetMonstrosityFlag(uint32_t index, uint16_t flag) const = 0; + virtual void SetMonstrosityNameId(uint32_t index, uint16_t nameid) const = 0; + virtual void SetMonstrosityName(uint32_t index, const char* name) const = 0; +}; + +interface IInventory +{ + virtual Ashita::FFXI::item_t* GetItem(int32_t containerId, int32_t slotId) const = 0; + virtual uint16_t GetContainerMax(int32_t containerId) const = 0; + virtual Ashita::FFXI::treasureitem_t* GetTreasureItem(int32_t slotId) const = 0; + virtual Ashita::FFXI::equipment_t* GetEquippedItem(int32_t equipSlotId) const = 0; + virtual uint32_t GetCraftWait(void) const = 0; +}; + +interface IParty +{ + // Alliance Property Getters + virtual uint32_t GetAllianceLeaderServerId(void) const = 0; + virtual uint32_t GetAllianceParty0LeaderServerId(void) const = 0; + virtual uint32_t GetAllianceParty1LeaderServerId(void) const = 0; + virtual uint32_t GetAllianceParty2LeaderServerId(void) const = 0; + virtual int8_t GetAllianceParty0Visible(void) const = 0; + virtual int8_t GetAllianceParty1Visible(void) const = 0; + virtual int8_t GetAllianceParty2Visible(void) const = 0; + virtual int8_t GetAllianceParty0MemberCount(void) const = 0; + virtual int8_t GetAllianceParty1MemberCount(void) const = 0; + virtual int8_t GetAllianceParty2MemberCount(void) const = 0; + virtual int8_t GetAllianceInvited(void) const = 0; + + // Party Member Property Getters + virtual uint8_t GetMemberIndex(uint32_t index) const = 0; + virtual uint8_t GetMemberNumber(uint32_t index) const = 0; + virtual const char* GetMemberName(uint32_t index) const = 0; + virtual uint32_t GetMemberServerId(uint32_t index) const = 0; + virtual uint32_t GetMemberTargetIndex(uint32_t index) const = 0; + virtual uint32_t GetMemberCurrentHP(uint32_t index) const = 0; + virtual uint32_t GetMemberCurrentMP(uint32_t index) const = 0; + virtual uint32_t GetMemberCurrentTP(uint32_t index) const = 0; + virtual uint8_t GetMemberCurrentHPP(uint32_t index) const = 0; + virtual uint8_t GetMemberCurrentMPP(uint32_t index) const = 0; + virtual uint16_t GetMemberZone(uint32_t index) const = 0; + virtual uint32_t GetMemberFlagMask(uint32_t index) const = 0; + virtual uint8_t GetMemberMainJob(uint32_t index) const = 0; + virtual uint8_t GetMemberMainJobLevel(uint32_t index) const = 0; + virtual uint8_t GetMemberSubJob(uint32_t index) const = 0; + virtual uint8_t GetMemberSubJobLvl(uint32_t index) const = 0; + virtual uint32_t GetMemberServerId2(uint32_t index) const = 0; + virtual uint8_t GetMemberCurrentHPP2(uint32_t index) const = 0; + virtual uint8_t GetMemberCurrentMPP2(uint32_t index) const = 0; + virtual uint8_t GetMemberActive(uint32_t index) const = 0; +}; + +interface IPlayer +{ + // Property Getters + virtual uint32_t GetHealthMax(void) const = 0; + virtual uint32_t GetManaMax(void) const = 0; + virtual uint8_t GetMainJob(void) const = 0; + virtual uint8_t GetMainJobLevel(void) const = 0; + virtual uint8_t GetSubJob(void) const = 0; + virtual uint8_t GetSubJobLevel(void) const = 0; + virtual uint16_t GetExpCurrent(void) const = 0; + virtual uint16_t GetExpNeeded(void) const = 0; + virtual int16_t GetStat(uint32_t stat) const = 0; + virtual int16_t GetStatsModifiers(uint32_t stat) const = 0; + virtual int16_t GetAttack(void) const = 0; + virtual int16_t GetDefense(void) const = 0; + virtual int16_t GetResist(uint32_t stat) const = 0; + virtual uint16_t GetTitle(void) const = 0; + virtual uint16_t GetRank(void) const = 0; + virtual uint16_t GetRankPoints(void) const = 0; + virtual uint8_t GetNation(void) const = 0; + virtual uint8_t GetResidence(void) const = 0; + virtual uint32_t GetHomepoint(void) const = 0; + virtual Ashita::FFXI::combatskill_t GetCombatSkill(uint32_t skill) const = 0; + virtual Ashita::FFXI::craftskill_t GetCraftSkill(uint32_t skill) const = 0; + virtual uint16_t GetAbilityRecast(uint32_t index) const = 0; + virtual uint16_t GetAbilityRecastTimerId(uint32_t index) const = 0; + virtual uint16_t GetLimitPoints(void) const = 0; + virtual uint8_t GetMeritPoints(void) const = 0; + virtual uint8_t GetLimitMode(void) const = 0; + virtual uint32_t GetMeritPointsMax(void) const = 0; + virtual int16_t* GetStatusIcons(void) const = 0; + virtual int32_t* GetStatusTimers(void) const = 0; + virtual int16_t* GetBuffs(void) const = 0; + + // Helper Functions + virtual bool HasAbility(uint32_t id) const = 0; + virtual bool HasKeyItem(uint32_t id) const = 0; + virtual bool HasPetCommand(uint32_t id) const = 0; + virtual bool HasSpell(uint32_t id) const = 0; + virtual bool HasTrait(uint32_t id) const = 0; + virtual bool HasWeaponSkill(uint32_t id) const = 0; + + // Pet Functions + virtual uint32_t GetPetTP(void) const = 0; + virtual uint32_t GetPetMP(void) const = 0; +}; + +interface ITarget +{ + // Property Getters + virtual uint32_t GetTargetIndex(void) const = 0; + virtual uint32_t GetTargetServerId(void) const = 0; + virtual uintptr_t GetTargetEntityPointer(void) const = 0; + virtual uintptr_t GetTargetWarpPointer(void) const = 0; + virtual uint8_t GetTargetVisible(void) const = 0; + virtual uint16_t GetTargetMask(void) const = 0; + virtual uint16_t GetTargetCalculatedId(void) const = 0; + virtual uint32_t GetSubTargetIndex(void) const = 0; + virtual uint32_t GetSubTargetServerId(void) const = 0; + virtual uintptr_t GetSubTargetEntityPointer(void) const = 0; + virtual uintptr_t GetSubTargetWarpPointer(void) const = 0; + virtual uint8_t GetSubTargetVisible(void) const = 0; + virtual uint16_t GetSubTargetMask(void) const = 0; + virtual uint8_t GetSubTargetActive(void) const = 0; + virtual uint8_t GetTargetDeactivate(void) const = 0; + virtual uint8_t GetIsLockedOn(void) const = 0; + virtual uint32_t GetTargetSelectionMask(void) const = 0; + virtual uint8_t GetIsMenuOpen(void) const = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Input Related Interfaces +// +// IKeyboard +// +// Exposes functions to interact with the hooked and wrapped keyboard device. +// +// IMouse +// +// Exposes functions to interact with the hooked and wrapped mouse device. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IKeyboard : newIDirectInputDevice8A +{ + // Keybind Related Functions + virtual void BindKey(uint32_t key, bool down, bool alt, bool ctrl, bool win, bool apps, bool shift, const char* command) = 0; + virtual void UnbindKey(uint32_t key, bool down, bool alt, bool ctrl, bool win, bool apps, bool shift) = 0; + virtual void UnbindAll(void) = 0; + virtual bool IsKeyBound(uint32_t key, bool alt, bool ctrl, bool win, bool apps, bool shift) = 0; + virtual void ListBinds(void) = 0; + + // Callback Related Functions + virtual void AddCallback(const char* alias, LPVOID lpGetDataCallback, LPVOID lpGetStateCallback, LPVOID lpKeyboardCallack, LPVOID lpMouseCallback) = 0; + virtual void RemoveCallback(const char* alias) = 0; + + // Key Related Helper Functions + virtual uint32_t V2D(uint32_t key) const = 0; + virtual uint32_t D2V(uint32_t key) const = 0; + virtual uint32_t S2D(const char* key) const = 0; + virtual const char* D2S(uint32_t key) const = 0; + + virtual HWND GetParentWindow(void) const = 0; + virtual bool GetBlocked(void) const = 0; + virtual void SetBlocked(bool blocked) = 0; +}; + +interface IMouse : newIDirectInputDevice8A +{ + virtual HWND GetParentWindow(void) const = 0; + virtual bool GetBlocked(void) const = 0; + virtual void SetBlocked(bool blocked) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Ashita Core +// +// The main Ashita interface passed to plugins when they are loaded that includes the ability +// to obtain and interact with the other various objects defined in this header. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IAshitaCore +{ + // Manager Exposure Functions + virtual IChatManager* GetChatManager(void) const = 0; + virtual IConfigurationManager* GetConfigurationManager(void) const = 0; + virtual IDataManager* GetDataManager(void) const = 0; + virtual IFontManager* GetFontManager(void) const = 0; + virtual IGuiManager* GetGuiManager(void) const = 0; + virtual IInputManager* GetInputManager(void) const = 0; + virtual IPacketManager* GetPacketManager(void) const = 0; + virtual IPluginManager* GetPluginManager(void) const = 0; + virtual IPointerManager* GetPointerManager(void) const = 0; + virtual IResourceManager* GetResourceManager(void) const = 0; + + // Ashita Property Functions + virtual HMODULE GetHandle(void) const = 0; + virtual const char* GetAshitaInstallPathA(void) const = 0; + virtual const wchar_t* GetAshitaInstallPathW(void) const = 0; + virtual Ashita::aswindowinfo_t* GetPlayOnlineWindowInfo(void) const = 0; + virtual Ashita::aswindowinfo_t* GetMaskWindowInfo(void) const = 0; + virtual Ashita::aswindowinfo_t* GetFFXiWindowInfo(void) const = 0; + virtual bool GetMouseUnhooked(void) const = 0; + virtual void SetMouseUnhooked(bool hooked) = 0; + + // Direct3D Property Functions + virtual uint32_t GetD3DFillMode(void) const = 0; + virtual bool GetD3DAmbientEnabled(void) const = 0; + virtual D3DCOLOR GetD3DAmbientColor(void) const = 0; + virtual void SetD3DFillMode(uint32_t fillmode) = 0; + virtual void SetD3DAmbientEnabled(bool enabled) = 0; + virtual void SetD3DAmbientColor(D3DCOLOR color) = 0; + + // DirectInput Property Functions + virtual bool GetAllowGamepadInBackground(void) const = 0; + virtual void SetAllowGamepadInBackground(bool enabled) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Plugin Information +// +// Plugin information that is shared back to the Ashita plugin manager while a plugin is being +// loaded. Plugins must populate this data in order to be considered valid. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +struct plugininfo_t +{ + char Name[512]; // The plugins name. + char Author[512]; // The plugins author. + double InterfaceVersion; // The plugins ADK interface version that it was compiled with. + double PluginVersion; // The plugins version. + int32_t Priority; // The plugins execution priority. + + /** + * Default Constructor + */ + plugininfo_t(void) + { + strcpy_s(this->Name, 512, "Unknown"); + strcpy_s(this->Author, 512, "Ashita Development Team"); + + this->InterfaceVersion = ASHITA_INTERFACE_VERSION; + this->PluginVersion = 1.0f; + this->Priority = 0; + } + + /** + * Default Constructor + */ + plugininfo_t(const char* name, const char* author, double interfaceVersion, double pluginVersion, int32_t priority) + { + strcpy_s(this->Name, 512, name); + strcpy_s(this->Author, 512, author); + + this->InterfaceVersion = interfaceVersion; + this->PluginVersion = pluginVersion; + this->Priority = priority; + } +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Plugin Base +// +// The main plugin interface that exposes the proper implementation of a plugins base class. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +interface IPluginBase +{ + /** + * Returns the plugins information structure. + * + * @returns {plugininfo_t} The plugin information structure of the plugin. + */ + virtual plugininfo_t GetPluginInfo(void) = 0; + + /** + * Invoked when the plugin is loaded, allowing it to prepare for usage. + * + * @param {IAshitaCore*} core - The Ashita core object to interact with the various Ashita managers. + * @param {ILogManager*} log - The log manager used to interact with the current log file. + * @param {uint32_t} id - The plugins id, or its module base, that identifies it other than its name. + * @returns {bool} True on success, false otherwise. (If false, the plugin will not be loaded.) + */ + virtual bool Initialize(IAshitaCore* core, ILogManager* log, uint32_t id) = 0; + + /** + * Invoked when the plugin is being unloaded, allowing it to cleanup its resources. + */ + virtual void Release(void) = 0; + + /////////////////////////////////////////////////////////////////////////////////////////////////// + // Chat Manager Callbacks + /////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Invoked when a command is being processed by the game client. + * + * Note: + * Please note, this handles all things done via the game in terms of commands + * and chat. All / commands as well as normal chat you type, macros, etc. will + * be processed through here. You should only use this to handle / commands. + * + * If you wish to handle other bits of outgoing text before the client sees it, + * then use the HandleOutgoingText callback instead. + * + * @param {const char*} command - The raw command string being processed. + * @param {uint32_t} type - The type of the command being processed. (See Ashita::CommandInputType enumeration.) + * @returns {bool} True if handled and should be blocked, false otherwise. + */ + virtual bool HandleCommand(const char* command, int32_t type) = 0; + + /** + * Invoked when incoming text being sent to the chat log is being processed. + * + * @param {int16_t} mode - The mode of the message being added to the chatlog. + * @param {const char*} message - The raw message being added to the chat log. + * @param {int16_t*} modifiedMode - The modified mode, if any, that has been altered by other plugins/addons. + * @param {char*} modifiedMessage - The modified message, if any, that has been altered by other plugins/addons. + * @param {bool} blocked - Flag if this message has been blocked already by another plugin. (Once blocked, other plugins cannot restore it.) + * @returns {bool} True if handled and should be blocked, false otherwise. + */ + virtual bool HandleIncomingText(int16_t mode, const char* message, int16_t* modifiedMode, char* modifiedMessage, bool blocked) = 0; + + /** + * Invoked when outgoing text has not been handled by other plugins/addons. + * Invoked after HandleCommand if nothing else processed the data. + * + * @param {int16_t} mode - The type of the text that is being sent. (See Ashita::CommandInputType enumeration.) + * @param {const char*} message - The raw message being sent. + * @param {int16_t*} modifiedMode - The modified mode, if any, that has been altered by other plugins/addons. + * @param {char*} modifiedMessage - The modified message, if any, that has been altered by other plugins/addons. + * @param {bool} blocked - Flag if this message has been blocked already by another plugin. (Once blocked, other plugins cannot restore it.) + * @returns {bool} True if handled and should be blocked, false otherwise. + */ + virtual bool HandleOutgoingText(int32_t type, const char* message, int32_t* modifiedType, char* modifiedMessage, bool blocked) = 0; + + /////////////////////////////////////////////////////////////////////////////////////////////////// + // Packet Manager Callbacks + /////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Invoked when an incoming packet is being handled. + * + * @param {uint16_t} id - The id of the packet. + * @param {uint32_t} size - The size of the packet data. + * @param {void*} data - The raw data of the packet. + * @param {void*} modified - The modified data, if any, that has been altered by other plugins/addons. + * @param {bool} blocked - Flag if this message has been blocked already by another plugin. (Once blocked, other plugins cannot restore it.) + * @returns {bool} True if handled and should be blocked, false otherwise. + */ + virtual bool HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked) = 0; + + /** + * Invoked when an outgoing packet is being handled. + * + * @param {uint16_t} id - The id of the packet. + * @param {uint32_t} size - The size of the packet data. + * @param {void*} data - The raw data of the packet. + * @param {void*} modified - The modified data, if any, that has been altered by other plugins/addons. + * @param {bool} blocked - Flag if this message has been blocked already by another plugin. (Once blocked, other plugins cannot restore it.) + * @returns {bool} True if handled and should be blocked, false otherwise. + */ + virtual bool HandleOutgoingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked) = 0; + + /////////////////////////////////////////////////////////////////////////////////////////////////// + // Direct3D Callbacks + /////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Invoked when the plugin is being initialized for Direct3D rendering. + * + * Note: + * Plugins must return true with this function in order to have the other Direct3D + * functions invoked. Returning false is ideal here if you do not need to use the + * Direct3D functions within your plugin. This can help with overall performance. + * + * @param {IDirect3DDevice8*} device - The Direct3D device pointer currently being used by the game. + * @return {bool} True if the plugin should handle the other Direct3D messages, false otherwise. + */ + virtual bool Direct3DInitialize(IDirect3DDevice8* device) = 0; + + /** + * Invoked when the plugin is being unloaded and is able to cleanup its Direct3D related resources. + */ + virtual void Direct3DRelease(void) = 0; + + /** + * Invoked when the Direct3D device is beginning to render. (BeginScene) + */ + virtual void Direct3DPreRender(void) = 0; + + /** + * Invoked when the Direct3D device is ending its rendering. (EndScene) + */ + virtual void Direct3DRender(void) = 0; + + /** + * Invoked when the Direct3D device is presenting the scene. (Present) + * + * @param {RECT*} pSourceRect - The source rect being rendered into. + * @param {RECT*} pDestRect - The destination rect being rendered from. + * @param {HWND} hDestWindowOverride - The window handle, if any, to override the rendering into. + * @param {RGNDATA*} pDirtyRegion - The dirty region data. + * @returns {bool} True if the call should be blocked, false otherwise. + */ + virtual bool Direct3DPresent(const RECT* pSourceRect, const RECT* pDestRect, HWND hDestWindowOverride, const RGNDATA* pDirtyRegion) = 0; + + /** + * Invoked when the Direct3D device is drawing a primitive to the scene. (DrawPrimitive) + * + * @param {D3DPRIMITIVETYPE} PrimitiveType - The type of primitive being rendered. + * @param {UINT} StartVertex - Index of the first vertex to load. + * @param {UINT} PrimitiveCount - Number of primitives to render. + * @returns {bool} True if the call should be blocked, false otherwise. + */ + virtual bool Direct3DDrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) = 0; + + /** + * Invoked when the Direct3D device is drawing a primitive to the scene. (DrawIndexedPrimitive) + * + * @param {D3DPRIMITIVETYPE} PrimitiveType - The type of primitive being rendered. + * @param {UINT} minIndex - Minimum vertex index for vertices used during this call. + * @param {UINT} numVertices - Number of vertices used during this call + * @param {UINT} startIndex - Index of the first index to use when accesssing the vertex buffer. + * @param {UINT} primCount - Number of primitives to render. + * @returns {bool} True if the call should be blocked, false otherwise. + */ + virtual bool Direct3DDrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT minIndex, UINT NumVertices, UINT startIndex, UINT primCount) = 0; + + /** + * Invoked when the Direct3D device is drawing a primitive to the scene. (DrawPrimitiveUP) + * + * @param {D3DPRIMITIVETYPE} PrimitiveType - The type of primitive being rendered. + * @param {UINT} PrimitiveCount - Number of primitives to render. + * @param {void*} pVertexStreamZeroData - User memory pointer to the vertex data. + * @param {UINT} VertexStreamZeroStride - The number of bytes of data for each vertex. + * @returns {bool} True if the call should be blocked, false otherwise. + */ + virtual bool Direct3DDrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) = 0; + + /** + * Invoked when the Direct3D device is drawing a primitive to the scene. (DrawIndexedPrimitiveUP) + * + * @param {D3DPRIMITIVETYPE} PrimitiveType - The type of primitive being rendered. + * @param {UINT} MinVertexIndex - Minimum vertex index. + * @param {UINT} NumVertexIndices - Number of vertices used during this call. + * @param {UINT} PrimitiveCount - Number of primitives to render. + * @param {void*} pIndexData - User memory pointer to the index data. + * @param {D3DFORMAT} IndexDataFormat - The format of the index data. + * @param {void*} pVertexStreamZeroData - User memory pointer to the vertex data. + * @param {UINT} VertexStreamZeroStride - The number of bytes of data for each vertex. + * @returns {bool} True if the call should be blocked, false otherwise. + */ + virtual bool Direct3DDrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) = 0; + + /** + * Invoked when the Direct3D device is setting a render state. (SetRenderState) + * + * @param {D3DRENDERSTATETYPE} state - The render state to alter. + * @param {DWORD} value - The new value for the render state. + * @returns {bool} True if the call should be blocked, false otherwise. + */ + virtual bool Direct3DSetRenderState(D3DRENDERSTATETYPE State, DWORD Value) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Plugin +// +// The main base class that plugins should inherit from. Defaults the function handlers that are +// not overriden to ensure that the plugin does not interfere with calls that it does not use. +// +// Note: +// Plugins should inherit from this base class to ensure they meet the standards of being +// a valid Ashita plugin. Failure to export a class that inherits from this base can lead +// to crashes and potential loss of data / settings. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +class IPlugin : public IPluginBase +{ +protected: + IAshitaCore* m_AshitaCore; + ILogManager* m_LogManager; + uint32_t m_PluginId; + IDirect3DDevice8* m_Direct3DDevice; + +public: + IPlugin(void) { } + virtual ~IPlugin(void) { } + +public: + plugininfo_t GetPluginInfo(void) override + { + return plugininfo_t("IPlugin", "Ashita Development Team", ASHITA_INTERFACE_VERSION, 1.0f, 0); + } + +public: + bool Initialize(IAshitaCore* core, ILogManager* log, uint32_t id) override + { + this->m_AshitaCore = core; + this->m_LogManager = log; + this->m_Direct3DDevice = nullptr; + this->m_PluginId = id; + return false; + } + void Release(void) override + { } + bool HandleCommand(const char* command, int32_t type) override + { + UNREFERENCED_PARAMETER(command); + UNREFERENCED_PARAMETER(type); + return false; + } + bool HandleIncomingText(int16_t mode, const char* message, int16_t* modifiedMode, char* modifiedMessage, bool blocked) override + { + UNREFERENCED_PARAMETER(mode); + UNREFERENCED_PARAMETER(message); + UNREFERENCED_PARAMETER(modifiedMode); + UNREFERENCED_PARAMETER(modifiedMessage); + UNREFERENCED_PARAMETER(blocked); + return false; + } + bool HandleOutgoingText(int32_t type, const char* message, int32_t* modifiedType, char* modifiedMessage, bool blocked) override + { + UNREFERENCED_PARAMETER(type); + UNREFERENCED_PARAMETER(message); + UNREFERENCED_PARAMETER(modifiedType); + UNREFERENCED_PARAMETER(modifiedMessage); + UNREFERENCED_PARAMETER(blocked); + return false; + } + bool HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked) override + { + UNREFERENCED_PARAMETER(id); + UNREFERENCED_PARAMETER(size); + UNREFERENCED_PARAMETER(data); + UNREFERENCED_PARAMETER(modified); + UNREFERENCED_PARAMETER(blocked); + return false; + } + bool HandleOutgoingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked) override + { + UNREFERENCED_PARAMETER(id); + UNREFERENCED_PARAMETER(size); + UNREFERENCED_PARAMETER(data); + UNREFERENCED_PARAMETER(modified); + UNREFERENCED_PARAMETER(blocked); + return false; + } + bool Direct3DInitialize(IDirect3DDevice8* device) override + { + this->m_Direct3DDevice = device; + return false; + } + void Direct3DRelease(void) override + { } + void Direct3DPreRender(void) override + { } + void Direct3DRender(void) override + { } + bool Direct3DPresent(const RECT* pSourceRect, const RECT* pDestRect, HWND hDestWindowOverride, const RGNDATA* pDirtyRegion) override + { + UNREFERENCED_PARAMETER(pSourceRect); + UNREFERENCED_PARAMETER(pDestRect); + UNREFERENCED_PARAMETER(hDestWindowOverride); + UNREFERENCED_PARAMETER(pDirtyRegion); + return false; + } + bool Direct3DDrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) override + { + UNREFERENCED_PARAMETER(PrimitiveType); + UNREFERENCED_PARAMETER(StartVertex); + UNREFERENCED_PARAMETER(PrimitiveCount); + return false; + } + bool Direct3DDrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT minIndex, UINT NumVertices, UINT startIndex, UINT primCount) override + { + UNREFERENCED_PARAMETER(PrimitiveType); + UNREFERENCED_PARAMETER(minIndex); + UNREFERENCED_PARAMETER(NumVertices); + UNREFERENCED_PARAMETER(startIndex); + UNREFERENCED_PARAMETER(primCount); + return false; + } + bool Direct3DDrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) override + { + UNREFERENCED_PARAMETER(PrimitiveType); + UNREFERENCED_PARAMETER(PrimitiveCount); + UNREFERENCED_PARAMETER(pVertexStreamZeroData); + UNREFERENCED_PARAMETER(VertexStreamZeroStride); + return false; + } + bool Direct3DDrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) override + { + UNREFERENCED_PARAMETER(PrimitiveType); + UNREFERENCED_PARAMETER(MinVertexIndex); + UNREFERENCED_PARAMETER(NumVertexIndices); + UNREFERENCED_PARAMETER(PrimitiveCount); + UNREFERENCED_PARAMETER(pIndexData); + UNREFERENCED_PARAMETER(IndexDataFormat); + UNREFERENCED_PARAMETER(pVertexStreamZeroData); + UNREFERENCED_PARAMETER(VertexStreamZeroStride); + return false; + } + bool Direct3DSetRenderState(D3DRENDERSTATETYPE State, DWORD Value) override + { + UNREFERENCED_PARAMETER(State); + UNREFERENCED_PARAMETER(Value); + return false; + } +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Ashita Plugin Exports +// +// These functions are required to be exported by all plugins in order to be validated +// for loading. Failure to export these functions will result in your plugin not being +// loaded. Plugins must return proper data for the plugin information and plugin creation +// otherwise it can lead to crashes! +// +// getinterfaceversion_f +// Exported function to return the plugins interface version it was compiled with. +// +// createplugininfo_f +// Exported function to return information about the given plugin back to Ashita. +// This info is used to validate the plugin as well as used when the plugin list is printed. +// +// createplugin_f +// Exported function to return a new instance of the plugins base class. This class must +// inherit from IPlugin as the returned value will be the inherited base object. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef double /**/(__stdcall *getinterfaceversion_f)(void); +typedef void /**/(__stdcall *createplugininfo_f)(plugininfo_t* info); +typedef IPlugin* /**/(__stdcall *createplugin_f)(void); + +#endif // __ASHITA_ADK_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/d3d8/includes/d3d8.h b/plugins/ADK/d3d8/includes/d3d8.h new file mode 100644 index 0000000..adf91eb --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3d8.h @@ -0,0 +1,1279 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D8_H_ +#define _D3D8_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + + +/* This identifier is passed to Direct3DCreate8 in order to ensure that an + * application was built against the correct header files. This number is + * incremented whenever a header (or other) change would require applications + * to be rebuilt. If the version doesn't match, Direct3DCreate8 will fail. + * (The number itself has no meaning.)*/ + +#define D3D_SDK_VERSION 220 + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); +#endif + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) + +/* IID_IDirect3D8 */ +/* {1DD9E8DA-1C77-4d40-B0CF-98FEFDFF9512} */ +DEFINE_GUID(IID_IDirect3D8, 0x1dd9e8da, 0x1c77, 0x4d40, 0xb0, 0xcf, 0x98, 0xfe, 0xfd, 0xff, 0x95, 0x12); + +/* IID_IDirect3DDevice8 */ +/* {7385E5DF-8FE8-41D5-86B6-D7B48547B6CF} */ +DEFINE_GUID(IID_IDirect3DDevice8, 0x7385e5df, 0x8fe8, 0x41d5, 0x86, 0xb6, 0xd7, 0xb4, 0x85, 0x47, 0xb6, 0xcf); + +/* IID_IDirect3DResource8 */ +/* {1B36BB7B-09B7-410a-B445-7D1430D7B33F} */ +DEFINE_GUID(IID_IDirect3DResource8, 0x1b36bb7b, 0x9b7, 0x410a, 0xb4, 0x45, 0x7d, 0x14, 0x30, 0xd7, 0xb3, 0x3f); + +/* IID_IDirect3DBaseTexture8 */ +/* {B4211CFA-51B9-4a9f-AB78-DB99B2BB678E} */ +DEFINE_GUID(IID_IDirect3DBaseTexture8, 0xb4211cfa, 0x51b9, 0x4a9f, 0xab, 0x78, 0xdb, 0x99, 0xb2, 0xbb, 0x67, 0x8e); + +/* IID_IDirect3DTexture8 */ +/* {E4CDD575-2866-4f01-B12E-7EECE1EC9358} */ +DEFINE_GUID(IID_IDirect3DTexture8, 0xe4cdd575, 0x2866, 0x4f01, 0xb1, 0x2e, 0x7e, 0xec, 0xe1, 0xec, 0x93, 0x58); + +/* IID_IDirect3DCubeTexture8 */ +/* {3EE5B968-2ACA-4c34-8BB5-7E0C3D19B750} */ +DEFINE_GUID(IID_IDirect3DCubeTexture8, 0x3ee5b968, 0x2aca, 0x4c34, 0x8b, 0xb5, 0x7e, 0x0c, 0x3d, 0x19, 0xb7, 0x50); + +/* IID_IDirect3DVolumeTexture8 */ +/* {4B8AAAFA-140F-42ba-9131-597EAFAA2EAD} */ +DEFINE_GUID(IID_IDirect3DVolumeTexture8, 0x4b8aaafa, 0x140f, 0x42ba, 0x91, 0x31, 0x59, 0x7e, 0xaf, 0xaa, 0x2e, 0xad); + +/* IID_IDirect3DVertexBuffer8 */ +/* {8AEEEAC7-05F9-44d4-B591-000B0DF1CB95} */ +DEFINE_GUID(IID_IDirect3DVertexBuffer8, 0x8aeeeac7, 0x05f9, 0x44d4, 0xb5, 0x91, 0x00, 0x0b, 0x0d, 0xf1, 0xcb, 0x95); + +/* IID_IDirect3DIndexBuffer8 */ +/* {0E689C9A-053D-44a0-9D92-DB0E3D750F86} */ +DEFINE_GUID(IID_IDirect3DIndexBuffer8, 0x0e689c9a, 0x053d, 0x44a0, 0x9d, 0x92, 0xdb, 0x0e, 0x3d, 0x75, 0x0f, 0x86); + +/* IID_IDirect3DSurface8 */ +/* {B96EEBCA-B326-4ea5-882F-2FF5BAE021DD} */ +DEFINE_GUID(IID_IDirect3DSurface8, 0xb96eebca, 0xb326, 0x4ea5, 0x88, 0x2f, 0x2f, 0xf5, 0xba, 0xe0, 0x21, 0xdd); + +/* IID_IDirect3DVolume8 */ +/* {BD7349F5-14F1-42e4-9C79-972380DB40C0} */ +DEFINE_GUID(IID_IDirect3DVolume8, 0xbd7349f5, 0x14f1, 0x42e4, 0x9c, 0x79, 0x97, 0x23, 0x80, 0xdb, 0x40, 0xc0); + +/* IID_IDirect3DSwapChain8 */ +/* {928C088B-76B9-4C6B-A536-A590853876CD} */ +DEFINE_GUID(IID_IDirect3DSwapChain8, 0x928c088b, 0x76b9, 0x4c6b, 0xa5, 0x36, 0xa5, 0x90, 0x85, 0x38, 0x76, 0xcd); + +#endif + +#ifdef __cplusplus + +interface IDirect3D8; +interface IDirect3DDevice8; + +interface IDirect3DResource8; +interface IDirect3DBaseTexture8; +interface IDirect3DTexture8; +interface IDirect3DVolumeTexture8; +interface IDirect3DCubeTexture8; + +interface IDirect3DVertexBuffer8; +interface IDirect3DIndexBuffer8; + +interface IDirect3DSurface8; +interface IDirect3DVolume8; + +interface IDirect3DSwapChain8; + +#endif + + +typedef interface IDirect3D8 IDirect3D8; +typedef interface IDirect3DDevice8 IDirect3DDevice8; +typedef interface IDirect3DResource8 IDirect3DResource8; +typedef interface IDirect3DBaseTexture8 IDirect3DBaseTexture8; +typedef interface IDirect3DTexture8 IDirect3DTexture8; +typedef interface IDirect3DVolumeTexture8 IDirect3DVolumeTexture8; +typedef interface IDirect3DCubeTexture8 IDirect3DCubeTexture8; +typedef interface IDirect3DVertexBuffer8 IDirect3DVertexBuffer8; +typedef interface IDirect3DIndexBuffer8 IDirect3DIndexBuffer8; +typedef interface IDirect3DSurface8 IDirect3DSurface8; +typedef interface IDirect3DVolume8 IDirect3DVolume8; +typedef interface IDirect3DSwapChain8 IDirect3DSwapChain8; + +#include "d3d8types.h" +#include "d3d8caps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DLL Function for creating a Direct3D8 object. This object supports + * enumeration and allows the creation of Direct3DDevice8 objects. + * Pass the value of the constant D3D_SDK_VERSION to this function, so + * that the run-time can validate that your application was compiled + * against the right headers. + */ + +IDirect3D8 * WINAPI Direct3DCreate8(UINT SDKVersion); + + +/* + * Direct3D interfaces + */ + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3D8 + +DECLARE_INTERFACE_(IDirect3D8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D8 methods ***/ + STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER8* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE CheckType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL Windowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS8* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice8** ppReturnedDeviceInterface) PURE; +}; + +typedef struct IDirect3D8 *LPDIRECT3D8, *PDIRECT3D8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D8_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D8_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D8_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D8_GetAdapterModeCount(p,a) (p)->lpVtbl->GetAdapterModeCount(p,a) +#define IDirect3D8_EnumAdapterModes(p,a,b,c) (p)->lpVtbl->EnumAdapterModes(p,a,b,c) +#define IDirect3D8_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D8_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D8_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D8_CheckDeviceMultiSampleType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e) +#define IDirect3D8_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D8_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D8_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D8_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#else +#define IDirect3D8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D8_AddRef(p) (p)->AddRef() +#define IDirect3D8_Release(p) (p)->Release() +#define IDirect3D8_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) +#define IDirect3D8_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D8_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D8_GetAdapterModeCount(p,a) (p)->GetAdapterModeCount(a) +#define IDirect3D8_EnumAdapterModes(p,a,b,c) (p)->EnumAdapterModes(a,b,c) +#define IDirect3D8_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D8_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D8_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D8_CheckDeviceMultiSampleType(p,a,b,c,d,e) (p)->CheckDeviceMultiSampleType(a,b,c,d,e) +#define IDirect3D8_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D8_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D8_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D8_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#endif + + + + + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice8 + +DECLARE_INTERFACE_(IDirect3DDevice8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice8 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(ResourceManagerDiscardBytes)(THIS_ DWORD Bytes) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D8** ppD3D8) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS8* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface8* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain8** pSwapChain) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture8** ppTexture) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture8** ppVolumeTexture) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture8** ppCubeTexture) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer8** ppVertexBuffer) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer8** ppIndexBuffer) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,BOOL Lockable,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CreateImageSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CopyRects)(THIS_ IDirect3DSurface8* pSourceSurface,CONST RECT* pSourceRectsArray,UINT cRects,IDirect3DSurface8* pDestinationSurface,CONST POINT* pDestPointsArray) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture8* pSourceTexture,IDirect3DBaseTexture8* pDestinationTexture) PURE; + STDMETHOD(GetFrontBuffer)(THIS_ IDirect3DSurface8* pDestSurface) PURE; + STDMETHOD(SetRenderTarget)(THIS_ IDirect3DSurface8* pRenderTarget,IDirect3DSurface8* pNewZStencil) PURE; + STDMETHOD(GetRenderTarget)(THIS_ IDirect3DSurface8** ppRenderTarget) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface8** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT8* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT8* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL8* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL8* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT8*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT8*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ DWORD* pToken) PURE; + STDMETHOD(ApplyStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(CaptureStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(DeleteStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,DWORD* pToken) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS8* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS8* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture8** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture8* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(GetInfo)(THIS_ DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage) PURE; + STDMETHOD(SetVertexShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(GetVertexShader)(THIS_ DWORD* pHandle) PURE; + STDMETHOD(DeleteVertexShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(SetVertexShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetVertexShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetVertexShaderDeclaration)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(GetVertexShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer8** ppStreamData,UINT* pStride) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,DWORD* pHandle) PURE; + STDMETHOD(SetPixelShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(GetPixelShader)(THIS_ DWORD* pHandle) PURE; + STDMETHOD(DeletePixelShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(SetPixelShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetPixelShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetPixelShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; +}; + +typedef struct IDirect3DDevice8 *LPDIRECT3DDEVICE8, *PDIRECT3DDEVICE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice8_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice8_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice8_ResourceManagerDiscardBytes(p,a) (p)->lpVtbl->ResourceManagerDiscardBytes(p,a) +#define IDirect3DDevice8_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice8_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice8_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DDevice8_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice8_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice8_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice8_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice8_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice8_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice8_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice8_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DDevice8_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DDevice8_SetGammaRamp(p,a,b) (p)->lpVtbl->SetGammaRamp(p,a,b) +#define IDirect3DDevice8_GetGammaRamp(p,a) (p)->lpVtbl->GetGammaRamp(p,a) +#define IDirect3DDevice8_CreateTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice8_CreateVolumeTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_CreateCubeTexture(p,a,b,c,d,e,f) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f) +#define IDirect3DDevice8_CreateVertexBuffer(p,a,b,c,d,e) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateIndexBuffer(p,a,b,c,d,e) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateRenderTarget(p,a,b,c,d,e,f) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f) +#define IDirect3DDevice8_CreateDepthStencilSurface(p,a,b,c,d,e) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateImageSurface(p,a,b,c,d) (p)->lpVtbl->CreateImageSurface(p,a,b,c,d) +#define IDirect3DDevice8_CopyRects(p,a,b,c,d,e) (p)->lpVtbl->CopyRects(p,a,b,c,d,e) +#define IDirect3DDevice8_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice8_GetFrontBuffer(p,a) (p)->lpVtbl->GetFrontBuffer(p,a) +#define IDirect3DDevice8_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice8_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice8_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice8_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice8_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice8_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice8_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice8_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice8_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice8_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice8_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice8_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice8_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice8_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice8_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice8_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice8_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice8_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice8_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice8_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice8_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice8_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice8_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice8_ApplyStateBlock(p,a) (p)->lpVtbl->ApplyStateBlock(p,a) +#define IDirect3DDevice8_CaptureStateBlock(p,a) (p)->lpVtbl->CaptureStateBlock(p,a) +#define IDirect3DDevice8_DeleteStateBlock(p,a) (p)->lpVtbl->DeleteStateBlock(p,a) +#define IDirect3DDevice8_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice8_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice8_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice8_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice8_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice8_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice8_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice8_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice8_GetInfo(p,a,b,c) (p)->lpVtbl->GetInfo(p,a,b,c) +#define IDirect3DDevice8_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice8_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice8_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice8_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice8_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->lpVtbl->CreateVertexShader(p,a,b,c,d) +#define IDirect3DDevice8_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice8_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice8_DeleteVertexShader(p,a) (p)->lpVtbl->DeleteVertexShader(p,a) +#define IDirect3DDevice8_SetVertexShaderConstant(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderConstant(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderDeclaration(p,a,b,c) (p)->lpVtbl->GetVertexShaderDeclaration(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderFunction(p,a,b,c) (p)->lpVtbl->GetVertexShaderFunction(p,a,b,c) +#define IDirect3DDevice8_SetStreamSource(p,a,b,c) (p)->lpVtbl->SetStreamSource(p,a,b,c) +#define IDirect3DDevice8_GetStreamSource(p,a,b,c) (p)->lpVtbl->GetStreamSource(p,a,b,c) +#define IDirect3DDevice8_SetIndices(p,a,b) (p)->lpVtbl->SetIndices(p,a,b) +#define IDirect3DDevice8_GetIndices(p,a,b) (p)->lpVtbl->GetIndices(p,a,b) +#define IDirect3DDevice8_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice8_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice8_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice8_DeletePixelShader(p,a) (p)->lpVtbl->DeletePixelShader(p,a) +#define IDirect3DDevice8_SetPixelShaderConstant(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetPixelShaderConstant(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetPixelShaderFunction(p,a,b,c) (p)->lpVtbl->GetPixelShaderFunction(p,a,b,c) +#define IDirect3DDevice8_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice8_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice8_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#else +#define IDirect3DDevice8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice8_AddRef(p) (p)->AddRef() +#define IDirect3DDevice8_Release(p) (p)->Release() +#define IDirect3DDevice8_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice8_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice8_ResourceManagerDiscardBytes(p,a) (p)->ResourceManagerDiscardBytes(a) +#define IDirect3DDevice8_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice8_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice8_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DDevice8_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice8_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice8_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice8_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice8_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice8_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice8_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice8_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DDevice8_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DDevice8_SetGammaRamp(p,a,b) (p)->SetGammaRamp(a,b) +#define IDirect3DDevice8_GetGammaRamp(p,a) (p)->GetGammaRamp(a) +#define IDirect3DDevice8_CreateTexture(p,a,b,c,d,e,f,g) (p)->CreateTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice8_CreateVolumeTexture(p,a,b,c,d,e,f,g,h) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_CreateCubeTexture(p,a,b,c,d,e,f) (p)->CreateCubeTexture(a,b,c,d,e,f) +#define IDirect3DDevice8_CreateVertexBuffer(p,a,b,c,d,e) (p)->CreateVertexBuffer(a,b,c,d,e) +#define IDirect3DDevice8_CreateIndexBuffer(p,a,b,c,d,e) (p)->CreateIndexBuffer(a,b,c,d,e) +#define IDirect3DDevice8_CreateRenderTarget(p,a,b,c,d,e,f) (p)->CreateRenderTarget(a,b,c,d,e,f) +#define IDirect3DDevice8_CreateDepthStencilSurface(p,a,b,c,d,e) (p)->CreateDepthStencilSurface(a,b,c,d,e) +#define IDirect3DDevice8_CreateImageSurface(p,a,b,c,d) (p)->CreateImageSurface(a,b,c,d) +#define IDirect3DDevice8_CopyRects(p,a,b,c,d,e) (p)->CopyRects(a,b,c,d,e) +#define IDirect3DDevice8_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice8_GetFrontBuffer(p,a) (p)->GetFrontBuffer(a) +#define IDirect3DDevice8_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice8_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice8_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice8_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice8_EndScene(p) (p)->EndScene() +#define IDirect3DDevice8_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice8_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice8_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice8_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice8_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice8_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice8_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice8_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice8_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice8_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice8_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice8_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice8_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice8_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice8_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice8_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice8_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice8_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice8_ApplyStateBlock(p,a) (p)->ApplyStateBlock(a) +#define IDirect3DDevice8_CaptureStateBlock(p,a) (p)->CaptureStateBlock(a) +#define IDirect3DDevice8_DeleteStateBlock(p,a) (p)->DeleteStateBlock(a) +#define IDirect3DDevice8_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice8_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice8_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice8_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice8_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice8_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice8_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice8_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice8_GetInfo(p,a,b,c) (p)->GetInfo(a,b,c) +#define IDirect3DDevice8_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice8_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice8_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice8_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice8_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->DrawIndexedPrimitive(a,b,c,d,e) +#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->ProcessVertices(a,b,c,d,e) +#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->CreateVertexShader(a,b,c,d) +#define IDirect3DDevice8_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice8_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice8_DeleteVertexShader(p,a) (p)->DeleteVertexShader(a) +#define IDirect3DDevice8_SetVertexShaderConstant(p,a,b,c) (p)->SetVertexShaderConstant(a,b,c) +#define IDirect3DDevice8_GetVertexShaderConstant(p,a,b,c) (p)->GetVertexShaderConstant(a,b,c) +#define IDirect3DDevice8_GetVertexShaderDeclaration(p,a,b,c) (p)->GetVertexShaderDeclaration(a,b,c) +#define IDirect3DDevice8_GetVertexShaderFunction(p,a,b,c) (p)->GetVertexShaderFunction(a,b,c) +#define IDirect3DDevice8_SetStreamSource(p,a,b,c) (p)->SetStreamSource(a,b,c) +#define IDirect3DDevice8_GetStreamSource(p,a,b,c) (p)->GetStreamSource(a,b,c) +#define IDirect3DDevice8_SetIndices(p,a,b) (p)->SetIndices(a,b) +#define IDirect3DDevice8_GetIndices(p,a,b) (p)->GetIndices(a,b) +#define IDirect3DDevice8_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice8_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice8_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice8_DeletePixelShader(p,a) (p)->DeletePixelShader(a) +#define IDirect3DDevice8_SetPixelShaderConstant(p,a,b,c) (p)->SetPixelShaderConstant(a,b,c) +#define IDirect3DDevice8_GetPixelShaderConstant(p,a,b,c) (p)->GetPixelShaderConstant(a,b,c) +#define IDirect3DDevice8_GetPixelShaderFunction(p,a,b,c) (p)->GetPixelShaderFunction(a,b,c) +#define IDirect3DDevice8_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice8_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice8_DeletePatch(p,a) (p)->DeletePatch(a) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain8 + +DECLARE_INTERFACE_(IDirect3DSwapChain8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain8 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) PURE; +}; + +typedef struct IDirect3DSwapChain8 *LPDIRECT3DSWAPCHAIN8, *PDIRECT3DSWAPCHAIN8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain8_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DSwapChain8_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#else +#define IDirect3DSwapChain8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain8_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain8_Release(p) (p)->Release() +#define IDirect3DSwapChain8_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DSwapChain8_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DResource8 + +DECLARE_INTERFACE_(IDirect3DResource8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; +}; + +typedef struct IDirect3DResource8 *LPDIRECT3DRESOURCE8, *PDIRECT3DRESOURCE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DResource8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DResource8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DResource8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DResource8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DResource8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DResource8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DResource8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DResource8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DResource8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DResource8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DResource8_GetType(p) (p)->lpVtbl->GetType(p) +#else +#define IDirect3DResource8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DResource8_AddRef(p) (p)->AddRef() +#define IDirect3DResource8_Release(p) (p)->Release() +#define IDirect3DResource8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DResource8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DResource8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DResource8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DResource8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DResource8_GetPriority(p) (p)->GetPriority() +#define IDirect3DResource8_PreLoad(p) (p)->PreLoad() +#define IDirect3DResource8_GetType(p) (p)->GetType() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DBaseTexture8 + +DECLARE_INTERFACE_(IDirect3DBaseTexture8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; +}; + +typedef struct IDirect3DBaseTexture8 *LPDIRECT3DBASETEXTURE8, *PDIRECT3DBASETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DBaseTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DBaseTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DBaseTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DBaseTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DBaseTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DBaseTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DBaseTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DBaseTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DBaseTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DBaseTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DBaseTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DBaseTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DBaseTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DBaseTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#else +#define IDirect3DBaseTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DBaseTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DBaseTexture8_Release(p) (p)->Release() +#define IDirect3DBaseTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DBaseTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DBaseTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DBaseTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DBaseTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DBaseTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DBaseTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DBaseTexture8_GetType(p) (p)->GetType() +#define IDirect3DBaseTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DBaseTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DBaseTexture8_GetLevelCount(p) (p)->GetLevelCount() +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DTexture8 + +DECLARE_INTERFACE_(IDirect3DTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface8** ppSurfaceLevel) PURE; + STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DTexture8 *LPDIRECT3DTEXTURE8, *PDIRECT3DTEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DTexture8_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IDirect3DTexture8_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IDirect3DTexture8_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IDirect3DTexture8_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) +#else +#define IDirect3DTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DTexture8_Release(p) (p)->Release() +#define IDirect3DTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DTexture8_GetType(p) (p)->GetType() +#define IDirect3DTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DTexture8_GetSurfaceLevel(p,a,b) (p)->GetSurfaceLevel(a,b) +#define IDirect3DTexture8_LockRect(p,a,b,c,d) (p)->LockRect(a,b,c,d) +#define IDirect3DTexture8_UnlockRect(p,a) (p)->UnlockRect(a) +#define IDirect3DTexture8_AddDirtyRect(p,a) (p)->AddDirtyRect(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolumeTexture8 + +DECLARE_INTERFACE_(IDirect3DVolumeTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume8** ppVolumeLevel) PURE; + STDMETHOD(LockBox)(THIS_ UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; +}; + +typedef struct IDirect3DVolumeTexture8 *LPDIRECT3DVOLUMETEXTURE8, *PDIRECT3DVOLUMETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolumeTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolumeTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolumeTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolumeTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolumeTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolumeTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolumeTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolumeTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVolumeTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVolumeTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVolumeTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVolumeTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DVolumeTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DVolumeTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DVolumeTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DVolumeTexture8_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IDirect3DVolumeTexture8_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IDirect3DVolumeTexture8_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IDirect3DVolumeTexture8_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) +#else +#define IDirect3DVolumeTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolumeTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DVolumeTexture8_Release(p) (p)->Release() +#define IDirect3DVolumeTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolumeTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolumeTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolumeTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolumeTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVolumeTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DVolumeTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DVolumeTexture8_GetType(p) (p)->GetType() +#define IDirect3DVolumeTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DVolumeTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DVolumeTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DVolumeTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DVolumeTexture8_GetVolumeLevel(p,a,b) (p)->GetVolumeLevel(a,b) +#define IDirect3DVolumeTexture8_LockBox(p,a,b,c,d) (p)->LockBox(a,b,c,d) +#define IDirect3DVolumeTexture8_UnlockBox(p,a) (p)->UnlockBox(a) +#define IDirect3DVolumeTexture8_AddDirtyBox(p,a) (p)->AddDirtyBox(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DCubeTexture8 + +DECLARE_INTERFACE_(IDirect3DCubeTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface8** ppCubeMapSurface) PURE; + STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DCubeTexture8 *LPDIRECT3DCUBETEXTURE8, *PDIRECT3DCUBETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DCubeTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCubeTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCubeTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DCubeTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DCubeTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DCubeTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DCubeTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DCubeTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DCubeTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DCubeTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DCubeTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DCubeTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DCubeTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DCubeTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DCubeTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DCubeTexture8_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IDirect3DCubeTexture8_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IDirect3DCubeTexture8_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IDirect3DCubeTexture8_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) +#else +#define IDirect3DCubeTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DCubeTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DCubeTexture8_Release(p) (p)->Release() +#define IDirect3DCubeTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DCubeTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DCubeTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DCubeTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DCubeTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DCubeTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DCubeTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DCubeTexture8_GetType(p) (p)->GetType() +#define IDirect3DCubeTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DCubeTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DCubeTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DCubeTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DCubeTexture8_GetCubeMapSurface(p,a,b,c) (p)->GetCubeMapSurface(a,b,c) +#define IDirect3DCubeTexture8_LockRect(p,a,b,c,d,e) (p)->LockRect(a,b,c,d,e) +#define IDirect3DCubeTexture8_UnlockRect(p,a,b) (p)->UnlockRect(a,b) +#define IDirect3DCubeTexture8_AddDirtyRect(p,a,b) (p)->AddDirtyRect(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer8 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DVertexBuffer8 *LPDIRECT3DVERTEXBUFFER8, *PDIRECT3DVERTEXBUFFER8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexBuffer8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVertexBuffer8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVertexBuffer8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVertexBuffer8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVertexBuffer8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVertexBuffer8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVertexBuffer8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVertexBuffer8_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DVertexBuffer8_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DVertexBuffer8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer8_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer8_Release(p) (p)->Release() +#define IDirect3DVertexBuffer8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexBuffer8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVertexBuffer8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVertexBuffer8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVertexBuffer8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVertexBuffer8_GetPriority(p) (p)->GetPriority() +#define IDirect3DVertexBuffer8_PreLoad(p) (p)->PreLoad() +#define IDirect3DVertexBuffer8_GetType(p) (p)->GetType() +#define IDirect3DVertexBuffer8_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DVertexBuffer8_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer8_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DIndexBuffer8 + +DECLARE_INTERFACE_(IDirect3DIndexBuffer8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DIndexBuffer8 *LPDIRECT3DINDEXBUFFER8, *PDIRECT3DINDEXBUFFER8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DIndexBuffer8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DIndexBuffer8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DIndexBuffer8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DIndexBuffer8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DIndexBuffer8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DIndexBuffer8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DIndexBuffer8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DIndexBuffer8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DIndexBuffer8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DIndexBuffer8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DIndexBuffer8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DIndexBuffer8_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DIndexBuffer8_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DIndexBuffer8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DIndexBuffer8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DIndexBuffer8_AddRef(p) (p)->AddRef() +#define IDirect3DIndexBuffer8_Release(p) (p)->Release() +#define IDirect3DIndexBuffer8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DIndexBuffer8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DIndexBuffer8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DIndexBuffer8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DIndexBuffer8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DIndexBuffer8_GetPriority(p) (p)->GetPriority() +#define IDirect3DIndexBuffer8_PreLoad(p) (p)->PreLoad() +#define IDirect3DIndexBuffer8_GetType(p) (p)->GetType() +#define IDirect3DIndexBuffer8_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DIndexBuffer8_Unlock(p) (p)->Unlock() +#define IDirect3DIndexBuffer8_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSurface8 + +DECLARE_INTERFACE_(IDirect3DSurface8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSurface8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS) PURE; +}; + +typedef struct IDirect3DSurface8 *LPDIRECT3DSURFACE8, *PDIRECT3DSURFACE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSurface8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSurface8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSurface8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSurface8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSurface8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DSurface8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DSurface8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DSurface8_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DSurface8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DSurface8_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) +#define IDirect3DSurface8_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) +#else +#define IDirect3DSurface8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSurface8_AddRef(p) (p)->AddRef() +#define IDirect3DSurface8_Release(p) (p)->Release() +#define IDirect3DSurface8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSurface8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DSurface8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DSurface8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DSurface8_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DSurface8_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DSurface8_LockRect(p,a,b,c) (p)->LockRect(a,b,c) +#define IDirect3DSurface8_UnlockRect(p) (p)->UnlockRect() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolume8 + +DECLARE_INTERFACE_(IDirect3DVolume8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVolume8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS) PURE; +}; + +typedef struct IDirect3DVolume8 *LPDIRECT3DVOLUME8, *PDIRECT3DVOLUME8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolume8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolume8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolume8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolume8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolume8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolume8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolume8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolume8_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DVolume8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DVolume8_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IDirect3DVolume8_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) +#else +#define IDirect3DVolume8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolume8_AddRef(p) (p)->AddRef() +#define IDirect3DVolume8_Release(p) (p)->Release() +#define IDirect3DVolume8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolume8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolume8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolume8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolume8_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DVolume8_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DVolume8_LockBox(p,a,b,c) (p)->LockBox(a,b,c) +#define IDirect3DVolume8_UnlockBox(p) (p)->UnlockBox() +#endif + +/**************************************************************************** + * Flags for SetPrivateData method on all D3D8 interfaces + * + * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData + * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this + * pointer and Release when the private data is destroyed. The data will be + * destroyed when another SetPrivateData with the same GUID is set, when + * FreePrivateData is called, or when the D3D8 object is freed. + ****************************************************************************/ +#define D3DSPD_IUNKNOWN 0x00000001L + +/**************************************************************************** + * + * Parameter for IDirect3D8 Enum and GetCaps8 functions to get the info for + * the current mode only. + * + ****************************************************************************/ + +#define D3DCURRENT_DISPLAY_MODE 0x00EFFFFFL + +/**************************************************************************** + * + * Flags for IDirect3D8::CreateDevice's BehaviorFlags + * + ****************************************************************************/ + +#define D3DCREATE_FPU_PRESERVE 0x00000002L +#define D3DCREATE_MULTITHREADED 0x00000004L + +#define D3DCREATE_PUREDEVICE 0x00000010L +#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020L +#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040L +#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080L + +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100L + + +/**************************************************************************** + * + * Parameter for IDirect3D8::CreateDevice's iAdapter + * + ****************************************************************************/ + +#define D3DADAPTER_DEFAULT 0 + +/**************************************************************************** + * + * Flags for IDirect3D8::EnumAdapters + * + ****************************************************************************/ + +#define D3DENUM_NO_WHQL_LEVEL 0x00000002L + +/**************************************************************************** + * + * Maximum number of back-buffers supported in DX8 + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX 3L + +/**************************************************************************** + * + * Flags for IDirect3DDevice8::SetGammaRamp + * + ****************************************************************************/ + +#define D3DSGR_NO_CALIBRATION 0x00000000L +#define D3DSGR_CALIBRATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DDevice8::SetCursorPosition + * + ****************************************************************************/ + +#define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + + +/* + * DirectDraw error codes + */ +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) + +/* + * Direct3D Errors + */ +#define D3D_OK S_OK + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) +#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) + +#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) +#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) +#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) +#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) +#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) +#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) +#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D_H_ */ + diff --git a/plugins/ADK/d3d8/includes/d3d8caps.h b/plugins/ADK/d3d8/includes/d3d8caps.h new file mode 100644 index 0000000..6af8e6c --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3d8caps.h @@ -0,0 +1,364 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8caps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3D8CAPS_H +#define _D3D8CAPS_H + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +typedef struct _D3DCAPS8 +{ + /* 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 IDirect3DTexture8's + DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture8's + DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture8's + DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture8's + DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture8'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 MaxPixelShaderValue; // max value of pixel shader arithmetic component + +} D3DCAPS8; + +// +// BIT DEFINES FOR D3DCAPS8 DWORD MEMBERS +// + +// +// Caps +// +#define D3DCAPS_READ_SCANLINE 0x00020000L + +// +// Caps2 +// +#define D3DCAPS2_NO2DDURING3DSCENE 0x00000002L +#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L +#define D3DCAPS2_CANRENDERWINDOWED 0x00080000L +#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L +#define D3DCAPS2_RESERVED 0x02000000L +#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L +#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L + +// +// 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 + +// +// 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_LINEPATTERNREP 0x00000004L +#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 */ + +// +// LineCaps +// +#define D3DLINECAPS_TEXTURE 0x00000001L +#define D3DLINECAPS_ZTEST 0x00000002L +#define D3DLINECAPS_BLEND 0x00000004L +#define D3DLINECAPS_ALPHACMP 0x00000008L +#define D3DLINECAPS_FOG 0x00000010L + +// +// RasterCaps +// +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_PAT 0x00000008L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L +#define D3DPRASTERCAPS_ZBIAS 0x00004000L +#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_STRETCHBLTMULTISAMPLE 0x00800000L + +// +// 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 + +// +// 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 */ + +// +// TextureFilterCaps +// +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */ +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */ +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */ +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L +#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000L +#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 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 + +// +// 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_NO_VSDT_UBYTE4 0x00000080L /* device does not support D3DVSDT_UBYTE4 */ + +#pragma pack() + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D8CAPS_H_ */ + diff --git a/plugins/ADK/d3d8/includes/d3d8types.h b/plugins/ADK/d3d8/includes/d3d8types.h new file mode 100644 index 0000000..5d622af --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3d8types.h @@ -0,0 +1,1684 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8types.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3D8TYPES_H_ +#define _D3D8TYPES_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + +#include + +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +// maps unsigned 8 bits/channel to D3DCOLOR +#define D3DCOLOR_ARGB(a,r,g,b) \ + ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) +#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) + +// maps floating point channels (0.f to 1.f range) to D3DCOLOR +#define D3DCOLOR_COLORVALUE(r,g,b,a) \ + D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) + + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef D3DCOLORVALUE_DEFINED +typedef struct _D3DCOLORVALUE { + float r; + float g; + float b; + float a; +} D3DCOLORVALUE; +#define D3DCOLORVALUE_DEFINED +#endif + +#ifndef D3DRECT_DEFINED +typedef struct _D3DRECT { + LONG x1; + LONG y1; + LONG x2; + LONG y2; +} D3DRECT; +#define D3DRECT_DEFINED +#endif + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif + +typedef struct _D3DVIEWPORT8 { + DWORD X; + DWORD Y; /* Viewport Top left */ + DWORD Width; + DWORD Height; /* Viewport Dimensions */ + float MinZ; /* Min/max of clip Volume */ + float MaxZ; +} D3DVIEWPORT8; + +/* + * Values for clip fields. + */ + +// Max number of user clipping planes, supported in D3D. +#define D3DMAXUSERCLIPPLANES 32 + +// These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE +// +#define D3DCLIPPLANE0 (1 << 0) +#define D3DCLIPPLANE1 (1 << 1) +#define D3DCLIPPLANE2 (1 << 2) +#define D3DCLIPPLANE3 (1 << 3) +#define D3DCLIPPLANE4 (1 << 4) +#define D3DCLIPPLANE5 (1 << 5) + +// The following bits are used in the ClipUnion and ClipIntersection +// members of the D3DCLIPSTATUS8 +// + +#define D3DCS_LEFT 0x00000001L +#define D3DCS_RIGHT 0x00000002L +#define D3DCS_TOP 0x00000004L +#define D3DCS_BOTTOM 0x00000008L +#define D3DCS_FRONT 0x00000010L +#define D3DCS_BACK 0x00000020L +#define D3DCS_PLANE0 0x00000040L +#define D3DCS_PLANE1 0x00000080L +#define D3DCS_PLANE2 0x00000100L +#define D3DCS_PLANE3 0x00000200L +#define D3DCS_PLANE4 0x00000400L +#define D3DCS_PLANE5 0x00000800L + +#define D3DCS_ALL (D3DCS_LEFT | \ + D3DCS_RIGHT | \ + D3DCS_TOP | \ + D3DCS_BOTTOM | \ + D3DCS_FRONT | \ + D3DCS_BACK | \ + D3DCS_PLANE0 | \ + D3DCS_PLANE1 | \ + D3DCS_PLANE2 | \ + D3DCS_PLANE3 | \ + D3DCS_PLANE4 | \ + D3DCS_PLANE5) + +typedef struct _D3DCLIPSTATUS8 { + DWORD ClipUnion; + DWORD ClipIntersection; +} D3DCLIPSTATUS8; + +typedef struct _D3DMATERIAL8 { + D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE Ambient; /* Ambient color RGB */ + D3DCOLORVALUE Specular; /* Specular 'shininess' */ + D3DCOLORVALUE Emissive; /* Emissive color RGB */ + float Power; /* Sharpness if specular highlight */ +} D3DMATERIAL8; + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, + D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DLIGHTTYPE; + +typedef struct _D3DLIGHT8 { + D3DLIGHTTYPE Type; /* Type of light source */ + D3DCOLORVALUE Diffuse; /* Diffuse color of light */ + D3DCOLORVALUE Specular; /* Specular color of light */ + D3DCOLORVALUE Ambient; /* Ambient color of light */ + D3DVECTOR Position; /* Position in world space */ + D3DVECTOR Direction; /* Direction in world space */ + float Range; /* Cutoff range */ + float Falloff; /* Falloff */ + float Attenuation0; /* Constant attenuation */ + float Attenuation1; /* Linear attenuation */ + float Attenuation2; /* Quadratic attenuation */ + float Theta; /* Inner angle of spotlight cone */ + float Phi; /* Outer angle of spotlight cone */ +} D3DLIGHT8; + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ +#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ + +/* + * The following defines the rendering states + */ + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, + D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, + D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFILLMODE; + +typedef struct _D3DLINEPATTERN { + WORD wRepeatFactor; + WORD wLinePattern; +} D3DLINEPATTERN; + +typedef enum _D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, + D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLEND; + +typedef enum _D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5, + D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLENDOP; + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5, + D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, + D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCULL; + +typedef enum _D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, + D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCMPFUNC; + +typedef enum _D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8, + D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSTENCILOP; + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3, + D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFOGMODE; + +typedef enum _D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, // Z buffering + D3DZB_USEW = 2, // W buffering + D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DZBUFFERTYPE; + +// Primitives supported by draw-primitive API +typedef enum _D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6, + D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DPRIMITIVETYPE; + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23, + D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTRANSFORMSTATETYPE; + +#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +#define D3DTS_WORLD D3DTS_WORLDMATRIX(0) +#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) +#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) +#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + +typedef enum _D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ + D3DRS_FILLMODE = 8, /* D3DFILLMODE */ + D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRS_LINEPATTERN = 10, /* D3DLINEPATTERN */ + D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRS_SRCBLEND = 19, /* D3DBLEND */ + D3DRS_DESTBLEND = 20, /* D3DBLEND */ + D3DRS_CULLMODE = 22, /* D3DCULL */ + D3DRS_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRS_ALPHAREF = 24, /* D3DFIXED */ + D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */ + D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ + D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */ + D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRS_ZVISIBLE = 30, /* TRUE to enable z checking */ + D3DRS_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */ + D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ + D3DRS_FOGEND = 37, /* Fog end */ + D3DRS_FOGDENSITY = 38, /* Fog density */ + D3DRS_EDGEANTIALIAS = 40, /* TRUE to enable edge antialiasing */ + D3DRS_ZBIAS = 47, /* LONG Z bias */ + D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */ + D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ + D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ + D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ + D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ + D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_STENCILREF = 57, /* Reference value used in stencil test */ + D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */ + D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ + D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ + D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */ + D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */ + D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */ + D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */ + D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */ + D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */ + D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */ + D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */ + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_SOFTWAREVERTEXPROCESSING = 153, + D3DRS_POINTSIZE = 154, /* float point size */ + D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */ + D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */ + D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */ + D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */ + D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */ + D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */ + D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation + D3DRS_PATCHSEGMENTS = 164, // Number of segments per edge when drawing patches + D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */ + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, // per-channel write enable + D3DRS_TWEENFACTOR = 170, // float tween factor + D3DRS_BLENDOP = 171, // D3DBLENDOP setting + D3DRS_POSITIONORDER = 172, // NPatch position interpolation order. D3DORDER_LINEAR or D3DORDER_CUBIC (default) + D3DRS_NORMALORDER = 173, // NPatch normal interpolation order. D3DORDER_LINEAR (default) or D3DORDER_QUADRATIC + + D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DRENDERSTATETYPE; + +// Values for material source +typedef enum _D3DMATERIALCOLORSOURCE +{ + D3DMCS_MATERIAL = 0, // Color from material is used + D3DMCS_COLOR1 = 1, // Diffuse vertex color is used + D3DMCS_COLOR2 = 2, // Specular vertex color is used + D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DMATERIALCOLORSOURCE; + +// Bias to apply to the texture coordinate set to apply a wrap to. +#define D3DRENDERSTATE_WRAPBIAS 128UL + +/* Flags to construct the WRAP render states */ +#define D3DWRAP_U 0x00000001L +#define D3DWRAP_V 0x00000002L +#define D3DWRAP_W 0x00000004L + +/* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */ +#define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U +#define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V +#define D3DWRAPCOORD_2 0x00000004L // same as D3DWRAP_W +#define D3DWRAPCOORD_3 0x00000008L + +/* Flags to construct D3DRS_COLORWRITEENABLE */ +#define D3DCOLORWRITEENABLE_RED (1L<<0) +#define D3DCOLORWRITEENABLE_GREEN (1L<<1) +#define D3DCOLORWRITEENABLE_BLUE (1L<<2) +#define D3DCOLORWRITEENABLE_ALPHA (1L<<3) + +/* + * State enumerants for per-stage texture processing. + */ +typedef enum _D3DTEXTURESTAGESTATETYPE +{ + D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */ + D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */ + D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */ + D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */ + D3DTSS_BUMPENVMAT00 = 7, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */ + D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ + D3DTSS_ADDRESSU = 13, /* D3DTEXTUREADDRESS for U coordinate */ + D3DTSS_ADDRESSV = 14, /* D3DTEXTUREADDRESS for V coordinate */ + D3DTSS_BORDERCOLOR = 15, /* D3DCOLOR */ + D3DTSS_MAGFILTER = 16, /* D3DTEXTUREFILTER filter to use for magnification */ + D3DTSS_MINFILTER = 17, /* D3DTEXTUREFILTER filter to use for minification */ + D3DTSS_MIPFILTER = 18, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */ + D3DTSS_MIPMAPLODBIAS = 19, /* float Mipmap LOD bias */ + D3DTSS_MAXMIPLEVEL = 20, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ + D3DTSS_MAXANISOTROPY = 21, /* DWORD maximum anisotropy */ + D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */ + D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */ + D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ + D3DTSS_ADDRESSW = 25, /* D3DTEXTUREADDRESS for W coordinate */ + D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */ + D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */ + D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */ + D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTURESTAGESTATETYPE; + +// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position +// and normal in the camera space) should be taken as texture coordinates +// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from +// +#define D3DTSS_TCI_PASSTHRU 0x00000000 +#define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000 +#define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000 +#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000 + +/* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + */ +typedef enum _D3DTEXTUREOP +{ + // Control + D3DTOP_DISABLE = 1, // disables stage + D3DTOP_SELECTARG1 = 2, // the default + D3DTOP_SELECTARG2 = 3, + + // Modulate + D3DTOP_MODULATE = 4, // multiply args together + D3DTOP_MODULATE2X = 5, // multiply and 1 bit + D3DTOP_MODULATE4X = 6, // multiply and 2 bits + + // Add + D3DTOP_ADD = 7, // add arguments together + D3DTOP_ADDSIGNED = 8, // add with -0.5 bias + D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit + D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation + D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + + // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha + D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha + D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRS_TEXTUREFACTOR + + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha + D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color + + // Specular mapping + D3DTOP_PREMODULATE = 17, // modulate with next texture before use + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + + // Bump mapping + D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation + D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel + + // This can do either diffuse or specular bump mapping with correct input. + // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) + // where each component has been scaled and offset to make it signed. + // The result is replicated into all four (including alpha) channels. + // This is a valid COLOROP only. + D3DTOP_DOTPRODUCT3 = 24, + + // Triadic ops + D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2 + D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2 + + D3DTOP_FORCE_DWORD = 0x7fffffff, +} D3DTEXTUREOP; + +/* + * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending + * operations set in texture processing stage controls in D3DRENDERSTATE. + */ +#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector +#define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only) +#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write) +#define D3DTA_TEXTURE 0x00000002 // select texture color (read only) +#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only) +#define D3DTA_SPECULAR 0x00000004 // select specular color (read only) +#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write) +#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier) +#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier) + +// +// Values for D3DTSS_***FILTER texture stage states +// +typedef enum _D3DTEXTUREFILTERTYPE +{ + D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only) + D3DTEXF_POINT = 1, // nearest + D3DTEXF_LINEAR = 2, // linear interpolation + D3DTEXF_ANISOTROPIC = 3, // anisotropic + D3DTEXF_FLATCUBIC = 4, // cubic + D3DTEXF_GAUSSIANCUBIC = 5, // different cubic kernel + D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREFILTERTYPE; + +/* Bits for Flags in ProcessVertices call */ + +#define D3DPV_DONOTCOPYDATA (1 << 0) + +//------------------------------------------------------------------- + +// Flexible vertex format bits +// +#define D3DFVF_RESERVED0 0x001 +#define D3DFVF_POSITION_MASK 0x00E +#define D3DFVF_XYZ 0x002 +#define D3DFVF_XYZRHW 0x004 +#define D3DFVF_XYZB1 0x006 +#define D3DFVF_XYZB2 0x008 +#define D3DFVF_XYZB3 0x00a +#define D3DFVF_XYZB4 0x00c +#define D3DFVF_XYZB5 0x00e + +#define D3DFVF_NORMAL 0x010 +#define D3DFVF_PSIZE 0x020 +#define D3DFVF_DIFFUSE 0x040 +#define D3DFVF_SPECULAR 0x080 + +#define D3DFVF_TEXCOUNT_MASK 0xf00 +#define D3DFVF_TEXCOUNT_SHIFT 8 +#define D3DFVF_TEX0 0x000 +#define D3DFVF_TEX1 0x100 +#define D3DFVF_TEX2 0x200 +#define D3DFVF_TEX3 0x300 +#define D3DFVF_TEX4 0x400 +#define D3DFVF_TEX5 0x500 +#define D3DFVF_TEX6 0x600 +#define D3DFVF_TEX7 0x700 +#define D3DFVF_TEX8 0x800 + +#define D3DFVF_LASTBETA_UBYTE4 0x1000 + +#define D3DFVF_RESERVED2 0xE000 // 4 reserved bits + +//--------------------------------------------------------------------- +// Vertex Shaders +// + +/* + +Vertex Shader Declaration + +The declaration portion of a vertex shader defines the static external +interface of the shader. The information in the declaration includes: + +- Assignments of vertex shader input registers to data streams. These +assignments bind a specific vertex register to a single component within a +vertex stream. A vertex stream element is identified by a byte offset +within the stream and a type. The type specifies the arithmetic data type +plus the dimensionality (1, 2, 3, or 4 values). Stream data which is +less than 4 values are always expanded out to 4 values with zero or more +0.F values and one 1.F value. + +- Assignment of vertex shader input registers to implicit data from the +primitive tessellator. This controls the loading of vertex data which is +not loaded from a stream, but rather is generated during primitive +tessellation prior to the vertex shader. + +- Loading data into the constant memory at the time a shader is set as the +current shader. Each token specifies values for one or more contiguous 4 +DWORD constant registers. This allows the shader to update an arbitrary +subset of the constant memory, overwriting the device state (which +contains the current values of the constant memory). Note that these +values can be subsequently overwritten (between DrawPrimitive calls) +during the time a shader is bound to a device via the +SetVertexShaderConstant method. + + +Declaration arrays are single-dimensional arrays of DWORDs composed of +multiple tokens each of which is one or more DWORDs. The single-DWORD +token value 0xFFFFFFFF is a special token used to indicate the end of the +declaration array. The single DWORD token value 0x00000000 is a NOP token +with is ignored during the declaration parsing. Note that 0x00000000 is a +valid value for DWORDs following the first DWORD for multiple word tokens. + +[31:29] TokenType + 0x0 - NOP (requires all DWORD bits to be zero) + 0x1 - stream selector + 0x2 - stream data definition (map to vertex input memory) + 0x3 - vertex input memory from tessellator + 0x4 - constant memory from shader + 0x5 - extension + 0x6 - reserved + 0x7 - end-of-array (requires all DWORD bits to be 1) + +NOP Token (single DWORD token) + [31:29] 0x0 + [28:00] 0x0 + +Stream Selector (single DWORD token) + [31:29] 0x1 + [28] indicates whether this is a tessellator stream + [27:04] 0x0 + [03:00] stream selector (0..15) + +Stream Data Definition (single DWORD token) + Vertex Input Register Load + [31:29] 0x2 + [28] 0x0 + [27:20] 0x0 + [19:16] type (dimensionality and data type) + [15:04] 0x0 + [03:00] vertex register address (0..15) + Data Skip (no register load) + [31:29] 0x2 + [28] 0x1 + [27:20] 0x0 + [19:16] count of DWORDS to skip over (0..15) + [15:00] 0x0 + Vertex Input Memory from Tessellator Data (single DWORD token) + [31:29] 0x3 + [28] indicates whether data is normals or u/v + [27:24] 0x0 + [23:20] vertex register address (0..15) + [19:16] type (dimensionality) + [15:04] 0x0 + [03:00] vertex register address (0..15) + +Constant Memory from Shader (multiple DWORD token) + [31:29] 0x4 + [28:25] count of 4*DWORD constants to load (0..15) + [24:07] 0x0 + [06:00] constant memory address (0..95) + +Extension Token (single or multiple DWORD token) + [31:29] 0x5 + [28:24] count of additional DWORDs in token (0..31) + [23:00] extension-specific information + +End-of-array token (single DWORD token) + [31:29] 0x7 + [28:00] 0x1fffffff + +The stream selector token must be immediately followed by a contiguous set of stream data definition tokens. This token sequence fully defines that stream, including the set of elements within the stream, the order in which the elements appear, the type of each element, and the vertex register into which to load an element. +Streams are allowed to include data which is not loaded into a vertex register, thus allowing data which is not used for this shader to exist in the vertex stream. This skipped data is defined only by a count of DWORDs to skip over, since the type information is irrelevant. +The token sequence: +Stream Select: stream=0 +Stream Data Definition (Load): type=FLOAT3; register=3 +Stream Data Definition (Load): type=FLOAT3; register=4 +Stream Data Definition (Skip): count=2 +Stream Data Definition (Load): type=FLOAT2; register=7 + +defines stream zero to consist of 4 elements, 3 of which are loaded into registers and the fourth skipped over. Register 3 is loaded with the first three DWORDs in each vertex interpreted as FLOAT data. Register 4 is loaded with the 4th, 5th, and 6th DWORDs interpreted as FLOAT data. The next two DWORDs (7th and 8th) are skipped over and not loaded into any vertex input register. Register 7 is loaded with the 9th and 10th DWORDS interpreted as FLOAT data. +Placing of tokens other than NOPs between the Stream Selector and Stream Data Definition tokens is disallowed. + +*/ + +typedef enum _D3DVSD_TOKENTYPE +{ + D3DVSD_TOKEN_NOP = 0, // NOP or extension + D3DVSD_TOKEN_STREAM, // stream selector + D3DVSD_TOKEN_STREAMDATA, // stream data definition (map to vertex input memory) + D3DVSD_TOKEN_TESSELLATOR, // vertex input memory from tessellator + D3DVSD_TOKEN_CONSTMEM, // constant memory from shader + D3DVSD_TOKEN_EXT, // extension + D3DVSD_TOKEN_END = 7, // end-of-array (requires all DWORD bits to be 1) + D3DVSD_FORCE_DWORD = 0x7fffffff,// force 32-bit size enum +} D3DVSD_TOKENTYPE; + +#define D3DVSD_TOKENTYPESHIFT 29 +#define D3DVSD_TOKENTYPEMASK (7 << D3DVSD_TOKENTYPESHIFT) + +#define D3DVSD_STREAMNUMBERSHIFT 0 +#define D3DVSD_STREAMNUMBERMASK (0xF << D3DVSD_STREAMNUMBERSHIFT) + +#define D3DVSD_DATALOADTYPESHIFT 28 +#define D3DVSD_DATALOADTYPEMASK (0x1 << D3DVSD_DATALOADTYPESHIFT) + +#define D3DVSD_DATATYPESHIFT 16 +#define D3DVSD_DATATYPEMASK (0xF << D3DVSD_DATATYPESHIFT) + +#define D3DVSD_SKIPCOUNTSHIFT 16 +#define D3DVSD_SKIPCOUNTMASK (0xF << D3DVSD_SKIPCOUNTSHIFT) + +#define D3DVSD_VERTEXREGSHIFT 0 +#define D3DVSD_VERTEXREGMASK (0x1F << D3DVSD_VERTEXREGSHIFT) + +#define D3DVSD_VERTEXREGINSHIFT 20 +#define D3DVSD_VERTEXREGINMASK (0xF << D3DVSD_VERTEXREGINSHIFT) + +#define D3DVSD_CONSTCOUNTSHIFT 25 +#define D3DVSD_CONSTCOUNTMASK (0xF << D3DVSD_CONSTCOUNTSHIFT) + +#define D3DVSD_CONSTADDRESSSHIFT 0 +#define D3DVSD_CONSTADDRESSMASK (0x7F << D3DVSD_CONSTADDRESSSHIFT) + +#define D3DVSD_CONSTRSSHIFT 16 +#define D3DVSD_CONSTRSMASK (0x1FFF << D3DVSD_CONSTRSSHIFT) + +#define D3DVSD_EXTCOUNTSHIFT 24 +#define D3DVSD_EXTCOUNTMASK (0x1F << D3DVSD_EXTCOUNTSHIFT) + +#define D3DVSD_EXTINFOSHIFT 0 +#define D3DVSD_EXTINFOMASK (0xFFFFFF << D3DVSD_EXTINFOSHIFT) + +#define D3DVSD_MAKETOKENTYPE(tokenType) ((tokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK) + +// macros for generation of CreateVertexShader Declaration token array + +// Set current stream +// _StreamNumber [0..(MaxStreams-1)] stream to get data from +// +#define D3DVSD_STREAM( _StreamNumber ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (_StreamNumber)) + +// Set tessellator stream +// +#define D3DVSD_STREAMTESSSHIFT 28 +#define D3DVSD_STREAMTESSMASK (1 << D3DVSD_STREAMTESSSHIFT) +#define D3DVSD_STREAM_TESS( ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (D3DVSD_STREAMTESSMASK)) + +// bind single vertex register to vertex element from vertex stream +// +// _VertexRegister [0..15] address of the vertex register +// _Type [D3DVSDT_*] dimensionality and arithmetic data type + +#define D3DVSD_REG( _VertexRegister, _Type ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | \ + ((_Type) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) + +// Skip _DWORDCount DWORDs in vertex +// +#define D3DVSD_SKIP( _DWORDCount ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | \ + ((_DWORDCount) << D3DVSD_SKIPCOUNTSHIFT)) + +// load data into vertex shader constant memory +// +// _ConstantAddress [0..95] - address of constant array to begin filling data +// _Count [0..15] - number of constant vectors to load (4 DWORDs each) +// followed by 4*_Count DWORDS of data +// +#define D3DVSD_CONST( _ConstantAddress, _Count ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | \ + ((_Count) << D3DVSD_CONSTCOUNTSHIFT) | (_ConstantAddress)) + +// enable tessellator generated normals +// +// _VertexRegisterIn [0..15] address of vertex register whose input stream +// will be used in normal computation +// _VertexRegisterOut [0..15] address of vertex register to output the normal to +// +#define D3DVSD_TESSNORMAL( _VertexRegisterIn, _VertexRegisterOut ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | \ + ((_VertexRegisterIn) << D3DVSD_VERTEXREGINSHIFT) | \ + ((0x02) << D3DVSD_DATATYPESHIFT) | (_VertexRegisterOut)) + +// enable tessellator generated surface parameters +// +// _VertexRegister [0..15] address of vertex register to output parameters +// +#define D3DVSD_TESSUV( _VertexRegister ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | \ + ((0x01) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) + +// Generates END token +// +#define D3DVSD_END() 0xFFFFFFFF + +// Generates NOP token +#define D3DVSD_NOP() 0x00000000 + +// bit declarations for _Type fields +#define D3DVSDT_FLOAT1 0x00 // 1D float expanded to (value, 0., 0., 1.) +#define D3DVSDT_FLOAT2 0x01 // 2D float expanded to (value, value, 0., 1.) +#define D3DVSDT_FLOAT3 0x02 // 3D float expanded to (value, value, value, 1.) +#define D3DVSDT_FLOAT4 0x03 // 4D float +#define D3DVSDT_D3DCOLOR 0x04 // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) +#define D3DVSDT_UBYTE4 0x05 // 4D unsigned byte +#define D3DVSDT_SHORT2 0x06 // 2D signed short expanded to (value, value, 0., 1.) +#define D3DVSDT_SHORT4 0x07 // 4D signed short + +// assignments of vertex input registers for fixed function vertex shader +// +#define D3DVSDE_POSITION 0 +#define D3DVSDE_BLENDWEIGHT 1 +#define D3DVSDE_BLENDINDICES 2 +#define D3DVSDE_NORMAL 3 +#define D3DVSDE_PSIZE 4 +#define D3DVSDE_DIFFUSE 5 +#define D3DVSDE_SPECULAR 6 +#define D3DVSDE_TEXCOORD0 7 +#define D3DVSDE_TEXCOORD1 8 +#define D3DVSDE_TEXCOORD2 9 +#define D3DVSDE_TEXCOORD3 10 +#define D3DVSDE_TEXCOORD4 11 +#define D3DVSDE_TEXCOORD5 12 +#define D3DVSDE_TEXCOORD6 13 +#define D3DVSDE_TEXCOORD7 14 +#define D3DVSDE_POSITION2 15 +#define D3DVSDE_NORMAL2 16 + +// Maximum supported number of texture coordinate sets +#define D3DDP_MAXTEXCOORD 8 + + +// +// Instruction Token Bit Definitions +// +#define D3DSI_OPCODE_MASK 0x0000FFFF + +typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE +{ + D3DSIO_NOP = 0, // PS/VS + D3DSIO_MOV , // PS/VS + D3DSIO_ADD , // PS/VS + D3DSIO_SUB , // PS + D3DSIO_MAD , // PS/VS + D3DSIO_MUL , // PS/VS + D3DSIO_RCP , // VS + D3DSIO_RSQ , // VS + D3DSIO_DP3 , // PS/VS + D3DSIO_DP4 , // PS/VS + D3DSIO_MIN , // VS + D3DSIO_MAX , // VS + D3DSIO_SLT , // VS + D3DSIO_SGE , // VS + D3DSIO_EXP , // VS + D3DSIO_LOG , // VS + D3DSIO_LIT , // VS + D3DSIO_DST , // VS + D3DSIO_LRP , // PS + D3DSIO_FRC , // VS + D3DSIO_M4x4 , // VS + D3DSIO_M4x3 , // VS + D3DSIO_M3x4 , // VS + D3DSIO_M3x3 , // VS + D3DSIO_M3x2 , // VS + + D3DSIO_TEXCOORD = 64, // PS + D3DSIO_TEXKILL , // PS + D3DSIO_TEX , // PS + D3DSIO_TEXBEM , // PS + D3DSIO_TEXBEML , // PS + D3DSIO_TEXREG2AR , // PS + D3DSIO_TEXREG2GB , // PS + D3DSIO_TEXM3x2PAD , // PS + D3DSIO_TEXM3x2TEX , // PS + D3DSIO_TEXM3x3PAD , // PS + D3DSIO_TEXM3x3TEX , // PS + D3DSIO_TEXM3x3DIFF , // PS + D3DSIO_TEXM3x3SPEC , // PS + D3DSIO_TEXM3x3VSPEC , // PS + D3DSIO_EXPP , // VS + D3DSIO_LOGP , // VS + D3DSIO_CND , // PS + D3DSIO_DEF , // PS + D3DSIO_TEXREG2RGB , // PS + D3DSIO_TEXDP3TEX , // PS + D3DSIO_TEXM3x2DEPTH , // PS + D3DSIO_TEXDP3 , // PS + D3DSIO_TEXM3x3 , // PS + D3DSIO_TEXDEPTH , // PS + D3DSIO_CMP , // PS + D3DSIO_BEM , // PS + + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF, + + D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +// +// Co-Issue Instruction Modifier - if set then this instruction is to be +// issued in parallel with the previous instruction(s) for which this bit +// is not set. +// +#define D3DSI_COISSUE 0x40000000 + +// +// Parameter Token Bit Definitions +// +#define D3DSP_REGNUM_MASK 0x00001FFF + +// destination parameter write mask +#define D3DSP_WRITEMASK_0 0x00010000 // Component 0 (X;Red) +#define D3DSP_WRITEMASK_1 0x00020000 // Component 1 (Y;Green) +#define D3DSP_WRITEMASK_2 0x00040000 // Component 2 (Z;Blue) +#define D3DSP_WRITEMASK_3 0x00080000 // Component 3 (W;Alpha) +#define D3DSP_WRITEMASK_ALL 0x000F0000 // All Components + +// destination parameter modifiers +#define D3DSP_DSTMOD_SHIFT 20 +#define D3DSP_DSTMOD_MASK 0x00F00000 + +typedef enum _D3DSHADER_PARAM_DSTMOD_TYPE +{ + D3DSPDM_NONE = 0<>8)&0xFF) +#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) + +// destination/source parameter register type +#define D3DSI_COMMENTSIZE_SHIFT 16 +#define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 +#define D3DSHADER_COMMENT(_DWordSize) \ + ((((_DWordSize)<= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D8TYPES(P)_H_ */ + diff --git a/plugins/ADK/d3d8/includes/d3dx8.h b/plugins/ADK/d3d8/includes/d3dx8.h new file mode 100644 index 0000000..31927a2 --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3dx8.h @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8.h +// Content: D3DX utility library +// +/////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX8_H__ +#define __D3DX8_H__ + +#include "d3d8.h" +#include + +#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 + + +#define D3DX_DEFAULT ULONG_MAX +#define D3DX_DEFAULT_FLOAT FLT_MAX + +#include "d3dx8math.h" +#include "d3dx8core.h" +#include "d3dx8tex.h" +#include "d3dx8mesh.h" +#include "d3dx8shape.h" +#include "d3dx8effect.h" + + +#endif //__D3DX8_H__ + diff --git a/plugins/ADK/d3d8/includes/d3dx8core.h b/plugins/ADK/d3d8/includes/d3dx8core.h new file mode 100644 index 0000000..46552a9 --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3dx8core.h @@ -0,0 +1,563 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8core.h +// Content: D3DX core types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx8.h" + +#ifndef __D3DX8CORE_H__ +#define __D3DX8CORE_H__ + + + +/////////////////////////////////////////////////////////////////////////// +// 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; + +// {932E6A7E-C68E-45dd-A7BF-53D19C86DB1F} +DEFINE_GUID(IID_ID3DXBuffer, +0x932e6a7e, 0xc68e, 0x45dd, 0xa7, 0xbf, 0x53, 0xd1, 0x9c, 0x86, 0xdb, 0x1f); + +#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; +}; + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXFont: +// ---------- +// Font objects contain the textures and resources needed to render +// a specific font on a specific device. +// +// Begin - +// Prepartes device for drawing text. This is optional.. if DrawText +// is called outside of Begin/End, it will call Begin and End for you. +// +// 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. +// +// 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 ID3DXFont ID3DXFont; +typedef interface ID3DXFont *LPD3DXFONT; + + +// {89FAD6A5-024D-49af-8FE7-F51123B85E25} +DEFINE_GUID( IID_ID3DXFont, +0x89fad6a5, 0x24d, 0x49af, 0x8f, 0xe7, 0xf5, 0x11, 0x23, 0xb8, 0x5e, 0x25); + + +#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_ LPDIRECT3DDEVICE8* ppDevice) PURE; + STDMETHOD(GetLogFont)(THIS_ LOGFONT* pLogFont) PURE; + + STDMETHOD(Begin)(THIS) PURE; + STDMETHOD_(INT, DrawTextA)(THIS_ LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; + STDMETHOD_(INT, DrawTextW)(THIS_ LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + +#ifndef DrawText +#ifdef UNICODE +#define DrawText DrawTextW +#else +#define DrawText DrawTextA +#endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateFont( + LPDIRECT3DDEVICE8 pDevice, + HFONT hFont, + LPD3DXFONT* ppFont); + + +HRESULT WINAPI + D3DXCreateFontIndirect( + LPDIRECT3DDEVICE8 pDevice, + CONST LOGFONT* pLogFont, + LPD3DXFONT* ppFont); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXSprite: +// ------------ +// This object intends to provide an easy way to drawing sprites using D3D. +// +// Begin - +// Prepares device for drawing sprites +// +// Draw, DrawAffine, DrawTransform - +// Draws a sprite in screen-space. Before transformation, the sprite is +// the size of SrcRect, with its top-left corner at the origin (0,0). +// The color and alpha channels are modulated by Color. +// +// 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; + + +// {13D69D15-F9B0-4e0f-B39E-C91EB33F6CE7} +DEFINE_GUID( IID_ID3DXSprite, +0x13d69d15, 0xf9b0, 0x4e0f, 0xb3, 0x9e, 0xc9, 0x1e, 0xb3, 0x3f, 0x6c, 0xe7); + + +#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_ LPDIRECT3DDEVICE8* ppDevice) PURE; + + STDMETHOD(Begin)(THIS) PURE; + + STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE8 pSrcTexture, + CONST RECT* pSrcRect, CONST D3DXVECTOR2* pScaling, + CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, + CONST D3DXVECTOR2* pTranslation, D3DCOLOR Color) PURE; + + STDMETHOD(DrawTransform)(THIS_ LPDIRECT3DTEXTURE8 pSrcTexture, + CONST RECT* pSrcRect, CONST D3DXMATRIX* pTransform, + D3DCOLOR Color) PURE; + + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateSprite( + LPDIRECT3DDEVICE8 pDevice, + LPD3DXSPRITE* ppSprite); + +#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; + + +typedef interface ID3DXRenderToSurface ID3DXRenderToSurface; +typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE; + + +// {82DF5B90-E34E-496e-AC1C-62117A6A5913} +DEFINE_GUID( IID_ID3DXRenderToSurface, +0x82df5b90, 0xe34e, 0x496e, 0xac, 0x1c, 0x62, 0x11, 0x7a, 0x6a, 0x59, 0x13); + + +#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_ LPDIRECT3DDEVICE8* ppDevice) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE; + + STDMETHOD(BeginScene)(THIS_ LPDIRECT3DSURFACE8 pSurface, CONST D3DVIEWPORT8* pViewport) PURE; + STDMETHOD(EndScene)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateRenderToSurface( + LPDIRECT3DDEVICE8 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; + D3DFORMAT Format; + BOOL DepthStencil; + D3DFORMAT DepthStencilFormat; +} D3DXRTE_DESC; + + +typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap; +typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap; + +// {4E42C623-9451-44b7-8C86-ABCCDE5D52C8} +DEFINE_GUID( IID_ID3DXRenderToEnvMap, +0x4e42c623, 0x9451, 0x44b7, 0x8c, 0x86, 0xab, 0xcc, 0xde, 0x5d, 0x52, 0xc8); + + +#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_ LPDIRECT3DDEVICE8* ppDevice) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE; + + STDMETHOD(BeginCube)(THIS_ + LPDIRECT3DCUBETEXTURE8 pCubeTex) PURE; + + STDMETHOD(BeginSphere)(THIS_ + LPDIRECT3DTEXTURE8 pTex) PURE; + + STDMETHOD(BeginHemisphere)(THIS_ + LPDIRECT3DTEXTURE8 pTexZPos, + LPDIRECT3DTEXTURE8 pTexZNeg) PURE; + + STDMETHOD(BeginParabolic)(THIS_ + LPDIRECT3DTEXTURE8 pTexZPos, + LPDIRECT3DTEXTURE8 pTexZNeg) PURE; + + STDMETHOD(Face)(THIS_ D3DCUBEMAP_FACES Face) PURE; + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateRenderToEnvMap( + LPDIRECT3DDEVICE8 pDevice, + UINT Size, + D3DFORMAT Format, + BOOL DepthStencil, + D3DFORMAT DepthStencilFormat, + LPD3DXRenderToEnvMap* ppRenderToEnvMap); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// Shader assemblers: +/////////////////////////////////////////////////////////////////////////// + +//------------------------------------------------------------------------- +// D3DXASM flags: +// -------------- +// +// D3DXASM_DEBUG +// Generate debug info. +// +// D3DXASM_SKIPVALIDATION +// Do not validate the generated code against known capabilities and +// constraints. This option is only recommended when assembling shaders +// you KNOW will work. (ie. have assembled before without this option.) +//------------------------------------------------------------------------- + +#define D3DXASM_DEBUG (1 << 0) +#define D3DXASM_SKIPVALIDATION (1 << 1) + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//------------------------------------------------------------------------- +// D3DXAssembleShader: +// ------------------- +// Assembles an ascii description of a vertex or pixel shader into +// binary form. +// +// 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 +// Flags +// D3DXASM_xxx flags +// ppConstants +// Returns an ID3DXBuffer object containing constant declarations. +// ppCompiledShader +// Returns an ID3DXBuffer object containing the object code. +// ppCompilationErrors +// Returns an ID3DXBuffer object containing ascii error messages +//------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXAssembleShaderFromFileA( + LPCSTR pSrcFile, + DWORD Flags, + LPD3DXBUFFER* ppConstants, + LPD3DXBUFFER* ppCompiledShader, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXAssembleShaderFromFileW( + LPCWSTR pSrcFile, + DWORD Flags, + LPD3DXBUFFER* ppConstants, + LPD3DXBUFFER* ppCompiledShader, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileW +#else +#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileA +#endif + +HRESULT WINAPI + D3DXAssembleShaderFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + DWORD Flags, + LPD3DXBUFFER* ppConstants, + LPD3DXBUFFER* ppCompiledShader, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXAssembleShaderFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + DWORD Flags, + LPD3DXBUFFER* ppConstants, + LPD3DXBUFFER* ppCompiledShader, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceW +#else +#define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceA +#endif + +HRESULT WINAPI + D3DXAssembleShader( + LPCVOID pSrcData, + UINT SrcDataLen, + DWORD Flags, + LPD3DXBUFFER* ppConstants, + LPD3DXBUFFER* ppCompiledShader, + LPD3DXBUFFER* ppCompilationErrors); + + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// Misc APIs: +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//------------------------------------------------------------------------- +// D3DXGetErrorString: +// ------------------ +// Returns the error string for given an hresult. Interprets all D3DX and +// D3D hresults. +// +// Parameters: +// hr +// The error code to be deciphered. +// pBuffer +// Pointer to the buffer to be filled in. +// BufferLen +// Count of characters in buffer. Any error message longer than this +// length will be truncated to fit. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXGetErrorStringA( + HRESULT hr, + LPSTR pBuffer, + UINT BufferLen); + +HRESULT WINAPI + D3DXGetErrorStringW( + HRESULT hr, + LPWSTR pBuffer, + UINT BufferLen); + +#ifdef UNICODE +#define D3DXGetErrorString D3DXGetErrorStringW +#else +#define D3DXGetErrorString D3DXGetErrorStringA +#endif + + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX8CORE_H__ diff --git a/plugins/ADK/d3d8/includes/d3dx8effect.h b/plugins/ADK/d3d8/includes/d3dx8effect.h new file mode 100644 index 0000000..97c44df --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3dx8effect.h @@ -0,0 +1,226 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8effect.h +// Content: D3DX effect types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx8.h" + +#ifndef __D3DX8EFFECT_H__ +#define __D3DX8EFFECT_H__ + + +#define D3DXFX_DONOTSAVESTATE (1 << 0) + + +typedef enum _D3DXPARAMETERTYPE +{ + D3DXPT_DWORD = 0, + D3DXPT_FLOAT = 1, + D3DXPT_VECTOR = 2, + D3DXPT_MATRIX = 3, + D3DXPT_TEXTURE = 4, + D3DXPT_VERTEXSHADER = 5, + D3DXPT_PIXELSHADER = 6, + D3DXPT_CONSTANT = 7, + D3DXPT_STRING = 8, + D3DXPT_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ + +} D3DXPARAMETERTYPE; + + +typedef struct _D3DXEFFECT_DESC +{ + UINT Parameters; + UINT Techniques; + +} D3DXEFFECT_DESC; + + +typedef struct _D3DXPARAMETER_DESC +{ + LPCSTR Name; + LPCSTR Index; + D3DXPARAMETERTYPE Type; + +} D3DXPARAMETER_DESC; + + +typedef struct _D3DXTECHNIQUE_DESC +{ + LPCSTR Name; + LPCSTR Index; + UINT Passes; + +} D3DXTECHNIQUE_DESC; + + +typedef struct _D3DXPASS_DESC +{ + LPCSTR Name; + LPCSTR Index; + +} D3DXPASS_DESC; + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffect /////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffect ID3DXEffect; +typedef interface ID3DXEffect *LPD3DXEFFECT; + +// {648B1CEB-8D4E-4d66-B6FA-E44969E82E89} +DEFINE_GUID( IID_ID3DXEffect, +0x648b1ceb, 0x8d4e, 0x4d66, 0xb6, 0xfa, 0xe4, 0x49, 0x69, 0xe8, 0x2e, 0x89); + + +#undef INTERFACE +#define INTERFACE ID3DXEffect + +DECLARE_INTERFACE_(ID3DXEffect, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXEffect + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ LPCSTR pParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ LPCSTR pTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ LPCSTR pTechnique, LPCSTR pPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(FindNextValidTechnique)(THIS_ LPCSTR pTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE8 pDevice, LPD3DXEFFECT* ppEffect) PURE; + STDMETHOD(GetCompiledEffect)(THIS_ LPD3DXBUFFER* ppCompiledEffect) PURE; + + STDMETHOD(SetTechnique)(THIS_ LPCSTR pTechnique) PURE; + STDMETHOD(GetTechnique)(THIS_ LPCSTR* ppTechnique) PURE; + + STDMETHOD(SetDword)(THIS_ LPCSTR pParameter, DWORD dw) PURE; + STDMETHOD(GetDword)(THIS_ LPCSTR pParameter, DWORD* pdw) PURE; + STDMETHOD(SetFloat)(THIS_ LPCSTR pParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ LPCSTR pParameter, FLOAT* pf) PURE; + STDMETHOD(SetVector)(THIS_ LPCSTR pParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ LPCSTR pParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetMatrix)(THIS_ LPCSTR pParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ LPCSTR pParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetTexture)(THIS_ LPCSTR pParameter, LPDIRECT3DBASETEXTURE8 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ LPCSTR pParameter, LPDIRECT3DBASETEXTURE8 *ppTexture) PURE; + STDMETHOD(SetVertexShader)(THIS_ LPCSTR pParameter, DWORD Handle) PURE; + STDMETHOD(GetVertexShader)(THIS_ LPCSTR pParameter, DWORD* pHandle) PURE; + STDMETHOD(SetPixelShader)(THIS_ LPCSTR pParameter, DWORD Handle) PURE; + STDMETHOD(GetPixelShader)(THIS_ LPCSTR pParameter, DWORD* pHandle) PURE; + STDMETHOD(SetString)(THIS_ LPCSTR pParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ LPCSTR pParameter, LPCSTR* ppString) PURE; + STDMETHOD_(BOOL, IsParameterUsed)(THIS_ LPCSTR pParameter) PURE; + + STDMETHOD(Validate)(THIS) PURE; + STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE; + STDMETHOD(Pass)(THIS_ UINT Pass) PURE; + STDMETHOD(End)(THIS) PURE; + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DXCreateEffect: +// ----------------- +// Creates an effect from an ascii or binaray 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 +// 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( + LPDIRECT3DDEVICE8 pDevice, + LPCSTR pSrcFile, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromFileW( + LPDIRECT3DDEVICE8 pDevice, + LPCWSTR pSrcFile, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW +#else +#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateEffectFromResourceA( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromResourceW( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW +#else +#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateEffect( + LPDIRECT3DDEVICE8 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX8EFFECT_H__ diff --git a/plugins/ADK/d3d8/includes/d3dx8math.h b/plugins/ADK/d3d8/includes/d3dx8math.h new file mode 100644 index 0000000..9c8f203 --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3dx8math.h @@ -0,0 +1,1215 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8math.h +// Content: D3DX math types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx8.h" + +#ifndef __D3DX8MATH_H__ +#define __D3DX8MATH_H__ + +#include +#pragma warning(disable:4201) // anonymous unions warning + + + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== +#define D3DX_PI ((FLOAT) 3.141592654f) +#define D3DX_1BYPI ((FLOAT) 0.318309886f) + +#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f)) +#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI)) + + + +//=========================================================================== +// +// Vectors +// +//=========================================================================== + +//-------------------------- +// 2D Vector +//-------------------------- +typedef struct D3DXVECTOR2 +{ +#ifdef __cplusplus +public: + D3DXVECTOR2() {}; + D3DXVECTOR2( CONST FLOAT * ); + D3DXVECTOR2( FLOAT x, FLOAT y ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR2& operator += ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator -= ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator *= ( FLOAT ); + D3DXVECTOR2& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR2 operator + () const; + D3DXVECTOR2 operator - () const; + + // binary operators + D3DXVECTOR2 operator + ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator - ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator * ( FLOAT ) const; + D3DXVECTOR2 operator / ( FLOAT ) const; + + friend D3DXVECTOR2 operator * ( FLOAT, CONST D3DXVECTOR2& ); + + BOOL operator == ( CONST D3DXVECTOR2& ) const; + BOOL operator != ( CONST D3DXVECTOR2& ) const; + + +public: +#endif //__cplusplus + FLOAT x, y; +} D3DXVECTOR2, *LPD3DXVECTOR2; + + +//-------------------------- +// 3D Vector +//-------------------------- +#ifdef __cplusplus +typedef struct D3DXVECTOR3 : public D3DVECTOR +{ +public: + D3DXVECTOR3() {}; + D3DXVECTOR3( CONST FLOAT * ); + D3DXVECTOR3( CONST D3DVECTOR& ); + D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator *= ( FLOAT ); + D3DXVECTOR3& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR3 operator + () const; + D3DXVECTOR3 operator - () const; + + // binary operators + D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator * ( FLOAT ) const; + D3DXVECTOR3 operator / ( FLOAT ) const; + + friend D3DXVECTOR3 operator * ( FLOAT, CONST struct D3DXVECTOR3& ); + + BOOL operator == ( CONST D3DXVECTOR3& ) const; + BOOL operator != ( CONST D3DXVECTOR3& ) const; + +} D3DXVECTOR3, *LPD3DXVECTOR3; + +#else //!__cplusplus +typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3; +#endif //!__cplusplus + + +//-------------------------- +// 4D Vector +//-------------------------- +typedef struct D3DXVECTOR4 +{ +#ifdef __cplusplus +public: + D3DXVECTOR4() {}; + D3DXVECTOR4( CONST FLOAT* ); + D3DXVECTOR4( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR4& operator += ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator -= ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator *= ( FLOAT ); + D3DXVECTOR4& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR4 operator + () const; + D3DXVECTOR4 operator - () const; + + // binary operators + D3DXVECTOR4 operator + ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator - ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator * ( FLOAT ) const; + D3DXVECTOR4 operator / ( FLOAT ) const; + + friend D3DXVECTOR4 operator * ( FLOAT, CONST D3DXVECTOR4& ); + + BOOL operator == ( CONST D3DXVECTOR4& ) const; + BOOL operator != ( CONST D3DXVECTOR4& ) const; + +public: +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXVECTOR4, *LPD3DXVECTOR4; + + +//=========================================================================== +// +// Matrices +// +//=========================================================================== +#ifdef __cplusplus +typedef struct D3DXMATRIX : public D3DMATRIX +{ +public: + D3DXMATRIX() {}; + D3DXMATRIX( CONST FLOAT * ); + D3DXMATRIX( CONST D3DMATRIX& ); + D3DXMATRIX( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + + // access grants + FLOAT& operator () ( UINT Row, UINT Col ); + FLOAT operator () ( UINT Row, UINT Col ) const; + + // casting operators + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXMATRIX& operator *= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator += ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator -= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator *= ( FLOAT ); + D3DXMATRIX& operator /= ( FLOAT ); + + // unary operators + D3DXMATRIX operator + () const; + D3DXMATRIX operator - () const; + + // binary operators + D3DXMATRIX operator * ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator + ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator - ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator * ( FLOAT ) const; + D3DXMATRIX operator / ( FLOAT ) const; + + friend D3DXMATRIX operator * ( FLOAT, CONST D3DXMATRIX& ); + + BOOL operator == ( CONST D3DXMATRIX& ) const; + BOOL operator != ( CONST D3DXMATRIX& ) const; + +} D3DXMATRIX, *LPD3DXMATRIX; + +#else //!__cplusplus +typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX; +#endif //!__cplusplus + +//=========================================================================== +// +// Aligned Matrices +// +// This class helps keep matrices 16-byte aligned as preferred by P4 cpus. +// It aligns matrices on the stack and on the heap or in global scope. +// It does this using __declspec(align(16)) which works on VC7 and on VC 6 +// with the processor pack. Unfortunately there is no way to detect the +// latter so this is turned on only on VC7. On other compilers this is the +// the same as D3DXMATRIX. +// Using this class on a compiler that does not actually do the alignment +// can be dangerous since it will not expose bugs that ignore alignment. +// E.g if an object of this class in inside a struct or class, and some code +// memcopys data in it assuming tight packing. This could break on a compiler +// that eventually start aligning the matrix. +// +//=========================================================================== +#ifdef __cplusplus +typedef struct _D3DXMATRIXA16 : public D3DXMATRIX +{ + _D3DXMATRIXA16() {} + _D3DXMATRIXA16( CONST FLOAT * f): D3DXMATRIX(f) {} + _D3DXMATRIXA16( CONST D3DMATRIX& m): D3DXMATRIX(m) {} + _D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ) : + D3DXMATRIX(_11, _12, _13, _14, + _21, _22, _23, _24, + _31, _32, _33, _34, + _41, _42, _43, _44) {} + void* operator new(size_t s) + { + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; + }; + + void* operator new[](size_t s) + { + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; + }; + + // This is NOT a virtual operator. If you cast + // to D3DXMATRIX, do not delete using that + void operator delete(void* p) + { + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } + }; + + // This is NOT a virtual operator. If you cast + // to D3DXMATRIX, do not delete using that + void operator delete[](void* p) + { + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } + }; + + struct _D3DXMATRIXA16& operator=(CONST D3DXMATRIX& rhs) + { + memcpy(&_11, &rhs, sizeof(D3DXMATRIX)); + return *this; + }; +} _D3DXMATRIXA16; + +#else //!__cplusplus +typedef D3DXMATRIX _D3DXMATRIXA16; +#endif //!__cplusplus + +#if _MSC_VER >= 1300 // VC7 +#define _ALIGN_16 __declspec(align(16)) +#else +#define _ALIGN_16 // Earlier compiler may not understand this, do nothing. +#endif + +#define D3DXMATRIXA16 _ALIGN_16 _D3DXMATRIXA16 + +typedef D3DXMATRIXA16 *LPD3DXMATRIXA16; + +//=========================================================================== +// +// Quaternions +// +//=========================================================================== +typedef struct D3DXQUATERNION +{ +#ifdef __cplusplus +public: + D3DXQUATERNION() {} + D3DXQUATERNION( CONST FLOAT * ); + D3DXQUATERNION( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXQUATERNION& operator += ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator -= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( FLOAT ); + D3DXQUATERNION& operator /= ( FLOAT ); + + // unary operators + D3DXQUATERNION operator + () const; + D3DXQUATERNION operator - () const; + + // binary operators + D3DXQUATERNION operator + ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator - ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( FLOAT ) const; + D3DXQUATERNION operator / ( FLOAT ) const; + + friend D3DXQUATERNION operator * (FLOAT, CONST D3DXQUATERNION& ); + + BOOL operator == ( CONST D3DXQUATERNION& ) const; + BOOL operator != ( CONST D3DXQUATERNION& ) const; + +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXQUATERNION, *LPD3DXQUATERNION; + + +//=========================================================================== +// +// Planes +// +//=========================================================================== +typedef struct D3DXPLANE +{ +#ifdef __cplusplus +public: + D3DXPLANE() {} + D3DXPLANE( CONST FLOAT* ); + D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // unary operators + D3DXPLANE operator + () const; + D3DXPLANE operator - () const; + + // binary operators + BOOL operator == ( CONST D3DXPLANE& ) const; + BOOL operator != ( CONST D3DXPLANE& ) const; + +#endif //__cplusplus + FLOAT a, b, c, d; +} D3DXPLANE, *LPD3DXPLANE; + + +//=========================================================================== +// +// Colors +// +//=========================================================================== + +typedef struct D3DXCOLOR +{ +#ifdef __cplusplus +public: + D3DXCOLOR() {} + D3DXCOLOR( DWORD argb ); + D3DXCOLOR( CONST FLOAT * ); + D3DXCOLOR( CONST D3DCOLORVALUE& ); + D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); + + // casting + operator DWORD () const; + + operator FLOAT* (); + operator CONST FLOAT* () const; + + operator D3DCOLORVALUE* (); + operator CONST D3DCOLORVALUE* () const; + + operator D3DCOLORVALUE& (); + operator CONST D3DCOLORVALUE& () const; + + // assignment operators + D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator *= ( FLOAT ); + D3DXCOLOR& operator /= ( FLOAT ); + + // unary operators + D3DXCOLOR operator + () const; + D3DXCOLOR operator - () const; + + // binary operators + D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator * ( FLOAT ) const; + D3DXCOLOR operator / ( FLOAT ) const; + + friend D3DXCOLOR operator * (FLOAT, CONST D3DXCOLOR& ); + + BOOL operator == ( CONST D3DXCOLOR& ) const; + BOOL operator != ( CONST D3DXCOLOR& ) const; + +#endif //__cplusplus + FLOAT r, g, b, a; +} D3DXCOLOR, *LPD3DXCOLOR; + + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// 2D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR2* WINAPI D3DXVec2Normalize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR2* WINAPI D3DXVec2Hermite + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR2* WINAPI D3DXVec2CatmullRom + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR2* WINAPI D3DXVec2BaryCentric + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoord + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormal + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 3D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR3* WINAPI D3DXVec3Normalize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR3* WINAPI D3DXVec3Hermite + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR3* WINAPI D3DXVec3CatmullRom + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR3* WINAPI D3DXVec3BaryCentric + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoord + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormal + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Project vector from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3Project + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT8 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3Unproject + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT8 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +#ifdef __cplusplus +} +#endif + + + +//-------------------------- +// 4D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ); + +D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Cross-product in 4 dimensions. +D3DXVECTOR4* WINAPI D3DXVec4Cross + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3); + +D3DXVECTOR4* WINAPI D3DXVec4Normalize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR4* WINAPI D3DXVec4Hermite + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR4* WINAPI D3DXVec4CatmullRom + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR4* WINAPI D3DXVec4BaryCentric + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); + +// Transform vector by matrix. +D3DXVECTOR4* WINAPI D3DXVec4Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline + +D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ); + +BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +FLOAT WINAPI D3DXMatrixfDeterminant + ( CONST D3DXMATRIX *pM ); + +D3DXMATRIX* WINAPI D3DXMatrixTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); + +// Matrix multiplication. The result represents the transformation M2 +// followed by the transformation M1. (Out = M1 * M2) +D3DXMATRIX* WINAPI D3DXMatrixMultiply + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Calculate inverse of matrix. Inversion my fail, in which case NULL will +// be returned. The determinant of pM is also returned it pfDeterminant +// is non-NULL. +D3DXMATRIX* WINAPI D3DXMatrixInverse + ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); + +// Build a matrix which scales by (sx, sy, sz) +D3DXMATRIX* WINAPI D3DXMatrixScaling + ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); + +// Build a matrix which translates by (x, y, z) +D3DXMATRIX* WINAPI D3DXMatrixTranslation + ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); + +// Build a matrix which rotates around the X axis +D3DXMATRIX* WINAPI D3DXMatrixRotationX + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Y axis +D3DXMATRIX* WINAPI D3DXMatrixRotationY + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Z axis +D3DXMATRIX* WINAPI D3DXMatrixRotationZ + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around an arbitrary axis +D3DXMATRIX* WINAPI D3DXMatrixRotationAxis + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Build a matrix from a quaternion +D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion + ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll + ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + + +// Build transformation matrix. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, + CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, + CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, + CONST D3DXVECTOR3 *pTranslation); + +// Build affine transformation matrix. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, + CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); + +// Build a lookat matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtRH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a lookat matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtLH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a matrix which flattens geometry into a plane, as if casting +// a shadow from a light. +D3DXMATRIX* WINAPI D3DXMatrixShadow + ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, + CONST D3DXPLANE *pPlane ); + +// Build a matrix which reflects the coordinate system about a plane +D3DXMATRIX* WINAPI D3DXMatrixReflect + ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ); + +// Length squared, or "norm" +FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ); + +FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); + +// (0, 0, 0, 1) +D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ); + +BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ); + +// (-x, -y, -z, w) +D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +void WINAPI D3DXQuaternionToAxisAngle + ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); + +// Build a quaternion from a rotation matrix. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix + ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); + +// Rotation about arbitrary axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis + ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll + ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Quaternion multiplication. The result represents the rotation Q2 +// followed by the rotation Q1. (Out = Q2 * Q1) +D3DXQUATERNION* WINAPI D3DXQuaternionMultiply + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2 ); + +D3DXQUATERNION* WINAPI D3DXQuaternionNormalize + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Conjugate and re-norm +D3DXQUATERNION* WINAPI D3DXQuaternionInverse + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects unit quaternions. +// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +D3DXQUATERNION* WINAPI D3DXQuaternionLn + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects pure quaternions. (w == 0) w is ignored in calculation. +// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +D3DXQUATERNION* WINAPI D3DXQuaternionExp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). +// Expects unit quaternions. +D3DXQUATERNION* WINAPI D3DXQuaternionSlerp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, FLOAT t ); + +// Spherical quadrangle interpolation. +// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +D3DXQUATERNION* WINAPI D3DXQuaternionSquad + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, + CONST D3DXQUATERNION *pC, FLOAT t ); + +// Setup control points for spherical quadrangle interpolation +// from Q1 to Q2. The control points are chosen in such a way +// to ensure the continuity of tangents with adjacent segments. +void WINAPI D3DXQuaternionSquadSetup + ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, + CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); + +// Barycentric interpolation. +// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, + FLOAT f, FLOAT g ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Plane +//-------------------------- + +// inline + +// ax + by + cz + dw +FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); + +// ax + by + cz + d +FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +// ax + by + cz +FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Normalize plane (so that |a,b,c| == 1) +D3DXPLANE* WINAPI D3DXPlaneNormalize + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); + +// Find the intersection between a plane and a line. If the line is +// parallel to the plane, NULL is returned. +D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine + ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2); + +// Construct a plane from a point and a normal +D3DXPLANE* WINAPI D3DXPlaneFromPointNormal + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); + +// Construct a plane from 3 points +D3DXPLANE* WINAPI D3DXPlaneFromPoints + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3); + +// Transform a plane by a matrix. The vector (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransform + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Color +//-------------------------- + +// inline + +// (1-r, 1-g, 1-b, a) +D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); + +D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// (r1*r2, g1*g2, b1*b2, a1*a2) +D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Interpolate r,g,b between desaturated color and color. +// DesaturatedColor + s(Color - DesaturatedColor) +D3DXCOLOR* WINAPI D3DXColorAdjustSaturation + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +D3DXCOLOR* WINAPI D3DXColorAdjustContrast + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); + +#ifdef __cplusplus +} +#endif + + + + +//-------------------------- +// Misc +//-------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +// Calculate Fresnel term given the cosine of theta (likely obtained by +// taking the dot of two normals), and the refraction index of the material. +FLOAT WINAPI D3DXFresnelTerm + (FLOAT CosTheta, FLOAT RefractionIndex); + +#ifdef __cplusplus +} +#endif + + + +//=========================================================================== +// +// Matrix Stack +// +//=========================================================================== + +typedef interface ID3DXMatrixStack ID3DXMatrixStack; +typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; + +// {E3357330-CC5E-11d2-A434-00A0C90629A8} +DEFINE_GUID( IID_ID3DXMatrixStack, +0xe3357330, 0xcc5e, 0x11d2, 0xa4, 0x34, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); + + +#undef INTERFACE +#define INTERFACE ID3DXMatrixStack + +DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) +{ + // + // IUnknown methods + // + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + // + // ID3DXMatrixStack methods + // + + // Pops the top of the stack, returns the current top + // *after* popping the top. + STDMETHOD(Pop)(THIS) PURE; + + // Pushes the stack by one, duplicating the current matrix. + STDMETHOD(Push)(THIS) PURE; + + // Loads identity in the current matrix. + STDMETHOD(LoadIdentity)(THIS) PURE; + + // Loads the given matrix into the current matrix + STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right-Multiplies the given matrix to the current matrix. + // (transformation is about the current world origin) + STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Left-Multiplies the given matrix to the current matrix + // (transformation is about the local origin of the object) + STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the current world origin) + STDMETHOD(RotateAxis) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the local origin of the object) + STDMETHOD(RotateAxisLocal) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // current world origin) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRoll) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // local origin of the object) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRollLocal) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Right multiply the current matrix with the computed scale + // matrix. (transformation is about the current world origin) + STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Left multiply the current matrix with the computed scale + // matrix. (transformation is about the local origin of the object) + STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Right multiply the current matrix with the computed translation + // matrix. (transformation is about the current world origin) + STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; + + // Left multiply the current matrix with the computed translation + // matrix. (transformation is about the local origin of the object) + STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Obtain the current matrix at the top of the stack + STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT WINAPI + D3DXCreateMatrixStack( + DWORD Flags, + LPD3DXMATRIXSTACK* ppStack); + +#ifdef __cplusplus +} +#endif + +#include "d3dx8math.inl" + +#pragma warning(default:4201) + +#endif // __D3DX8MATH_H__ diff --git a/plugins/ADK/d3d8/includes/d3dx8math.inl b/plugins/ADK/d3d8/includes/d3dx8math.inl new file mode 100644 index 0000000..a64e5c5 --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3dx8math.inl @@ -0,0 +1,1757 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8math.inl +// Content: D3DX math inline functions +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX8MATH_INL__ +#define __D3DX8MATH_INL__ + + +//=========================================================================== +// +// Inline Class Methods +// +//=========================================================================== + +#ifdef __cplusplus + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; +} + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) +{ + x = fx; + y = fy; +} + +// casting +D3DXINLINE +D3DXVECTOR2::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR2::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + +// assignment operators +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) +{ + x += v.x; + y += v.y; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator -= ( CONST D3DXVECTOR2& v ) +{ + x -= v.x; + y -= v.y; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + return *this; +} + +// unary operators +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator - () const +{ + return D3DXVECTOR2(-x, -y); +} + +// binary operators +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x + v.x, y + v.y); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator - ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x - v.x, y - v.y); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator * ( FLOAT f ) const +{ + return D3DXVECTOR2(x * f, y * f); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR2(x * fInv, y * fInv); +} + + +D3DXINLINE D3DXVECTOR2 +operator * ( FLOAT f, CONST D3DXVECTOR2& v ) +{ + return D3DXVECTOR2(f * v.x, f * v.y); +} + +D3DXINLINE BOOL +D3DXVECTOR2::operator == ( CONST D3DXVECTOR2& v ) const +{ + return x == v.x && y == v.y; +} + +D3DXINLINE BOOL +D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const +{ + return x != v.x || y != v.y; +} + + + + +//-------------------------- +// 3D Vector +//-------------------------- +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DVECTOR& v ) +{ + x = v.x; + y = v.y; + z = v.z; +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DXINLINE +D3DXVECTOR3::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR3::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) +{ + x += v.x; + y += v.y; + z += v.z; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator -= ( CONST D3DXVECTOR3& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator - () const +{ + return D3DXVECTOR3(-x, -y, -z); +} + + +// binary operators +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x + v.x, y + v.y, z + v.z); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator - ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x - v.x, y - v.y, z - v.z); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator * ( FLOAT f ) const +{ + return D3DXVECTOR3(x * f, y * f, z * f); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR3(x * fInv, y * fInv, z * fInv); +} + + +D3DXINLINE D3DXVECTOR3 +operator * ( FLOAT f, CONST struct D3DXVECTOR3& v ) +{ + return D3DXVECTOR3(f * v.x, f * v.y, f * v.z); +} + + +D3DXINLINE BOOL +D3DXVECTOR3::operator == ( CONST D3DXVECTOR3& v ) const +{ + return x == v.x && y == v.y && z == v.z; +} + +D3DXINLINE BOOL +D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const +{ + return x != v.x || y != v.y || z != v.z; +} + + + +//-------------------------- +// 4D Vector +//-------------------------- +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXVECTOR4::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR4::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) +{ + x += v.x; + y += v.y; + z += v.z; + w += v.w; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator -= ( CONST D3DXVECTOR4& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + w -= v.w; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator - () const +{ + return D3DXVECTOR4(-x, -y, -z, -w); +} + + +// binary operators +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x + v.x, y + v.y, z + v.z, w + v.w); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator - ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x - v.x, y - v.y, z - v.z, w - v.w); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator * ( FLOAT f ) const +{ + return D3DXVECTOR4(x * f, y * f, z * f, w * f); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR4(x * fInv, y * fInv, z * fInv, w * fInv); +} + + +D3DXINLINE D3DXVECTOR4 +operator * ( FLOAT f, CONST D3DXVECTOR4& v ) +{ + return D3DXVECTOR4(f * v.x, f * v.y, f * v.z, f * v.w); +} + + +D3DXINLINE BOOL +D3DXVECTOR4::operator == ( CONST D3DXVECTOR4& v ) const +{ + return x == v.x && y == v.y && z == v.z && w == v.w; +} + +D3DXINLINE BOOL +D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const +{ + return x != v.x || y != v.y || z != v.z || w != v.w; +} + + +//-------------------------- +// Matrix +//-------------------------- +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + memcpy(&_11, pf, sizeof(D3DXMATRIX)); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DMATRIX& mat ) +{ + memcpy(&_11, &mat, sizeof(D3DXMATRIX)); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, + FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24, + FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34, + FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44 ) +{ + _11 = f11; _12 = f12; _13 = f13; _14 = f14; + _21 = f21; _22 = f22; _23 = f23; _24 = f24; + _31 = f31; _32 = f32; _33 = f33; _34 = f34; + _41 = f41; _42 = f42; _43 = f43; _44 = f44; +} + + + +// access grants +D3DXINLINE FLOAT& +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) +{ + return m[iRow][iCol]; +} + +D3DXINLINE FLOAT +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const +{ + return m[iRow][iCol]; +} + + +// casting operators +D3DXINLINE +D3DXMATRIX::operator FLOAT* () +{ + return (FLOAT *) &_11; +} + +D3DXINLINE +D3DXMATRIX::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &_11; +} + + +// assignment operators +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) +{ + D3DXMatrixMultiply(this, this, &mat); + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator += ( CONST D3DXMATRIX& mat ) +{ + _11 += mat._11; _12 += mat._12; _13 += mat._13; _14 += mat._14; + _21 += mat._21; _22 += mat._22; _23 += mat._23; _24 += mat._24; + _31 += mat._31; _32 += mat._32; _33 += mat._33; _34 += mat._34; + _41 += mat._41; _42 += mat._42; _43 += mat._43; _44 += mat._44; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator -= ( CONST D3DXMATRIX& mat ) +{ + _11 -= mat._11; _12 -= mat._12; _13 -= mat._13; _14 -= mat._14; + _21 -= mat._21; _22 -= mat._22; _23 -= mat._23; _24 -= mat._24; + _31 -= mat._31; _32 -= mat._32; _33 -= mat._33; _34 -= mat._34; + _41 -= mat._41; _42 -= mat._42; _43 -= mat._43; _44 -= mat._44; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( FLOAT f ) +{ + _11 *= f; _12 *= f; _13 *= f; _14 *= f; + _21 *= f; _22 *= f; _23 *= f; _24 *= f; + _31 *= f; _32 *= f; _33 *= f; _34 *= f; + _41 *= f; _42 *= f; _43 *= f; _44 *= f; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + _11 *= fInv; _12 *= fInv; _13 *= fInv; _14 *= fInv; + _21 *= fInv; _22 *= fInv; _23 *= fInv; _24 *= fInv; + _31 *= fInv; _32 *= fInv; _33 *= fInv; _34 *= fInv; + _41 *= fInv; _42 *= fInv; _43 *= fInv; _44 *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator - () const +{ + return D3DXMATRIX(-_11, -_12, -_13, -_14, + -_21, -_22, -_23, -_24, + -_31, -_32, -_33, -_34, + -_41, -_42, -_43, -_44); +} + + +// binary operators +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const +{ + D3DXMATRIX matT; + D3DXMatrixMultiply(&matT, this, &mat); + return matT; +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator + ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 + mat._11, _12 + mat._12, _13 + mat._13, _14 + mat._14, + _21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + mat._24, + _31 + mat._31, _32 + mat._32, _33 + mat._33, _34 + mat._34, + _41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + mat._44); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator - ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - mat._14, + _21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - mat._24, + _31 - mat._31, _32 - mat._32, _33 - mat._33, _34 - mat._34, + _41 - mat._41, _42 - mat._42, _43 - mat._43, _44 - mat._44); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator * ( FLOAT f ) const +{ + return D3DXMATRIX(_11 * f, _12 * f, _13 * f, _14 * f, + _21 * f, _22 * f, _23 * f, _24 * f, + _31 * f, _32 * f, _33 * f, _34 * f, + _41 * f, _42 * f, _43 * f, _44 * f); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXMATRIX(_11 * fInv, _12 * fInv, _13 * fInv, _14 * fInv, + _21 * fInv, _22 * fInv, _23 * fInv, _24 * fInv, + _31 * fInv, _32 * fInv, _33 * fInv, _34 * fInv, + _41 * fInv, _42 * fInv, _43 * fInv, _44 * fInv); +} + + +D3DXINLINE D3DXMATRIX +operator * ( FLOAT f, CONST D3DXMATRIX& mat ) +{ + return D3DXMATRIX(f * mat._11, f * mat._12, f * mat._13, f * mat._14, + f * mat._21, f * mat._22, f * mat._23, f * mat._24, + f * mat._31, f * mat._32, f * mat._33, f * mat._34, + f * mat._41, f * mat._42, f * mat._43, f * mat._44); +} + + +D3DXINLINE BOOL +D3DXMATRIX::operator == ( CONST D3DXMATRIX& mat ) const +{ + return 0 == memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + +D3DXINLINE BOOL +D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const +{ + return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXQUATERNION::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXQUATERNION::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) +{ + x += q.x; + y += q.y; + z += q.z; + w += q.w; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator -= ( CONST D3DXQUATERNION& q ) +{ + x -= q.x; + y -= q.y; + z -= q.z; + w -= q.w; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( CONST D3DXQUATERNION& q ) +{ + D3DXQuaternionMultiply(this, this, &q); + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator - () const +{ + return D3DXQUATERNION(-x, -y, -z, -w); +} + + +// binary operators +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x + q.x, y + q.y, z + q.z, w + q.w); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator - ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x - q.x, y - q.y, z - q.z, w - q.w); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( CONST D3DXQUATERNION& q ) const +{ + D3DXQUATERNION qT; + D3DXQuaternionMultiply(&qT, this, &q); + return qT; +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( FLOAT f ) const +{ + return D3DXQUATERNION(x * f, y * f, z * f, w * f); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXQUATERNION(x * fInv, y * fInv, z * fInv, w * fInv); +} + + +D3DXINLINE D3DXQUATERNION +operator * (FLOAT f, CONST D3DXQUATERNION& q ) +{ + return D3DXQUATERNION(f * q.x, f * q.y, f * q.z, f * q.w); +} + + +D3DXINLINE BOOL +D3DXQUATERNION::operator == ( CONST D3DXQUATERNION& q ) const +{ + return x == q.x && y == q.y && z == q.z && w == q.w; +} + +D3DXINLINE BOOL +D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const +{ + return x != q.x || y != q.y || z != q.z || w != q.w; +} + + + +//-------------------------- +// Plane +//-------------------------- + +D3DXINLINE +D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + a = pf[0]; + b = pf[1]; + c = pf[2]; + d = pf[3]; +} + +D3DXINLINE +D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) +{ + a = fa; + b = fb; + c = fc; + d = fd; +} + + +// casting +D3DXINLINE +D3DXPLANE::operator FLOAT* () +{ + return (FLOAT *) &a; +} + +D3DXINLINE +D3DXPLANE::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &a; +} + + +// unary operators +D3DXINLINE D3DXPLANE +D3DXPLANE::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXPLANE +D3DXPLANE::operator - () const +{ + return D3DXPLANE(-a, -b, -c, -d); +} + + +// binary operators +D3DXINLINE BOOL +D3DXPLANE::operator == ( CONST D3DXPLANE& p ) const +{ + return a == p.a && b == p.b && c == p.c && d == p.d; +} + +D3DXINLINE BOOL +D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const +{ + return a != p.a || b != p.b || c != p.c || d != p.d; +} + + + + +//-------------------------- +// Color +//-------------------------- + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( DWORD dw ) +{ + CONST FLOAT f = 1.0f / 255.0f; + r = f * (FLOAT) (unsigned char) (dw >> 16); + g = f * (FLOAT) (unsigned char) (dw >> 8); + b = f * (FLOAT) (unsigned char) (dw >> 0); + a = f * (FLOAT) (unsigned char) (dw >> 24); +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + r = pf[0]; + g = pf[1]; + b = pf[2]; + a = pf[3]; +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST D3DCOLORVALUE& c ) +{ + r = c.r; + g = c.g; + b = c.b; + a = c.a; +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) +{ + r = fr; + g = fg; + b = fb; + a = fa; +} + + +// casting +D3DXINLINE +D3DXCOLOR::operator DWORD () const +{ + DWORD dwR = r >= 1.0f ? 0xff : r <= 0.0f ? 0x00 : (DWORD) (r * 255.0f + 0.5f); + DWORD dwG = g >= 1.0f ? 0xff : g <= 0.0f ? 0x00 : (DWORD) (g * 255.0f + 0.5f); + DWORD dwB = b >= 1.0f ? 0xff : b <= 0.0f ? 0x00 : (DWORD) (b * 255.0f + 0.5f); + DWORD dwA = a >= 1.0f ? 0xff : a <= 0.0f ? 0x00 : (DWORD) (a * 255.0f + 0.5f); + + return (dwA << 24) | (dwR << 16) | (dwG << 8) | dwB; +} + + +D3DXINLINE +D3DXCOLOR::operator FLOAT * () +{ + return (FLOAT *) &r; +} + +D3DXINLINE +D3DXCOLOR::operator CONST FLOAT * () const +{ + return (CONST FLOAT *) &r; +} + + +D3DXINLINE +D3DXCOLOR::operator D3DCOLORVALUE * () +{ + return (D3DCOLORVALUE *) &r; +} + +D3DXINLINE +D3DXCOLOR::operator CONST D3DCOLORVALUE * () const +{ + return (CONST D3DCOLORVALUE *) &r; +} + + +D3DXINLINE +D3DXCOLOR::operator D3DCOLORVALUE& () +{ + return *((D3DCOLORVALUE *) &r); +} + +D3DXINLINE +D3DXCOLOR::operator CONST D3DCOLORVALUE& () const +{ + return *((CONST D3DCOLORVALUE *) &r); +} + + +// assignment operators +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) +{ + r += c.r; + g += c.g; + b += c.b; + a += c.a; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator -= ( CONST D3DXCOLOR& c ) +{ + r -= c.r; + g -= c.g; + b -= c.b; + a -= c.a; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator *= ( FLOAT f ) +{ + r *= f; + g *= f; + b *= f; + a *= f; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + r *= fInv; + g *= fInv; + b *= fInv; + a *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator - () const +{ + return D3DXCOLOR(-r, -g, -b, -a); +} + + +// binary operators +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r + c.r, g + c.g, b + c.b, a + c.a); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator - ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r - c.r, g - c.g, b - c.b, a - c.a); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator * ( FLOAT f ) const +{ + return D3DXCOLOR(r * f, g * f, b * f, a * f); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXCOLOR(r * fInv, g * fInv, b * fInv, a * fInv); +} + + +D3DXINLINE D3DXCOLOR +operator * (FLOAT f, CONST D3DXCOLOR& c ) +{ + return D3DXCOLOR(f * c.r, f * c.g, f * c.b, f * c.a); +} + + +D3DXINLINE BOOL +D3DXCOLOR::operator == ( CONST D3DXCOLOR& c ) const +{ + return r == c.r && g == c.g && b == c.b && a == c.a; +} + +D3DXINLINE BOOL +D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const +{ + return r != c.r || g != c.g || b != c.b || a != c.a; +} + + +#endif //__cplusplus + + + +//=========================================================================== +// +// Inline functions +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y); +#endif +} + +D3DXINLINE FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y; +} + +D3DXINLINE FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y; +} + +D3DXINLINE FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->y - pV1->y * pV2->x; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + return pOut; +} + + +//-------------------------- +// 3D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#endif +} + +D3DXINLINE FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z; +} + +D3DXINLINE FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ + D3DXVECTOR3 v; + +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + v.x = pV1->y * pV2->z - pV1->z * pV2->y; + v.y = pV1->z * pV2->x - pV1->x * pV2->z; + v.z = pV1->x * pV2->y - pV1->y * pV2->x; + + *pOut = v; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + return pOut; +} + + +//-------------------------- +// 4D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#endif +} + +D3DXINLINE FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w; +} + +D3DXINLINE FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z + pV1->w * pV2->w; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + pOut->w = pV1->w + pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + pOut->w = pV1->w - pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w < pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w > pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + pOut->w = pV->w * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + pOut->w = pV1->w + s * (pV2->w - pV1->w); + return pOut; +} + + +//-------------------------- +// 4D Matrix +//-------------------------- + +D3DXINLINE D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ) +{ +#ifdef D3DX_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->m[0][1] = pOut->m[0][2] = pOut->m[0][3] = + pOut->m[1][0] = pOut->m[1][2] = pOut->m[1][3] = + pOut->m[2][0] = pOut->m[2][1] = pOut->m[2][3] = + pOut->m[3][0] = pOut->m[3][1] = pOut->m[3][2] = 0.0f; + + pOut->m[0][0] = pOut->m[1][1] = pOut->m[2][2] = pOut->m[3][3] = 1.0f; + return pOut; +} + + +D3DXINLINE BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ) +{ +#ifdef D3DX_DEBUG + if(!pM) + return FALSE; +#endif + + return pM->m[0][0] == 1.0f && pM->m[0][1] == 0.0f && pM->m[0][2] == 0.0f && pM->m[0][3] == 0.0f && + pM->m[1][0] == 0.0f && pM->m[1][1] == 1.0f && pM->m[1][2] == 0.0f && pM->m[1][3] == 0.0f && + pM->m[2][0] == 0.0f && pM->m[2][1] == 0.0f && pM->m[2][2] == 1.0f && pM->m[2][3] == 0.0f && + pM->m[3][0] == 0.0f && pM->m[3][1] == 0.0f && pM->m[3][2] == 0.0f && pM->m[3][3] == 1.0f; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DXINLINE FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#else + return (FLOAT) sqrt(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#endif +} + +D3DXINLINE FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return 0.0f; +#endif + + return pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w; +} + +D3DXINLINE FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ) +{ +#ifdef D3DX_DEBUG + if(!pQ1 || !pQ2) + return 0.0f; +#endif + + return pQ1->x * pQ2->x + pQ1->y * pQ2->y + pQ1->z * pQ2->z + pQ1->w * pQ2->w; +} + + +D3DXINLINE D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ) +{ +#ifdef D3DX_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->x = pOut->y = pOut->z = 0.0f; + pOut->w = 1.0f; + return pOut; +} + +D3DXINLINE BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return FALSE; +#endif + + return pQ->x == 0.0f && pQ->y == 0.0f && pQ->z == 0.0f && pQ->w == 1.0f; +} + + +D3DXINLINE D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pQ) + return NULL; +#endif + + pOut->x = -pQ->x; + pOut->y = -pQ->y; + pOut->z = -pQ->z; + pOut->w = pQ->w; + return pOut; +} + + +//-------------------------- +// Plane +//-------------------------- + +D3DXINLINE FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d * pV->w; +} + +D3DXINLINE FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d; +} + +D3DXINLINE FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z; +} + + +//-------------------------- +// Color +//-------------------------- + +D3DXINLINE D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = 1.0f - pC->r; + pOut->g = 1.0f - pC->g; + pOut->b = 1.0f - pC->b; + pOut->a = pC->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + pC2->r; + pOut->g = pC1->g + pC2->g; + pOut->b = pC1->b + pC2->b; + pOut->a = pC1->a + pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r - pC2->r; + pOut->g = pC1->g - pC2->g; + pOut->b = pC1->b - pC2->b; + pOut->a = pC1->a - pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = pC->r * s; + pOut->g = pC->g * s; + pOut->b = pC->b * s; + pOut->a = pC->a * s; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r * pC2->r; + pOut->g = pC1->g * pC2->g; + pOut->b = pC1->b * pC2->b; + pOut->a = pC1->a * pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + s * (pC2->r - pC1->r); + pOut->g = pC1->g + s * (pC2->g - pC1->g); + pOut->b = pC1->b + s * (pC2->b - pC1->b); + pOut->a = pC1->a + s * (pC2->a - pC1->a); + return pOut; +} + + +#endif // __D3DX8MATH_INL__ diff --git a/plugins/ADK/d3d8/includes/d3dx8mesh.h b/plugins/ADK/d3d8/includes/d3dx8mesh.h new file mode 100644 index 0000000..5408cd3 --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3dx8mesh.h @@ -0,0 +1,760 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8mesh.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx8.h" + +#ifndef __D3DX8MESH_H__ +#define __D3DX8MESH_H__ + +#include "dxfile.h" // defines LPDIRECTXFILEDATA + +// {2A835771-BF4D-43f4-8E14-82A809F17D8A} +DEFINE_GUID(IID_ID3DXBaseMesh, +0x2a835771, 0xbf4d, 0x43f4, 0x8e, 0x14, 0x82, 0xa8, 0x9, 0xf1, 0x7d, 0x8a); + +// {CCAE5C3B-4DD1-4d0f-997E-4684CA64557F} +DEFINE_GUID(IID_ID3DXMesh, +0xccae5c3b, 0x4dd1, 0x4d0f, 0x99, 0x7e, 0x46, 0x84, 0xca, 0x64, 0x55, 0x7f); + +// {19FBE386-C282-4659-97BD-CB869B084A6C} +DEFINE_GUID(IID_ID3DXPMesh, +0x19fbe386, 0xc282, 0x4659, 0x97, 0xbd, 0xcb, 0x86, 0x9b, 0x8, 0x4a, 0x6c); + +// {4E3CA05C-D4FF-4d11-8A02-16459E08F6F4} +DEFINE_GUID(IID_ID3DXSPMesh, +0x4e3ca05c, 0xd4ff, 0x4d11, 0x8a, 0x2, 0x16, 0x45, 0x9e, 0x8, 0xf6, 0xf4); + +// {8DB06ECC-EBFC-408a-9404-3074B4773515} +DEFINE_GUID(IID_ID3DXSkinMesh, +0x8db06ecc, 0xebfc, 0x408a, 0x94, 0x4, 0x30, 0x74, 0xb4, 0x77, 0x35, 0x15); + +// Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags +enum _D3DXMESH { + D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. + D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB. + D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB. + D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB. + D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB. + D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER + D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB. + D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB. + D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB. + D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, // Use D3DUSAGE_SOFTWAREPROCESSING for VB. + D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER + D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB. + D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB. + D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB. + D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, // Use D3DUSAGE_SOFTWAREPROCESSING for IB. + + D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer + + D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinMesh::ConvertToBlendedMesh + + // Helper options + D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM + D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED + D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY + D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC + D3DXMESH_SOFTWAREPROCESSING = 0x18000, // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING + +}; + +// option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh +enum _D3DXMESHSIMP +{ + D3DXMESHSIMP_VERTEX = 0x1, + D3DXMESHSIMP_FACE = 0x2, + +}; + +enum _MAX_FVF_DECL_SIZE +{ + MAX_FVF_DECL_SIZE = 20 +}; + +typedef struct ID3DXBaseMesh *LPD3DXBASEMESH; +typedef struct ID3DXMesh *LPD3DXMESH; +typedef struct ID3DXPMesh *LPD3DXPMESH; +typedef struct ID3DXSPMesh *LPD3DXSPMESH; +typedef struct ID3DXSkinMesh *LPD3DXSKINMESH; + +typedef struct _D3DXATTRIBUTERANGE +{ + DWORD AttribId; + DWORD FaceStart; + DWORD FaceCount; + DWORD VertexStart; + DWORD VertexCount; +} D3DXATTRIBUTERANGE; + +typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus +struct D3DXMATERIAL +{ + D3DMATERIAL8 MatD3D; + LPSTR pTextureFilename; +}; +typedef struct D3DXMATERIAL *LPD3DXMATERIAL; +#ifdef __cplusplus +} +#endif //__cplusplus + +typedef struct _D3DXATTRIBUTEWEIGHTS +{ + FLOAT Position; + FLOAT Boundary; + FLOAT Normal; + FLOAT Diffuse; + FLOAT Specular; + FLOAT Tex[8]; +} D3DXATTRIBUTEWEIGHTS; + +typedef D3DXATTRIBUTEWEIGHTS* LPD3DXATTRIBUTEWEIGHTS; + +enum _D3DXWELDEPSILONSFLAGS +{ + D3DXWELDEPSILONS_WELDALL = 0x1, // weld all vertices marked by adjacency as being overlapping + + D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, // if a given vertex component is within epsilon, modify partial matched + // vertices so that both components identical AND if all components "equal" + // remove one of the vertices + D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, // instructs weld to only allow modifications to vertices and not removal + // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set + // useful to modify vertices to be equal, but not allow vertices to be removed +}; + +typedef struct _D3DXWELDEPSILONS +{ + FLOAT SkinWeights; + FLOAT Normal; + FLOAT Tex[8]; + DWORD Flags; +} D3DXWELDEPSILONS; + +typedef D3DXWELDEPSILONS* LPD3DXWELDEPSILONS; + + +#undef INTERFACE +#define INTERFACE ID3DXBaseMesh + +DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER8* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER8* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXMesh + +DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER8* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER8* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + // ID3DXMesh + STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE; + STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; + STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppOptMesh) PURE; + STDMETHOD(OptimizeInplace)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap) PURE; + +}; + + +#undef INTERFACE +#define INTERFACE ID3DXPMesh + +DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER8* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER8* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, BYTE** ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + // ID3DXPMesh + STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE8 pD3D, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMesh)(THIS_ DWORD Options, + CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3D, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(SetNumFaces)(THIS_ DWORD Faces) PURE; + STDMETHOD(SetNumVertices)(THIS_ DWORD Vertices) PURE; + STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMinFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetMinVertices)(THIS) PURE; + STDMETHOD(Save)(THIS_ IStream *pStream, LPD3DXMATERIAL pMaterials, DWORD NumMaterials) PURE; + + STDMETHOD(Optimize)(THIS_ DWORD Flags, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppOptMesh) PURE; + + STDMETHOD(OptimizeBaseLOD)(THIS_ DWORD Flags, DWORD* pFaceRemap) PURE; + STDMETHOD(TrimByFaces)(THIS_ DWORD NewFacesMin, DWORD NewFacesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE; + STDMETHOD(TrimByVertices)(THIS_ DWORD NewVerticesMin, DWORD NewVerticesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE; + + STDMETHOD(GetAdjacency)(THIS_ DWORD* pAdjacency) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXSPMesh + +DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXSPMesh + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE8 pD3D, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE8 pD3D, DWORD *pVertexRemapOut, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMesh)(THIS_ DWORD Options, + CONST DWORD *pDeclaration, LPDIRECT3DDEVICE8 pD3D, DWORD *pVertexRemapOut, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ReduceFaces)(THIS_ DWORD Faces) PURE; + STDMETHOD(ReduceVertices)(THIS_ DWORD Vertices) PURE; + STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE; + STDMETHOD(GetVertexAttributeWeights)(THIS_ LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights) PURE; + STDMETHOD(GetVertexWeights)(THIS_ FLOAT *pVertexWeights) PURE; +}; + +#define UNUSED16 (0xffff) +#define UNUSED32 (0xffffffff) + +// ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags +enum _D3DXMESHOPT { + D3DXMESHOPT_COMPACT = 0x01000000, + D3DXMESHOPT_ATTRSORT = 0x02000000, + D3DXMESHOPT_VERTEXCACHE = 0x04000000, + D3DXMESHOPT_STRIPREORDER = 0x08000000, + D3DXMESHOPT_IGNOREVERTS = 0x10000000, // optimize faces only, don't touch vertices + D3DXMESHOPT_SHAREVB = 0x1000, // same as D3DXMESH_VB_SHARE +}; + +// Subset of the mesh that has the same attribute and bone combination. +// This subset can be rendered in a single draw call +typedef struct _D3DXBONECOMBINATION +{ + DWORD AttribId; + DWORD FaceStart; + DWORD FaceCount; + DWORD VertexStart; + DWORD VertexCount; + DWORD* BoneId; +} D3DXBONECOMBINATION, *LPD3DXBONECOMBINATION; + + +#undef INTERFACE +#define INTERFACE ID3DXSkinMesh + +DECLARE_INTERFACE_(ID3DXSkinMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXMesh + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ DWORD Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER8* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER8* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, BYTE** ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, BYTE** ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE; + STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; + // ID3DXSkinMesh + STDMETHOD_(DWORD, GetNumBones)(THIS) PURE; + STDMETHOD(GetOriginalMesh)(THIS_ LPD3DXMESH* ppMesh) PURE; + STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE; + STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE; + STDMETHOD(GetBoneInfluence)(THIS_ DWORD bone, DWORD* vertices, FLOAT* weights) PURE; + STDMETHOD(GetMaxVertexInfluences)(THIS_ DWORD* maxVertexInfluences) PURE; + STDMETHOD(GetMaxFaceInfluences)(THIS_ DWORD* maxFaceInfluences) PURE; + + STDMETHOD(ConvertToBlendedMesh)(THIS_ DWORD Options, + CONST LPDWORD pAdjacencyIn, + LPDWORD pAdjacencyOut, + DWORD* pNumBoneCombinations, + LPD3DXBUFFER* ppBoneCombinationTable, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppMesh) PURE; + + STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_ DWORD Options, + CONST LPDWORD pAdjacencyIn, + DWORD paletteSize, + LPDWORD pAdjacencyOut, + DWORD* pNumBoneCombinations, + LPD3DXBUFFER* ppBoneCombinationTable, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppMesh) PURE; + + STDMETHOD(GenerateSkinnedMesh)(THIS_ DWORD Options, + FLOAT minWeight, + CONST LPDWORD pAdjacencyIn, + LPDWORD pAdjacencyOut, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppMesh) PURE; + STDMETHOD(UpdateSkinnedMesh)(THIS_ CONST D3DXMATRIX* pBoneTransforms, CONST D3DXMATRIX* pBoneInvTransforms, LPD3DXMESH pMesh) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateMesh( + DWORD NumFaces, + DWORD NumVertices, + DWORD Options, + CONST DWORD *pDeclaration, + LPDIRECT3DDEVICE8 pD3D, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXCreateMeshFVF( + DWORD NumFaces, + DWORD NumVertices, + DWORD Options, + DWORD FVF, + LPDIRECT3DDEVICE8 pD3D, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXCreateSPMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + LPD3DXSPMESH* ppSMesh); + +// clean a mesh up for simplification, try to make manifold +HRESULT WINAPI + D3DXCleanMesh( + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacencyIn, + LPD3DXMESH* ppMeshOut, + DWORD* pAdjacencyOut, + LPD3DXBUFFER* ppErrorsAndWarnings); + +HRESULT WINAPI + D3DXValidMesh( + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacency, + LPD3DXBUFFER* ppErrorsAndWarnings); + +HRESULT WINAPI + D3DXGeneratePMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + DWORD MinValue, + DWORD Options, + LPD3DXPMESH* ppPMesh); + +HRESULT WINAPI + D3DXSimplifyMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + DWORD MinValue, + DWORD Options, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXComputeBoundingSphere( + PVOID pPointsFVF, + DWORD NumVertices, + DWORD FVF, + D3DXVECTOR3 *pCenter, + FLOAT *pRadius); + +HRESULT WINAPI + D3DXComputeBoundingBox( + PVOID pPointsFVF, + DWORD NumVertices, + DWORD FVF, + D3DXVECTOR3 *pMin, + D3DXVECTOR3 *pMax); + +HRESULT WINAPI + D3DXComputeNormals( + LPD3DXBASEMESH pMesh, + CONST DWORD *pAdjacency); + +HRESULT WINAPI + D3DXCreateBuffer( + DWORD NumBytes, + LPD3DXBUFFER *ppBuffer); + + +HRESULT WINAPI + D3DXLoadMeshFromX( + LPSTR pFilename, + DWORD Options, + LPDIRECT3DDEVICE8 pD3D, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXLoadMeshFromXInMemory( + PBYTE Memory, + DWORD SizeOfMemory, + DWORD Options, + LPDIRECT3DDEVICE8 pD3D, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXLoadMeshFromXResource( + HMODULE Module, + LPCTSTR Name, + LPCTSTR Type, + DWORD Options, + LPDIRECT3DDEVICE8 pD3D, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXSaveMeshToX( + LPSTR pFilename, + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST LPD3DXMATERIAL pMaterials, + DWORD NumMaterials, + DWORD Format + ); + +HRESULT WINAPI + D3DXCreatePMeshFromStream( + IStream *pStream, + DWORD Options, + LPDIRECT3DDEVICE8 pD3DDevice, + LPD3DXBUFFER *ppMaterials, + DWORD* pNumMaterials, + LPD3DXPMESH *ppPMesh); + +HRESULT WINAPI + D3DXCreateSkinMesh( + DWORD NumFaces, + DWORD NumVertices, + DWORD NumBones, + DWORD Options, + CONST DWORD *pDeclaration, + LPDIRECT3DDEVICE8 pD3D, + LPD3DXSKINMESH* ppSkinMesh); + +HRESULT WINAPI + D3DXCreateSkinMeshFVF( + DWORD NumFaces, + DWORD NumVertices, + DWORD NumBones, + DWORD Options, + DWORD FVF, + LPDIRECT3DDEVICE8 pD3D, + LPD3DXSKINMESH* ppSkinMesh); + +HRESULT WINAPI + D3DXCreateSkinMeshFromMesh( + LPD3DXMESH pMesh, + DWORD numBones, + LPD3DXSKINMESH* ppSkinMesh); + +HRESULT WINAPI + D3DXLoadMeshFromXof( + LPDIRECTXFILEDATA pXofObjMesh, + DWORD Options, + LPDIRECT3DDEVICE8 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXLoadSkinMeshFromXof( + LPDIRECTXFILEDATA pxofobjMesh, + DWORD Options, + LPDIRECT3DDEVICE8 pD3D, + LPD3DXBUFFER* ppAdjacency, + LPD3DXBUFFER* ppMaterials, + DWORD *pMatOut, + LPD3DXBUFFER* ppBoneNames, + LPD3DXBUFFER* ppBoneTransforms, + LPD3DXSKINMESH* ppMesh); + +HRESULT WINAPI + D3DXTessellateNPatches( + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacencyIn, + FLOAT NumSegs, + BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppAdjacencyOut); + +UINT WINAPI + D3DXGetFVFVertexSize(DWORD FVF); + +HRESULT WINAPI + D3DXDeclaratorFromFVF( + DWORD FVF, + DWORD Declaration[MAX_FVF_DECL_SIZE]); + +HRESULT WINAPI + D3DXFVFFromDeclarator( + CONST DWORD *pDeclarator, + DWORD *pFVF); + +HRESULT WINAPI + D3DXWeldVertices( + CONST LPD3DXMESH pMesh, + LPD3DXWELDEPSILONS pEpsilons, + CONST DWORD *pAdjacencyIn, + DWORD *pAdjacencyOut, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap); + +typedef struct _D3DXINTERSECTINFO +{ + DWORD FaceIndex; // index of face intersected + FLOAT U; // Barycentric Hit Coordinates + FLOAT V; // Barycentric Hit Coordinates + FLOAT Dist; // Ray-Intersection Parameter Distance +} D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO; + + +HRESULT WINAPI + D3DXIntersect( + LPD3DXBASEMESH pMesh, + CONST D3DXVECTOR3 *pRayPos, + CONST D3DXVECTOR3 *pRayDir, + BOOL *pHit, // True if any faces were intersected + DWORD *pFaceIndex, // index of closest face intersected + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist, // Ray-Intersection Parameter Distance + LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) + DWORD *pCountOfHits); // Number of entries in AllHits array + +HRESULT WINAPI + D3DXIntersectSubset( + LPD3DXBASEMESH pMesh, + DWORD AttribId, + CONST D3DXVECTOR3 *pRayPos, + CONST D3DXVECTOR3 *pRayDir, + BOOL *pHit, // True if any faces were intersected + DWORD *pFaceIndex, // index of closest face intersected + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist, // Ray-Intersection Parameter Distance + LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) + DWORD *pCountOfHits); // Number of entries in AllHits array + + +HRESULT WINAPI D3DXSplitMesh + ( + CONST LPD3DXMESH pMeshIn, + CONST DWORD *pAdjacencyIn, + CONST DWORD MaxSize, + CONST DWORD Options, + DWORD *pMeshesOut, + LPD3DXBUFFER *ppMeshArrayOut, + LPD3DXBUFFER *ppAdjacencyArrayOut, + LPD3DXBUFFER *ppFaceRemapArrayOut, + LPD3DXBUFFER *ppVertRemapArrayOut + ); + +BOOL D3DXIntersectTri +( + CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position + CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position + CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position + CONST D3DXVECTOR3 *pRayPos, // Ray origin + CONST D3DXVECTOR3 *pRayDir, // Ray direction + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist); // Ray-Intersection Parameter Distance + +BOOL WINAPI + D3DXSphereBoundProbe( + CONST D3DXVECTOR3 *pCenter, + FLOAT Radius, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + +BOOL WINAPI + D3DXBoxBoundProbe( + CONST D3DXVECTOR3 *pMin, + CONST D3DXVECTOR3 *pMax, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + +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), +}; + + +#define D3DX_COMP_TANGENT_NONE 0xFFFFFFFF + +HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH InMesh, + DWORD TexStage, + LPD3DXMESH OutMesh, + DWORD TexStageUVec, + DWORD TexStageVVec, + DWORD Wrap, + DWORD *Adjacency); + +HRESULT WINAPI +D3DXConvertMeshSubsetToSingleStrip +( + LPD3DXBASEMESH MeshIn, + DWORD AttribId, + DWORD IBOptions, + LPDIRECT3DINDEXBUFFER8 *ppIndexBuffer, + DWORD *pNumIndices +); + +HRESULT WINAPI +D3DXConvertMeshSubsetToStrips +( + LPD3DXBASEMESH MeshIn, + DWORD AttribId, + DWORD IBOptions, + LPDIRECT3DINDEXBUFFER8 *ppIndexBuffer, + DWORD *pNumIndices, + LPD3DXBUFFER *ppStripLengths, + DWORD *pNumStrips +); + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX8MESH_H__ + + diff --git a/plugins/ADK/d3d8/includes/d3dx8shape.h b/plugins/ADK/d3d8/includes/d3dx8shape.h new file mode 100644 index 0000000..b7ab637 --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3dx8shape.h @@ -0,0 +1,220 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8shapes.h +// Content: D3DX simple shapes +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx8.h" + +#ifndef __D3DX8SHAPES_H__ +#define __D3DX8SHAPES_H__ + +/////////////////////////////////////////////////////////////////////////// +// Functions: +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//------------------------------------------------------------------------- +// D3DXCreatePolygon: +// ------------------ +// Creates a mesh containing an n-sided polygon. The polygon is centered +// at the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Length Length of each side. +// Sides Number of sides the polygon has. (Must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreatePolygon( + LPDIRECT3DDEVICE8 pDevice, + FLOAT Length, + UINT Sides, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateBox: +// -------------- +// Creates a mesh containing an axis-aligned box. The box is centered at +// the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Width Width of box (along X-axis) +// Height Height of box (along Y-axis) +// Depth Depth of box (along Z-axis) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateBox( + LPDIRECT3DDEVICE8 pDevice, + FLOAT Width, + FLOAT Height, + FLOAT Depth, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateCylinder: +// ------------------- +// Creates a mesh containing a cylinder. The generated cylinder is +// centered at the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius1 Radius at -Z end (should be >= 0.0f) +// Radius2 Radius at +Z end (should be >= 0.0f) +// Length Length of cylinder (along Z-axis) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateCylinder( + LPDIRECT3DDEVICE8 pDevice, + FLOAT Radius1, + FLOAT Radius2, + FLOAT Length, + UINT Slices, + UINT Stacks, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateSphere: +// ----------------- +// Creates a mesh containing a sphere. The sphere is centered at the +// origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius Radius of the sphere (should be >= 0.0f) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateSphere( + LPDIRECT3DDEVICE8 pDevice, + FLOAT Radius, + UINT Slices, + UINT Stacks, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateTorus: +// ---------------- +// Creates a mesh containing a torus. The generated torus is centered at +// the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// InnerRadius Inner radius of the torus (should be >= 0.0f) +// OuterRadius Outer radius of the torue (should be >= 0.0f) +// Sides Number of sides in a cross-section (must be >= 3) +// Rings Number of rings making up the torus (must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTorus( + LPDIRECT3DDEVICE8 pDevice, + FLOAT InnerRadius, + FLOAT OuterRadius, + UINT Sides, + UINT Rings, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateTeapot: +// ----------------- +// Creates a mesh containing a teapot. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTeapot( + LPDIRECT3DDEVICE8 pDevice, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateText: +// --------------- +// Creates a mesh containing the specified text using the font associated +// with the device context. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// hDC Device context, with desired font selected +// pText Text to generate +// Deviation Maximum chordal deviation from true font outlines +// Extrusion Amount to extrude text in -Z direction +// ppMesh The mesh object which will be created +// pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTextA( + LPDIRECT3DDEVICE8 pDevice, + HDC hDC, + LPCSTR pText, + FLOAT Deviation, + FLOAT Extrusion, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency, + LPGLYPHMETRICSFLOAT pGlyphMetrics); + +HRESULT WINAPI + D3DXCreateTextW( + LPDIRECT3DDEVICE8 pDevice, + HDC hDC, + LPCWSTR pText, + FLOAT Deviation, + FLOAT Extrusion, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency, + LPGLYPHMETRICSFLOAT pGlyphMetrics); + +#ifdef UNICODE +#define D3DXCreateText D3DXCreateTextW +#else +#define D3DXCreateText D3DXCreateTextA +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX8SHAPES_H__ diff --git a/plugins/ADK/d3d8/includes/d3dx8tex.h b/plugins/ADK/d3d8/includes/d3dx8tex.h new file mode 100644 index 0000000..dd9fe9d --- /dev/null +++ b/plugins/ADK/d3d8/includes/d3dx8tex.h @@ -0,0 +1,1592 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8tex.h +// Content: D3DX texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx8.h" + +#ifndef __D3DX8TEX_H__ +#define __D3DX8TEX_H__ + + +//---------------------------------------------------------------------------- +// D3DX_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX_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. +// D3DX_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX_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: +// +// D3DX_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR +// Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | +// D3DX_FILTER_MIRROR_V +// D3DX_FILTER_DITHER +// Dithers the resulting image. +// +//---------------------------------------------------------------------------- + +#define D3DX_FILTER_NONE (1 << 0) +#define D3DX_FILTER_POINT (2 << 0) +#define D3DX_FILTER_LINEAR (3 << 0) +#define D3DX_FILTER_TRIANGLE (4 << 0) +#define D3DX_FILTER_BOX (5 << 0) + +#define D3DX_FILTER_MIRROR_U (1 << 16) +#define D3DX_FILTER_MIRROR_V (2 << 16) +#define D3DX_FILTER_MIRROR_W (4 << 16) +#define D3DX_FILTER_MIRROR (7 << 16) +#define D3DX_FILTER_DITHER (8 << 16) + + +//---------------------------------------------------------------------------- +// D3DX_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DXComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR +// Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V +// D3DX_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX_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. +// +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- + +#define D3DX_NORMALMAP_MIRROR_U (1 << 16) +#define D3DX_NORMALMAP_MIRROR_V (2 << 16) +#define D3DX_NORMALMAP_MIRROR (3 << 16) +#define D3DX_NORMALMAP_INVERTSIGN (8 << 16) +#define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16) + + + + +//---------------------------------------------------------------------------- +// D3DX_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX_CHANNEL_RED +// Indicates the red channel should be used +// D3DX_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +#define D3DX_CHANNEL_RED (1 << 0) +#define D3DX_CHANNEL_BLUE (1 << 1) +#define D3DX_CHANNEL_GREEN (1 << 2) +#define D3DX_CHANNEL_ALPHA (1 << 3) +#define D3DX_CHANNEL_LUMINANCE (1 << 4) + + + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_FILEFORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +typedef enum _D3DXIMAGE_FILEFORMAT +{ + D3DXIFF_BMP = 0, + D3DXIFF_JPG = 1, + D3DXIFF_TGA = 2, + D3DXIFF_PNG = 3, + D3DXIFF_DDS = 4, + D3DXIFF_PPM = 5, + D3DXIFF_DIB = 6, + D3DXIFF_FORCE_DWORD = 0x7fffffff + +} D3DXIMAGE_FILEFORMAT; + + +//---------------------------------------------------------------------------- +// LPD3DXFILL2D and LPD3DXFILL3D: +// ------------------------------ +// Function types used by the texture fill functions. +// +// Parameters: +// pOut +// Pointer to a vector which the function uses to return its result. +// X,Y,Z,W will be mapped to R,G,B,A respectivly. +// pTexCoord +// Pointer to a vector containing the coordinates of the texel currently +// being evaluated. Textures and VolumeTexture texcoord components +// range from 0 to 1. CubeTexture texcoord component range from -1 to 1. +// pTexelSize +// Pointer to a vector containing the dimensions of the current texel. +// pData +// Pointer to user data. +// +//---------------------------------------------------------------------------- + +typedef VOID (*LPD3DXFILL2D)(D3DXVECTOR4 *pOut, D3DXVECTOR2 *pTexCoord, D3DXVECTOR2 *pTexelSize, LPVOID pData); +typedef VOID (*LPD3DXFILL3D)(D3DXVECTOR4 *pOut, D3DXVECTOR3 *pTexCoord, D3DXVECTOR3 *pTexelSize, LPVOID pData); + + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_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 +// MipLevels +// Number of mip levels in original image +// Format +// D3D format which most closely describes the data in original image +// ResourceType +// D3DRESOURCETYPE representing the type of texture stored in the file. +// D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. +// ImageFileFormat +// D3DXIMAGE_FILEFORMAT representing the format of the image file. +// +//---------------------------------------------------------------------------- + +typedef struct _D3DXIMAGE_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + D3DFORMAT Format; + D3DRESOURCETYPE ResourceType; + D3DXIMAGE_FILEFORMAT ImageFileFormat; + +} D3DXIMAGE_INFO; + + + + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +; +//---------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource: +// ------------------------------ +// Fills in a D3DXIMAGE_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. +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetImageInfoFromFileA( + LPCSTR pSrcFile, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXGetImageInfoFromFileW( + LPCWSTR pSrcFile, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileW +#else +#define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileA +#endif + + +HRESULT WINAPI + D3DXGetImageInfoFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXGetImageInfoFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceW +#else +#define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceA +#endif + + +HRESULT WINAPI + D3DXGetImageInfoFromFileInMemory( + LPCVOID pSrcData, + UINT SrcDataSize, + D3DXIMAGE_INFO* pSrcInfo); + + + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Surface APIs //////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromFile/Resource: +// --------------------------------- +// Load surface from a file or resource +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// 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. +// pSrcRect +// Source rectangle, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromFileA( + LPDIRECT3DSURFACE8 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCSTR pSrcFile, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadSurfaceFromFileW( + LPDIRECT3DSURFACE8 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCWSTR pSrcFile, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileW +#else +#define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileA +#endif + + + +HRESULT WINAPI + D3DXLoadSurfaceFromResourceA( + LPDIRECT3DSURFACE8 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadSurfaceFromResourceW( + LPDIRECT3DSURFACE8 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + +#ifdef UNICODE +#define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceW +#else +#define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceA +#endif + + + +HRESULT WINAPI + D3DXLoadSurfaceFromFileInMemory( + LPDIRECT3DSURFACE8 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCVOID pSrcData, + UINT SrcDataSize, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromSurface: +// --------------------------- +// Load surface from another surface (with color conversion) +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcSurface +// Source surface +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for entire surface +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromSurface( + LPDIRECT3DSURFACE8 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPDIRECT3DSURFACE8 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey); + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromMemory: +// -------------------------- +// Load surface from memory. +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcMemory +// Pointer to the top-left corner of the source image in memory +// SrcFormat +// Pixel format of the source image. +// SrcPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the width of one row of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromMemory( + LPDIRECT3DSURFACE8 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCVOID pSrcMemory, + D3DFORMAT SrcFormat, + UINT SrcPitch, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey); + + +//---------------------------------------------------------------------------- +// D3DXSaveSurfaceToFile: +// ---------------------- +// Save a surface to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcSurface +// Source surface, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for the entire image +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveSurfaceToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE8 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + +HRESULT WINAPI + D3DXSaveSurfaceToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE8 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + +#ifdef UNICODE +#define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileW +#else +#define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA +#endif + + + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Volume APIs ///////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromFile/Resource: +// -------------------------------- +// Load volume from a file or resource +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// 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. +// pSrcBox +// Source box, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromFileA( + LPDIRECT3DVOLUME8 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCSTR pSrcFile, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadVolumeFromFileW( + LPDIRECT3DVOLUME8 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCWSTR pSrcFile, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileW +#else +#define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileA +#endif + + +HRESULT WINAPI + D3DXLoadVolumeFromResourceA( + LPDIRECT3DVOLUME8 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadVolumeFromResourceW( + LPDIRECT3DVOLUME8 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceW +#else +#define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceA +#endif + + + +HRESULT WINAPI + D3DXLoadVolumeFromFileInMemory( + LPDIRECT3DVOLUME8 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCVOID pSrcData, + UINT SrcDataSize, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromVolume: +// ------------------------- +// Load volume from another volume (with color conversion) +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcVolume +// Source volume +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for entire volume +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromVolume( + LPDIRECT3DVOLUME8 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPDIRECT3DVOLUME8 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey); + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromMemory: +// ------------------------- +// Load volume from memory. +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcMemory +// Pointer to the top-left corner of the source volume in memory +// SrcFormat +// Pixel format of the source volume. +// SrcRowPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one row of cells, in bytes. +// SrcSlicePitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one slice of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromMemory( + LPDIRECT3DVOLUME8 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCVOID pSrcMemory, + D3DFORMAT SrcFormat, + UINT SrcRowPitch, + UINT SrcSlicePitch, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey); + + + +//---------------------------------------------------------------------------- +// D3DXSaveVolumeToFile: +// --------------------- +// Save a volume to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcVolume +// Source volume, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for the entire volume +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveVolumeToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME8 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +HRESULT WINAPI + D3DXSaveVolumeToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME8 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +#ifdef UNICODE +#define D3DXSaveVolumeToFile D3DXSaveVolumeToFileW +#else +#define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA +#endif + + + + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXCheckTextureRequirements: +// ----------------------------- +// Checks texture creation parameters. If parameters are invalid, this +// function returns corrected parameters. +// +// Parameters: +// +// pDevice +// The D3D device to be used +// pWidth, pHeight, pDepth, pSize +// Desired size in pixels, or NULL. Returns corrected size. +// pNumMipLevels +// Number of desired mipmap levels, or NULL. Returns corrected number. +// Usage +// Texture usage flags +// pFormat +// Desired pixel format, or NULL. Returns corrected format. +// Pool +// Memory pool to be used to create texture +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCheckTextureRequirements( + LPDIRECT3DDEVICE8 pDevice, + UINT* pWidth, + UINT* pHeight, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + +HRESULT WINAPI + D3DXCheckCubeTextureRequirements( + LPDIRECT3DDEVICE8 pDevice, + UINT* pSize, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + +HRESULT WINAPI + D3DXCheckVolumeTextureRequirements( + LPDIRECT3DDEVICE8 pDevice, + UINT* pWidth, + UINT* pHeight, + UINT* pDepth, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + + +//---------------------------------------------------------------------------- +// D3DXCreateTexture: +// ------------------ +// Create an empty texture +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// Width, Height, Depth, Size +// size in pixels; these must be non-zero +// MipLevels +// number of mip levels desired; if zero or D3DX_DEFAULT, a complete +// mipmap chain will be created. +// Usage +// Texture usage flags +// Format +// Pixel format. +// Pool +// Memory pool to be used to create texture +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateTexture( + LPDIRECT3DDEVICE8 pDevice, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DTEXTURE8* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTexture( + LPDIRECT3DDEVICE8 pDevice, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTexture( + LPDIRECT3DDEVICE8 pDevice, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + + + +//---------------------------------------------------------------------------- +// D3DXCreateTextureFromFile/Resource: +// ----------------------------------- +// 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. +// Width, Height, Depth, Size +// Size in pixels; if zero or D3DX_DEFAULT, the size will be taken +// from the file. +// MipLevels +// Number of mip levels; if zero or D3DX_DEFAULT, a complete mipmap +// chain will be created. +// Usage +// Texture usage flags +// Format +// Desired pixel format. If D3DFMT_UNKNOWN, the format will be +// taken from the file. +// Pool +// Memory pool to be used to create texture +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// MipFilter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// pPalette +// 256 color palette to be filled in, or NULL +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + + +// FromFile + +HRESULT WINAPI + D3DXCreateTextureFromFileA( + LPDIRECT3DDEVICE8 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DTEXTURE8* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromFileW( + LPDIRECT3DDEVICE8 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DTEXTURE8* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromFile D3DXCreateTextureFromFileW +#else +#define D3DXCreateTextureFromFile D3DXCreateTextureFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileA( + LPDIRECT3DDEVICE8 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileW( + LPDIRECT3DDEVICE8 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileW +#else +#define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileA( + LPDIRECT3DDEVICE8 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileW( + LPDIRECT3DDEVICE8 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileW +#else +#define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA +#endif + + +// FromResource + +HRESULT WINAPI + D3DXCreateTextureFromResourceA( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DTEXTURE8* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromResourceW( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DTEXTURE8* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceW +#else +#define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceA( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceW( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceW +#else +#define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceA( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceW( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceW +#else +#define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA +#endif + + +// FromFileEx + +HRESULT WINAPI + D3DXCreateTextureFromFileExA( + LPDIRECT3DDEVICE8 pDevice, + LPCSTR pSrcFile, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE8* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromFileExW( + LPDIRECT3DDEVICE8 pDevice, + LPCWSTR pSrcFile, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE8* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExW +#else +#define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileExA( + LPDIRECT3DDEVICE8 pDevice, + LPCSTR pSrcFile, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileExW( + LPDIRECT3DDEVICE8 pDevice, + LPCWSTR pSrcFile, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExW +#else +#define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileExA( + LPDIRECT3DDEVICE8 pDevice, + LPCSTR pSrcFile, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileExW( + LPDIRECT3DDEVICE8 pDevice, + LPCWSTR pSrcFile, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExW +#else +#define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA +#endif + + +// FromResourceEx + +HRESULT WINAPI + D3DXCreateTextureFromResourceExA( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE8* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromResourceExW( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE8* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExW +#else +#define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceExA( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceExW( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExW +#else +#define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceExA( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceExW( + LPDIRECT3DDEVICE8 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExW +#else +#define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA +#endif + + +// FromFileInMemory + +HRESULT WINAPI + D3DXCreateTextureFromFileInMemory( + LPDIRECT3DDEVICE8 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DTEXTURE8* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileInMemory( + LPDIRECT3DDEVICE8 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileInMemory( + LPDIRECT3DDEVICE8 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + + +// FromFileInMemoryEx + +HRESULT WINAPI + D3DXCreateTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE8 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE8* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE8 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE8* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE8 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); + + + +//---------------------------------------------------------------------------- +// D3DXSaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DXSaveTextureToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE8 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + +HRESULT WINAPI + D3DXSaveTextureToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE8 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + +#ifdef UNICODE +#define D3DXSaveTextureToFile D3DXSaveTextureToFileW +#else +#define D3DXSaveTextureToFile D3DXSaveTextureToFileA +#endif + + + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXFilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// pPalette +// 256 color palette to be used, or NULL for non-palettized formats +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// Filter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFilterTexture( + LPDIRECT3DBASETEXTURE8 pBaseTexture, + CONST PALETTEENTRY* pPalette, + UINT SrcLevel, + DWORD Filter); + +#define D3DXFilterCubeTexture D3DXFilterTexture +#define D3DXFilterVolumeTexture D3DXFilterTexture + + + +//---------------------------------------------------------------------------- +// D3DXFillTexture: +// ---------------- +// Uses a user provided function to fill each texel of each mip level of a +// given texture. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pFunction +// Pointer to user provided evalutor function which will be used to +// compute the value of each texel. +// pData +// Pointer to an arbitrary block of user defined data. This pointer +// will be passed to the function provided in pFunction +//----------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFillTexture( + LPDIRECT3DTEXTURE8 pTexture, + LPD3DXFILL2D pFunction, + LPVOID pData); + +HRESULT WINAPI + D3DXFillCubeTexture( + LPDIRECT3DCUBETEXTURE8 pCubeTexture, + LPD3DXFILL3D pFunction, + LPVOID pData); + +HRESULT WINAPI + D3DXFillVolumeTexture( + LPDIRECT3DVOLUMETEXTURE8 pVolumeTexture, + LPD3DXFILL3D pFunction, + LPVOID pData); + + + +//---------------------------------------------------------------------------- +// D3DXComputeNormalMap: +// --------------------- +// 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 +// pTexture +// Pointer to the destination texture +// pSrcTexture +// Pointer to the source heightmap texture +// pSrcPalette +// Source palette of 256 colors, or NULL +// Flags +// D3DX_NORMALMAP flags +// Channel +// D3DX_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXComputeNormalMap( + LPDIRECT3DTEXTURE8 pTexture, + LPDIRECT3DTEXTURE8 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette, + DWORD Flags, + DWORD Channel, + FLOAT Amplitude); + + + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX8TEX_H__ diff --git a/plugins/ADK/d3d8/includes/dinput.h b/plugins/ADK/d3d8/includes/dinput.h new file mode 100644 index 0000000..5aac256 --- /dev/null +++ b/plugins/ADK/d3d8/includes/dinput.h @@ -0,0 +1,4417 @@ +/**************************************************************************** + * + * Copyright (C) 1996-2000 Microsoft Corporation. All Rights Reserved. + * + * File: dinput.h + * Content: DirectInput include file + * + ****************************************************************************/ + +#ifndef __DINPUT_INCLUDED__ +#define __DINPUT_INCLUDED__ + +#ifndef DIJ_RINGZERO + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include +#endif + +#endif /* DIJ_RINGZERO */ + +#ifdef __cplusplus +extern "C" { +#endif + + + + + +/* + * To build applications for older versions of DirectInput + * + * #define DIRECTINPUT_VERSION [ 0x0300 | 0x0500 | 0x0700 ] + * + * before #include . By default, #include + * will produce a DirectX 8-compatible header file. + * + */ + +#define DIRECTINPUT_HEADER_VERSION 0x0800 +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION DIRECTINPUT_HEADER_VERSION +#pragma message(__FILE__ ": DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800") +#endif + +#ifndef DIJ_RINGZERO + +/**************************************************************************** + * + * Class IDs + * + ****************************************************************************/ + +DEFINE_GUID(CLSID_DirectInput, 0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice, 0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(CLSID_DirectInput8, 0x25E609E4,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice8,0x25E609E5,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Interfaces + * + ****************************************************************************/ + +DEFINE_GUID(IID_IDirectInputA, 0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputW, 0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2A, 0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2W, 0x5944E663,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput7A, 0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput7W, 0x9A4CB685,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput8A, 0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInput8W, 0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInputDeviceA, 0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDeviceW, 0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2A,0x5944E682,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2W,0x5944E683,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice7A,0x57D7C6BC,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice7W,0x57D7C6BD,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice8A,0x54D41080,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputDevice8W,0x54D41081,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputEffect, 0xE7E1F7C0,0x88D2,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + +/**************************************************************************** + * + * Predefined object types + * + ****************************************************************************/ + +DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RxAxis, 0xA36D02F4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RyAxis, 0xA36D02F5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RzAxis, 0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Slider, 0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_Button, 0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Key, 0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_POV, 0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_Unknown, 0xA36D02F3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined product GUIDs + * + ****************************************************************************/ + +DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboard,0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Joystick ,0x6F1D2B70,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm, 0x6F1D2B80,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm2,0x6F1D2B81,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm, 0x6F1D2B82,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm2,0x6F1D2B83,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined force feedback effects + * + ****************************************************************************/ + +DEFINE_GUID(GUID_ConstantForce, 0x13541C20,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_RampForce, 0x13541C21,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Square, 0x13541C22,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Sine, 0x13541C23,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Triangle, 0x13541C24,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothUp, 0x13541C25,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothDown, 0x13541C26,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Spring, 0x13541C27,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Damper, 0x13541C28,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Inertia, 0x13541C29,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Friction, 0x13541C2A,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_CustomForce, 0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Interfaces and Structures... + * + ****************************************************************************/ + +#if(DIRECTINPUT_VERSION >= 0x0500) + +/**************************************************************************** + * + * IDirectInputEffect + * + ****************************************************************************/ + +#define DIEFT_ALL 0x00000000 + +#define DIEFT_CONSTANTFORCE 0x00000001 +#define DIEFT_RAMPFORCE 0x00000002 +#define DIEFT_PERIODIC 0x00000003 +#define DIEFT_CONDITION 0x00000004 +#define DIEFT_CUSTOMFORCE 0x00000005 +#define DIEFT_HARDWARE 0x000000FF +#define DIEFT_FFATTACK 0x00000200 +#define DIEFT_FFFADE 0x00000400 +#define DIEFT_SATURATION 0x00000800 +#define DIEFT_POSNEGCOEFFICIENTS 0x00001000 +#define DIEFT_POSNEGSATURATION 0x00002000 +#define DIEFT_DEADBAND 0x00004000 +#define DIEFT_STARTDELAY 0x00008000 +#define DIEFT_GETTYPE(n) LOBYTE(n) + +#define DI_DEGREES 100 +#define DI_FFNOMINALMAX 10000 +#define DI_SECONDS 1000000 + +typedef struct DICONSTANTFORCE { + LONG lMagnitude; +} DICONSTANTFORCE, *LPDICONSTANTFORCE; +typedef const DICONSTANTFORCE *LPCDICONSTANTFORCE; + +typedef struct DIRAMPFORCE { + LONG lStart; + LONG lEnd; +} DIRAMPFORCE, *LPDIRAMPFORCE; +typedef const DIRAMPFORCE *LPCDIRAMPFORCE; + +typedef struct DIPERIODIC { + DWORD dwMagnitude; + LONG lOffset; + DWORD dwPhase; + DWORD dwPeriod; +} DIPERIODIC, *LPDIPERIODIC; +typedef const DIPERIODIC *LPCDIPERIODIC; + +typedef struct DICONDITION { + LONG lOffset; + LONG lPositiveCoefficient; + LONG lNegativeCoefficient; + DWORD dwPositiveSaturation; + DWORD dwNegativeSaturation; + LONG lDeadBand; +} DICONDITION, *LPDICONDITION; +typedef const DICONDITION *LPCDICONDITION; + +typedef struct DICUSTOMFORCE { + DWORD cChannels; + DWORD dwSamplePeriod; + DWORD cSamples; + LPLONG rglForceData; +} DICUSTOMFORCE, *LPDICUSTOMFORCE; +typedef const DICUSTOMFORCE *LPCDICUSTOMFORCE; + + +typedef struct DIENVELOPE { + DWORD dwSize; /* sizeof(DIENVELOPE) */ + DWORD dwAttackLevel; + DWORD dwAttackTime; /* Microseconds */ + DWORD dwFadeLevel; + DWORD dwFadeTime; /* Microseconds */ +} DIENVELOPE, *LPDIENVELOPE; +typedef const DIENVELOPE *LPCDIENVELOPE; + + +/* This structure is defined for DirectX 5.0 compatibility */ +typedef struct DIEFFECT_DX5 { + DWORD dwSize; /* sizeof(DIEFFECT_DX5) */ + DWORD dwFlags; /* DIEFF_* */ + DWORD dwDuration; /* Microseconds */ + DWORD dwSamplePeriod; /* Microseconds */ + DWORD dwGain; + DWORD dwTriggerButton; /* or DIEB_NOTRIGGER */ + DWORD dwTriggerRepeatInterval; /* Microseconds */ + DWORD cAxes; /* Number of axes */ + LPDWORD rgdwAxes; /* Array of axes */ + LPLONG rglDirection; /* Array of directions */ + LPDIENVELOPE lpEnvelope; /* Optional */ + DWORD cbTypeSpecificParams; /* Size of params */ + LPVOID lpvTypeSpecificParams; /* Pointer to params */ +} DIEFFECT_DX5, *LPDIEFFECT_DX5; +typedef const DIEFFECT_DX5 *LPCDIEFFECT_DX5; + +typedef struct DIEFFECT { + DWORD dwSize; /* sizeof(DIEFFECT) */ + DWORD dwFlags; /* DIEFF_* */ + DWORD dwDuration; /* Microseconds */ + DWORD dwSamplePeriod; /* Microseconds */ + DWORD dwGain; + DWORD dwTriggerButton; /* or DIEB_NOTRIGGER */ + DWORD dwTriggerRepeatInterval; /* Microseconds */ + DWORD cAxes; /* Number of axes */ + LPDWORD rgdwAxes; /* Array of axes */ + LPLONG rglDirection; /* Array of directions */ + LPDIENVELOPE lpEnvelope; /* Optional */ + DWORD cbTypeSpecificParams; /* Size of params */ + LPVOID lpvTypeSpecificParams; /* Pointer to params */ +#if(DIRECTINPUT_VERSION >= 0x0600) + DWORD dwStartDelay; /* Microseconds */ +#endif /* DIRECTINPUT_VERSION >= 0x0600 */ +} DIEFFECT, *LPDIEFFECT; +typedef DIEFFECT DIEFFECT_DX6; +typedef LPDIEFFECT LPDIEFFECT_DX6; +typedef const DIEFFECT *LPCDIEFFECT; + + +#if(DIRECTINPUT_VERSION >= 0x0700) +#ifndef DIJ_RINGZERO +typedef struct DIFILEEFFECT{ + DWORD dwSize; + GUID GuidEffect; + LPCDIEFFECT lpDiEffect; + CHAR szFriendlyName[MAX_PATH]; +}DIFILEEFFECT, *LPDIFILEEFFECT; +typedef const DIFILEEFFECT *LPCDIFILEEFFECT; +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSINFILECALLBACK)(LPCDIFILEEFFECT , LPVOID); +#endif /* DIJ_RINGZERO */ +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#define DIEFF_OBJECTIDS 0x00000001 +#define DIEFF_OBJECTOFFSETS 0x00000002 +#define DIEFF_CARTESIAN 0x00000010 +#define DIEFF_POLAR 0x00000020 +#define DIEFF_SPHERICAL 0x00000040 + +#define DIEP_DURATION 0x00000001 +#define DIEP_SAMPLEPERIOD 0x00000002 +#define DIEP_GAIN 0x00000004 +#define DIEP_TRIGGERBUTTON 0x00000008 +#define DIEP_TRIGGERREPEATINTERVAL 0x00000010 +#define DIEP_AXES 0x00000020 +#define DIEP_DIRECTION 0x00000040 +#define DIEP_ENVELOPE 0x00000080 +#define DIEP_TYPESPECIFICPARAMS 0x00000100 +#if(DIRECTINPUT_VERSION >= 0x0600) +#define DIEP_STARTDELAY 0x00000200 +#define DIEP_ALLPARAMS_DX5 0x000001FF +#define DIEP_ALLPARAMS 0x000003FF +#else /* DIRECTINPUT_VERSION < 0x0600 */ +#define DIEP_ALLPARAMS 0x000001FF +#endif /* DIRECTINPUT_VERSION < 0x0600 */ +#define DIEP_START 0x20000000 +#define DIEP_NORESTART 0x40000000 +#define DIEP_NODOWNLOAD 0x80000000 +#define DIEB_NOTRIGGER 0xFFFFFFFF + +#define DIES_SOLO 0x00000001 +#define DIES_NODOWNLOAD 0x80000000 + +#define DIEGES_PLAYING 0x00000001 +#define DIEGES_EMULATED 0x00000002 + +typedef struct DIEFFESCAPE { + DWORD dwSize; + DWORD dwCommand; + LPVOID lpvInBuffer; + DWORD cbInBuffer; + LPVOID lpvOutBuffer; + DWORD cbOutBuffer; +} DIEFFESCAPE, *LPDIEFFESCAPE; + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputEffect + +DECLARE_INTERFACE_(IDirectInputEffect, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputEffect methods ***/ + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(GetEffectGuid)(THIS_ LPGUID) PURE; + STDMETHOD(GetParameters)(THIS_ LPDIEFFECT,DWORD) PURE; + STDMETHOD(SetParameters)(THIS_ LPCDIEFFECT,DWORD) PURE; + STDMETHOD(Start)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(Stop)(THIS) PURE; + STDMETHOD(GetEffectStatus)(THIS_ LPDWORD) PURE; + STDMETHOD(Download)(THIS) PURE; + STDMETHOD(Unload)(THIS) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; +}; + +typedef struct IDirectInputEffect *LPDIRECTINPUTEFFECT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputEffect_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputEffect_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->lpVtbl->GetEffectGuid(p,a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->lpVtbl->GetParameters(p,a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->lpVtbl->SetParameters(p,a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->lpVtbl->Start(p,a,b) +#define IDirectInputEffect_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectInputEffect_GetEffectStatus(p,a) (p)->lpVtbl->GetEffectStatus(p,a) +#define IDirectInputEffect_Download(p) (p)->lpVtbl->Download(p) +#define IDirectInputEffect_Unload(p) (p)->lpVtbl->Unload(p) +#define IDirectInputEffect_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#else +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputEffect_AddRef(p) (p)->AddRef() +#define IDirectInputEffect_Release(p) (p)->Release() +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->GetEffectGuid(a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->GetParameters(a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->SetParameters(a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->Start(a,b) +#define IDirectInputEffect_Stop(p) (p)->Stop() +#define IDirectInputEffect_GetEffectStatus(p,a) (p)->GetEffectStatus(a) +#define IDirectInputEffect_Download(p) (p)->Download() +#define IDirectInputEffect_Unload(p) (p)->Unload() +#define IDirectInputEffect_Escape(p,a) (p)->Escape(a) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +/**************************************************************************** + * + * IDirectInputDevice + * + ****************************************************************************/ + +#if DIRECTINPUT_VERSION <= 0x700 +#define DIDEVTYPE_DEVICE 1 +#define DIDEVTYPE_MOUSE 2 +#define DIDEVTYPE_KEYBOARD 3 +#define DIDEVTYPE_JOYSTICK 4 + +#else +#define DI8DEVCLASS_ALL 0 +#define DI8DEVCLASS_DEVICE 1 +#define DI8DEVCLASS_POINTER 2 +#define DI8DEVCLASS_KEYBOARD 3 +#define DI8DEVCLASS_GAMECTRL 4 + +#define DI8DEVTYPE_DEVICE 0x11 +#define DI8DEVTYPE_MOUSE 0x12 +#define DI8DEVTYPE_KEYBOARD 0x13 +#define DI8DEVTYPE_JOYSTICK 0x14 +#define DI8DEVTYPE_GAMEPAD 0x15 +#define DI8DEVTYPE_DRIVING 0x16 +#define DI8DEVTYPE_FLIGHT 0x17 +#define DI8DEVTYPE_1STPERSON 0x18 +#define DI8DEVTYPE_DEVICECTRL 0x19 +#define DI8DEVTYPE_SCREENPOINTER 0x1A +#define DI8DEVTYPE_REMOTE 0x1B +#define DI8DEVTYPE_SUPPLEMENTAL 0x1C +#endif /* DIRECTINPUT_VERSION <= 0x700 */ + +#define DIDEVTYPE_HID 0x00010000 + +#if DIRECTINPUT_VERSION <= 0x700 +#define DIDEVTYPEMOUSE_UNKNOWN 1 +#define DIDEVTYPEMOUSE_TRADITIONAL 2 +#define DIDEVTYPEMOUSE_FINGERSTICK 3 +#define DIDEVTYPEMOUSE_TOUCHPAD 4 +#define DIDEVTYPEMOUSE_TRACKBALL 5 + +#define DIDEVTYPEKEYBOARD_UNKNOWN 0 +#define DIDEVTYPEKEYBOARD_PCXT 1 +#define DIDEVTYPEKEYBOARD_OLIVETTI 2 +#define DIDEVTYPEKEYBOARD_PCAT 3 +#define DIDEVTYPEKEYBOARD_PCENH 4 +#define DIDEVTYPEKEYBOARD_NOKIA1050 5 +#define DIDEVTYPEKEYBOARD_NOKIA9140 6 +#define DIDEVTYPEKEYBOARD_NEC98 7 +#define DIDEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DIDEVTYPEKEYBOARD_NEC98106 9 +#define DIDEVTYPEKEYBOARD_JAPAN106 10 +#define DIDEVTYPEKEYBOARD_JAPANAX 11 +#define DIDEVTYPEKEYBOARD_J3100 12 + +#define DIDEVTYPEJOYSTICK_UNKNOWN 1 +#define DIDEVTYPEJOYSTICK_TRADITIONAL 2 +#define DIDEVTYPEJOYSTICK_FLIGHTSTICK 3 +#define DIDEVTYPEJOYSTICK_GAMEPAD 4 +#define DIDEVTYPEJOYSTICK_RUDDER 5 +#define DIDEVTYPEJOYSTICK_WHEEL 6 +#define DIDEVTYPEJOYSTICK_HEADTRACKER 7 + +#else +#define DI8DEVTYPEMOUSE_UNKNOWN 1 +#define DI8DEVTYPEMOUSE_TRADITIONAL 2 +#define DI8DEVTYPEMOUSE_FINGERSTICK 3 +#define DI8DEVTYPEMOUSE_TOUCHPAD 4 +#define DI8DEVTYPEMOUSE_TRACKBALL 5 +#define DI8DEVTYPEMOUSE_ABSOLUTE 6 + +#define DI8DEVTYPEKEYBOARD_UNKNOWN 0 +#define DI8DEVTYPEKEYBOARD_PCXT 1 +#define DI8DEVTYPEKEYBOARD_OLIVETTI 2 +#define DI8DEVTYPEKEYBOARD_PCAT 3 +#define DI8DEVTYPEKEYBOARD_PCENH 4 +#define DI8DEVTYPEKEYBOARD_NOKIA1050 5 +#define DI8DEVTYPEKEYBOARD_NOKIA9140 6 +#define DI8DEVTYPEKEYBOARD_NEC98 7 +#define DI8DEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DI8DEVTYPEKEYBOARD_NEC98106 9 +#define DI8DEVTYPEKEYBOARD_JAPAN106 10 +#define DI8DEVTYPEKEYBOARD_JAPANAX 11 +#define DI8DEVTYPEKEYBOARD_J3100 12 + +#define DI8DEVTYPE_LIMITEDGAMESUBTYPE 1 + +#define DI8DEVTYPEJOYSTICK_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEJOYSTICK_STANDARD 2 + +#define DI8DEVTYPEGAMEPAD_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEGAMEPAD_STANDARD 2 +#define DI8DEVTYPEGAMEPAD_TILT 3 + +#define DI8DEVTYPEDRIVING_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEDRIVING_COMBINEDPEDALS 2 +#define DI8DEVTYPEDRIVING_DUALPEDALS 3 +#define DI8DEVTYPEDRIVING_THREEPEDALS 4 +#define DI8DEVTYPEDRIVING_HANDHELD 5 + +#define DI8DEVTYPEFLIGHT_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEFLIGHT_STICK 2 +#define DI8DEVTYPEFLIGHT_YOKE 3 +#define DI8DEVTYPEFLIGHT_RC 4 + +#define DI8DEVTYPE1STPERSON_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPE1STPERSON_UNKNOWN 2 +#define DI8DEVTYPE1STPERSON_SIXDOF 3 +#define DI8DEVTYPE1STPERSON_SHOOTER 4 + +#define DI8DEVTYPESCREENPTR_UNKNOWN 2 +#define DI8DEVTYPESCREENPTR_LIGHTGUN 3 +#define DI8DEVTYPESCREENPTR_LIGHTPEN 4 +#define DI8DEVTYPESCREENPTR_TOUCH 5 + +#define DI8DEVTYPEREMOTE_UNKNOWN 2 + +#define DI8DEVTYPEDEVICECTRL_UNKNOWN 2 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION 3 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED 4 + +#define DI8DEVTYPESUPPLEMENTAL_UNKNOWN 2 +#define DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER 3 +#define DI8DEVTYPESUPPLEMENTAL_HEADTRACKER 4 +#define DI8DEVTYPESUPPLEMENTAL_HANDTRACKER 5 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE 6 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTER 7 +#define DI8DEVTYPESUPPLEMENTAL_THROTTLE 8 +#define DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE 9 +#define DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS 10 +#define DI8DEVTYPESUPPLEMENTAL_DUALPEDALS 11 +#define DI8DEVTYPESUPPLEMENTAL_THREEPEDALS 12 +#define DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS 13 +#endif /* DIRECTINPUT_VERSION <= 0x700 */ + +#define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) +#define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* This structure is defined for DirectX 3.0 compatibility */ +typedef struct DIDEVCAPS_DX3 { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +} DIDEVCAPS_DX3, *LPDIDEVCAPS_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVCAPS { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFSamplePeriod; + DWORD dwFFMinTimeResolution; + DWORD dwFirmwareRevision; + DWORD dwHardwareRevision; + DWORD dwFFDriverVersion; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVCAPS, *LPDIDEVCAPS; + +#define DIDC_ATTACHED 0x00000001 +#define DIDC_POLLEDDEVICE 0x00000002 +#define DIDC_EMULATED 0x00000004 +#define DIDC_POLLEDDATAFORMAT 0x00000008 +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIDC_FORCEFEEDBACK 0x00000100 +#define DIDC_FFATTACK 0x00000200 +#define DIDC_FFFADE 0x00000400 +#define DIDC_SATURATION 0x00000800 +#define DIDC_POSNEGCOEFFICIENTS 0x00001000 +#define DIDC_POSNEGSATURATION 0x00002000 +#define DIDC_DEADBAND 0x00004000 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#define DIDC_STARTDELAY 0x00008000 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDC_ALIAS 0x00010000 +#define DIDC_PHANTOM 0x00020000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIDC_HIDDEN 0x00040000 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#define DIDFT_ALL 0x00000000 + +#define DIDFT_RELAXIS 0x00000001 +#define DIDFT_ABSAXIS 0x00000002 +#define DIDFT_AXIS 0x00000003 + +#define DIDFT_PSHBUTTON 0x00000004 +#define DIDFT_TGLBUTTON 0x00000008 +#define DIDFT_BUTTON 0x0000000C + +#define DIDFT_POV 0x00000010 +#define DIDFT_COLLECTION 0x00000040 +#define DIDFT_NODATA 0x00000080 + +#define DIDFT_ANYINSTANCE 0x00FFFF00 +#define DIDFT_INSTANCEMASK DIDFT_ANYINSTANCE +#define DIDFT_MAKEINSTANCE(n) ((WORD)(n) << 8) +#define DIDFT_GETTYPE(n) LOBYTE(n) +#define DIDFT_GETINSTANCE(n) LOWORD((n) >> 8) +#define DIDFT_FFACTUATOR 0x01000000 +#define DIDFT_FFEFFECTTRIGGER 0x02000000 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDFT_OUTPUT 0x10000000 +#define DIDFT_VENDORDEFINED 0x04000000 +#define DIDFT_ALIAS 0x08000000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#ifndef DIDFT_OPTIONAL +#define DIDFT_OPTIONAL 0x80000000 +#endif + +#define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8) +#define DIDFT_NOCOLLECTION 0x00FFFF00 + +#ifndef DIJ_RINGZERO + +typedef struct _DIOBJECTDATAFORMAT { + const GUID *pguid; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; +} DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT; +typedef const DIOBJECTDATAFORMAT *LPCDIOBJECTDATAFORMAT; + +typedef struct _DIDATAFORMAT { + DWORD dwSize; + DWORD dwObjSize; + DWORD dwFlags; + DWORD dwDataSize; + DWORD dwNumObjs; + LPDIOBJECTDATAFORMAT rgodf; +} DIDATAFORMAT, *LPDIDATAFORMAT; +typedef const DIDATAFORMAT *LPCDIDATAFORMAT; + +#define DIDF_ABSAXIS 0x00000001 +#define DIDF_RELAXIS 0x00000002 + +#ifdef __cplusplus +extern "C" { +#endif +extern const DIDATAFORMAT c_dfDIMouse; + +#if(DIRECTINPUT_VERSION >= 0x0700) +extern const DIDATAFORMAT c_dfDIMouse2; +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +extern const DIDATAFORMAT c_dfDIKeyboard; + +#if(DIRECTINPUT_VERSION >= 0x0500) +extern const DIDATAFORMAT c_dfDIJoystick; +extern const DIDATAFORMAT c_dfDIJoystick2; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +#ifdef __cplusplus +}; +#endif + + +#if DIRECTINPUT_VERSION > 0x0700 + +typedef struct _DIACTIONA { + UINT_PTR uAppData; + DWORD dwSemantic; + OPTIONAL DWORD dwFlags; + OPTIONAL union { + LPCSTR lptszActionName; + UINT uResIdString; + }; + OPTIONAL GUID guidInstance; + OPTIONAL DWORD dwObjID; + OPTIONAL DWORD dwHow; +} DIACTIONA, *LPDIACTIONA ; +typedef struct _DIACTIONW { + UINT_PTR uAppData; + DWORD dwSemantic; + OPTIONAL DWORD dwFlags; + OPTIONAL union { + LPCWSTR lptszActionName; + UINT uResIdString; + }; + OPTIONAL GUID guidInstance; + OPTIONAL DWORD dwObjID; + OPTIONAL DWORD dwHow; +} DIACTIONW, *LPDIACTIONW ; +#ifdef UNICODE +typedef DIACTIONW DIACTION; +typedef LPDIACTIONW LPDIACTION; +#else +typedef DIACTIONA DIACTION; +typedef LPDIACTIONA LPDIACTION; +#endif // UNICODE + +typedef const DIACTIONA *LPCDIACTIONA; +typedef const DIACTIONW *LPCDIACTIONW; +#ifdef UNICODE +typedef DIACTIONW DIACTION; +typedef LPCDIACTIONW LPCDIACTION; +#else +typedef DIACTIONA DIACTION; +typedef LPCDIACTIONA LPCDIACTION; +#endif // UNICODE +typedef const DIACTION *LPCDIACTION; + + +#define DIA_FORCEFEEDBACK 0x00000001 +#define DIA_APPMAPPED 0x00000002 +#define DIA_APPNOMAP 0x00000004 +#define DIA_NORANGE 0x00000008 +#define DIA_APPFIXED 0x00000010 + +#define DIAH_UNMAPPED 0x00000000 +#define DIAH_USERCONFIG 0x00000001 +#define DIAH_APPREQUESTED 0x00000002 +#define DIAH_HWAPP 0x00000004 +#define DIAH_HWDEFAULT 0x00000008 +#define DIAH_DEFAULT 0x00000020 +#define DIAH_ERROR 0x80000000 + +typedef struct _DIACTIONFORMATA { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONA rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + OPTIONAL LONG lAxisMin; + OPTIONAL LONG lAxisMax; + OPTIONAL HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + CHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATA, *LPDIACTIONFORMATA; +typedef struct _DIACTIONFORMATW { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONW rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + OPTIONAL LONG lAxisMin; + OPTIONAL LONG lAxisMax; + OPTIONAL HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + WCHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATW, *LPDIACTIONFORMATW; +#ifdef UNICODE +typedef DIACTIONFORMATW DIACTIONFORMAT; +typedef LPDIACTIONFORMATW LPDIACTIONFORMAT; +#else +typedef DIACTIONFORMATA DIACTIONFORMAT; +typedef LPDIACTIONFORMATA LPDIACTIONFORMAT; +#endif // UNICODE +typedef const DIACTIONFORMATA *LPCDIACTIONFORMATA; +typedef const DIACTIONFORMATW *LPCDIACTIONFORMATW; +#ifdef UNICODE +typedef DIACTIONFORMATW DIACTIONFORMAT; +typedef LPCDIACTIONFORMATW LPCDIACTIONFORMAT; +#else +typedef DIACTIONFORMATA DIACTIONFORMAT; +typedef LPCDIACTIONFORMATA LPCDIACTIONFORMAT; +#endif // UNICODE +typedef const DIACTIONFORMAT *LPCDIACTIONFORMAT; + +#define DIAFTS_NEWDEVICELOW 0xFFFFFFFF +#define DIAFTS_NEWDEVICEHIGH 0xFFFFFFFF +#define DIAFTS_UNUSEDDEVICELOW 0x00000000 +#define DIAFTS_UNUSEDDEVICEHIGH 0x00000000 + +#define DIDBAM_DEFAULT 0x00000000 +#define DIDBAM_PRESERVE 0x00000001 +#define DIDBAM_INITIALIZE 0x00000002 +#define DIDBAM_HWDEFAULTS 0x00000004 + +#define DIDSAM_DEFAULT 0x00000000 +#define DIDSAM_NOUSER 0x00000001 +#define DIDSAM_FORCESAVE 0x00000002 + +#define DICD_DEFAULT 0x00000000 +#define DICD_EDIT 0x00000001 + +/* + * The following definition is normally defined in d3dtypes.h + */ +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +typedef struct _DICOLORSET{ + DWORD dwSize; + D3DCOLOR cTextFore; + D3DCOLOR cTextHighlight; + D3DCOLOR cCalloutLine; + D3DCOLOR cCalloutHighlight; + D3DCOLOR cBorder; + D3DCOLOR cControlFill; + D3DCOLOR cHighlightFill; + D3DCOLOR cAreaFill; +} DICOLORSET, *LPDICOLORSET; +typedef const DICOLORSET *LPCDICOLORSET; + + +typedef struct _DICONFIGUREDEVICESPARAMSA{ + DWORD dwSize; + DWORD dwcUsers; + LPSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATA lprgFormats; + HWND hwnd; + DICOLORSET dics; + IUnknown FAR * lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSA, *LPDICONFIGUREDEVICESPARAMSA; +typedef struct _DICONFIGUREDEVICESPARAMSW{ + DWORD dwSize; + DWORD dwcUsers; + LPWSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATW lprgFormats; + HWND hwnd; + DICOLORSET dics; + IUnknown FAR * lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSW, *LPDICONFIGUREDEVICESPARAMSW; +#ifdef UNICODE +typedef DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMS; +typedef LPDICONFIGUREDEVICESPARAMSW LPDICONFIGUREDEVICESPARAMS; +#else +typedef DICONFIGUREDEVICESPARAMSA DICONFIGUREDEVICESPARAMS; +typedef LPDICONFIGUREDEVICESPARAMSA LPDICONFIGUREDEVICESPARAMS; +#endif // UNICODE +typedef const DICONFIGUREDEVICESPARAMSA *LPCDICONFIGUREDEVICESPARAMSA; +typedef const DICONFIGUREDEVICESPARAMSW *LPCDICONFIGUREDEVICESPARAMSW; +#ifdef UNICODE +typedef DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMS; +typedef LPCDICONFIGUREDEVICESPARAMSW LPCDICONFIGUREDEVICESPARAMS; +#else +typedef DICONFIGUREDEVICESPARAMSA DICONFIGUREDEVICESPARAMS; +typedef LPCDICONFIGUREDEVICESPARAMSA LPCDICONFIGUREDEVICESPARAMS; +#endif // UNICODE +typedef const DICONFIGUREDEVICESPARAMS *LPCDICONFIGUREDEVICESPARAMS; + + +#define DIDIFT_CONFIGURATION 0x00000001 +#define DIDIFT_OVERLAY 0x00000002 + +#define DIDAL_CENTERED 0x00000000 +#define DIDAL_LEFTALIGNED 0x00000001 +#define DIDAL_RIGHTALIGNED 0x00000002 +#define DIDAL_MIDDLE 0x00000000 +#define DIDAL_TOPALIGNED 0x00000004 +#define DIDAL_BOTTOMALIGNED 0x00000008 + +typedef struct _DIDEVICEIMAGEINFOA { + CHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOA, *LPDIDEVICEIMAGEINFOA; +typedef struct _DIDEVICEIMAGEINFOW { + WCHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOW, *LPDIDEVICEIMAGEINFOW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOW DIDEVICEIMAGEINFO; +typedef LPDIDEVICEIMAGEINFOW LPDIDEVICEIMAGEINFO; +#else +typedef DIDEVICEIMAGEINFOA DIDEVICEIMAGEINFO; +typedef LPDIDEVICEIMAGEINFOA LPDIDEVICEIMAGEINFO; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOA *LPCDIDEVICEIMAGEINFOA; +typedef const DIDEVICEIMAGEINFOW *LPCDIDEVICEIMAGEINFOW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOW DIDEVICEIMAGEINFO; +typedef LPCDIDEVICEIMAGEINFOW LPCDIDEVICEIMAGEINFO; +#else +typedef DIDEVICEIMAGEINFOA DIDEVICEIMAGEINFO; +typedef LPCDIDEVICEIMAGEINFOA LPCDIDEVICEIMAGEINFO; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFO *LPCDIDEVICEIMAGEINFO; + +typedef struct _DIDEVICEIMAGEINFOHEADERA { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOA lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERA, *LPDIDEVICEIMAGEINFOHEADERA; +typedef struct _DIDEVICEIMAGEINFOHEADERW { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOW lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERW, *LPDIDEVICEIMAGEINFOHEADERW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOHEADERW DIDEVICEIMAGEINFOHEADER; +typedef LPDIDEVICEIMAGEINFOHEADERW LPDIDEVICEIMAGEINFOHEADER; +#else +typedef DIDEVICEIMAGEINFOHEADERA DIDEVICEIMAGEINFOHEADER; +typedef LPDIDEVICEIMAGEINFOHEADERA LPDIDEVICEIMAGEINFOHEADER; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOHEADERA *LPCDIDEVICEIMAGEINFOHEADERA; +typedef const DIDEVICEIMAGEINFOHEADERW *LPCDIDEVICEIMAGEINFOHEADERW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOHEADERW DIDEVICEIMAGEINFOHEADER; +typedef LPCDIDEVICEIMAGEINFOHEADERW LPCDIDEVICEIMAGEINFOHEADER; +#else +typedef DIDEVICEIMAGEINFOHEADERA DIDEVICEIMAGEINFOHEADER; +typedef LPCDIDEVICEIMAGEINFOHEADERA LPCDIDEVICEIMAGEINFOHEADER; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOHEADER *LPCDIDEVICEIMAGEINFOHEADER; + +#endif /* DIRECTINPUT_VERSION > 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* These structures are defined for DirectX 3.0 compatibility */ + +typedef struct DIDEVICEOBJECTINSTANCE_DX3A { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3A, *LPDIDEVICEOBJECTINSTANCE_DX3A; +typedef struct DIDEVICEOBJECTINSTANCE_DX3W { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3W, *LPDIDEVICEOBJECTINSTANCE_DX3W; +#ifdef UNICODE +typedef DIDEVICEOBJECTINSTANCE_DX3W DIDEVICEOBJECTINSTANCE_DX3; +typedef LPDIDEVICEOBJECTINSTANCE_DX3W LPDIDEVICEOBJECTINSTANCE_DX3; +#else +typedef DIDEVICEOBJECTINSTANCE_DX3A DIDEVICEOBJECTINSTANCE_DX3; +typedef LPDIDEVICEOBJECTINSTANCE_DX3A LPDIDEVICEOBJECTINSTANCE_DX3; +#endif // UNICODE +typedef const DIDEVICEOBJECTINSTANCE_DX3A *LPCDIDEVICEOBJECTINSTANCE_DX3A; +typedef const DIDEVICEOBJECTINSTANCE_DX3W *LPCDIDEVICEOBJECTINSTANCE_DX3W; +typedef const DIDEVICEOBJECTINSTANCE_DX3 *LPCDIDEVICEOBJECTINSTANCE_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVICEOBJECTINSTANCEA { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReportId; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA; +typedef struct DIDEVICEOBJECTINSTANCEW { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReportId; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEOBJECTINSTANCEW DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEW LPDIDEVICEOBJECTINSTANCE; +#else +typedef DIDEVICEOBJECTINSTANCEA DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEA LPDIDEVICEOBJECTINSTANCE; +#endif // UNICODE +typedef const DIDEVICEOBJECTINSTANCEA *LPCDIDEVICEOBJECTINSTANCEA; +typedef const DIDEVICEOBJECTINSTANCEW *LPCDIDEVICEOBJECTINSTANCEW; +typedef const DIDEVICEOBJECTINSTANCE *LPCDIDEVICEOBJECTINSTANCE; + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKW +#else +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKA +#endif // !UNICODE + +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIDOI_FFACTUATOR 0x00000001 +#define DIDOI_FFEFFECTTRIGGER 0x00000002 +#define DIDOI_POLLED 0x00008000 +#define DIDOI_ASPECTPOSITION 0x00000100 +#define DIDOI_ASPECTVELOCITY 0x00000200 +#define DIDOI_ASPECTACCEL 0x00000300 +#define DIDOI_ASPECTFORCE 0x00000400 +#define DIDOI_ASPECTMASK 0x00000F00 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDOI_GUIDISUSAGE 0x00010000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +typedef struct DIPROPHEADER { + DWORD dwSize; + DWORD dwHeaderSize; + DWORD dwObj; + DWORD dwHow; +} DIPROPHEADER, *LPDIPROPHEADER; +typedef const DIPROPHEADER *LPCDIPROPHEADER; + +#define DIPH_DEVICE 0 +#define DIPH_BYOFFSET 1 +#define DIPH_BYID 2 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIPH_BYUSAGE 3 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIMAKEUSAGEDWORD(UsagePage, Usage) \ + (DWORD)MAKELONG(Usage, UsagePage) +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +typedef struct DIPROPDWORD { + DIPROPHEADER diph; + DWORD dwData; +} DIPROPDWORD, *LPDIPROPDWORD; +typedef const DIPROPDWORD *LPCDIPROPDWORD; + +#if(DIRECTINPUT_VERSION >= 0x0800) +typedef struct DIPROPPOINTER { + DIPROPHEADER diph; + UINT_PTR uData; +} DIPROPPOINTER, *LPDIPROPPOINTER; +typedef const DIPROPPOINTER *LPCDIPROPPOINTER; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +typedef struct DIPROPRANGE { + DIPROPHEADER diph; + LONG lMin; + LONG lMax; +} DIPROPRANGE, *LPDIPROPRANGE; +typedef const DIPROPRANGE *LPCDIPROPRANGE; + +#define DIPROPRANGE_NOMIN ((LONG)0x80000000) +#define DIPROPRANGE_NOMAX ((LONG)0x7FFFFFFF) + +#if(DIRECTINPUT_VERSION >= 0x050a) +typedef struct DIPROPCAL { + DIPROPHEADER diph; + LONG lMin; + LONG lCenter; + LONG lMax; +} DIPROPCAL, *LPDIPROPCAL; +typedef const DIPROPCAL *LPCDIPROPCAL; + +typedef struct DIPROPCALPOV { + DIPROPHEADER diph; + LONG lMin[5]; + LONG lMax[5]; +} DIPROPCALPOV, *LPDIPROPCALPOV; +typedef const DIPROPCALPOV *LPCDIPROPCALPOV; + +typedef struct DIPROPGUIDANDPATH { + DIPROPHEADER diph; + GUID guidClass; + WCHAR wszPath[MAX_PATH]; +} DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH; +typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH; + +typedef struct DIPROPSTRING { + DIPROPHEADER diph; + WCHAR wsz[MAX_PATH]; +} DIPROPSTRING, *LPDIPROPSTRING; +typedef const DIPROPSTRING *LPCDIPROPSTRING; + +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define MAXCPOINTSNUM 8 + +typedef struct _CPOINT +{ + LONG lP; // raw value + DWORD dwLog; // logical_value / max_logical_value * 10000 +} CPOINT, *PCPOINT; + +typedef struct DIPROPCPOINTS { + DIPROPHEADER diph; + DWORD dwCPointsNum; + CPOINT cp[MAXCPOINTSNUM]; +} DIPROPCPOINTS, *LPDIPROPCPOINTS; +typedef const DIPROPCPOINTS *LPCDIPROPCPOINTS; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +#ifdef __cplusplus +#define MAKEDIPROP(prop) (*(const GUID *)(prop)) +#else +#define MAKEDIPROP(prop) ((REFGUID)(prop)) +#endif + +#define DIPROP_BUFFERSIZE MAKEDIPROP(1) + +#define DIPROP_AXISMODE MAKEDIPROP(2) + +#define DIPROPAXISMODE_ABS 0 +#define DIPROPAXISMODE_REL 1 + +#define DIPROP_GRANULARITY MAKEDIPROP(3) + +#define DIPROP_RANGE MAKEDIPROP(4) + +#define DIPROP_DEADZONE MAKEDIPROP(5) + +#define DIPROP_SATURATION MAKEDIPROP(6) + +#define DIPROP_FFGAIN MAKEDIPROP(7) + +#define DIPROP_FFLOAD MAKEDIPROP(8) + +#define DIPROP_AUTOCENTER MAKEDIPROP(9) + +#define DIPROPAUTOCENTER_OFF 0 +#define DIPROPAUTOCENTER_ON 1 + +#define DIPROP_CALIBRATIONMODE MAKEDIPROP(10) + +#define DIPROPCALIBRATIONMODE_COOKED 0 +#define DIPROPCALIBRATIONMODE_RAW 1 + +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIPROP_CALIBRATION MAKEDIPROP(11) + +#define DIPROP_GUIDANDPATH MAKEDIPROP(12) + +#define DIPROP_INSTANCENAME MAKEDIPROP(13) + +#define DIPROP_PRODUCTNAME MAKEDIPROP(14) +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x05b2) +#define DIPROP_JOYSTICKID MAKEDIPROP(15) + +#define DIPROP_GETPORTDISPLAYNAME MAKEDIPROP(16) + +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ + +#if(DIRECTINPUT_VERSION >= 0x0700) +#define DIPROP_PHYSICALRANGE MAKEDIPROP(18) + +#define DIPROP_LOGICALRANGE MAKEDIPROP(19) +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIPROP_KEYNAME MAKEDIPROP(20) + +#define DIPROP_CPOINTS MAKEDIPROP(21) + +#define DIPROP_APPDATA MAKEDIPROP(22) + +#define DIPROP_SCANCODE MAKEDIPROP(23) + +#define DIPROP_VIDPID MAKEDIPROP(24) + +#define DIPROP_USERNAME MAKEDIPROP(25) + +#define DIPROP_TYPENAME MAKEDIPROP(26) +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +typedef struct DIDEVICEOBJECTDATA_DX3 { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +} DIDEVICEOBJECTDATA_DX3, *LPDIDEVICEOBJECTDATA_DX3; +typedef const DIDEVICEOBJECTDATA_DX3 *LPCDIDEVICEOBJECTDATA_DX; + +typedef struct DIDEVICEOBJECTDATA { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +#if(DIRECTINPUT_VERSION >= 0x0800) + UINT_PTR uAppData; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ +} DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA; +typedef const DIDEVICEOBJECTDATA *LPCDIDEVICEOBJECTDATA; + +#define DIGDD_PEEK 0x00000001 + +#define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \ + ((int)((dwSequence1) - (dwSequence2)) cmp 0) +#define DISCL_EXCLUSIVE 0x00000001 +#define DISCL_NONEXCLUSIVE 0x00000002 +#define DISCL_FOREGROUND 0x00000004 +#define DISCL_BACKGROUND 0x00000008 +#define DISCL_NOWINKEY 0x00000010 + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* These structures are defined for DirectX 3.0 compatibility */ + +typedef struct DIDEVICEINSTANCE_DX3A { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3A, *LPDIDEVICEINSTANCE_DX3A; +typedef struct DIDEVICEINSTANCE_DX3W { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3W, *LPDIDEVICEINSTANCE_DX3W; +#ifdef UNICODE +typedef DIDEVICEINSTANCE_DX3W DIDEVICEINSTANCE_DX3; +typedef LPDIDEVICEINSTANCE_DX3W LPDIDEVICEINSTANCE_DX3; +#else +typedef DIDEVICEINSTANCE_DX3A DIDEVICEINSTANCE_DX3; +typedef LPDIDEVICEINSTANCE_DX3A LPDIDEVICEINSTANCE_DX3; +#endif // UNICODE +typedef const DIDEVICEINSTANCE_DX3A *LPCDIDEVICEINSTANCE_DX3A; +typedef const DIDEVICEINSTANCE_DX3W *LPCDIDEVICEINSTANCE_DX3W; +typedef const DIDEVICEINSTANCE_DX3 *LPCDIDEVICEINSTANCE_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVICEINSTANCEA { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA; +typedef struct DIDEVICEINSTANCEW { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE; +#else +typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE; +#endif // UNICODE + +typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA; +typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; +typedef LPCDIDEVICEINSTANCEW LPCDIDEVICEINSTANCE; +#else +typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; +typedef LPCDIDEVICEINSTANCEA LPCDIDEVICEINSTANCE; +#endif // UNICODE +typedef const DIDEVICEINSTANCE *LPCDIDEVICEINSTANCE; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceW + +DECLARE_INTERFACE_(IDirectInputDeviceW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceW *LPDIRECTINPUTDEVICEW; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceA + +DECLARE_INTERFACE_(IDirectInputDeviceA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceA *LPDIRECTINPUTDEVICEA; + +#ifdef UNICODE +#define IID_IDirectInputDevice IID_IDirectInputDeviceW +#define IDirectInputDevice IDirectInputDeviceW +#define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl +#else +#define IID_IDirectInputDevice IID_IDirectInputDeviceA +#define IDirectInputDevice IDirectInputDeviceA +#define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl +#endif +typedef struct IDirectInputDevice *LPDIRECTINPUTDEVICE; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#else +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice_AddRef(p) (p)->AddRef() +#define IDirectInputDevice_Release(p) (p)->Release() +#define IDirectInputDevice_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice_Acquire(p) (p)->Acquire() +#define IDirectInputDevice_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#endif + +#endif /* DIJ_RINGZERO */ + + +#if(DIRECTINPUT_VERSION >= 0x0500) + +#define DISFFC_RESET 0x00000001 +#define DISFFC_STOPALL 0x00000002 +#define DISFFC_PAUSE 0x00000004 +#define DISFFC_CONTINUE 0x00000008 +#define DISFFC_SETACTUATORSON 0x00000010 +#define DISFFC_SETACTUATORSOFF 0x00000020 + +#define DIGFFS_EMPTY 0x00000001 +#define DIGFFS_STOPPED 0x00000002 +#define DIGFFS_PAUSED 0x00000004 +#define DIGFFS_ACTUATORSON 0x00000010 +#define DIGFFS_ACTUATORSOFF 0x00000020 +#define DIGFFS_POWERON 0x00000040 +#define DIGFFS_POWEROFF 0x00000080 +#define DIGFFS_SAFETYSWITCHON 0x00000100 +#define DIGFFS_SAFETYSWITCHOFF 0x00000200 +#define DIGFFS_USERFFSWITCHON 0x00000400 +#define DIGFFS_USERFFSWITCHOFF 0x00000800 +#define DIGFFS_DEVICELOST 0x80000000 + +#ifndef DIJ_RINGZERO + +typedef struct DIEFFECTINFOA { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + CHAR tszName[MAX_PATH]; +} DIEFFECTINFOA, *LPDIEFFECTINFOA; +typedef struct DIEFFECTINFOW { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + WCHAR tszName[MAX_PATH]; +} DIEFFECTINFOW, *LPDIEFFECTINFOW; +#ifdef UNICODE +typedef DIEFFECTINFOW DIEFFECTINFO; +typedef LPDIEFFECTINFOW LPDIEFFECTINFO; +#else +typedef DIEFFECTINFOA DIEFFECTINFO; +typedef LPDIEFFECTINFOA LPDIEFFECTINFO; +#endif // UNICODE +typedef const DIEFFECTINFOA *LPCDIEFFECTINFOA; +typedef const DIEFFECTINFOW *LPCDIEFFECTINFOW; +typedef const DIEFFECTINFO *LPCDIEFFECTINFO; + +#define DISDD_CONTINUE 0x00000001 + +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID); +#ifdef UNICODE +#define LPDIENUMEFFECTSCALLBACK LPDIENUMEFFECTSCALLBACKW +#else +#define LPDIENUMEFFECTSCALLBACK LPDIENUMEFFECTSCALLBACKA +#endif // !UNICODE +typedef BOOL (FAR PASCAL * LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID); + +#undef INTERFACE +#define INTERFACE IDirectInputDevice2W + +DECLARE_INTERFACE_(IDirectInputDevice2W, IDirectInputDeviceW) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; +}; + +typedef struct IDirectInputDevice2W *LPDIRECTINPUTDEVICE2W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice2A + +DECLARE_INTERFACE_(IDirectInputDevice2A, IDirectInputDeviceA) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; +}; + +typedef struct IDirectInputDevice2A *LPDIRECTINPUTDEVICE2A; + +#ifdef UNICODE +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2W +#define IDirectInputDevice2 IDirectInputDevice2W +#define IDirectInputDevice2Vtbl IDirectInputDevice2WVtbl +#else +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2A +#define IDirectInputDevice2 IDirectInputDevice2A +#define IDirectInputDevice2Vtbl IDirectInputDevice2AVtbl +#endif +typedef struct IDirectInputDevice2 *LPDIRECTINPUTDEVICE2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice2_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice2_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice2_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#else +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice2_AddRef(p) (p)->AddRef() +#define IDirectInputDevice2_Release(p) (p)->Release() +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice2_Acquire(p) (p)->Acquire() +#define IDirectInputDevice2_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice2_Poll(p) (p)->Poll() +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +#if(DIRECTINPUT_VERSION >= 0x0700) +#define DIFEF_DEFAULT 0x00000000 +#define DIFEF_INCLUDENONSTANDARD 0x00000001 +#define DIFEF_MODIFYIFNEEDED 0x00000010 + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputDevice7W + +DECLARE_INTERFACE_(IDirectInputDevice7W, IDirectInputDevice2W) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + + /*** IDirectInputDevice7W methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; +}; + +typedef struct IDirectInputDevice7W *LPDIRECTINPUTDEVICE7W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice7A + +DECLARE_INTERFACE_(IDirectInputDevice7A, IDirectInputDevice2A) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + + /*** IDirectInputDevice7A methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; +}; + +typedef struct IDirectInputDevice7A *LPDIRECTINPUTDEVICE7A; + +#ifdef UNICODE +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7W +#define IDirectInputDevice7 IDirectInputDevice7W +#define IDirectInputDevice7Vtbl IDirectInputDevice7WVtbl +#else +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7A +#define IDirectInputDevice7 IDirectInputDevice7A +#define IDirectInputDevice7Vtbl IDirectInputDevice7AVtbl +#endif +typedef struct IDirectInputDevice7 *LPDIRECTINPUTDEVICE7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice7_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice7_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice7_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +#else +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice7_AddRef(p) (p)->AddRef() +#define IDirectInputDevice7_Release(p) (p)->Release() +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice7_Acquire(p) (p)->Acquire() +#define IDirectInputDevice7_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice7_Poll(p) (p)->Poll() +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputDevice8W + +DECLARE_INTERFACE_(IDirectInputDevice8W, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice8W methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATW,LPCWSTR,DWORD) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATW,LPCWSTR,DWORD) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERW) PURE; +}; + +typedef struct IDirectInputDevice8W *LPDIRECTINPUTDEVICE8W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice8A + +DECLARE_INTERFACE_(IDirectInputDevice8A, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice8A methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATA,LPCSTR,DWORD) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATA,LPCSTR,DWORD) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERA) PURE; +}; + +typedef struct IDirectInputDevice8A *LPDIRECTINPUTDEVICE8A; + +#ifdef UNICODE +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8W +#define IDirectInputDevice8 IDirectInputDevice8W +#define IDirectInputDevice8Vtbl IDirectInputDevice8WVtbl +#else +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8A +#define IDirectInputDevice8 IDirectInputDevice8A +#define IDirectInputDevice8Vtbl IDirectInputDevice8AVtbl +#endif +typedef struct IDirectInputDevice8 *LPDIRECTINPUTDEVICE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice8_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice8_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice8_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->lpVtbl->BuildActionMap(p,a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->lpVtbl->SetActionMap(p,a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->lpVtbl->GetImageInfo(p,a) +#else +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice8_AddRef(p) (p)->AddRef() +#define IDirectInputDevice8_Release(p) (p)->Release() +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice8_Acquire(p) (p)->Acquire() +#define IDirectInputDevice8_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice8_Poll(p) (p)->Poll() +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->BuildActionMap(a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->SetActionMap(a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->GetImageInfo(a) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +/**************************************************************************** + * + * Mouse + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +typedef struct _DIMOUSESTATE { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[4]; +} DIMOUSESTATE, *LPDIMOUSESTATE; + +#if DIRECTINPUT_VERSION >= 0x0700 +typedef struct _DIMOUSESTATE2 { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[8]; +} DIMOUSESTATE2, *LPDIMOUSESTATE2; +#endif + + +#define DIMOFS_X FIELD_OFFSET(DIMOUSESTATE, lX) +#define DIMOFS_Y FIELD_OFFSET(DIMOUSESTATE, lY) +#define DIMOFS_Z FIELD_OFFSET(DIMOUSESTATE, lZ) +#define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0) +#define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1) +#define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2) +#define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3) +#if (DIRECTINPUT_VERSION >= 0x0700) +#define DIMOFS_BUTTON4 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 4) +#define DIMOFS_BUTTON5 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 5) +#define DIMOFS_BUTTON6 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 6) +#define DIMOFS_BUTTON7 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 7) +#endif +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Keyboard + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +/**************************************************************************** + * + * DirectInput keyboard scan codes + * + ****************************************************************************/ +#define DIK_ESCAPE 0x01 +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_0 0x0B +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_TAB 0x0F +#define DIK_Q 0x10 +#define DIK_W 0x11 +#define DIK_E 0x12 +#define DIK_R 0x13 +#define DIK_T 0x14 +#define DIK_Y 0x15 +#define DIK_U 0x16 +#define DIK_I 0x17 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_LCONTROL 0x1D +#define DIK_A 0x1E +#define DIK_S 0x1F +#define DIK_D 0x20 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_LSHIFT 0x2A +#define DIK_BACKSLASH 0x2B +#define DIK_Z 0x2C +#define DIK_X 0x2D +#define DIK_C 0x2E +#define DIK_V 0x2F +#define DIK_B 0x30 +#define DIK_N 0x31 +#define DIK_M 0x32 +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_RSHIFT 0x36 +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD0 0x52 +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_OEM_102 0x56 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ +#define DIK_F11 0x57 +#define DIK_F12 0x58 +#define DIK_F13 0x64 /* (NEC PC98) */ +#define DIK_F14 0x65 /* (NEC PC98) */ +#define DIK_F15 0x66 /* (NEC PC98) */ +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_ABNT_C1 0x73 /* /? on Brazilian keyboard */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_ABNT_C2 0x7E /* Numpad . on Brazilian keyboard */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NEXTTRACK 0x99 /* Next Track */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_RCONTROL 0x9D +#define DIK_MUTE 0xA0 /* Mute */ +#define DIK_CALCULATOR 0xA1 /* Calculator */ +#define DIK_PLAYPAUSE 0xA2 /* Play / Pause */ +#define DIK_MEDIASTOP 0xA4 /* Media Stop */ +#define DIK_VOLUMEDOWN 0xAE /* Volume - */ +#define DIK_VOLUMEUP 0xB0 /* Volume + */ +#define DIK_WEBHOME 0xB2 /* Web home */ +#define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ +#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ +#define DIK_SYSRQ 0xB7 +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_PAUSE 0xC5 /* Pause */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ +#define DIK_APPS 0xDD /* AppMenu key */ +#define DIK_POWER 0xDE /* System Power */ +#define DIK_SLEEP 0xDF /* System Sleep */ +#define DIK_WAKE 0xE3 /* System Wake */ +#define DIK_WEBSEARCH 0xE5 /* Web Search */ +#define DIK_WEBFAVORITES 0xE6 /* Web Favorites */ +#define DIK_WEBREFRESH 0xE7 /* Web Refresh */ +#define DIK_WEBSTOP 0xE8 /* Web Stop */ +#define DIK_WEBFORWARD 0xE9 /* Web Forward */ +#define DIK_WEBBACK 0xEA /* Web Back */ +#define DIK_MYCOMPUTER 0xEB /* My Computer */ +#define DIK_MAIL 0xEC /* Mail */ +#define DIK_MEDIASELECT 0xED /* Media Select */ + +/* + * Alternate names for keys, to facilitate transition from DOS. + */ +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ + +/* + * Alternate names for keys originally not used on US keyboards. + */ +#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */ + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Joystick + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +typedef struct DIJOYSTATE { + LONG lX; /* x-axis position */ + LONG lY; /* y-axis position */ + LONG lZ; /* z-axis position */ + LONG lRx; /* x-axis rotation */ + LONG lRy; /* y-axis rotation */ + LONG lRz; /* z-axis rotation */ + LONG rglSlider[2]; /* extra axes positions */ + DWORD rgdwPOV[4]; /* POV directions */ + BYTE rgbButtons[32]; /* 32 buttons */ +} DIJOYSTATE, *LPDIJOYSTATE; + +typedef struct DIJOYSTATE2 { + LONG lX; /* x-axis position */ + LONG lY; /* y-axis position */ + LONG lZ; /* z-axis position */ + LONG lRx; /* x-axis rotation */ + LONG lRy; /* y-axis rotation */ + LONG lRz; /* z-axis rotation */ + LONG rglSlider[2]; /* extra axes positions */ + DWORD rgdwPOV[4]; /* POV directions */ + BYTE rgbButtons[128]; /* 128 buttons */ + LONG lVX; /* x-axis velocity */ + LONG lVY; /* y-axis velocity */ + LONG lVZ; /* z-axis velocity */ + LONG lVRx; /* x-axis angular velocity */ + LONG lVRy; /* y-axis angular velocity */ + LONG lVRz; /* z-axis angular velocity */ + LONG rglVSlider[2]; /* extra axes velocities */ + LONG lAX; /* x-axis acceleration */ + LONG lAY; /* y-axis acceleration */ + LONG lAZ; /* z-axis acceleration */ + LONG lARx; /* x-axis angular acceleration */ + LONG lARy; /* y-axis angular acceleration */ + LONG lARz; /* z-axis angular acceleration */ + LONG rglASlider[2]; /* extra axes accelerations */ + LONG lFX; /* x-axis force */ + LONG lFY; /* y-axis force */ + LONG lFZ; /* z-axis force */ + LONG lFRx; /* x-axis torque */ + LONG lFRy; /* y-axis torque */ + LONG lFRz; /* z-axis torque */ + LONG rglFSlider[2]; /* extra axes forces */ +} DIJOYSTATE2, *LPDIJOYSTATE2; + +#define DIJOFS_X FIELD_OFFSET(DIJOYSTATE, lX) +#define DIJOFS_Y FIELD_OFFSET(DIJOYSTATE, lY) +#define DIJOFS_Z FIELD_OFFSET(DIJOYSTATE, lZ) +#define DIJOFS_RX FIELD_OFFSET(DIJOYSTATE, lRx) +#define DIJOFS_RY FIELD_OFFSET(DIJOYSTATE, lRy) +#define DIJOFS_RZ FIELD_OFFSET(DIJOYSTATE, lRz) +#define DIJOFS_SLIDER(n) (FIELD_OFFSET(DIJOYSTATE, rglSlider) + \ + (n) * sizeof(LONG)) +#define DIJOFS_POV(n) (FIELD_OFFSET(DIJOYSTATE, rgdwPOV) + \ + (n) * sizeof(DWORD)) +#define DIJOFS_BUTTON(n) (FIELD_OFFSET(DIJOYSTATE, rgbButtons) + (n)) +#define DIJOFS_BUTTON0 DIJOFS_BUTTON(0) +#define DIJOFS_BUTTON1 DIJOFS_BUTTON(1) +#define DIJOFS_BUTTON2 DIJOFS_BUTTON(2) +#define DIJOFS_BUTTON3 DIJOFS_BUTTON(3) +#define DIJOFS_BUTTON4 DIJOFS_BUTTON(4) +#define DIJOFS_BUTTON5 DIJOFS_BUTTON(5) +#define DIJOFS_BUTTON6 DIJOFS_BUTTON(6) +#define DIJOFS_BUTTON7 DIJOFS_BUTTON(7) +#define DIJOFS_BUTTON8 DIJOFS_BUTTON(8) +#define DIJOFS_BUTTON9 DIJOFS_BUTTON(9) +#define DIJOFS_BUTTON10 DIJOFS_BUTTON(10) +#define DIJOFS_BUTTON11 DIJOFS_BUTTON(11) +#define DIJOFS_BUTTON12 DIJOFS_BUTTON(12) +#define DIJOFS_BUTTON13 DIJOFS_BUTTON(13) +#define DIJOFS_BUTTON14 DIJOFS_BUTTON(14) +#define DIJOFS_BUTTON15 DIJOFS_BUTTON(15) +#define DIJOFS_BUTTON16 DIJOFS_BUTTON(16) +#define DIJOFS_BUTTON17 DIJOFS_BUTTON(17) +#define DIJOFS_BUTTON18 DIJOFS_BUTTON(18) +#define DIJOFS_BUTTON19 DIJOFS_BUTTON(19) +#define DIJOFS_BUTTON20 DIJOFS_BUTTON(20) +#define DIJOFS_BUTTON21 DIJOFS_BUTTON(21) +#define DIJOFS_BUTTON22 DIJOFS_BUTTON(22) +#define DIJOFS_BUTTON23 DIJOFS_BUTTON(23) +#define DIJOFS_BUTTON24 DIJOFS_BUTTON(24) +#define DIJOFS_BUTTON25 DIJOFS_BUTTON(25) +#define DIJOFS_BUTTON26 DIJOFS_BUTTON(26) +#define DIJOFS_BUTTON27 DIJOFS_BUTTON(27) +#define DIJOFS_BUTTON28 DIJOFS_BUTTON(28) +#define DIJOFS_BUTTON29 DIJOFS_BUTTON(29) +#define DIJOFS_BUTTON30 DIJOFS_BUTTON(30) +#define DIJOFS_BUTTON31 DIJOFS_BUTTON(31) + + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * IDirectInput + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +#define DIENUM_STOP 0 +#define DIENUM_CONTINUE 1 + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKW +#else +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKA +#endif // !UNICODE +typedef BOOL (FAR PASCAL * LPDICONFIGUREDEVICESCALLBACK)(IUnknown FAR *, LPVOID); + +#define DIEDFL_ALLDEVICES 0x00000000 +#define DIEDFL_ATTACHEDONLY 0x00000001 +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIEDFL_FORCEFEEDBACK 0x00000100 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIEDFL_INCLUDEALIASES 0x00010000 +#define DIEDFL_INCLUDEPHANTOMS 0x00020000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDFL_INCLUDEHIDDEN 0x00040000 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +#if(DIRECTINPUT_VERSION >= 0x0800) +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESBYSEMANTICSCBA)(LPCDIDEVICEINSTANCEA, LPDIRECTINPUTDEVICE8A, DWORD, DWORD, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESBYSEMANTICSCBW)(LPCDIDEVICEINSTANCEW, LPDIRECTINPUTDEVICE8W, DWORD, DWORD, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICESBYSEMANTICSCB LPDIENUMDEVICESBYSEMANTICSCBW +#else +#define LPDIENUMDEVICESBYSEMANTICSCB LPDIENUMDEVICESBYSEMANTICSCBA +#endif // !UNICODE +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDBS_MAPPEDPRI1 0x00000001 +#define DIEDBS_MAPPEDPRI2 0x00000002 +#define DIEDBS_RECENTDEVICE 0x00000010 +#define DIEDBS_NEWDEVICE 0x00000020 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDBSFL_ATTACHEDONLY 0x00000000 +#define DIEDBSFL_THISUSER 0x00000010 +#define DIEDBSFL_FORCEFEEDBACK DIEDFL_FORCEFEEDBACK +#define DIEDBSFL_AVAILABLEDEVICES 0x00001000 +#define DIEDBSFL_MULTIMICEKEYBOARDS 0x00002000 +#define DIEDBSFL_NONGAMINGDEVICES 0x00004000 +#define DIEDBSFL_VALID 0x00007110 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#undef INTERFACE +#define INTERFACE IDirectInputW + +DECLARE_INTERFACE_(IDirectInputW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputW *LPDIRECTINPUTW; + +#undef INTERFACE +#define INTERFACE IDirectInputA + +DECLARE_INTERFACE_(IDirectInputA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputA *LPDIRECTINPUTA; + +#ifdef UNICODE +#define IID_IDirectInput IID_IDirectInputW +#define IDirectInput IDirectInputW +#define IDirectInputVtbl IDirectInputWVtbl +#else +#define IID_IDirectInput IID_IDirectInputA +#define IDirectInput IDirectInputA +#define IDirectInputVtbl IDirectInputAVtbl +#endif +typedef struct IDirectInput *LPDIRECTINPUT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#else +#define IDirectInput_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput_AddRef(p) (p)->AddRef() +#define IDirectInput_Release(p) (p)->Release() +#define IDirectInput_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput_Initialize(p,a,b) (p)->Initialize(a,b) +#endif + +#undef INTERFACE +#define INTERFACE IDirectInput2W + +DECLARE_INTERFACE_(IDirectInput2W, IDirectInputW) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + + /*** IDirectInput2W methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; +}; + +typedef struct IDirectInput2W *LPDIRECTINPUT2W; + +#undef INTERFACE +#define INTERFACE IDirectInput2A + +DECLARE_INTERFACE_(IDirectInput2A, IDirectInputA) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + + /*** IDirectInput2A methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; +}; + +typedef struct IDirectInput2A *LPDIRECTINPUT2A; + +#ifdef UNICODE +#define IID_IDirectInput2 IID_IDirectInput2W +#define IDirectInput2 IDirectInput2W +#define IDirectInput2Vtbl IDirectInput2WVtbl +#else +#define IID_IDirectInput2 IID_IDirectInput2A +#define IDirectInput2 IDirectInput2A +#define IDirectInput2Vtbl IDirectInput2AVtbl +#endif +typedef struct IDirectInput2 *LPDIRECTINPUT2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput2_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#else +#define IDirectInput2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput2_AddRef(p) (p)->AddRef() +#define IDirectInput2_Release(p) (p)->Release() +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput2_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#endif + + +#undef INTERFACE +#define INTERFACE IDirectInput7W + +DECLARE_INTERFACE_(IDirectInput7W, IDirectInput2W) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput2W methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; + + /*** IDirectInput7W methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID,REFIID,LPVOID *,LPUNKNOWN) PURE; +}; + +typedef struct IDirectInput7W *LPDIRECTINPUT7W; + +#undef INTERFACE +#define INTERFACE IDirectInput7A + +DECLARE_INTERFACE_(IDirectInput7A, IDirectInput2A) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput2A methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; + + /*** IDirectInput7A methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID,REFIID,LPVOID *,LPUNKNOWN) PURE; +}; + +typedef struct IDirectInput7A *LPDIRECTINPUT7A; + +#ifdef UNICODE +#define IID_IDirectInput7 IID_IDirectInput7W +#define IDirectInput7 IDirectInput7W +#define IDirectInput7Vtbl IDirectInput7WVtbl +#else +#define IID_IDirectInput7 IID_IDirectInput7A +#define IDirectInput7 IDirectInput7A +#define IDirectInput7Vtbl IDirectInput7AVtbl +#endif +typedef struct IDirectInput7 *LPDIRECTINPUT7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput7_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d) +#else +#define IDirectInput7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput7_AddRef(p) (p)->AddRef() +#define IDirectInput7_Release(p) (p)->Release() +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput7_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->CreateDeviceEx(a,b,c,d) +#endif + +#if(DIRECTINPUT_VERSION >= 0x0800) +#undef INTERFACE +#define INTERFACE IDirectInput8W + +DECLARE_INTERFACE_(IDirectInput8W, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput8W methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE8W *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCWSTR,LPDIACTIONFORMATW,LPDIENUMDEVICESBYSEMANTICSCBW,LPVOID,DWORD) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSW,DWORD,LPVOID) PURE; +}; + +typedef struct IDirectInput8W *LPDIRECTINPUT8W; + +#undef INTERFACE +#define INTERFACE IDirectInput8A + +DECLARE_INTERFACE_(IDirectInput8A, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput8A methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE8A *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCSTR,LPDIACTIONFORMATA,LPDIENUMDEVICESBYSEMANTICSCBA,LPVOID,DWORD) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSA,DWORD,LPVOID) PURE; +}; + +typedef struct IDirectInput8A *LPDIRECTINPUT8A; + +#ifdef UNICODE +#define IID_IDirectInput8 IID_IDirectInput8W +#define IDirectInput8 IDirectInput8W +#define IDirectInput8Vtbl IDirectInput8WVtbl +#else +#define IID_IDirectInput8 IID_IDirectInput8A +#define IDirectInput8 IDirectInput8A +#define IDirectInput8Vtbl IDirectInput8AVtbl +#endif +typedef struct IDirectInput8 *LPDIRECTINPUT8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->lpVtbl->EnumDevicesBySemantics(p,a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->lpVtbl->ConfigureDevices(p,a,b,c,d) +#else +#define IDirectInput8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput8_AddRef(p) (p)->AddRef() +#define IDirectInput8_Release(p) (p)->Release() +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->EnumDevicesBySemantics(a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->ConfigureDevices(a,b,c,d) +#endif +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if DIRECTINPUT_VERSION > 0x0700 + +extern HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); + +#else +extern HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter); +extern HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter); +#ifdef UNICODE +#define DirectInputCreate DirectInputCreateW +#else +#define DirectInputCreate DirectInputCreateA +#endif // !UNICODE + +extern HRESULT WINAPI DirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); + +#endif /* DIRECTINPUT_VERSION > 0x700 */ + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * Return Codes + * + ****************************************************************************/ + +/* + * The operation completed successfully. + */ +#define DI_OK S_OK + +/* + * The device exists but is not currently attached. + */ +#define DI_NOTATTACHED S_FALSE + +/* + * The device buffer overflowed. Some input was lost. + */ +#define DI_BUFFEROVERFLOW S_FALSE + +/* + * The change in device properties had no effect. + */ +#define DI_PROPNOEFFECT S_FALSE + +/* + * The operation had no effect. + */ +#define DI_NOEFFECT S_FALSE + +/* + * The device is a polled device. As a result, device buffering + * will not collect any data and event notifications will not be + * signalled until GetDeviceState is called. + */ +#define DI_POLLEDDEVICE ((HRESULT)0x00000002L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but the effect was not + * downloaded because the device is not exclusively acquired + * or because the DIEP_NODOWNLOAD flag was passed. + */ +#define DI_DOWNLOADSKIPPED ((HRESULT)0x00000003L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but in order to change + * the parameters, the effect needed to be restarted. + */ +#define DI_EFFECTRESTARTED ((HRESULT)0x00000004L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but some of them were + * beyond the capabilities of the device and were truncated. + */ +#define DI_TRUNCATED ((HRESULT)0x00000008L) + +/* + * The settings have been successfully applied but could not be + * persisted. + */ +#define DI_SETTINGSNOTSAVED ((HRESULT)0x0000000BL) + +/* + * Equal to DI_EFFECTRESTARTED | DI_TRUNCATED. + */ +#define DI_TRUNCATEDANDRESTARTED ((HRESULT)0x0000000CL) + +/* + * A SUCCESS code indicating that settings cannot be modified. + */ +#define DI_WRITEPROTECT ((HRESULT)0x00000013L) + +/* + * The application requires a newer version of DirectInput. + */ +#define DIERR_OLDDIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION) + +/* + * The application was written for an unsupported prerelease version + * of DirectInput. + */ +#define DIERR_BETADIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP) + +/* + * The object could not be created due to an incompatible driver version + * or mismatched or incomplete driver components. + */ +#define DIERR_BADDRIVERVER \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL) + +/* + * The device or device instance or effect is not registered with DirectInput. + */ +#define DIERR_DEVICENOTREG REGDB_E_CLASSNOTREG + +/* + * The requested object does not exist. + */ +#define DIERR_NOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) + +/* + * The requested object does not exist. + */ +#define DIERR_OBJECTNOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) + +/* + * An invalid parameter was passed to the returning function, + * or the object was not in a state that admitted the function + * to be called. + */ +#define DIERR_INVALIDPARAM E_INVALIDARG + +/* + * The specified interface is not supported by the object + */ +#define DIERR_NOINTERFACE E_NOINTERFACE + +/* + * An undetermined error occured inside the DInput subsystem + */ +#define DIERR_GENERIC E_FAIL + +/* + * The DInput subsystem couldn't allocate sufficient memory to complete the + * caller's request. + */ +#define DIERR_OUTOFMEMORY E_OUTOFMEMORY + +/* + * The function called is not supported at this time + */ +#define DIERR_UNSUPPORTED E_NOTIMPL + +/* + * This object has not been initialized + */ +#define DIERR_NOTINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY) + +/* + * This object is already initialized + */ +#define DIERR_ALREADYINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED) + +/* + * This object does not support aggregation + */ +#define DIERR_NOAGGREGATION CLASS_E_NOAGGREGATION + +/* + * Another app has a higher priority level, preventing this call from + * succeeding. + */ +#define DIERR_OTHERAPPHASPRIO E_ACCESSDENIED + +/* + * Access to the device has been lost. It must be re-acquired. + */ +#define DIERR_INPUTLOST \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT) + +/* + * The operation cannot be performed while the device is acquired. + */ +#define DIERR_ACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY) + +/* + * The operation cannot be performed unless the device is acquired. + */ +#define DIERR_NOTACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS) + +/* + * The specified property cannot be changed. + */ +#define DIERR_READONLY E_ACCESSDENIED + +/* + * The device already has an event notification associated with it. + */ +#define DIERR_HANDLEEXISTS E_ACCESSDENIED + +/* + * Data is not yet available. + */ +#ifndef E_PENDING +#define E_PENDING 0x8000000AL +#endif + +/* + * Unable to IDirectInputJoyConfig_Acquire because the user + * does not have sufficient privileges to change the joystick + * configuration. + */ +#define DIERR_INSUFFICIENTPRIVS 0x80040200L + +/* + * The device is full. + */ +#define DIERR_DEVICEFULL 0x80040201L + +/* + * Not all the requested information fit into the buffer. + */ +#define DIERR_MOREDATA 0x80040202L + +/* + * The effect is not downloaded. + */ +#define DIERR_NOTDOWNLOADED 0x80040203L + +/* + * The device cannot be reinitialized because there are still effects + * attached to it. + */ +#define DIERR_HASEFFECTS 0x80040204L + +/* + * The operation cannot be performed unless the device is acquired + * in DISCL_EXCLUSIVE mode. + */ +#define DIERR_NOTEXCLUSIVEACQUIRED 0x80040205L + +/* + * The effect could not be downloaded because essential information + * is missing. For example, no axes have been associated with the + * effect, or no type-specific information has been created. + */ +#define DIERR_INCOMPLETEEFFECT 0x80040206L + +/* + * Attempted to read buffered device data from a device that is + * not buffered. + */ +#define DIERR_NOTBUFFERED 0x80040207L + +/* + * An attempt was made to modify parameters of an effect while it is + * playing. Not all hardware devices support altering the parameters + * of an effect while it is playing. + */ +#define DIERR_EFFECTPLAYING 0x80040208L + +/* + * The operation could not be completed because the device is not + * plugged in. + */ +#define DIERR_UNPLUGGED 0x80040209L + +/* + * SendDeviceData failed because more information was requested + * to be sent than can be sent to the device. Some devices have + * restrictions on how much data can be sent to them. (For example, + * there might be a limit on the number of buttons that can be + * pressed at once.) + */ +#define DIERR_REPORTFULL 0x8004020AL + + +/* + * A mapper file function failed because reading or writing the user or IHV + * settings file failed. + */ +#define DIERR_MAPFILEFAIL 0x8004020BL + + +/*--- DINPUT Mapper Definitions: New for Dx8 ---*/ + + +/*--- Keyboard + Physical Keyboard Device ---*/ + +#define DIKEYBOARD_ESCAPE 0x81000401 +#define DIKEYBOARD_1 0x81000402 +#define DIKEYBOARD_2 0x81000403 +#define DIKEYBOARD_3 0x81000404 +#define DIKEYBOARD_4 0x81000405 +#define DIKEYBOARD_5 0x81000406 +#define DIKEYBOARD_6 0x81000407 +#define DIKEYBOARD_7 0x81000408 +#define DIKEYBOARD_8 0x81000409 +#define DIKEYBOARD_9 0x8100040A +#define DIKEYBOARD_0 0x8100040B +#define DIKEYBOARD_MINUS 0x8100040C /* - on main keyboard */ +#define DIKEYBOARD_EQUALS 0x8100040D +#define DIKEYBOARD_BACK 0x8100040E /* backspace */ +#define DIKEYBOARD_TAB 0x8100040F +#define DIKEYBOARD_Q 0x81000410 +#define DIKEYBOARD_W 0x81000411 +#define DIKEYBOARD_E 0x81000412 +#define DIKEYBOARD_R 0x81000413 +#define DIKEYBOARD_T 0x81000414 +#define DIKEYBOARD_Y 0x81000415 +#define DIKEYBOARD_U 0x81000416 +#define DIKEYBOARD_I 0x81000417 +#define DIKEYBOARD_O 0x81000418 +#define DIKEYBOARD_P 0x81000419 +#define DIKEYBOARD_LBRACKET 0x8100041A +#define DIKEYBOARD_RBRACKET 0x8100041B +#define DIKEYBOARD_RETURN 0x8100041C /* Enter on main keyboard */ +#define DIKEYBOARD_LCONTROL 0x8100041D +#define DIKEYBOARD_A 0x8100041E +#define DIKEYBOARD_S 0x8100041F +#define DIKEYBOARD_D 0x81000420 +#define DIKEYBOARD_F 0x81000421 +#define DIKEYBOARD_G 0x81000422 +#define DIKEYBOARD_H 0x81000423 +#define DIKEYBOARD_J 0x81000424 +#define DIKEYBOARD_K 0x81000425 +#define DIKEYBOARD_L 0x81000426 +#define DIKEYBOARD_SEMICOLON 0x81000427 +#define DIKEYBOARD_APOSTROPHE 0x81000428 +#define DIKEYBOARD_GRAVE 0x81000429 /* accent grave */ +#define DIKEYBOARD_LSHIFT 0x8100042A +#define DIKEYBOARD_BACKSLASH 0x8100042B +#define DIKEYBOARD_Z 0x8100042C +#define DIKEYBOARD_X 0x8100042D +#define DIKEYBOARD_C 0x8100042E +#define DIKEYBOARD_V 0x8100042F +#define DIKEYBOARD_B 0x81000430 +#define DIKEYBOARD_N 0x81000431 +#define DIKEYBOARD_M 0x81000432 +#define DIKEYBOARD_COMMA 0x81000433 +#define DIKEYBOARD_PERIOD 0x81000434 /* . on main keyboard */ +#define DIKEYBOARD_SLASH 0x81000435 /* / on main keyboard */ +#define DIKEYBOARD_RSHIFT 0x81000436 +#define DIKEYBOARD_MULTIPLY 0x81000437 /* * on numeric keypad */ +#define DIKEYBOARD_LMENU 0x81000438 /* left Alt */ +#define DIKEYBOARD_SPACE 0x81000439 +#define DIKEYBOARD_CAPITAL 0x8100043A +#define DIKEYBOARD_F1 0x8100043B +#define DIKEYBOARD_F2 0x8100043C +#define DIKEYBOARD_F3 0x8100043D +#define DIKEYBOARD_F4 0x8100043E +#define DIKEYBOARD_F5 0x8100043F +#define DIKEYBOARD_F6 0x81000440 +#define DIKEYBOARD_F7 0x81000441 +#define DIKEYBOARD_F8 0x81000442 +#define DIKEYBOARD_F9 0x81000443 +#define DIKEYBOARD_F10 0x81000444 +#define DIKEYBOARD_NUMLOCK 0x81000445 +#define DIKEYBOARD_SCROLL 0x81000446 /* Scroll Lock */ +#define DIKEYBOARD_NUMPAD7 0x81000447 +#define DIKEYBOARD_NUMPAD8 0x81000448 +#define DIKEYBOARD_NUMPAD9 0x81000449 +#define DIKEYBOARD_SUBTRACT 0x8100044A /* - on numeric keypad */ +#define DIKEYBOARD_NUMPAD4 0x8100044B +#define DIKEYBOARD_NUMPAD5 0x8100044C +#define DIKEYBOARD_NUMPAD6 0x8100044D +#define DIKEYBOARD_ADD 0x8100044E /* + on numeric keypad */ +#define DIKEYBOARD_NUMPAD1 0x8100044F +#define DIKEYBOARD_NUMPAD2 0x81000450 +#define DIKEYBOARD_NUMPAD3 0x81000451 +#define DIKEYBOARD_NUMPAD0 0x81000452 +#define DIKEYBOARD_DECIMAL 0x81000453 /* . on numeric keypad */ +#define DIKEYBOARD_OEM_102 0x81000456 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ +#define DIKEYBOARD_F11 0x81000457 +#define DIKEYBOARD_F12 0x81000458 +#define DIKEYBOARD_F13 0x81000464 /* (NEC PC98) */ +#define DIKEYBOARD_F14 0x81000465 /* (NEC PC98) */ +#define DIKEYBOARD_F15 0x81000466 /* (NEC PC98) */ +#define DIKEYBOARD_KANA 0x81000470 /* (Japanese keyboard) */ +#define DIKEYBOARD_ABNT_C1 0x81000473 /* /? on Brazilian keyboard */ +#define DIKEYBOARD_CONVERT 0x81000479 /* (Japanese keyboard) */ +#define DIKEYBOARD_NOCONVERT 0x8100047B /* (Japanese keyboard) */ +#define DIKEYBOARD_YEN 0x8100047D /* (Japanese keyboard) */ +#define DIKEYBOARD_ABNT_C2 0x8100047E /* Numpad . on Brazilian keyboard */ +#define DIKEYBOARD_NUMPADEQUALS 0x8100048D /* = on numeric keypad (NEC PC98) */ +#define DIKEYBOARD_PREVTRACK 0x81000490 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIKEYBOARD_AT 0x81000491 /* (NEC PC98) */ +#define DIKEYBOARD_COLON 0x81000492 /* (NEC PC98) */ +#define DIKEYBOARD_UNDERLINE 0x81000493 /* (NEC PC98) */ +#define DIKEYBOARD_KANJI 0x81000494 /* (Japanese keyboard) */ +#define DIKEYBOARD_STOP 0x81000495 /* (NEC PC98) */ +#define DIKEYBOARD_AX 0x81000496 /* (Japan AX) */ +#define DIKEYBOARD_UNLABELED 0x81000497 /* (J3100) */ +#define DIKEYBOARD_NEXTTRACK 0x81000499 /* Next Track */ +#define DIKEYBOARD_NUMPADENTER 0x8100049C /* Enter on numeric keypad */ +#define DIKEYBOARD_RCONTROL 0x8100049D +#define DIKEYBOARD_MUTE 0x810004A0 /* Mute */ +#define DIKEYBOARD_CALCULATOR 0x810004A1 /* Calculator */ +#define DIKEYBOARD_PLAYPAUSE 0x810004A2 /* Play / Pause */ +#define DIKEYBOARD_MEDIASTOP 0x810004A4 /* Media Stop */ +#define DIKEYBOARD_VOLUMEDOWN 0x810004AE /* Volume - */ +#define DIKEYBOARD_VOLUMEUP 0x810004B0 /* Volume + */ +#define DIKEYBOARD_WEBHOME 0x810004B2 /* Web home */ +#define DIKEYBOARD_NUMPADCOMMA 0x810004B3 /* , on numeric keypad (NEC PC98) */ +#define DIKEYBOARD_DIVIDE 0x810004B5 /* / on numeric keypad */ +#define DIKEYBOARD_SYSRQ 0x810004B7 +#define DIKEYBOARD_RMENU 0x810004B8 /* right Alt */ +#define DIKEYBOARD_PAUSE 0x810004C5 /* Pause */ +#define DIKEYBOARD_HOME 0x810004C7 /* Home on arrow keypad */ +#define DIKEYBOARD_UP 0x810004C8 /* UpArrow on arrow keypad */ +#define DIKEYBOARD_PRIOR 0x810004C9 /* PgUp on arrow keypad */ +#define DIKEYBOARD_LEFT 0x810004CB /* LeftArrow on arrow keypad */ +#define DIKEYBOARD_RIGHT 0x810004CD /* RightArrow on arrow keypad */ +#define DIKEYBOARD_END 0x810004CF /* End on arrow keypad */ +#define DIKEYBOARD_DOWN 0x810004D0 /* DownArrow on arrow keypad */ +#define DIKEYBOARD_NEXT 0x810004D1 /* PgDn on arrow keypad */ +#define DIKEYBOARD_INSERT 0x810004D2 /* Insert on arrow keypad */ +#define DIKEYBOARD_DELETE 0x810004D3 /* Delete on arrow keypad */ +#define DIKEYBOARD_LWIN 0x810004DB /* Left Windows key */ +#define DIKEYBOARD_RWIN 0x810004DC /* Right Windows key */ +#define DIKEYBOARD_APPS 0x810004DD /* AppMenu key */ +#define DIKEYBOARD_POWER 0x810004DE /* System Power */ +#define DIKEYBOARD_SLEEP 0x810004DF /* System Sleep */ +#define DIKEYBOARD_WAKE 0x810004E3 /* System Wake */ +#define DIKEYBOARD_WEBSEARCH 0x810004E5 /* Web Search */ +#define DIKEYBOARD_WEBFAVORITES 0x810004E6 /* Web Favorites */ +#define DIKEYBOARD_WEBREFRESH 0x810004E7 /* Web Refresh */ +#define DIKEYBOARD_WEBSTOP 0x810004E8 /* Web Stop */ +#define DIKEYBOARD_WEBFORWARD 0x810004E9 /* Web Forward */ +#define DIKEYBOARD_WEBBACK 0x810004EA /* Web Back */ +#define DIKEYBOARD_MYCOMPUTER 0x810004EB /* My Computer */ +#define DIKEYBOARD_MAIL 0x810004EC /* Mail */ +#define DIKEYBOARD_MEDIASELECT 0x810004ED /* Media Select */ + + +/*--- MOUSE + Physical Mouse Device ---*/ + +#define DIMOUSE_XAXISAB (0x82000200 |DIMOFS_X ) /* X Axis-absolute: Some mice natively report absolute coordinates */ +#define DIMOUSE_YAXISAB (0x82000200 |DIMOFS_Y ) /* Y Axis-absolute: Some mice natively report absolute coordinates */ +#define DIMOUSE_XAXIS (0x82000300 |DIMOFS_X ) /* X Axis */ +#define DIMOUSE_YAXIS (0x82000300 |DIMOFS_Y ) /* Y Axis */ +#define DIMOUSE_WHEEL (0x82000300 |DIMOFS_Z ) /* Z Axis */ +#define DIMOUSE_BUTTON0 (0x82000400 |DIMOFS_BUTTON0) /* Button 0 */ +#define DIMOUSE_BUTTON1 (0x82000400 |DIMOFS_BUTTON1) /* Button 1 */ +#define DIMOUSE_BUTTON2 (0x82000400 |DIMOFS_BUTTON2) /* Button 2 */ +#define DIMOUSE_BUTTON3 (0x82000400 |DIMOFS_BUTTON3) /* Button 3 */ +#define DIMOUSE_BUTTON4 (0x82000400 |DIMOFS_BUTTON4) /* Button 4 */ +#define DIMOUSE_BUTTON5 (0x82000400 |DIMOFS_BUTTON5) /* Button 5 */ +#define DIMOUSE_BUTTON6 (0x82000400 |DIMOFS_BUTTON6) /* Button 6 */ +#define DIMOUSE_BUTTON7 (0x82000400 |DIMOFS_BUTTON7) /* Button 7 */ + + +/*--- VOICE + Physical Dplay Voice Device ---*/ + +#define DIVOICE_CHANNEL1 0x83000401 +#define DIVOICE_CHANNEL2 0x83000402 +#define DIVOICE_CHANNEL3 0x83000403 +#define DIVOICE_CHANNEL4 0x83000404 +#define DIVOICE_CHANNEL5 0x83000405 +#define DIVOICE_CHANNEL6 0x83000406 +#define DIVOICE_CHANNEL7 0x83000407 +#define DIVOICE_CHANNEL8 0x83000408 +#define DIVOICE_TEAM 0x83000409 +#define DIVOICE_ALL 0x8300040A +#define DIVOICE_RECORDMUTE 0x8300040B +#define DIVOICE_PLAYBACKMUTE 0x8300040C +#define DIVOICE_TRANSMIT 0x8300040D + +#define DIVOICE_VOICECOMMAND 0x83000410 + + +/*--- Driving Simulator - Racing + Vehicle control is primary objective ---*/ +#define DIVIRTUAL_DRIVING_RACE 0x01000000 +#define DIAXIS_DRIVINGR_STEER 0x01008A01 /* Steering */ +#define DIAXIS_DRIVINGR_ACCELERATE 0x01039202 /* Accelerate */ +#define DIAXIS_DRIVINGR_BRAKE 0x01041203 /* Brake-Axis */ +#define DIBUTTON_DRIVINGR_SHIFTUP 0x01000C01 /* Shift to next higher gear */ +#define DIBUTTON_DRIVINGR_SHIFTDOWN 0x01000C02 /* Shift to next lower gear */ +#define DIBUTTON_DRIVINGR_VIEW 0x01001C03 /* Cycle through view options */ +#define DIBUTTON_DRIVINGR_MENU 0x010004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_DRIVINGR_ACCEL_AND_BRAKE 0x01014A04 /* Some devices combine accelerate and brake in a single axis */ +#define DIHATSWITCH_DRIVINGR_GLANCE 0x01004601 /* Look around */ +#define DIBUTTON_DRIVINGR_BRAKE 0x01004C04 /* Brake-button */ +#define DIBUTTON_DRIVINGR_DASHBOARD 0x01004405 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGR_AIDS 0x01004406 /* Driver correction aids */ +#define DIBUTTON_DRIVINGR_MAP 0x01004407 /* Display Driving Map */ +#define DIBUTTON_DRIVINGR_BOOST 0x01004408 /* Turbo Boost */ +#define DIBUTTON_DRIVINGR_PIT 0x01004409 /* Pit stop notification */ +#define DIBUTTON_DRIVINGR_ACCELERATE_LINK 0x0103D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGR_STEER_LEFT_LINK 0x0100CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGR_STEER_RIGHT_LINK 0x0100CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGR_GLANCE_LEFT_LINK 0x0107C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGR_GLANCE_RIGHT_LINK 0x0107C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGR_DEVICE 0x010044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGR_PAUSE 0x010044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Combat + Combat from within a vehicle is primary objective ---*/ +#define DIVIRTUAL_DRIVING_COMBAT 0x02000000 +#define DIAXIS_DRIVINGC_STEER 0x02008A01 /* Steering */ +#define DIAXIS_DRIVINGC_ACCELERATE 0x02039202 /* Accelerate */ +#define DIAXIS_DRIVINGC_BRAKE 0x02041203 /* Brake-axis */ +#define DIBUTTON_DRIVINGC_FIRE 0x02000C01 /* Fire */ +#define DIBUTTON_DRIVINGC_WEAPONS 0x02000C02 /* Select next weapon */ +#define DIBUTTON_DRIVINGC_TARGET 0x02000C03 /* Select next available target */ +#define DIBUTTON_DRIVINGC_MENU 0x020004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_DRIVINGC_ACCEL_AND_BRAKE 0x02014A04 /* Some devices combine accelerate and brake in a single axis */ +#define DIHATSWITCH_DRIVINGC_GLANCE 0x02004601 /* Look around */ +#define DIBUTTON_DRIVINGC_SHIFTUP 0x02004C04 /* Shift to next higher gear */ +#define DIBUTTON_DRIVINGC_SHIFTDOWN 0x02004C05 /* Shift to next lower gear */ +#define DIBUTTON_DRIVINGC_DASHBOARD 0x02004406 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGC_AIDS 0x02004407 /* Driver correction aids */ +#define DIBUTTON_DRIVINGC_BRAKE 0x02004C08 /* Brake-button */ +#define DIBUTTON_DRIVINGC_FIRESECONDARY 0x02004C09 /* Alternative fire button */ +#define DIBUTTON_DRIVINGC_ACCELERATE_LINK 0x0203D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGC_STEER_LEFT_LINK 0x0200CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGC_STEER_RIGHT_LINK 0x0200CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGC_GLANCE_LEFT_LINK 0x0207C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGC_GLANCE_RIGHT_LINK 0x0207C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGC_DEVICE 0x020044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGC_PAUSE 0x020044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Tank + Combat from withing a tank is primary objective ---*/ +#define DIVIRTUAL_DRIVING_TANK 0x03000000 +#define DIAXIS_DRIVINGT_STEER 0x03008A01 /* Turn tank left / right */ +#define DIAXIS_DRIVINGT_BARREL 0x03010202 /* Raise / lower barrel */ +#define DIAXIS_DRIVINGT_ACCELERATE 0x03039203 /* Accelerate */ +#define DIAXIS_DRIVINGT_ROTATE 0x03020204 /* Turn barrel left / right */ +#define DIBUTTON_DRIVINGT_FIRE 0x03000C01 /* Fire */ +#define DIBUTTON_DRIVINGT_WEAPONS 0x03000C02 /* Select next weapon */ +#define DIBUTTON_DRIVINGT_TARGET 0x03000C03 /* Selects next available target */ +#define DIBUTTON_DRIVINGT_MENU 0x030004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_DRIVINGT_GLANCE 0x03004601 /* Look around */ +#define DIAXIS_DRIVINGT_BRAKE 0x03045205 /* Brake-axis */ +#define DIAXIS_DRIVINGT_ACCEL_AND_BRAKE 0x03014A06 /* Some devices combine accelerate and brake in a single axis */ +#define DIBUTTON_DRIVINGT_VIEW 0x03005C04 /* Cycle through view options */ +#define DIBUTTON_DRIVINGT_DASHBOARD 0x03005C05 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGT_BRAKE 0x03004C06 /* Brake-button */ +#define DIBUTTON_DRIVINGT_FIRESECONDARY 0x03004C07 /* Alternative fire button */ +#define DIBUTTON_DRIVINGT_ACCELERATE_LINK 0x0303D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGT_STEER_LEFT_LINK 0x0300CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGT_STEER_RIGHT_LINK 0x0300CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGT_BARREL_UP_LINK 0x030144E0 /* Fallback Barrel up button */ +#define DIBUTTON_DRIVINGT_BARREL_DOWN_LINK 0x030144E8 /* Fallback Barrel down button */ +#define DIBUTTON_DRIVINGT_ROTATE_LEFT_LINK 0x030244E4 /* Fallback Rotate left button */ +#define DIBUTTON_DRIVINGT_ROTATE_RIGHT_LINK 0x030244EC /* Fallback Rotate right button */ +#define DIBUTTON_DRIVINGT_GLANCE_LEFT_LINK 0x0307C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGT_GLANCE_RIGHT_LINK 0x0307C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGT_DEVICE 0x030044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGT_PAUSE 0x030044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Civilian + Plane control is the primary objective ---*/ +#define DIVIRTUAL_FLYING_CIVILIAN 0x04000000 +#define DIAXIS_FLYINGC_BANK 0x04008A01 /* Roll ship left / right */ +#define DIAXIS_FLYINGC_PITCH 0x04010A02 /* Nose up / down */ +#define DIAXIS_FLYINGC_THROTTLE 0x04039203 /* Throttle */ +#define DIBUTTON_FLYINGC_VIEW 0x04002401 /* Cycle through view options */ +#define DIBUTTON_FLYINGC_DISPLAY 0x04002402 /* Select next dashboard / heads up display option */ +#define DIBUTTON_FLYINGC_GEAR 0x04002C03 /* Gear up / down */ +#define DIBUTTON_FLYINGC_MENU 0x040004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGC_GLANCE 0x04004601 /* Look around */ +#define DIAXIS_FLYINGC_BRAKE 0x04046A04 /* Apply Brake */ +#define DIAXIS_FLYINGC_RUDDER 0x04025205 /* Yaw ship left/right */ +#define DIAXIS_FLYINGC_FLAPS 0x04055A06 /* Flaps */ +#define DIBUTTON_FLYINGC_FLAPSUP 0x04006404 /* Increment stepping up until fully retracted */ +#define DIBUTTON_FLYINGC_FLAPSDOWN 0x04006405 /* Decrement stepping down until fully extended */ +#define DIBUTTON_FLYINGC_BRAKE_LINK 0x04046CE0 /* Fallback brake button */ +#define DIBUTTON_FLYINGC_FASTER_LINK 0x0403D4E0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGC_SLOWER_LINK 0x0403D4E8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGC_GLANCE_LEFT_LINK 0x0407C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGC_GLANCE_RIGHT_LINK 0x0407C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGC_GLANCE_UP_LINK 0x0407C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGC_GLANCE_DOWN_LINK 0x0407C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGC_DEVICE 0x040044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGC_PAUSE 0x040044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Military + Aerial combat is the primary objective ---*/ +#define DIVIRTUAL_FLYING_MILITARY 0x05000000 +#define DIAXIS_FLYINGM_BANK 0x05008A01 /* Bank - Roll ship left / right */ +#define DIAXIS_FLYINGM_PITCH 0x05010A02 /* Pitch - Nose up / down */ +#define DIAXIS_FLYINGM_THROTTLE 0x05039203 /* Throttle - faster / slower */ +#define DIBUTTON_FLYINGM_FIRE 0x05000C01 /* Fire */ +#define DIBUTTON_FLYINGM_WEAPONS 0x05000C02 /* Select next weapon */ +#define DIBUTTON_FLYINGM_TARGET 0x05000C03 /* Selects next available target */ +#define DIBUTTON_FLYINGM_MENU 0x050004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGM_GLANCE 0x05004601 /* Look around */ +#define DIBUTTON_FLYINGM_COUNTER 0x05005C04 /* Activate counter measures */ +#define DIAXIS_FLYINGM_RUDDER 0x05024A04 /* Rudder - Yaw ship left/right */ +#define DIAXIS_FLYINGM_BRAKE 0x05046205 /* Brake-axis */ +#define DIBUTTON_FLYINGM_VIEW 0x05006405 /* Cycle through view options */ +#define DIBUTTON_FLYINGM_DISPLAY 0x05006406 /* Select next dashboard option */ +#define DIAXIS_FLYINGM_FLAPS 0x05055206 /* Flaps */ +#define DIBUTTON_FLYINGM_FLAPSUP 0x05005407 /* Increment stepping up until fully retracted */ +#define DIBUTTON_FLYINGM_FLAPSDOWN 0x05005408 /* Decrement stepping down until fully extended */ +#define DIBUTTON_FLYINGM_FIRESECONDARY 0x05004C09 /* Alternative fire button */ +#define DIBUTTON_FLYINGM_GEAR 0x0500640A /* Gear up / down */ +#define DIBUTTON_FLYINGM_BRAKE_LINK 0x050464E0 /* Fallback brake button */ +#define DIBUTTON_FLYINGM_FASTER_LINK 0x0503D4E0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGM_SLOWER_LINK 0x0503D4E8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGM_GLANCE_LEFT_LINK 0x0507C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGM_GLANCE_RIGHT_LINK 0x0507C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGM_GLANCE_UP_LINK 0x0507C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGM_GLANCE_DOWN_LINK 0x0507C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGM_DEVICE 0x050044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGM_PAUSE 0x050044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Combat Helicopter + Combat from helicopter is primary objective ---*/ +#define DIVIRTUAL_FLYING_HELICOPTER 0x06000000 +#define DIAXIS_FLYINGH_BANK 0x06008A01 /* Bank - Roll ship left / right */ +#define DIAXIS_FLYINGH_PITCH 0x06010A02 /* Pitch - Nose up / down */ +#define DIAXIS_FLYINGH_COLLECTIVE 0x06018A03 /* Collective - Blade pitch/power */ +#define DIBUTTON_FLYINGH_FIRE 0x06001401 /* Fire */ +#define DIBUTTON_FLYINGH_WEAPONS 0x06001402 /* Select next weapon */ +#define DIBUTTON_FLYINGH_TARGET 0x06001403 /* Selects next available target */ +#define DIBUTTON_FLYINGH_MENU 0x060004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGH_GLANCE 0x06004601 /* Look around */ +#define DIAXIS_FLYINGH_TORQUE 0x06025A04 /* Torque - Rotate ship around left / right axis */ +#define DIAXIS_FLYINGH_THROTTLE 0x0603DA05 /* Throttle */ +#define DIBUTTON_FLYINGH_COUNTER 0x06005404 /* Activate counter measures */ +#define DIBUTTON_FLYINGH_VIEW 0x06006405 /* Cycle through view options */ +#define DIBUTTON_FLYINGH_GEAR 0x06006406 /* Gear up / down */ +#define DIBUTTON_FLYINGH_FIRESECONDARY 0x06004C07 /* Alternative fire button */ +#define DIBUTTON_FLYINGH_FASTER_LINK 0x0603DCE0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGH_SLOWER_LINK 0x0603DCE8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGH_GLANCE_LEFT_LINK 0x0607C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGH_GLANCE_RIGHT_LINK 0x0607C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGH_GLANCE_UP_LINK 0x0607C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGH_GLANCE_DOWN_LINK 0x0607C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGH_DEVICE 0x060044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGH_PAUSE 0x060044FC /* Start / Pause / Restart game */ + +/*--- Space Simulator - Combat + Space Simulator with weapons ---*/ +#define DIVIRTUAL_SPACESIM 0x07000000 +#define DIAXIS_SPACESIM_LATERAL 0x07008201 /* Move ship left / right */ +#define DIAXIS_SPACESIM_MOVE 0x07010202 /* Move ship forward/backward */ +#define DIAXIS_SPACESIM_THROTTLE 0x07038203 /* Throttle - Engine speed */ +#define DIBUTTON_SPACESIM_FIRE 0x07000401 /* Fire */ +#define DIBUTTON_SPACESIM_WEAPONS 0x07000402 /* Select next weapon */ +#define DIBUTTON_SPACESIM_TARGET 0x07000403 /* Selects next available target */ +#define DIBUTTON_SPACESIM_MENU 0x070004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SPACESIM_GLANCE 0x07004601 /* Look around */ +#define DIAXIS_SPACESIM_CLIMB 0x0701C204 /* Climb - Pitch ship up/down */ +#define DIAXIS_SPACESIM_ROTATE 0x07024205 /* Rotate - Turn ship left/right */ +#define DIBUTTON_SPACESIM_VIEW 0x07004404 /* Cycle through view options */ +#define DIBUTTON_SPACESIM_DISPLAY 0x07004405 /* Select next dashboard / heads up display option */ +#define DIBUTTON_SPACESIM_RAISE 0x07004406 /* Raise ship while maintaining current pitch */ +#define DIBUTTON_SPACESIM_LOWER 0x07004407 /* Lower ship while maintaining current pitch */ +#define DIBUTTON_SPACESIM_GEAR 0x07004408 /* Gear up / down */ +#define DIBUTTON_SPACESIM_FIRESECONDARY 0x07004409 /* Alternative fire button */ +#define DIBUTTON_SPACESIM_LEFT_LINK 0x0700C4E4 /* Fallback move left button */ +#define DIBUTTON_SPACESIM_RIGHT_LINK 0x0700C4EC /* Fallback move right button */ +#define DIBUTTON_SPACESIM_FORWARD_LINK 0x070144E0 /* Fallback move forward button */ +#define DIBUTTON_SPACESIM_BACKWARD_LINK 0x070144E8 /* Fallback move backwards button */ +#define DIBUTTON_SPACESIM_FASTER_LINK 0x0703C4E0 /* Fallback throttle up button */ +#define DIBUTTON_SPACESIM_SLOWER_LINK 0x0703C4E8 /* Fallback throttle down button */ +#define DIBUTTON_SPACESIM_TURN_LEFT_LINK 0x070244E4 /* Fallback turn left button */ +#define DIBUTTON_SPACESIM_TURN_RIGHT_LINK 0x070244EC /* Fallback turn right button */ +#define DIBUTTON_SPACESIM_GLANCE_LEFT_LINK 0x0707C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_SPACESIM_GLANCE_RIGHT_LINK 0x0707C4EC /* Fallback Glance Right button */ +#define DIBUTTON_SPACESIM_GLANCE_UP_LINK 0x0707C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_SPACESIM_GLANCE_DOWN_LINK 0x0707C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_SPACESIM_DEVICE 0x070044FE /* Show input device and controls */ +#define DIBUTTON_SPACESIM_PAUSE 0x070044FC /* Start / Pause / Restart game */ + +/*--- Fighting - First Person + Hand to Hand combat is primary objective ---*/ +#define DIVIRTUAL_FIGHTING_HAND2HAND 0x08000000 +#define DIAXIS_FIGHTINGH_LATERAL 0x08008201 /* Sidestep left/right */ +#define DIAXIS_FIGHTINGH_MOVE 0x08010202 /* Move forward/backward */ +#define DIBUTTON_FIGHTINGH_PUNCH 0x08000401 /* Punch */ +#define DIBUTTON_FIGHTINGH_KICK 0x08000402 /* Kick */ +#define DIBUTTON_FIGHTINGH_BLOCK 0x08000403 /* Block */ +#define DIBUTTON_FIGHTINGH_CROUCH 0x08000404 /* Crouch */ +#define DIBUTTON_FIGHTINGH_JUMP 0x08000405 /* Jump */ +#define DIBUTTON_FIGHTINGH_SPECIAL1 0x08000406 /* Apply first special move */ +#define DIBUTTON_FIGHTINGH_SPECIAL2 0x08000407 /* Apply second special move */ +#define DIBUTTON_FIGHTINGH_MENU 0x080004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FIGHTINGH_SELECT 0x08004408 /* Select special move */ +#define DIHATSWITCH_FIGHTINGH_SLIDE 0x08004601 /* Look around */ +#define DIBUTTON_FIGHTINGH_DISPLAY 0x08004409 /* Shows next on-screen display option */ +#define DIAXIS_FIGHTINGH_ROTATE 0x08024203 /* Rotate - Turn body left/right */ +#define DIBUTTON_FIGHTINGH_DODGE 0x0800440A /* Dodge */ +#define DIBUTTON_FIGHTINGH_LEFT_LINK 0x0800C4E4 /* Fallback left sidestep button */ +#define DIBUTTON_FIGHTINGH_RIGHT_LINK 0x0800C4EC /* Fallback right sidestep button */ +#define DIBUTTON_FIGHTINGH_FORWARD_LINK 0x080144E0 /* Fallback forward button */ +#define DIBUTTON_FIGHTINGH_BACKWARD_LINK 0x080144E8 /* Fallback backward button */ +#define DIBUTTON_FIGHTINGH_DEVICE 0x080044FE /* Show input device and controls */ +#define DIBUTTON_FIGHTINGH_PAUSE 0x080044FC /* Start / Pause / Restart game */ + +/*--- Fighting - First Person Shooting + Navigation and combat are primary objectives ---*/ +#define DIVIRTUAL_FIGHTING_FPS 0x09000000 +#define DIAXIS_FPS_ROTATE 0x09008201 /* Rotate character left/right */ +#define DIAXIS_FPS_MOVE 0x09010202 /* Move forward/backward */ +#define DIBUTTON_FPS_FIRE 0x09000401 /* Fire */ +#define DIBUTTON_FPS_WEAPONS 0x09000402 /* Select next weapon */ +#define DIBUTTON_FPS_APPLY 0x09000403 /* Use item */ +#define DIBUTTON_FPS_SELECT 0x09000404 /* Select next inventory item */ +#define DIBUTTON_FPS_CROUCH 0x09000405 /* Crouch/ climb down/ swim down */ +#define DIBUTTON_FPS_JUMP 0x09000406 /* Jump/ climb up/ swim up */ +#define DIAXIS_FPS_LOOKUPDOWN 0x09018203 /* Look up / down */ +#define DIBUTTON_FPS_STRAFE 0x09000407 /* Enable strafing while active */ +#define DIBUTTON_FPS_MENU 0x090004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FPS_GLANCE 0x09004601 /* Look around */ +#define DIBUTTON_FPS_DISPLAY 0x09004408 /* Shows next on-screen display option/ map */ +#define DIAXIS_FPS_SIDESTEP 0x09024204 /* Sidestep */ +#define DIBUTTON_FPS_DODGE 0x09004409 /* Dodge */ +#define DIBUTTON_FPS_GLANCEL 0x0900440A /* Glance Left */ +#define DIBUTTON_FPS_GLANCER 0x0900440B /* Glance Right */ +#define DIBUTTON_FPS_FIRESECONDARY 0x0900440C /* Alternative fire button */ +#define DIBUTTON_FPS_ROTATE_LEFT_LINK 0x0900C4E4 /* Fallback rotate left button */ +#define DIBUTTON_FPS_ROTATE_RIGHT_LINK 0x0900C4EC /* Fallback rotate right button */ +#define DIBUTTON_FPS_FORWARD_LINK 0x090144E0 /* Fallback forward button */ +#define DIBUTTON_FPS_BACKWARD_LINK 0x090144E8 /* Fallback backward button */ +#define DIBUTTON_FPS_GLANCE_UP_LINK 0x0901C4E0 /* Fallback look up button */ +#define DIBUTTON_FPS_GLANCE_DOWN_LINK 0x0901C4E8 /* Fallback look down button */ +#define DIBUTTON_FPS_STEP_LEFT_LINK 0x090244E4 /* Fallback step left button */ +#define DIBUTTON_FPS_STEP_RIGHT_LINK 0x090244EC /* Fallback step right button */ +#define DIBUTTON_FPS_DEVICE 0x090044FE /* Show input device and controls */ +#define DIBUTTON_FPS_PAUSE 0x090044FC /* Start / Pause / Restart game */ + +/*--- Fighting - Third Person action + Perspective of camera is behind the main character ---*/ +#define DIVIRTUAL_FIGHTING_THIRDPERSON 0x0A000000 +#define DIAXIS_TPS_TURN 0x0A020201 /* Turn left/right */ +#define DIAXIS_TPS_MOVE 0x0A010202 /* Move forward/backward */ +#define DIBUTTON_TPS_RUN 0x0A000401 /* Run or walk toggle switch */ +#define DIBUTTON_TPS_ACTION 0x0A000402 /* Action Button */ +#define DIBUTTON_TPS_SELECT 0x0A000403 /* Select next weapon */ +#define DIBUTTON_TPS_USE 0x0A000404 /* Use inventory item currently selected */ +#define DIBUTTON_TPS_JUMP 0x0A000405 /* Character Jumps */ +#define DIBUTTON_TPS_MENU 0x0A0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_TPS_GLANCE 0x0A004601 /* Look around */ +#define DIBUTTON_TPS_VIEW 0x0A004406 /* Select camera view */ +#define DIBUTTON_TPS_STEPLEFT 0x0A004407 /* Character takes a left step */ +#define DIBUTTON_TPS_STEPRIGHT 0x0A004408 /* Character takes a right step */ +#define DIAXIS_TPS_STEP 0x0A00C203 /* Character steps left/right */ +#define DIBUTTON_TPS_DODGE 0x0A004409 /* Character dodges or ducks */ +#define DIBUTTON_TPS_INVENTORY 0x0A00440A /* Cycle through inventory */ +#define DIBUTTON_TPS_TURN_LEFT_LINK 0x0A0244E4 /* Fallback turn left button */ +#define DIBUTTON_TPS_TURN_RIGHT_LINK 0x0A0244EC /* Fallback turn right button */ +#define DIBUTTON_TPS_FORWARD_LINK 0x0A0144E0 /* Fallback forward button */ +#define DIBUTTON_TPS_BACKWARD_LINK 0x0A0144E8 /* Fallback backward button */ +#define DIBUTTON_TPS_GLANCE_UP_LINK 0x0A07C4E0 /* Fallback look up button */ +#define DIBUTTON_TPS_GLANCE_DOWN_LINK 0x0A07C4E8 /* Fallback look down button */ +#define DIBUTTON_TPS_GLANCE_LEFT_LINK 0x0A07C4E4 /* Fallback glance up button */ +#define DIBUTTON_TPS_GLANCE_RIGHT_LINK 0x0A07C4EC /* Fallback glance right button */ +#define DIBUTTON_TPS_DEVICE 0x0A0044FE /* Show input device and controls */ +#define DIBUTTON_TPS_PAUSE 0x0A0044FC /* Start / Pause / Restart game */ + +/*--- Strategy - Role Playing + Navigation and problem solving are primary actions ---*/ +#define DIVIRTUAL_STRATEGY_ROLEPLAYING 0x0B000000 +#define DIAXIS_STRATEGYR_LATERAL 0x0B008201 /* sidestep - left/right */ +#define DIAXIS_STRATEGYR_MOVE 0x0B010202 /* move forward/backward */ +#define DIBUTTON_STRATEGYR_GET 0x0B000401 /* Acquire item */ +#define DIBUTTON_STRATEGYR_APPLY 0x0B000402 /* Use selected item */ +#define DIBUTTON_STRATEGYR_SELECT 0x0B000403 /* Select nextitem */ +#define DIBUTTON_STRATEGYR_ATTACK 0x0B000404 /* Attack */ +#define DIBUTTON_STRATEGYR_CAST 0x0B000405 /* Cast Spell */ +#define DIBUTTON_STRATEGYR_CROUCH 0x0B000406 /* Crouch */ +#define DIBUTTON_STRATEGYR_JUMP 0x0B000407 /* Jump */ +#define DIBUTTON_STRATEGYR_MENU 0x0B0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_STRATEGYR_GLANCE 0x0B004601 /* Look around */ +#define DIBUTTON_STRATEGYR_MAP 0x0B004408 /* Cycle through map options */ +#define DIBUTTON_STRATEGYR_DISPLAY 0x0B004409 /* Shows next on-screen display option */ +#define DIAXIS_STRATEGYR_ROTATE 0x0B024203 /* Turn body left/right */ +#define DIBUTTON_STRATEGYR_LEFT_LINK 0x0B00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_STRATEGYR_RIGHT_LINK 0x0B00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_STRATEGYR_FORWARD_LINK 0x0B0144E0 /* Fallback move forward button */ +#define DIBUTTON_STRATEGYR_BACK_LINK 0x0B0144E8 /* Fallback move backward button */ +#define DIBUTTON_STRATEGYR_ROTATE_LEFT_LINK 0x0B0244E4 /* Fallback turn body left button */ +#define DIBUTTON_STRATEGYR_ROTATE_RIGHT_LINK 0x0B0244EC /* Fallback turn body right button */ +#define DIBUTTON_STRATEGYR_DEVICE 0x0B0044FE /* Show input device and controls */ +#define DIBUTTON_STRATEGYR_PAUSE 0x0B0044FC /* Start / Pause / Restart game */ + +/*--- Strategy - Turn based + Navigation and problem solving are primary actions ---*/ +#define DIVIRTUAL_STRATEGY_TURN 0x0C000000 +#define DIAXIS_STRATEGYT_LATERAL 0x0C008201 /* Sidestep left/right */ +#define DIAXIS_STRATEGYT_MOVE 0x0C010202 /* Move forward/backwards */ +#define DIBUTTON_STRATEGYT_SELECT 0x0C000401 /* Select unit or object */ +#define DIBUTTON_STRATEGYT_INSTRUCT 0x0C000402 /* Cycle through instructions */ +#define DIBUTTON_STRATEGYT_APPLY 0x0C000403 /* Apply selected instruction */ +#define DIBUTTON_STRATEGYT_TEAM 0x0C000404 /* Select next team / cycle through all */ +#define DIBUTTON_STRATEGYT_TURN 0x0C000405 /* Indicate turn over */ +#define DIBUTTON_STRATEGYT_MENU 0x0C0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_STRATEGYT_ZOOM 0x0C004406 /* Zoom - in / out */ +#define DIBUTTON_STRATEGYT_MAP 0x0C004407 /* cycle through map options */ +#define DIBUTTON_STRATEGYT_DISPLAY 0x0C004408 /* shows next on-screen display options */ +#define DIBUTTON_STRATEGYT_LEFT_LINK 0x0C00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_STRATEGYT_RIGHT_LINK 0x0C00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_STRATEGYT_FORWARD_LINK 0x0C0144E0 /* Fallback move forward button */ +#define DIBUTTON_STRATEGYT_BACK_LINK 0x0C0144E8 /* Fallback move back button */ +#define DIBUTTON_STRATEGYT_DEVICE 0x0C0044FE /* Show input device and controls */ +#define DIBUTTON_STRATEGYT_PAUSE 0x0C0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hunting + Hunting ---*/ +#define DIVIRTUAL_SPORTS_HUNTING 0x0D000000 +#define DIAXIS_HUNTING_LATERAL 0x0D008201 /* sidestep left/right */ +#define DIAXIS_HUNTING_MOVE 0x0D010202 /* move forward/backwards */ +#define DIBUTTON_HUNTING_FIRE 0x0D000401 /* Fire selected weapon */ +#define DIBUTTON_HUNTING_AIM 0x0D000402 /* Select aim/move */ +#define DIBUTTON_HUNTING_WEAPON 0x0D000403 /* Select next weapon */ +#define DIBUTTON_HUNTING_BINOCULAR 0x0D000404 /* Look through Binoculars */ +#define DIBUTTON_HUNTING_CALL 0x0D000405 /* Make animal call */ +#define DIBUTTON_HUNTING_MAP 0x0D000406 /* View Map */ +#define DIBUTTON_HUNTING_SPECIAL 0x0D000407 /* Special game operation */ +#define DIBUTTON_HUNTING_MENU 0x0D0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HUNTING_GLANCE 0x0D004601 /* Look around */ +#define DIBUTTON_HUNTING_DISPLAY 0x0D004408 /* show next on-screen display option */ +#define DIAXIS_HUNTING_ROTATE 0x0D024203 /* Turn body left/right */ +#define DIBUTTON_HUNTING_CROUCH 0x0D004409 /* Crouch/ Climb / Swim down */ +#define DIBUTTON_HUNTING_JUMP 0x0D00440A /* Jump/ Climb up / Swim up */ +#define DIBUTTON_HUNTING_FIRESECONDARY 0x0D00440B /* Alternative fire button */ +#define DIBUTTON_HUNTING_LEFT_LINK 0x0D00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HUNTING_RIGHT_LINK 0x0D00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HUNTING_FORWARD_LINK 0x0D0144E0 /* Fallback move forward button */ +#define DIBUTTON_HUNTING_BACK_LINK 0x0D0144E8 /* Fallback move back button */ +#define DIBUTTON_HUNTING_ROTATE_LEFT_LINK 0x0D0244E4 /* Fallback turn body left button */ +#define DIBUTTON_HUNTING_ROTATE_RIGHT_LINK 0x0D0244EC /* Fallback turn body right button */ +#define DIBUTTON_HUNTING_DEVICE 0x0D0044FE /* Show input device and controls */ +#define DIBUTTON_HUNTING_PAUSE 0x0D0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Fishing + Catching Fish is primary objective ---*/ +#define DIVIRTUAL_SPORTS_FISHING 0x0E000000 +#define DIAXIS_FISHING_LATERAL 0x0E008201 /* sidestep left/right */ +#define DIAXIS_FISHING_MOVE 0x0E010202 /* move forward/backwards */ +#define DIBUTTON_FISHING_CAST 0x0E000401 /* Cast line */ +#define DIBUTTON_FISHING_TYPE 0x0E000402 /* Select cast type */ +#define DIBUTTON_FISHING_BINOCULAR 0x0E000403 /* Look through Binocular */ +#define DIBUTTON_FISHING_BAIT 0x0E000404 /* Select type of Bait */ +#define DIBUTTON_FISHING_MAP 0x0E000405 /* View Map */ +#define DIBUTTON_FISHING_MENU 0x0E0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FISHING_GLANCE 0x0E004601 /* Look around */ +#define DIBUTTON_FISHING_DISPLAY 0x0E004406 /* Show next on-screen display option */ +#define DIAXIS_FISHING_ROTATE 0x0E024203 /* Turn character left / right */ +#define DIBUTTON_FISHING_CROUCH 0x0E004407 /* Crouch/ Climb / Swim down */ +#define DIBUTTON_FISHING_JUMP 0x0E004408 /* Jump/ Climb up / Swim up */ +#define DIBUTTON_FISHING_LEFT_LINK 0x0E00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FISHING_RIGHT_LINK 0x0E00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FISHING_FORWARD_LINK 0x0E0144E0 /* Fallback move forward button */ +#define DIBUTTON_FISHING_BACK_LINK 0x0E0144E8 /* Fallback move back button */ +#define DIBUTTON_FISHING_ROTATE_LEFT_LINK 0x0E0244E4 /* Fallback turn body left button */ +#define DIBUTTON_FISHING_ROTATE_RIGHT_LINK 0x0E0244EC /* Fallback turn body right button */ +#define DIBUTTON_FISHING_DEVICE 0x0E0044FE /* Show input device and controls */ +#define DIBUTTON_FISHING_PAUSE 0x0E0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Batting + Batter control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_BAT 0x0F000000 +#define DIAXIS_BASEBALLB_LATERAL 0x0F008201 /* Aim left / right */ +#define DIAXIS_BASEBALLB_MOVE 0x0F010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLB_SELECT 0x0F000401 /* cycle through swing options */ +#define DIBUTTON_BASEBALLB_NORMAL 0x0F000402 /* normal swing */ +#define DIBUTTON_BASEBALLB_POWER 0x0F000403 /* swing for the fence */ +#define DIBUTTON_BASEBALLB_BUNT 0x0F000404 /* bunt */ +#define DIBUTTON_BASEBALLB_STEAL 0x0F000405 /* Base runner attempts to steal a base */ +#define DIBUTTON_BASEBALLB_BURST 0x0F000406 /* Base runner invokes burst of speed */ +#define DIBUTTON_BASEBALLB_SLIDE 0x0F000407 /* Base runner slides into base */ +#define DIBUTTON_BASEBALLB_CONTACT 0x0F000408 /* Contact swing */ +#define DIBUTTON_BASEBALLB_MENU 0x0F0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLB_NOSTEAL 0x0F004409 /* Base runner goes back to a base */ +#define DIBUTTON_BASEBALLB_BOX 0x0F00440A /* Enter or exit batting box */ +#define DIBUTTON_BASEBALLB_LEFT_LINK 0x0F00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BASEBALLB_RIGHT_LINK 0x0F00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BASEBALLB_FORWARD_LINK 0x0F0144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLB_BACK_LINK 0x0F0144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLB_DEVICE 0x0F0044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLB_PAUSE 0x0F0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Pitching + Pitcher control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_PITCH 0x10000000 +#define DIAXIS_BASEBALLP_LATERAL 0x10008201 /* Aim left / right */ +#define DIAXIS_BASEBALLP_MOVE 0x10010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLP_SELECT 0x10000401 /* cycle through pitch selections */ +#define DIBUTTON_BASEBALLP_PITCH 0x10000402 /* throw pitch */ +#define DIBUTTON_BASEBALLP_BASE 0x10000403 /* select base to throw to */ +#define DIBUTTON_BASEBALLP_THROW 0x10000404 /* throw to base */ +#define DIBUTTON_BASEBALLP_FAKE 0x10000405 /* Fake a throw to a base */ +#define DIBUTTON_BASEBALLP_MENU 0x100004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLP_WALK 0x10004406 /* Throw intentional walk / pitch out */ +#define DIBUTTON_BASEBALLP_LOOK 0x10004407 /* Look at runners on bases */ +#define DIBUTTON_BASEBALLP_LEFT_LINK 0x1000C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BASEBALLP_RIGHT_LINK 0x1000C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BASEBALLP_FORWARD_LINK 0x100144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLP_BACK_LINK 0x100144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLP_DEVICE 0x100044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLP_PAUSE 0x100044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Fielding + Fielder control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_FIELD 0x11000000 +#define DIAXIS_BASEBALLF_LATERAL 0x11008201 /* Aim left / right */ +#define DIAXIS_BASEBALLF_MOVE 0x11010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLF_NEAREST 0x11000401 /* Switch to fielder nearest to the ball */ +#define DIBUTTON_BASEBALLF_THROW1 0x11000402 /* Make conservative throw */ +#define DIBUTTON_BASEBALLF_THROW2 0x11000403 /* Make aggressive throw */ +#define DIBUTTON_BASEBALLF_BURST 0x11000404 /* Invoke burst of speed */ +#define DIBUTTON_BASEBALLF_JUMP 0x11000405 /* Jump to catch ball */ +#define DIBUTTON_BASEBALLF_DIVE 0x11000406 /* Dive to catch ball */ +#define DIBUTTON_BASEBALLF_MENU 0x110004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLF_SHIFTIN 0x11004407 /* Shift the infield positioning */ +#define DIBUTTON_BASEBALLF_SHIFTOUT 0x11004408 /* Shift the outfield positioning */ +#define DIBUTTON_BASEBALLF_AIM_LEFT_LINK 0x1100C4E4 /* Fallback aim left button */ +#define DIBUTTON_BASEBALLF_AIM_RIGHT_LINK 0x1100C4EC /* Fallback aim right button */ +#define DIBUTTON_BASEBALLF_FORWARD_LINK 0x110144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLF_BACK_LINK 0x110144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLF_DEVICE 0x110044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLF_PAUSE 0x110044FC /* Start / Pause / Restart game */ + +/*--- Sports - Basketball - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_BASKETBALL_OFFENSE 0x12000000 +#define DIAXIS_BBALLO_LATERAL 0x12008201 /* left / right */ +#define DIAXIS_BBALLO_MOVE 0x12010202 /* up / down */ +#define DIBUTTON_BBALLO_SHOOT 0x12000401 /* shoot basket */ +#define DIBUTTON_BBALLO_DUNK 0x12000402 /* dunk basket */ +#define DIBUTTON_BBALLO_PASS 0x12000403 /* throw pass */ +#define DIBUTTON_BBALLO_FAKE 0x12000404 /* fake shot or pass */ +#define DIBUTTON_BBALLO_SPECIAL 0x12000405 /* apply special move */ +#define DIBUTTON_BBALLO_PLAYER 0x12000406 /* select next player */ +#define DIBUTTON_BBALLO_BURST 0x12000407 /* invoke burst */ +#define DIBUTTON_BBALLO_CALL 0x12000408 /* call for ball / pass to me */ +#define DIBUTTON_BBALLO_MENU 0x120004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BBALLO_GLANCE 0x12004601 /* scroll view */ +#define DIBUTTON_BBALLO_SCREEN 0x12004409 /* Call for screen */ +#define DIBUTTON_BBALLO_PLAY 0x1200440A /* Call for specific offensive play */ +#define DIBUTTON_BBALLO_JAB 0x1200440B /* Initiate fake drive to basket */ +#define DIBUTTON_BBALLO_POST 0x1200440C /* Perform post move */ +#define DIBUTTON_BBALLO_TIMEOUT 0x1200440D /* Time Out */ +#define DIBUTTON_BBALLO_SUBSTITUTE 0x1200440E /* substitute one player for another */ +#define DIBUTTON_BBALLO_LEFT_LINK 0x1200C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BBALLO_RIGHT_LINK 0x1200C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BBALLO_FORWARD_LINK 0x120144E0 /* Fallback move forward button */ +#define DIBUTTON_BBALLO_BACK_LINK 0x120144E8 /* Fallback move back button */ +#define DIBUTTON_BBALLO_DEVICE 0x120044FE /* Show input device and controls */ +#define DIBUTTON_BBALLO_PAUSE 0x120044FC /* Start / Pause / Restart game */ + +/*--- Sports - Basketball - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_BASKETBALL_DEFENSE 0x13000000 +#define DIAXIS_BBALLD_LATERAL 0x13008201 /* left / right */ +#define DIAXIS_BBALLD_MOVE 0x13010202 /* up / down */ +#define DIBUTTON_BBALLD_JUMP 0x13000401 /* jump to block shot */ +#define DIBUTTON_BBALLD_STEAL 0x13000402 /* attempt to steal ball */ +#define DIBUTTON_BBALLD_FAKE 0x13000403 /* fake block or steal */ +#define DIBUTTON_BBALLD_SPECIAL 0x13000404 /* apply special move */ +#define DIBUTTON_BBALLD_PLAYER 0x13000405 /* select next player */ +#define DIBUTTON_BBALLD_BURST 0x13000406 /* invoke burst */ +#define DIBUTTON_BBALLD_PLAY 0x13000407 /* call for specific defensive play */ +#define DIBUTTON_BBALLD_MENU 0x130004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BBALLD_GLANCE 0x13004601 /* scroll view */ +#define DIBUTTON_BBALLD_TIMEOUT 0x13004408 /* Time Out */ +#define DIBUTTON_BBALLD_SUBSTITUTE 0x13004409 /* substitute one player for another */ +#define DIBUTTON_BBALLD_LEFT_LINK 0x1300C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BBALLD_RIGHT_LINK 0x1300C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BBALLD_FORWARD_LINK 0x130144E0 /* Fallback move forward button */ +#define DIBUTTON_BBALLD_BACK_LINK 0x130144E8 /* Fallback move back button */ +#define DIBUTTON_BBALLD_DEVICE 0x130044FE /* Show input device and controls */ +#define DIBUTTON_BBALLD_PAUSE 0x130044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Play + Play selection ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_FIELD 0x14000000 +#define DIBUTTON_FOOTBALLP_PLAY 0x14000401 /* cycle through available plays */ +#define DIBUTTON_FOOTBALLP_SELECT 0x14000402 /* select play */ +#define DIBUTTON_FOOTBALLP_HELP 0x14000403 /* Bring up pop-up help */ +#define DIBUTTON_FOOTBALLP_MENU 0x140004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLP_DEVICE 0x140044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLP_PAUSE 0x140044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - QB + Offense: Quarterback / Kicker ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_QBCK 0x15000000 +#define DIAXIS_FOOTBALLQ_LATERAL 0x15008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLQ_MOVE 0x15010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLQ_SELECT 0x15000401 /* Select */ +#define DIBUTTON_FOOTBALLQ_SNAP 0x15000402 /* snap ball - start play */ +#define DIBUTTON_FOOTBALLQ_JUMP 0x15000403 /* jump over defender */ +#define DIBUTTON_FOOTBALLQ_SLIDE 0x15000404 /* Dive/Slide */ +#define DIBUTTON_FOOTBALLQ_PASS 0x15000405 /* throws pass to receiver */ +#define DIBUTTON_FOOTBALLQ_FAKE 0x15000406 /* pump fake pass or fake kick */ +#define DIBUTTON_FOOTBALLQ_MENU 0x150004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLQ_FAKESNAP 0x15004407 /* Fake snap */ +#define DIBUTTON_FOOTBALLQ_MOTION 0x15004408 /* Send receivers in motion */ +#define DIBUTTON_FOOTBALLQ_AUDIBLE 0x15004409 /* Change offensive play at line of scrimmage */ +#define DIBUTTON_FOOTBALLQ_LEFT_LINK 0x1500C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLQ_RIGHT_LINK 0x1500C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLQ_FORWARD_LINK 0x150144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLQ_BACK_LINK 0x150144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLQ_DEVICE 0x150044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLQ_PAUSE 0x150044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Offense + Offense - Runner ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_OFFENSE 0x16000000 +#define DIAXIS_FOOTBALLO_LATERAL 0x16008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLO_MOVE 0x16010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLO_JUMP 0x16000401 /* jump or hurdle over defender */ +#define DIBUTTON_FOOTBALLO_LEFTARM 0x16000402 /* holds out left arm */ +#define DIBUTTON_FOOTBALLO_RIGHTARM 0x16000403 /* holds out right arm */ +#define DIBUTTON_FOOTBALLO_THROW 0x16000404 /* throw pass or lateral ball to another runner */ +#define DIBUTTON_FOOTBALLO_SPIN 0x16000405 /* Spin to avoid defenders */ +#define DIBUTTON_FOOTBALLO_MENU 0x160004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLO_JUKE 0x16004406 /* Use special move to avoid defenders */ +#define DIBUTTON_FOOTBALLO_SHOULDER 0x16004407 /* Lower shoulder to run over defenders */ +#define DIBUTTON_FOOTBALLO_TURBO 0x16004408 /* Speed burst past defenders */ +#define DIBUTTON_FOOTBALLO_DIVE 0x16004409 /* Dive over defenders */ +#define DIBUTTON_FOOTBALLO_ZOOM 0x1600440A /* Zoom view in / out */ +#define DIBUTTON_FOOTBALLO_SUBSTITUTE 0x1600440B /* substitute one player for another */ +#define DIBUTTON_FOOTBALLO_LEFT_LINK 0x1600C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLO_RIGHT_LINK 0x1600C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLO_FORWARD_LINK 0x160144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLO_BACK_LINK 0x160144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLO_DEVICE 0x160044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLO_PAUSE 0x160044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_DEFENSE 0x17000000 +#define DIAXIS_FOOTBALLD_LATERAL 0x17008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLD_MOVE 0x17010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLD_PLAY 0x17000401 /* cycle through available plays */ +#define DIBUTTON_FOOTBALLD_SELECT 0x17000402 /* select player closest to the ball */ +#define DIBUTTON_FOOTBALLD_JUMP 0x17000403 /* jump to intercept or block */ +#define DIBUTTON_FOOTBALLD_TACKLE 0x17000404 /* tackler runner */ +#define DIBUTTON_FOOTBALLD_FAKE 0x17000405 /* hold down to fake tackle or intercept */ +#define DIBUTTON_FOOTBALLD_SUPERTACKLE 0x17000406 /* Initiate special tackle */ +#define DIBUTTON_FOOTBALLD_MENU 0x170004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLD_SPIN 0x17004407 /* Spin to beat offensive line */ +#define DIBUTTON_FOOTBALLD_SWIM 0x17004408 /* Swim to beat the offensive line */ +#define DIBUTTON_FOOTBALLD_BULLRUSH 0x17004409 /* Bull rush the offensive line */ +#define DIBUTTON_FOOTBALLD_RIP 0x1700440A /* Rip the offensive line */ +#define DIBUTTON_FOOTBALLD_AUDIBLE 0x1700440B /* Change defensive play at the line of scrimmage */ +#define DIBUTTON_FOOTBALLD_ZOOM 0x1700440C /* Zoom view in / out */ +#define DIBUTTON_FOOTBALLD_SUBSTITUTE 0x1700440D /* substitute one player for another */ +#define DIBUTTON_FOOTBALLD_LEFT_LINK 0x1700C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLD_RIGHT_LINK 0x1700C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLD_FORWARD_LINK 0x170144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLD_BACK_LINK 0x170144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLD_DEVICE 0x170044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLD_PAUSE 0x170044FC /* Start / Pause / Restart game */ + +/*--- Sports - Golf + ---*/ +#define DIVIRTUAL_SPORTS_GOLF 0x18000000 +#define DIAXIS_GOLF_LATERAL 0x18008201 /* Move / Aim: left / right */ +#define DIAXIS_GOLF_MOVE 0x18010202 /* Move / Aim: up / down */ +#define DIBUTTON_GOLF_SWING 0x18000401 /* swing club */ +#define DIBUTTON_GOLF_SELECT 0x18000402 /* cycle between: club / swing strength / ball arc / ball spin */ +#define DIBUTTON_GOLF_UP 0x18000403 /* increase selection */ +#define DIBUTTON_GOLF_DOWN 0x18000404 /* decrease selection */ +#define DIBUTTON_GOLF_TERRAIN 0x18000405 /* shows terrain detail */ +#define DIBUTTON_GOLF_FLYBY 0x18000406 /* view the hole via a flyby */ +#define DIBUTTON_GOLF_MENU 0x180004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_GOLF_SCROLL 0x18004601 /* scroll view */ +#define DIBUTTON_GOLF_ZOOM 0x18004407 /* Zoom view in / out */ +#define DIBUTTON_GOLF_TIMEOUT 0x18004408 /* Call for time out */ +#define DIBUTTON_GOLF_SUBSTITUTE 0x18004409 /* substitute one player for another */ +#define DIBUTTON_GOLF_LEFT_LINK 0x1800C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_GOLF_RIGHT_LINK 0x1800C4EC /* Fallback sidestep right button */ +#define DIBUTTON_GOLF_FORWARD_LINK 0x180144E0 /* Fallback move forward button */ +#define DIBUTTON_GOLF_BACK_LINK 0x180144E8 /* Fallback move back button */ +#define DIBUTTON_GOLF_DEVICE 0x180044FE /* Show input device and controls */ +#define DIBUTTON_GOLF_PAUSE 0x180044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_OFFENSE 0x19000000 +#define DIAXIS_HOCKEYO_LATERAL 0x19008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYO_MOVE 0x19010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYO_SHOOT 0x19000401 /* Shoot */ +#define DIBUTTON_HOCKEYO_PASS 0x19000402 /* pass the puck */ +#define DIBUTTON_HOCKEYO_BURST 0x19000403 /* invoke speed burst */ +#define DIBUTTON_HOCKEYO_SPECIAL 0x19000404 /* invoke special move */ +#define DIBUTTON_HOCKEYO_FAKE 0x19000405 /* hold down to fake pass or kick */ +#define DIBUTTON_HOCKEYO_MENU 0x190004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYO_SCROLL 0x19004601 /* scroll view */ +#define DIBUTTON_HOCKEYO_ZOOM 0x19004406 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYO_STRATEGY 0x19004407 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYO_TIMEOUT 0x19004408 /* Call for time out */ +#define DIBUTTON_HOCKEYO_SUBSTITUTE 0x19004409 /* substitute one player for another */ +#define DIBUTTON_HOCKEYO_LEFT_LINK 0x1900C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYO_RIGHT_LINK 0x1900C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYO_FORWARD_LINK 0x190144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYO_BACK_LINK 0x190144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYO_DEVICE 0x190044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYO_PAUSE 0x190044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_DEFENSE 0x1A000000 +#define DIAXIS_HOCKEYD_LATERAL 0x1A008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYD_MOVE 0x1A010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYD_PLAYER 0x1A000401 /* control player closest to the puck */ +#define DIBUTTON_HOCKEYD_STEAL 0x1A000402 /* attempt steal */ +#define DIBUTTON_HOCKEYD_BURST 0x1A000403 /* speed burst or body check */ +#define DIBUTTON_HOCKEYD_BLOCK 0x1A000404 /* block puck */ +#define DIBUTTON_HOCKEYD_FAKE 0x1A000405 /* hold down to fake tackle or intercept */ +#define DIBUTTON_HOCKEYD_MENU 0x1A0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYD_SCROLL 0x1A004601 /* scroll view */ +#define DIBUTTON_HOCKEYD_ZOOM 0x1A004406 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYD_STRATEGY 0x1A004407 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYD_TIMEOUT 0x1A004408 /* Call for time out */ +#define DIBUTTON_HOCKEYD_SUBSTITUTE 0x1A004409 /* substitute one player for another */ +#define DIBUTTON_HOCKEYD_LEFT_LINK 0x1A00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYD_RIGHT_LINK 0x1A00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYD_FORWARD_LINK 0x1A0144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYD_BACK_LINK 0x1A0144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYD_DEVICE 0x1A0044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYD_PAUSE 0x1A0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Goalie + Goal tending ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_GOALIE 0x1B000000 +#define DIAXIS_HOCKEYG_LATERAL 0x1B008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYG_MOVE 0x1B010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYG_PASS 0x1B000401 /* pass puck */ +#define DIBUTTON_HOCKEYG_POKE 0x1B000402 /* poke / check / hack */ +#define DIBUTTON_HOCKEYG_STEAL 0x1B000403 /* attempt steal */ +#define DIBUTTON_HOCKEYG_BLOCK 0x1B000404 /* block puck */ +#define DIBUTTON_HOCKEYG_MENU 0x1B0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYG_SCROLL 0x1B004601 /* scroll view */ +#define DIBUTTON_HOCKEYG_ZOOM 0x1B004405 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYG_STRATEGY 0x1B004406 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYG_TIMEOUT 0x1B004407 /* Call for time out */ +#define DIBUTTON_HOCKEYG_SUBSTITUTE 0x1B004408 /* substitute one player for another */ +#define DIBUTTON_HOCKEYG_LEFT_LINK 0x1B00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYG_RIGHT_LINK 0x1B00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYG_FORWARD_LINK 0x1B0144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYG_BACK_LINK 0x1B0144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYG_DEVICE 0x1B0044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYG_PAUSE 0x1B0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Mountain Biking + ---*/ +#define DIVIRTUAL_SPORTS_BIKING_MOUNTAIN 0x1C000000 +#define DIAXIS_BIKINGM_TURN 0x1C008201 /* left / right */ +#define DIAXIS_BIKINGM_PEDAL 0x1C010202 /* Pedal faster / slower / brake */ +#define DIBUTTON_BIKINGM_JUMP 0x1C000401 /* jump over obstacle */ +#define DIBUTTON_BIKINGM_CAMERA 0x1C000402 /* switch camera view */ +#define DIBUTTON_BIKINGM_SPECIAL1 0x1C000403 /* perform first special move */ +#define DIBUTTON_BIKINGM_SELECT 0x1C000404 /* Select */ +#define DIBUTTON_BIKINGM_SPECIAL2 0x1C000405 /* perform second special move */ +#define DIBUTTON_BIKINGM_MENU 0x1C0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BIKINGM_SCROLL 0x1C004601 /* scroll view */ +#define DIBUTTON_BIKINGM_ZOOM 0x1C004406 /* Zoom view in / out */ +#define DIAXIS_BIKINGM_BRAKE 0x1C044203 /* Brake axis */ +#define DIBUTTON_BIKINGM_LEFT_LINK 0x1C00C4E4 /* Fallback turn left button */ +#define DIBUTTON_BIKINGM_RIGHT_LINK 0x1C00C4EC /* Fallback turn right button */ +#define DIBUTTON_BIKINGM_FASTER_LINK 0x1C0144E0 /* Fallback pedal faster button */ +#define DIBUTTON_BIKINGM_SLOWER_LINK 0x1C0144E8 /* Fallback pedal slower button */ +#define DIBUTTON_BIKINGM_BRAKE_BUTTON_LINK 0x1C0444E8 /* Fallback brake button */ +#define DIBUTTON_BIKINGM_DEVICE 0x1C0044FE /* Show input device and controls */ +#define DIBUTTON_BIKINGM_PAUSE 0x1C0044FC /* Start / Pause / Restart game */ + +/*--- Sports: Skiing / Snowboarding / Skateboarding + ---*/ +#define DIVIRTUAL_SPORTS_SKIING 0x1D000000 +#define DIAXIS_SKIING_TURN 0x1D008201 /* left / right */ +#define DIAXIS_SKIING_SPEED 0x1D010202 /* faster / slower */ +#define DIBUTTON_SKIING_JUMP 0x1D000401 /* Jump */ +#define DIBUTTON_SKIING_CROUCH 0x1D000402 /* crouch down */ +#define DIBUTTON_SKIING_CAMERA 0x1D000403 /* switch camera view */ +#define DIBUTTON_SKIING_SPECIAL1 0x1D000404 /* perform first special move */ +#define DIBUTTON_SKIING_SELECT 0x1D000405 /* Select */ +#define DIBUTTON_SKIING_SPECIAL2 0x1D000406 /* perform second special move */ +#define DIBUTTON_SKIING_MENU 0x1D0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SKIING_GLANCE 0x1D004601 /* scroll view */ +#define DIBUTTON_SKIING_ZOOM 0x1D004407 /* Zoom view in / out */ +#define DIBUTTON_SKIING_LEFT_LINK 0x1D00C4E4 /* Fallback turn left button */ +#define DIBUTTON_SKIING_RIGHT_LINK 0x1D00C4EC /* Fallback turn right button */ +#define DIBUTTON_SKIING_FASTER_LINK 0x1D0144E0 /* Fallback increase speed button */ +#define DIBUTTON_SKIING_SLOWER_LINK 0x1D0144E8 /* Fallback decrease speed button */ +#define DIBUTTON_SKIING_DEVICE 0x1D0044FE /* Show input device and controls */ +#define DIBUTTON_SKIING_PAUSE 0x1D0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Soccer - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_SOCCER_OFFENSE 0x1E000000 +#define DIAXIS_SOCCERO_LATERAL 0x1E008201 /* Move / Aim: left / right */ +#define DIAXIS_SOCCERO_MOVE 0x1E010202 /* Move / Aim: up / down */ +#define DIAXIS_SOCCERO_BEND 0x1E018203 /* Bend to soccer shot/pass */ +#define DIBUTTON_SOCCERO_SHOOT 0x1E000401 /* Shoot the ball */ +#define DIBUTTON_SOCCERO_PASS 0x1E000402 /* Pass */ +#define DIBUTTON_SOCCERO_FAKE 0x1E000403 /* Fake */ +#define DIBUTTON_SOCCERO_PLAYER 0x1E000404 /* Select next player */ +#define DIBUTTON_SOCCERO_SPECIAL1 0x1E000405 /* Apply special move */ +#define DIBUTTON_SOCCERO_SELECT 0x1E000406 /* Select special move */ +#define DIBUTTON_SOCCERO_MENU 0x1E0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SOCCERO_GLANCE 0x1E004601 /* scroll view */ +#define DIBUTTON_SOCCERO_SUBSTITUTE 0x1E004407 /* Substitute one player for another */ +#define DIBUTTON_SOCCERO_SHOOTLOW 0x1E004408 /* Shoot the ball low */ +#define DIBUTTON_SOCCERO_SHOOTHIGH 0x1E004409 /* Shoot the ball high */ +#define DIBUTTON_SOCCERO_PASSTHRU 0x1E00440A /* Make a thru pass */ +#define DIBUTTON_SOCCERO_SPRINT 0x1E00440B /* Sprint / turbo boost */ +#define DIBUTTON_SOCCERO_CONTROL 0x1E00440C /* Obtain control of the ball */ +#define DIBUTTON_SOCCERO_HEAD 0x1E00440D /* Attempt to head the ball */ +#define DIBUTTON_SOCCERO_LEFT_LINK 0x1E00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_SOCCERO_RIGHT_LINK 0x1E00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_SOCCERO_FORWARD_LINK 0x1E0144E0 /* Fallback move forward button */ +#define DIBUTTON_SOCCERO_BACK_LINK 0x1E0144E8 /* Fallback move back button */ +#define DIBUTTON_SOCCERO_DEVICE 0x1E0044FE /* Show input device and controls */ +#define DIBUTTON_SOCCERO_PAUSE 0x1E0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Soccer - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_SOCCER_DEFENSE 0x1F000000 +#define DIAXIS_SOCCERD_LATERAL 0x1F008201 /* Move / Aim: left / right */ +#define DIAXIS_SOCCERD_MOVE 0x1F010202 /* Move / Aim: up / down */ +#define DIBUTTON_SOCCERD_BLOCK 0x1F000401 /* Attempt to block shot */ +#define DIBUTTON_SOCCERD_STEAL 0x1F000402 /* Attempt to steal ball */ +#define DIBUTTON_SOCCERD_FAKE 0x1F000403 /* Fake a block or a steal */ +#define DIBUTTON_SOCCERD_PLAYER 0x1F000404 /* Select next player */ +#define DIBUTTON_SOCCERD_SPECIAL 0x1F000405 /* Apply special move */ +#define DIBUTTON_SOCCERD_SELECT 0x1F000406 /* Select special move */ +#define DIBUTTON_SOCCERD_SLIDE 0x1F000407 /* Attempt a slide tackle */ +#define DIBUTTON_SOCCERD_MENU 0x1F0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SOCCERD_GLANCE 0x1F004601 /* scroll view */ +#define DIBUTTON_SOCCERD_FOUL 0x1F004408 /* Initiate a foul / hard-foul */ +#define DIBUTTON_SOCCERD_HEAD 0x1F004409 /* Attempt a Header */ +#define DIBUTTON_SOCCERD_CLEAR 0x1F00440A /* Attempt to clear the ball down the field */ +#define DIBUTTON_SOCCERD_GOALIECHARGE 0x1F00440B /* Make the goalie charge out of the box */ +#define DIBUTTON_SOCCERD_SUBSTITUTE 0x1F00440C /* Substitute one player for another */ +#define DIBUTTON_SOCCERD_LEFT_LINK 0x1F00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_SOCCERD_RIGHT_LINK 0x1F00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_SOCCERD_FORWARD_LINK 0x1F0144E0 /* Fallback move forward button */ +#define DIBUTTON_SOCCERD_BACK_LINK 0x1F0144E8 /* Fallback move back button */ +#define DIBUTTON_SOCCERD_DEVICE 0x1F0044FE /* Show input device and controls */ +#define DIBUTTON_SOCCERD_PAUSE 0x1F0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Racquet + Tennis - Table-Tennis - Squash ---*/ +#define DIVIRTUAL_SPORTS_RACQUET 0x20000000 +#define DIAXIS_RACQUET_LATERAL 0x20008201 /* Move / Aim: left / right */ +#define DIAXIS_RACQUET_MOVE 0x20010202 /* Move / Aim: up / down */ +#define DIBUTTON_RACQUET_SWING 0x20000401 /* Swing racquet */ +#define DIBUTTON_RACQUET_BACKSWING 0x20000402 /* Swing backhand */ +#define DIBUTTON_RACQUET_SMASH 0x20000403 /* Smash shot */ +#define DIBUTTON_RACQUET_SPECIAL 0x20000404 /* Special shot */ +#define DIBUTTON_RACQUET_SELECT 0x20000405 /* Select special shot */ +#define DIBUTTON_RACQUET_MENU 0x200004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_RACQUET_GLANCE 0x20004601 /* scroll view */ +#define DIBUTTON_RACQUET_TIMEOUT 0x20004406 /* Call for time out */ +#define DIBUTTON_RACQUET_SUBSTITUTE 0x20004407 /* Substitute one player for another */ +#define DIBUTTON_RACQUET_LEFT_LINK 0x2000C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_RACQUET_RIGHT_LINK 0x2000C4EC /* Fallback sidestep right button */ +#define DIBUTTON_RACQUET_FORWARD_LINK 0x200144E0 /* Fallback move forward button */ +#define DIBUTTON_RACQUET_BACK_LINK 0x200144E8 /* Fallback move back button */ +#define DIBUTTON_RACQUET_DEVICE 0x200044FE /* Show input device and controls */ +#define DIBUTTON_RACQUET_PAUSE 0x200044FC /* Start / Pause / Restart game */ + +/*--- Arcade- 2D + Side to Side movement ---*/ +#define DIVIRTUAL_ARCADE_SIDE2SIDE 0x21000000 +#define DIAXIS_ARCADES_LATERAL 0x21008201 /* left / right */ +#define DIAXIS_ARCADES_MOVE 0x21010202 /* up / down */ +#define DIBUTTON_ARCADES_THROW 0x21000401 /* throw object */ +#define DIBUTTON_ARCADES_CARRY 0x21000402 /* carry object */ +#define DIBUTTON_ARCADES_ATTACK 0x21000403 /* attack */ +#define DIBUTTON_ARCADES_SPECIAL 0x21000404 /* apply special move */ +#define DIBUTTON_ARCADES_SELECT 0x21000405 /* select special move */ +#define DIBUTTON_ARCADES_MENU 0x210004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_ARCADES_VIEW 0x21004601 /* scroll view left / right / up / down */ +#define DIBUTTON_ARCADES_LEFT_LINK 0x2100C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_ARCADES_RIGHT_LINK 0x2100C4EC /* Fallback sidestep right button */ +#define DIBUTTON_ARCADES_FORWARD_LINK 0x210144E0 /* Fallback move forward button */ +#define DIBUTTON_ARCADES_BACK_LINK 0x210144E8 /* Fallback move back button */ +#define DIBUTTON_ARCADES_VIEW_UP_LINK 0x2107C4E0 /* Fallback scroll view up button */ +#define DIBUTTON_ARCADES_VIEW_DOWN_LINK 0x2107C4E8 /* Fallback scroll view down button */ +#define DIBUTTON_ARCADES_VIEW_LEFT_LINK 0x2107C4E4 /* Fallback scroll view left button */ +#define DIBUTTON_ARCADES_VIEW_RIGHT_LINK 0x2107C4EC /* Fallback scroll view right button */ +#define DIBUTTON_ARCADES_DEVICE 0x210044FE /* Show input device and controls */ +#define DIBUTTON_ARCADES_PAUSE 0x210044FC /* Start / Pause / Restart game */ + +/*--- Arcade - Platform Game + Character moves around on screen ---*/ +#define DIVIRTUAL_ARCADE_PLATFORM 0x22000000 +#define DIAXIS_ARCADEP_LATERAL 0x22008201 /* Left / right */ +#define DIAXIS_ARCADEP_MOVE 0x22010202 /* Up / down */ +#define DIBUTTON_ARCADEP_JUMP 0x22000401 /* Jump */ +#define DIBUTTON_ARCADEP_FIRE 0x22000402 /* Fire */ +#define DIBUTTON_ARCADEP_CROUCH 0x22000403 /* Crouch */ +#define DIBUTTON_ARCADEP_SPECIAL 0x22000404 /* Apply special move */ +#define DIBUTTON_ARCADEP_SELECT 0x22000405 /* Select special move */ +#define DIBUTTON_ARCADEP_MENU 0x220004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_ARCADEP_VIEW 0x22004601 /* Scroll view */ +#define DIBUTTON_ARCADEP_FIRESECONDARY 0x22004406 /* Alternative fire button */ +#define DIBUTTON_ARCADEP_LEFT_LINK 0x2200C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_ARCADEP_RIGHT_LINK 0x2200C4EC /* Fallback sidestep right button */ +#define DIBUTTON_ARCADEP_FORWARD_LINK 0x220144E0 /* Fallback move forward button */ +#define DIBUTTON_ARCADEP_BACK_LINK 0x220144E8 /* Fallback move back button */ +#define DIBUTTON_ARCADEP_VIEW_UP_LINK 0x2207C4E0 /* Fallback scroll view up button */ +#define DIBUTTON_ARCADEP_VIEW_DOWN_LINK 0x2207C4E8 /* Fallback scroll view down button */ +#define DIBUTTON_ARCADEP_VIEW_LEFT_LINK 0x2207C4E4 /* Fallback scroll view left button */ +#define DIBUTTON_ARCADEP_VIEW_RIGHT_LINK 0x2207C4EC /* Fallback scroll view right button */ +#define DIBUTTON_ARCADEP_DEVICE 0x220044FE /* Show input device and controls */ +#define DIBUTTON_ARCADEP_PAUSE 0x220044FC /* Start / Pause / Restart game */ + +/*--- CAD - 2D Object Control + Controls to select and move objects in 2D ---*/ +#define DIVIRTUAL_CAD_2DCONTROL 0x23000000 +#define DIAXIS_2DCONTROL_LATERAL 0x23008201 /* Move view left / right */ +#define DIAXIS_2DCONTROL_MOVE 0x23010202 /* Move view up / down */ +#define DIAXIS_2DCONTROL_INOUT 0x23018203 /* Zoom - in / out */ +#define DIBUTTON_2DCONTROL_SELECT 0x23000401 /* Select Object */ +#define DIBUTTON_2DCONTROL_SPECIAL1 0x23000402 /* Do first special operation */ +#define DIBUTTON_2DCONTROL_SPECIAL 0x23000403 /* Select special operation */ +#define DIBUTTON_2DCONTROL_SPECIAL2 0x23000404 /* Do second special operation */ +#define DIBUTTON_2DCONTROL_MENU 0x230004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_2DCONTROL_HATSWITCH 0x23004601 /* Hat switch */ +#define DIAXIS_2DCONTROL_ROTATEZ 0x23024204 /* Rotate view clockwise / counterclockwise */ +#define DIBUTTON_2DCONTROL_DISPLAY 0x23004405 /* Shows next on-screen display options */ +#define DIBUTTON_2DCONTROL_DEVICE 0x230044FE /* Show input device and controls */ +#define DIBUTTON_2DCONTROL_PAUSE 0x230044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D object control + Controls to select and move objects within a 3D environment ---*/ +#define DIVIRTUAL_CAD_3DCONTROL 0x24000000 +#define DIAXIS_3DCONTROL_LATERAL 0x24008201 /* Move view left / right */ +#define DIAXIS_3DCONTROL_MOVE 0x24010202 /* Move view up / down */ +#define DIAXIS_3DCONTROL_INOUT 0x24018203 /* Zoom - in / out */ +#define DIBUTTON_3DCONTROL_SELECT 0x24000401 /* Select Object */ +#define DIBUTTON_3DCONTROL_SPECIAL1 0x24000402 /* Do first special operation */ +#define DIBUTTON_3DCONTROL_SPECIAL 0x24000403 /* Select special operation */ +#define DIBUTTON_3DCONTROL_SPECIAL2 0x24000404 /* Do second special operation */ +#define DIBUTTON_3DCONTROL_MENU 0x240004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_3DCONTROL_HATSWITCH 0x24004601 /* Hat switch */ +#define DIAXIS_3DCONTROL_ROTATEX 0x24034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_3DCONTROL_ROTATEY 0x2402C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_3DCONTROL_ROTATEZ 0x24024206 /* Rotate view left / right */ +#define DIBUTTON_3DCONTROL_DISPLAY 0x24004405 /* Show next on-screen display options */ +#define DIBUTTON_3DCONTROL_DEVICE 0x240044FE /* Show input device and controls */ +#define DIBUTTON_3DCONTROL_PAUSE 0x240044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D Navigation - Fly through + Controls for 3D modeling ---*/ +#define DIVIRTUAL_CAD_FLYBY 0x25000000 +#define DIAXIS_CADF_LATERAL 0x25008201 /* move view left / right */ +#define DIAXIS_CADF_MOVE 0x25010202 /* move view up / down */ +#define DIAXIS_CADF_INOUT 0x25018203 /* in / out */ +#define DIBUTTON_CADF_SELECT 0x25000401 /* Select Object */ +#define DIBUTTON_CADF_SPECIAL1 0x25000402 /* do first special operation */ +#define DIBUTTON_CADF_SPECIAL 0x25000403 /* Select special operation */ +#define DIBUTTON_CADF_SPECIAL2 0x25000404 /* do second special operation */ +#define DIBUTTON_CADF_MENU 0x250004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_CADF_HATSWITCH 0x25004601 /* Hat switch */ +#define DIAXIS_CADF_ROTATEX 0x25034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_CADF_ROTATEY 0x2502C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_CADF_ROTATEZ 0x25024206 /* Rotate view left / right */ +#define DIBUTTON_CADF_DISPLAY 0x25004405 /* shows next on-screen display options */ +#define DIBUTTON_CADF_DEVICE 0x250044FE /* Show input device and controls */ +#define DIBUTTON_CADF_PAUSE 0x250044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D Model Control + Controls for 3D modeling ---*/ +#define DIVIRTUAL_CAD_MODEL 0x26000000 +#define DIAXIS_CADM_LATERAL 0x26008201 /* move view left / right */ +#define DIAXIS_CADM_MOVE 0x26010202 /* move view up / down */ +#define DIAXIS_CADM_INOUT 0x26018203 /* in / out */ +#define DIBUTTON_CADM_SELECT 0x26000401 /* Select Object */ +#define DIBUTTON_CADM_SPECIAL1 0x26000402 /* do first special operation */ +#define DIBUTTON_CADM_SPECIAL 0x26000403 /* Select special operation */ +#define DIBUTTON_CADM_SPECIAL2 0x26000404 /* do second special operation */ +#define DIBUTTON_CADM_MENU 0x260004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_CADM_HATSWITCH 0x26004601 /* Hat switch */ +#define DIAXIS_CADM_ROTATEX 0x26034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_CADM_ROTATEY 0x2602C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_CADM_ROTATEZ 0x26024206 /* Rotate view left / right */ +#define DIBUTTON_CADM_DISPLAY 0x26004405 /* shows next on-screen display options */ +#define DIBUTTON_CADM_DEVICE 0x260044FE /* Show input device and controls */ +#define DIBUTTON_CADM_PAUSE 0x260044FC /* Start / Pause / Restart game */ + +/*--- Control - Media Equipment + Remote ---*/ +#define DIVIRTUAL_REMOTE_CONTROL 0x27000000 +#define DIAXIS_REMOTE_SLIDER 0x27050201 /* Slider for adjustment: volume / color / bass / etc */ +#define DIBUTTON_REMOTE_MUTE 0x27000401 /* Set volume on current device to zero */ +#define DIBUTTON_REMOTE_SELECT 0x27000402 /* Next/previous: channel/ track / chapter / picture / station */ +#define DIBUTTON_REMOTE_PLAY 0x27002403 /* Start or pause entertainment on current device */ +#define DIBUTTON_REMOTE_CUE 0x27002404 /* Move through current media */ +#define DIBUTTON_REMOTE_REVIEW 0x27002405 /* Move through current media */ +#define DIBUTTON_REMOTE_CHANGE 0x27002406 /* Select next device */ +#define DIBUTTON_REMOTE_RECORD 0x27002407 /* Start recording the current media */ +#define DIBUTTON_REMOTE_MENU 0x270004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_REMOTE_SLIDER2 0x27054202 /* Slider for adjustment: volume */ +#define DIBUTTON_REMOTE_TV 0x27005C08 /* Select TV */ +#define DIBUTTON_REMOTE_CABLE 0x27005C09 /* Select cable box */ +#define DIBUTTON_REMOTE_CD 0x27005C0A /* Select CD player */ +#define DIBUTTON_REMOTE_VCR 0x27005C0B /* Select VCR */ +#define DIBUTTON_REMOTE_TUNER 0x27005C0C /* Select tuner */ +#define DIBUTTON_REMOTE_DVD 0x27005C0D /* Select DVD player */ +#define DIBUTTON_REMOTE_ADJUST 0x27005C0E /* Enter device adjustment menu */ +#define DIBUTTON_REMOTE_DIGIT0 0x2700540F /* Digit 0 */ +#define DIBUTTON_REMOTE_DIGIT1 0x27005410 /* Digit 1 */ +#define DIBUTTON_REMOTE_DIGIT2 0x27005411 /* Digit 2 */ +#define DIBUTTON_REMOTE_DIGIT3 0x27005412 /* Digit 3 */ +#define DIBUTTON_REMOTE_DIGIT4 0x27005413 /* Digit 4 */ +#define DIBUTTON_REMOTE_DIGIT5 0x27005414 /* Digit 5 */ +#define DIBUTTON_REMOTE_DIGIT6 0x27005415 /* Digit 6 */ +#define DIBUTTON_REMOTE_DIGIT7 0x27005416 /* Digit 7 */ +#define DIBUTTON_REMOTE_DIGIT8 0x27005417 /* Digit 8 */ +#define DIBUTTON_REMOTE_DIGIT9 0x27005418 /* Digit 9 */ +#define DIBUTTON_REMOTE_DEVICE 0x270044FE /* Show input device and controls */ +#define DIBUTTON_REMOTE_PAUSE 0x270044FC /* Start / Pause / Restart game */ + +/*--- Control- Web + Help or Browser ---*/ +#define DIVIRTUAL_BROWSER_CONTROL 0x28000000 +#define DIAXIS_BROWSER_LATERAL 0x28008201 /* Move on screen pointer */ +#define DIAXIS_BROWSER_MOVE 0x28010202 /* Move on screen pointer */ +#define DIBUTTON_BROWSER_SELECT 0x28000401 /* Select current item */ +#define DIAXIS_BROWSER_VIEW 0x28018203 /* Move view up/down */ +#define DIBUTTON_BROWSER_REFRESH 0x28000402 /* Refresh */ +#define DIBUTTON_BROWSER_MENU 0x280004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BROWSER_SEARCH 0x28004403 /* Use search tool */ +#define DIBUTTON_BROWSER_STOP 0x28004404 /* Cease current update */ +#define DIBUTTON_BROWSER_HOME 0x28004405 /* Go directly to "home" location */ +#define DIBUTTON_BROWSER_FAVORITES 0x28004406 /* Mark current site as favorite */ +#define DIBUTTON_BROWSER_NEXT 0x28004407 /* Select Next page */ +#define DIBUTTON_BROWSER_PREVIOUS 0x28004408 /* Select Previous page */ +#define DIBUTTON_BROWSER_HISTORY 0x28004409 /* Show/Hide History */ +#define DIBUTTON_BROWSER_PRINT 0x2800440A /* Print current page */ +#define DIBUTTON_BROWSER_DEVICE 0x280044FE /* Show input device and controls */ +#define DIBUTTON_BROWSER_PAUSE 0x280044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Giant Walking Robot + Walking tank with weapons ---*/ +#define DIVIRTUAL_DRIVING_MECHA 0x29000000 +#define DIAXIS_MECHA_STEER 0x29008201 /* Turns mecha left/right */ +#define DIAXIS_MECHA_TORSO 0x29010202 /* Tilts torso forward/backward */ +#define DIAXIS_MECHA_ROTATE 0x29020203 /* Turns torso left/right */ +#define DIAXIS_MECHA_THROTTLE 0x29038204 /* Engine Speed */ +#define DIBUTTON_MECHA_FIRE 0x29000401 /* Fire */ +#define DIBUTTON_MECHA_WEAPONS 0x29000402 /* Select next weapon group */ +#define DIBUTTON_MECHA_TARGET 0x29000403 /* Select closest enemy available target */ +#define DIBUTTON_MECHA_REVERSE 0x29000404 /* Toggles throttle in/out of reverse */ +#define DIBUTTON_MECHA_ZOOM 0x29000405 /* Zoom in/out targeting reticule */ +#define DIBUTTON_MECHA_JUMP 0x29000406 /* Fires jump jets */ +#define DIBUTTON_MECHA_MENU 0x290004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_MECHA_CENTER 0x29004407 /* Center torso to legs */ +#define DIHATSWITCH_MECHA_GLANCE 0x29004601 /* Look around */ +#define DIBUTTON_MECHA_VIEW 0x29004408 /* Cycle through view options */ +#define DIBUTTON_MECHA_FIRESECONDARY 0x29004409 /* Alternative fire button */ +#define DIBUTTON_MECHA_LEFT_LINK 0x2900C4E4 /* Fallback steer left button */ +#define DIBUTTON_MECHA_RIGHT_LINK 0x2900C4EC /* Fallback steer right button */ +#define DIBUTTON_MECHA_FORWARD_LINK 0x290144E0 /* Fallback tilt torso forward button */ +#define DIBUTTON_MECHA_BACK_LINK 0x290144E8 /* Fallback tilt toroso backward button */ +#define DIBUTTON_MECHA_ROTATE_LEFT_LINK 0x290244E4 /* Fallback rotate toroso right button */ +#define DIBUTTON_MECHA_ROTATE_RIGHT_LINK 0x290244EC /* Fallback rotate torso left button */ +#define DIBUTTON_MECHA_FASTER_LINK 0x2903C4E0 /* Fallback increase engine speed */ +#define DIBUTTON_MECHA_SLOWER_LINK 0x2903C4E8 /* Fallback decrease engine speed */ +#define DIBUTTON_MECHA_DEVICE 0x290044FE /* Show input device and controls */ +#define DIBUTTON_MECHA_PAUSE 0x290044FC /* Start / Pause / Restart game */ + +/* + * "ANY" semantics can be used as a last resort to get mappings for actions + * that match nothing in the chosen virtual genre. These semantics will be + * mapped at a lower priority that virtual genre semantics. Also, hardware + * vendors will not be able to provide sensible mappings for these unless + * they provide application specific mappings. + */ +#define DIAXIS_ANY_X_1 0xFF00C201 +#define DIAXIS_ANY_X_2 0xFF00C202 +#define DIAXIS_ANY_Y_1 0xFF014201 +#define DIAXIS_ANY_Y_2 0xFF014202 +#define DIAXIS_ANY_Z_1 0xFF01C201 +#define DIAXIS_ANY_Z_2 0xFF01C202 +#define DIAXIS_ANY_R_1 0xFF024201 +#define DIAXIS_ANY_R_2 0xFF024202 +#define DIAXIS_ANY_U_1 0xFF02C201 +#define DIAXIS_ANY_U_2 0xFF02C202 +#define DIAXIS_ANY_V_1 0xFF034201 +#define DIAXIS_ANY_V_2 0xFF034202 +#define DIAXIS_ANY_A_1 0xFF03C201 +#define DIAXIS_ANY_A_2 0xFF03C202 +#define DIAXIS_ANY_B_1 0xFF044201 +#define DIAXIS_ANY_B_2 0xFF044202 +#define DIAXIS_ANY_C_1 0xFF04C201 +#define DIAXIS_ANY_C_2 0xFF04C202 +#define DIAXIS_ANY_S_1 0xFF054201 +#define DIAXIS_ANY_S_2 0xFF054202 + +#define DIAXIS_ANY_1 0xFF004201 +#define DIAXIS_ANY_2 0xFF004202 +#define DIAXIS_ANY_3 0xFF004203 +#define DIAXIS_ANY_4 0xFF004204 + +#define DIPOV_ANY_1 0xFF004601 +#define DIPOV_ANY_2 0xFF004602 +#define DIPOV_ANY_3 0xFF004603 +#define DIPOV_ANY_4 0xFF004604 + +#define DIBUTTON_ANY(instance) ( 0xFF004400 | instance ) + + +#ifdef __cplusplus +}; +#endif + +#endif /* __DINPUT_INCLUDED__ */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current sdk files + * + ****************************************************************************/ + +#ifdef _INC_MMSYSTEM +#ifndef MMNOJOY + +#ifndef __VJOYDX_INCLUDED__ +#define __VJOYDX_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure + * contains mini-driver specific data to be passed by VJoyD to the mini- + * driver instead of doing a poll. + */ +#define JOY_PASSDRIVERDATA 0x10000000l + +/* + * Informs the joystick driver that the configuration has been changed + * and should be reloaded from the registery. + * dwFlags is reserved and should be set to zero + */ +WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags ); + +#ifndef DIJ_RINGZERO +/* + * Invoke the joystick control panel directly, using the passed window handle + * as the parent of the dialog. This API is only supported for compatibility + * purposes; new applications should use the RunControlPanel method of a + * device interface for a game controller. + * The API is called by using the function pointer returned by + * GetProcAddress( hCPL, TEXT("ShowJoyCPL") ) where hCPL is a HMODULE returned + * by LoadLibrary( TEXT("joy.cpl") ). The typedef is provided to allow + * declaration and casting of an appropriately typed variable. + */ +void WINAPI ShowJoyCPL( HWND hWnd ); +typedef void (WINAPI* LPFNSHOWJOYCPL)( HWND hWnd ); +#endif /* DIJ_RINGZERO */ + + +/* + * Hardware Setting indicating that the device is a headtracker + */ +#define JOY_HWS_ISHEADTRACKER 0x02000000l + +/* + * Hardware Setting indicating that the VxD is used to replace + * the standard analog polling + */ +#define JOY_HWS_ISGAMEPORTDRIVER 0x04000000l + +/* + * Hardware Setting indicating that the driver needs a standard + * gameport in order to communicate with the device. + */ +#define JOY_HWS_ISANALOGPORTDRIVER 0x08000000l + +/* + * Hardware Setting indicating that VJoyD should not load this + * driver, it will be loaded externally and will register with + * VJoyD of it's own accord. + */ +#define JOY_HWS_AUTOLOAD 0x10000000l + +/* + * Hardware Setting indicating that the driver acquires any + * resources needed without needing a devnode through VJoyD. + */ +#define JOY_HWS_NODEVNODE 0x20000000l + + +/* + * Hardware Setting indicating that the device is a gameport bus + */ +#define JOY_HWS_ISGAMEPORTBUS 0x80000000l +#define JOY_HWS_GAMEPORTBUSBUSY 0x00000001l + +/* + * Usage Setting indicating that the settings are volatile and + * should be removed if still present on a reboot. + */ +#define JOY_US_VOLATILE 0x00000008L + +#ifdef __cplusplus +}; +#endif + +#endif /* __VJOYDX_INCLUDED__ */ + +#endif /* not MMNOJOY */ +#endif /* _INC_MMSYSTEM */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current ddk files + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +#ifdef _INC_MMDDK +#ifndef MMNOJOYDEV + +#ifndef __VJOYDXD_INCLUDED__ +#define __VJOYDXD_INCLUDED__ +/* + * Poll type in which the do_other field of the JOYOEMPOLLDATA + * structure contains mini-driver specific data passed from an app. + */ +#define JOY_OEMPOLL_PASSDRIVERDATA 7 + +#endif /* __VJOYDXD_INCLUDED__ */ + +#endif /* not MMNOJOYDEV */ +#endif /* _INC_MMDDK */ + +#endif /* DIJ_RINGZERO */ + diff --git a/plugins/ADK/d3d8/includes/dxerr8.h b/plugins/ADK/d3d8/includes/dxerr8.h new file mode 100644 index 0000000..8b7813d --- /dev/null +++ b/plugins/ADK/d3d8/includes/dxerr8.h @@ -0,0 +1,100 @@ +/*==========================================================================; + * + * + * File: dxerr8.h + * Content: DirectX Error Library Include File + * + ****************************************************************************/ + +#ifndef _DXERR8_H_ +#define _DXERR8_H_ + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +// +// DXGetErrorString8 +// +// Desc: Converts a DirectX HRESULT to a string +// +// Args: HRESULT hr Can be any error code from +// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: Converted string +// +const char* WINAPI DXGetErrorString8A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorString8W(HRESULT hr); + +#ifdef UNICODE +#define DXGetErrorString8 DXGetErrorString8W +#else +#define DXGetErrorString8 DXGetErrorString8A +#endif + + +// +// DXGetErrorDescription8 +// +// Desc: Returns a string description of a DirectX HRESULT +// +// Args: HRESULT hr Can be any error code from +// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: String description +// +const char* WINAPI DXGetErrorDescription8A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorDescription8W(HRESULT hr); + +#ifdef UNICODE + #define DXGetErrorDescription8 DXGetErrorDescription8W +#else + #define DXGetErrorDescription8 DXGetErrorDescription8A +#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, TRUE ) +#define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) +#else +#define DXTRACE_MSG(str) (0L) +#define DXTRACE_ERR(str,hr) (hr) +#define DXTRACE_ERR_NOMSGBOX(str,hr) (hr) +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _DXERR8_H_ + diff --git a/plugins/ADK/d3d8/includes/dxfile.h b/plugins/ADK/d3d8/includes/dxfile.h new file mode 100644 index 0000000..8b5995a --- /dev/null +++ b/plugins/ADK/d3d8/includes/dxfile.h @@ -0,0 +1,240 @@ +/*************************************************************************** + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: dxfile.h + * + * Content: DirectX File public header file + * + ***************************************************************************/ + +#ifndef __DXFILE_H__ +#define __DXFILE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef DWORD DXFILEFORMAT; + +#define DXFILEFORMAT_BINARY 0 +#define DXFILEFORMAT_TEXT 1 +#define DXFILEFORMAT_COMPRESSED 2 + +typedef DWORD DXFILELOADOPTIONS; + +#define DXFILELOAD_FROMFILE 0x00L +#define DXFILELOAD_FROMRESOURCE 0x01L +#define DXFILELOAD_FROMMEMORY 0x02L +#define DXFILELOAD_FROMSTREAM 0x04L +#define DXFILELOAD_FROMURL 0x08L + +typedef struct _DXFILELOADRESOURCE { + HMODULE hModule; + LPCTSTR lpName; + LPCTSTR lpType; +}DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE; + +typedef struct _DXFILELOADMEMORY { + LPVOID lpMemory; + DWORD dSize; +}DXFILELOADMEMORY, *LPDXFILELOADMEMORY; + +/* + * DirectX File object types. + */ + +#ifndef WIN_TYPES +#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype +#endif + +WIN_TYPES(IDirectXFile, DIRECTXFILE); +WIN_TYPES(IDirectXFileEnumObject, DIRECTXFILEENUMOBJECT); +WIN_TYPES(IDirectXFileSaveObject, DIRECTXFILESAVEOBJECT); +WIN_TYPES(IDirectXFileObject, DIRECTXFILEOBJECT); +WIN_TYPES(IDirectXFileData, DIRECTXFILEDATA); +WIN_TYPES(IDirectXFileDataReference, DIRECTXFILEDATAREFERENCE); +WIN_TYPES(IDirectXFileBinary, DIRECTXFILEBINARY); + +/* + * API for creating IDirectXFile interface. + */ + +STDAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile); + +/* + * The methods for IUnknown + */ + +#define IUNKNOWN_METHODS(kind) \ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD_(ULONG, AddRef) (THIS) kind; \ + STDMETHOD_(ULONG, Release) (THIS) kind + +/* + * The methods for IDirectXFileObject + */ + +#define IDIRECTXFILEOBJECT_METHODS(kind) \ + STDMETHOD(GetName) (THIS_ LPSTR, LPDWORD) kind; \ + STDMETHOD(GetId) (THIS_ LPGUID) kind + +/* + * DirectX File interfaces. + */ + +#undef INTERFACE +#define INTERFACE IDirectXFile + +DECLARE_INTERFACE_(IDirectXFile, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(CreateEnumObject) (THIS_ LPVOID, DXFILELOADOPTIONS, + LPDIRECTXFILEENUMOBJECT *) PURE; + STDMETHOD(CreateSaveObject) (THIS_ LPCSTR, DXFILEFORMAT, + LPDIRECTXFILESAVEOBJECT *) PURE; + STDMETHOD(RegisterTemplates) (THIS_ LPVOID, DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileEnumObject + +DECLARE_INTERFACE_(IDirectXFileEnumObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(GetNextDataObject) (THIS_ LPDIRECTXFILEDATA *) PURE; + STDMETHOD(GetDataObjectById) (THIS_ REFGUID, LPDIRECTXFILEDATA *) PURE; + STDMETHOD(GetDataObjectByName) (THIS_ LPCSTR, LPDIRECTXFILEDATA *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileSaveObject + +DECLARE_INTERFACE_(IDirectXFileSaveObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(SaveTemplates) (THIS_ DWORD, const GUID **) PURE; + STDMETHOD(CreateDataObject) (THIS_ REFGUID, LPCSTR, const GUID *, + DWORD, LPVOID, LPDIRECTXFILEDATA *) PURE; + STDMETHOD(SaveData) (THIS_ LPDIRECTXFILEDATA) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirectXFileObject + +DECLARE_INTERFACE_(IDirectXFileObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileData + +DECLARE_INTERFACE_(IDirectXFileData, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(GetData) (THIS_ LPCSTR, DWORD *, void **) PURE; + STDMETHOD(GetType) (THIS_ const GUID **) PURE; + STDMETHOD(GetNextObject) (THIS_ LPDIRECTXFILEOBJECT *) PURE; + STDMETHOD(AddDataObject) (THIS_ LPDIRECTXFILEDATA) PURE; + STDMETHOD(AddDataReference) (THIS_ LPCSTR, const GUID *) PURE; + STDMETHOD(AddBinaryObject) (THIS_ LPCSTR, const GUID *, LPCSTR, LPVOID, DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileDataReference + +DECLARE_INTERFACE_(IDirectXFileDataReference, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(Resolve) (THIS_ LPDIRECTXFILEDATA *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileBinary + +DECLARE_INTERFACE_(IDirectXFileBinary, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(GetSize) (THIS_ DWORD *) PURE; + STDMETHOD(GetMimeType) (THIS_ LPCSTR *) PURE; + STDMETHOD(Read) (THIS_ LPVOID, DWORD, LPDWORD) PURE; +}; + +/* + * DirectXFile Object Class Id (for CoCreateInstance()) + */ + +DEFINE_GUID(CLSID_CDirectXFile, 0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); + +/* + * DirectX File Interface GUIDs. + */ + +DEFINE_GUID(IID_IDirectXFile, 0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileEnumObject, 0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileSaveObject, 0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileObject, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileData, 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileDataReference, 0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileBinary, 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* + * DirectX File Header template's GUID. + */ + +DEFINE_GUID(TID_DXFILEHeader, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + + +/* + * DirectX File errors. + */ + +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +#define DXFILE_OK 0 + +#define DXFILEERR_BADOBJECT MAKE_DDHRESULT(850) +#define DXFILEERR_BADVALUE MAKE_DDHRESULT(851) +#define DXFILEERR_BADTYPE MAKE_DDHRESULT(852) +#define DXFILEERR_BADSTREAMHANDLE MAKE_DDHRESULT(853) +#define DXFILEERR_BADALLOC MAKE_DDHRESULT(854) +#define DXFILEERR_NOTFOUND MAKE_DDHRESULT(855) +#define DXFILEERR_NOTDONEYET MAKE_DDHRESULT(856) +#define DXFILEERR_FILENOTFOUND MAKE_DDHRESULT(857) +#define DXFILEERR_RESOURCENOTFOUND MAKE_DDHRESULT(858) +#define DXFILEERR_URLNOTFOUND MAKE_DDHRESULT(859) +#define DXFILEERR_BADRESOURCE MAKE_DDHRESULT(860) +#define DXFILEERR_BADFILETYPE MAKE_DDHRESULT(861) +#define DXFILEERR_BADFILEVERSION MAKE_DDHRESULT(862) +#define DXFILEERR_BADFILEFLOATSIZE MAKE_DDHRESULT(863) +#define DXFILEERR_BADFILECOMPRESSIONTYPE MAKE_DDHRESULT(864) +#define DXFILEERR_BADFILE MAKE_DDHRESULT(865) +#define DXFILEERR_PARSEERROR MAKE_DDHRESULT(866) +#define DXFILEERR_NOTEMPLATE MAKE_DDHRESULT(867) +#define DXFILEERR_BADARRAYSIZE MAKE_DDHRESULT(868) +#define DXFILEERR_BADDATAREFERENCE MAKE_DDHRESULT(869) +#define DXFILEERR_INTERNALERROR MAKE_DDHRESULT(870) +#define DXFILEERR_NOMOREOBJECTS MAKE_DDHRESULT(871) +#define DXFILEERR_BADINTRINSICS MAKE_DDHRESULT(872) +#define DXFILEERR_NOMORESTREAMHANDLES MAKE_DDHRESULT(873) +#define DXFILEERR_NOMOREDATA MAKE_DDHRESULT(874) +#define DXFILEERR_BADCACHEFILE MAKE_DDHRESULT(875) +#define DXFILEERR_NOINTERNET MAKE_DDHRESULT(876) + + +#ifdef __cplusplus +}; +#endif + +#endif /* _DXFILE_H_ */ + \ No newline at end of file diff --git a/plugins/ADK/d3d8/lib/DxErr8.lib b/plugins/ADK/d3d8/lib/DxErr8.lib new file mode 100644 index 0000000..c22ccde Binary files /dev/null and b/plugins/ADK/d3d8/lib/DxErr8.lib differ diff --git a/plugins/ADK/d3d8/lib/d3d8.lib b/plugins/ADK/d3d8/lib/d3d8.lib new file mode 100644 index 0000000..252aac4 Binary files /dev/null and b/plugins/ADK/d3d8/lib/d3d8.lib differ diff --git a/plugins/ADK/d3d8/lib/d3dx8.lib b/plugins/ADK/d3d8/lib/d3dx8.lib new file mode 100644 index 0000000..79ffe8e Binary files /dev/null and b/plugins/ADK/d3d8/lib/d3dx8.lib differ diff --git a/plugins/ADK/d3d8/lib/dxguid.lib b/plugins/ADK/d3d8/lib/dxguid.lib new file mode 100644 index 0000000..db39821 Binary files /dev/null and b/plugins/ADK/d3d8/lib/dxguid.lib differ diff --git a/plugins/ADK/ffxi/entity.h b/plugins/ADK/ffxi/entity.h new file mode 100644 index 0000000..327b64c --- /dev/null +++ b/plugins/ADK/ffxi/entity.h @@ -0,0 +1,204 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_FFXI_ENTITY_H_INCLUDED__ +#define __ASHITA_AS_FFXI_ENTITY_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +namespace Ashita +{ + namespace FFXI + { + struct position_t + { + float X; + float Y; + float Z; + float Unknown0000; + float Roll; + float Yaw; // Heading + float Pitch; + + bool operator==(const position_t &pos) const + { + return ((this->X == pos.X) && (this->Y == pos.Y) && (this->Z == pos.Z)); + } + + bool operator!=(const position_t &pos) const + { + return !(this == &pos); + } + }; + + struct move_t + { + float X; + float Y; + float Z; + float Unknown0000; + + bool operator==(const move_t &pos) const + { + return ((this->X == pos.X) && (this->Y == pos.Y) && (this->Z == pos.Z)); + } + + bool operator!=(const move_t &pos) const + { + return !(this == &pos); + } + }; + + struct movement_t + { + position_t LocalPosition; + float Unknown0000; + position_t LastPosition; + uint32_t Unknown0001; + move_t Move; + }; + + struct look_t + { + uint16_t Hair; // Hair Style + uint16_t Head; // Head Armor (Starts at 0x1000) + uint16_t Body; // Body Armor (Starts at 0x2000) + uint16_t Hands; // Hands Armor (Starts at 0x3000) + uint16_t Legs; // Legs Armor (Starts at 0x4000) + uint16_t Feet; // Feet Armor (Starts at 0x5000) + uint16_t Main; // Main Weapon (Starts at 0x6000) + uint16_t Sub; // Sub Weapon (Starts at 0x7000) + uint16_t Ranged; // Ranged Weapon (Starts at 0x8000) + }; + + struct render_t + { + uint32_t Flags0; // Main Render Flags + uint32_t Flags1; // Name Flags (Party, Away, Anon) + uint32_t Flags2; // Name Flags (Bazaar, GM Icon, etc.) + uint32_t Flags3; // Entity Flags (Shadow) + uint32_t Flags4; // Name Flags (Name Visibility) + }; + + struct animation_t + { + uint8_t Animations[0x28]; + }; + +#pragma pack(push, 1) + struct ffxi_entity_t + { + uintptr_t CYyObjectVtable; // CYyObject + movement_t Movement; + uint8_t Unknown0000[28]; + uintptr_t Unknown0001; // Unknown Vtable pointer. + uint32_t TargetIndex; + uint32_t ServerId; + int8_t Name[28]; + float Speed; + float AnimationSpeed; + uintptr_t WarpPointer; // Pointer to the entities editable movement information. + uint32_t Unknown0002[13]; + float Distance; + uint32_t Unknown0003; // Usually 0x64. + uint32_t Unknown0004; // Usually 0x64. + float Heading; // Yaw + uintptr_t PetOwnerId; + uint8_t HealthPercent; + uint8_t ManaPercent; // Pet only. + uint8_t EntityType; + uint8_t Race; + uint32_t Unknown0005; + uint16_t ModelFade; // Used to force-refresh the entity model. + uint8_t Unknown0006[6]; + look_t Look; + uint8_t Unknown0007[14]; + uint16_t ActionTimer1; + uint16_t ActionTimer2; + render_t Render; + float Unknown0008; // Fishing related. + uint32_t Unknown0009; // Fade-in effect. (Valid values: 3 / 6) + uint16_t Unknown0010; // Fade-in misc. (-1 gets reset to 0) + uint32_t Unknown0011; + uint16_t NpcSpeechLoop; + uint16_t NpcSpeechFrame; + uint8_t Unknown0012[18]; + float Speed2; // Editable movement speed. + uint16_t NpcWalkPosition1; + uint16_t NpcWalkPosition2; + uint16_t NpcWalkMode; + uint16_t CostumeId; + uint8_t mou4[4]; // Always 'mou4'. + uint32_t Status; + uint32_t StatusServer; + uint32_t StatusNpcChat; // Used while talking with an npc. + uint32_t Unknown0013; + uint32_t Unknown0014; + uint32_t Unknown0015; + uint32_t Unknown0016; + uint32_t ClaimServerId; // The entities server id that has claim (or last claimed) the entity. + uint32_t Unknown0017; // Inventory related. + animation_t Animations; // The entities animation strings. (idl, sil, wlk, etc.) + uint16_t AnimationTick; // Current ticks of the active animation. + uint16_t AnimationStep; // Current step of the active animation. + uint8_t AnimationPlay; // Current animation playing. (6 = Stand>Sit, 12 = Play current emote.) + uint8_t Unknown0018; // Animation related. + uint16_t EmoteTargetIndex; // The target index the emote is being performed on. + uint16_t EmoteId; // The id of the emote. + uint16_t Unknown0019; + uint32_t EmoteIdString; // The string id of emote. + uintptr_t EmoteTargetWarpPointer; // The emote target entities warp pointer. + uint32_t Unknown0020; + uint32_t SpawnFlags; // 0x01 = PC, 0x02 = NPC, 0x10 = Mob, 0x0D = Self + uint32_t LinkshellColor; // ARGB style color code. + uint16_t NameColor; // Numerical code to pre-defined colors. + uint16_t CampaignNameFlag; // Normally 0x4000, low-byte sets the flag. + uint16_t FishingTimer; // Counts down from when you click 'fish' til you either make a catch or reel-in. + uint16_t FishingCastTimer; // Counts down from when you click 'fish' til your bait hits the water. + uint32_t FishingUnknown0000; // Fishing related. + uint32_t FishingUnknown0001; // Fishing related. + uint16_t FishingUnknown0002; // Fishing related. + uint8_t Unknown0021[14]; + uint16_t TargetedIndex; // The entities targeted index. (Does not always populate. Does not populate for local player.) + uint16_t PetTargetIndex; // The entities pet target index. + uint16_t Unknown0022; // Npc talking countdown timer. (After done talking with npc.) + uint8_t Unknown0023; // Flag set after talking with an npc. + uint8_t BallistaScoreFlag; // Ballista / PvP related. + uint8_t PankrationEnabled; + uint8_t PankrationFlagFlip; + uint16_t Unknown0024; + float ModelSize; + uint8_t Unknown0025[8]; + uint16_t MonstrosityFlag; // The entities monstrosity flags. + uint16_t MonstrosityNameId; // The entities monstrosity name id. + int8_t MonstrosityName[36]; // The entities monstrosity name. + }; +#pragma pack(pop) + }; // namespace FFXI +}; // namespace Ashita + +#endif // __ASHITA_AS_FFXI_ENTITY_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/ffxi/enums.h b/plugins/ADK/ffxi/enums.h new file mode 100644 index 0000000..8546314 --- /dev/null +++ b/plugins/ADK/ffxi/enums.h @@ -0,0 +1,659 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_FFXI_ENUMS_H_INCLUDED__ +#define __ASHITA_AS_FFXI_ENUMS_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/** + * Name Flag Definitions + */ +#define FLAG_INEVENT 0x00000002 +#define FLAG_CHOCOBO 0x00000040 +#define FLAG_WALLHACK 0x00000200 +#define FLAG_INVITE 0x00000800 +#define FLAG_ANON 0x00001000 +#define FLAG_UNKNOWN 0x00002000 +#define FLAG_AWAY 0x00004000 +#define FLAG_PLAYONLINE 0x00010000 +#define FLAG_LINKSHELL 0x00020000 +#define FLAG_DC 0x00040000 +#define FLAG_GM 0x04000000 +#define FLAG_GM_SUPPORT 0x04000000 +#define FLAG_GM_SENIOR 0x05000000 +#define FLAG_GM_LEAD 0x06000000 +#define FLAG_GM_PRODUCER 0x07000000 +#define FLAG_BAZAAR 0x80000000 + +namespace Ashita { + namespace FFXI { + namespace Enums + { + //////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Equipment / Inventory Related Enumerations + // + //////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Containers Enumeration + */ + enum class Containers : uint32_t { + Inventory = 0, + Safe = 1, + Storage = 2, + Temporary = 3, + Locker = 4, + Satchel = 5, + Sack = 6, + Case = 7, + Wardrobe = 8, + Safe2 = 9, + Wardrobe2 = 10, + Wardrobe3 = 11, + Wardrobe4 = 12, + + ContainerMax = 13 + }; + + /** + * Equipment Slots Enumeration + */ + enum class EquipmentSlots : uint32_t { + Main = 0, + Sub, + Range, + Ammo, + Head, + Body, + Hands, + Legs, + Feet, + Waist, + Ear1, + Ear2, + Ring1, + Ring2, + Back, + + EquipmentSlotMax = 16 + }; + + /** + * Treasure Status Enumeration + */ + enum class TreasureStatus { + None = 0, + Pass, + Lot + }; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Entity Related Enumerations + // + //////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Entity Types Enumeration + */ + enum class EntityTypes : uint32_t { + Player = 0, // Player Entities + Npc1 = 1, // NPC Entities (Town Folk, etc.) + Npc2 = 2, // NPC Entities (Home Points, Moogles, Coffers, Town Folk, etc.) + Npc3 = 3, // NPC Entities (Doors, Lights, Unique Objects, Bridges, etc.) + Elevator = 4, // Elevator Entities + Airship = 5, // Airship / Boat Entities + }; + + /** + * Entity Spawn Flags Enumeration + */ + enum class EntitySpawnFlags : uint32_t { + Player = 0x0001, // Entity is a player. + Npc = 0x0002, // Entity is an NPC. + PartyMember = 0x0004, // Entity is a party member. + AllianceMember = 0x0008, // Entity is an alliance member. + Monster = 0x0010, // Entity is a monster. + Object = 0x0020, // Entity is an object. + LocalPlayer = 0x0200, // Entity is the local player. + }; + + /** + * Entity Hair Enumeration + */ + enum class EntityHair { + Hair1A = 0, + Hair1B, + Hair2A, + Hair2B, + Hair3A, + Hair3B, + Hair4A, + Hair4B, + Hair5A, + Hair5B, + Hair6A, + Hair6B, + Hair7A, + Hair7B, + Hair8A, + Hair8B, + + // Non-Player Hair Styles + Fomar = 29, + Mannequin = 30, + }; + + /** + * Entity Race Enumeration + */ + enum class EntityRace { + Invalid = 0, + HumeMale, + HumeFemale, + ElvaanMale, + ElvaanFemale, + TarutaruMale, + TarutaruFemale, + Mithra, + Galka, + + // Non-Player Races + MithraChild = 29, + HumeChildFemale = 30, + HumeChildMale = 31, + GoldChocobo = 32, + BlackChocobo = 33, + BlueChocobo = 34, + RedChocobo = 35, + GreenChocobo = 36 + }; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Player Related Enumerations + // + //////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Jobs Enumeration + */ + enum class Jobs : uint32_t { + None = 0, + Warrior = 1, + Monk = 2, + WhiteMage = 3, + BlackMage = 4, + RedMage = 5, + Thief = 6, + Paladin = 7, + DarkKnight = 8, + Beastmaster = 9, + Bard = 10, + Ranger = 11, + Samurai = 12, + Ninja = 13, + Dragoon = 14, + Summoner = 15, + BlueMage = 16, + Corsair = 17, + Puppetmaster = 18, + Dancer = 19, + Scholar = 20, + Geomancer = 21, + RuneFencer = 22 + }; + + /** + * Login Status Enumeration + */ + enum class LoginStatus { + LoginScreen = 0, + Loading = 1, + LoggedIn = 2 + }; + + /** + * Craft Rank Enumeration + */ + enum class CraftRank { + Amateur = 0, + Recruit, + Initiate, + Novice, + Apprentice, + Journeyman, + Craftsman, + Artisan, + Adept, + Veteran + }; + + /** + * Skill Types Enumeration + */ + enum class SkillTypes : uint32_t { + // Weapon Skills + HandToHand = 1, + Dagger = 2, + Sword = 3, + GreatSword = 4, + Axe = 5, + GreatAxe = 6, + Scythe = 7, + Polarm = 8, + Katana = 9, + GreatKatana = 10, + Club = 11, + Staff = 12, + + // Combat Skills + Archery = 25, + Marksmanship = 26, + Throwing = 27, + Guard = 28, + Evasion = 29, + Shield = 30, + Parry = 31, + Divine = 32, + Healing = 33, + Enhancing = 34, + Enfeebling = 35, + Elemental = 36, + Dark = 37, + Summoning = 38, + Ninjutsu = 39, + Singing = 40, + String = 41, + Wind = 42, + BlueMagic = 43, + + // Crafting Skills + Fishing = 48, + Woodworking = 49, + Smithing = 50, + Goldsmithing = 51, + Clothcraft = 52, + Leathercraft = 53, + Bonecraft = 54, + Alchemy = 55, + Cooking = 56, + Synergy = 57, + ChocoboDigging = 58, + }; + + /** + * Player Nation Id + */ + enum class Nation { + SandOria, + Bastok, + Windurst + }; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Resources Related Enumerations + // + //////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Equipment Slot Mask Enumeration + */ + enum class EquipmentSlotMask { + None = 0x0000, + Main = 0x0001, + Sub = 0x0002, + Range = 0x0004, + Ammo = 0x0008, + Head = 0x0010, + Body = 0x0020, + Hands = 0x0040, + Legs = 0x0080, + Feet = 0x0100, + Neck = 0x0200, + Waist = 0x0400, + LEar = 0x0800, + REar = 0x1000, + LRing = 0x2000, + RRing = 0x4000, + Back = 0x8000, + + // Slot Groups + Ears = LEar | REar, + Rings = LRing | RRing, + + // All Slots + All = 0xFFFF + }; + + /** + * Item Flags Enumeration + */ + enum class ItemFlags : uint32_t { + None = 0x0000, + WallHanging = 0x0001, + Flag1 = 0x0002, + Flag2 = 0x0004, + Flag3 = 0x0008, + DeliveryInner = 0x0010, + Inscribable = 0x0020, + NoAuction = 0x0040, + Scroll = 0x0080, + Linkshell = 0x0100, + CanUse = 0x0200, + CanTradeNpc = 0x0400, + CanEquip = 0x0800, + NoSale = 0x1000, + NoDelivery = 0x2000, + NoTrade = 0x4000, + Rare = 0x8000, + + Exclusive = NoAuction | NoDelivery | NoTrade, + Nothing = Linkshell | NoSale | Exclusive | Rare + }; + + /** + * Item Type Enumeration + */ + enum class ItemType : uint32_t { + None = 0x0000, + Item = 0x0001, + QuestItem = 0x0002, + Fish = 0x0003, + Weapon = 0x0004, + Armor = 0x0005, + Linkshell = 0x0006, + UsableItem = 0x0007, + Crystal = 0x0008, + Currency = 0x0009, + Furnishing = 0x000A, + Plant = 0x000B, + Flowerpot = 0x000C, + PuppetItem = 0x000D, + Mannequin = 0x000E, + Book = 0x000F, + RacingForm = 0x0010, + BettingSlip = 0x0011, + SoulPlate = 0x0012, + Reflector = 0x0013, + Logs = 0x0014, + LotteryTicket = 0x0015, + TabulaM = 0x0016, + TabulaR = 0x0017, + Voucher = 0x0018, + Rune = 0x0019, + Evolith = 0x001A, + StorageSlip = 0x001B, + Type1 = 0x001C + }; + + /** + * Job Mask Enumeration + */ + enum class JobMask : uint32_t { + None = 0x00000000, + WAR = 0x00000002, + MNK = 0x00000004, + WHM = 0x00000008, + BLM = 0x00000010, + RDM = 0x00000020, + THF = 0x00000040, + PLD = 0x00000080, + DRK = 0x00000100, + BST = 0x00000200, + BRD = 0x00000400, + RNG = 0x00000800, + SAM = 0x00001000, + NIN = 0x00002000, + DRG = 0x00004000, + SMN = 0x00008000, + BLU = 0x00010000, + COR = 0x00020000, + PUP = 0x00040000, + DNC = 0x00080000, + SCH = 0x00100000, + GEO = 0x00200000, + RUN = 0x00400000, + MON = 0x00800000, + JOB24 = 0x01000000, + JOB25 = 0x02000000, + JOB26 = 0x04000000, + JOB27 = 0x08000000, + JOB28 = 0x10000000, + JOB29 = 0x20000000, + JOB30 = 0x40000000, + JOB31 = 0x80000000, + + AllJobs = 0x007FFFFE, + }; + + /** + * Combat Type Enumeration + */ + enum class CombatType { + Magic = 0x1000, + Combat = 0x2000 + }; + + /** + * Ability Type Enumeration + */ + enum class AbilityType { + General = 0, + Job, + Pet, + Weapon, + Trait, + BloodPactRage, + Corsair, + CorsairShot, + BloodPactWard, + Samba, + Waltz, + Step, + Florish1, + Scholar, + Jig, + Flourish2, + Monster, + Flourish3, + Weaponskill, + Rune, + Ward, + Effusion, + }; + + /** + * Magic Type Enumeration + */ + enum class MagicType : uint32_t { + None = 0, + WhiteMagic = 1, + BlackMagic = 2, + Summon = 3, + Ninjutsu = 4, + Song = 5, + BlueMagic = 6, + Geomancy = 7, + Trust = 8 + }; + + /** + * Element Color Enumeration + */ + enum class ElementColor { + Red, + Clear, + Green, + Yellow, + Purple, + Blue, + White, + Black + }; + + /** + * Element Type Enumeration + */ + enum class ElementType { + Fire, + Ice, + Air, + Earth, + Thunder, + Water, + Light, + Dark, + + Special = 0x0F, + Unknown = 0xFF + }; + + /** + * Puppet Slot Enumeration + */ + enum class PuppetSlot { + None, + Head, + Body, + Attachment + }; + + /** + * Race Mask Enumeration + */ + enum class RaceMask { + None = 0x0000, + HumeMale = 0x0002, + HumeFemale = 0x0004, + ElvaanMale = 0x0008, + ElvaanFemale = 0x0010, + TarutaruMale = 0x0020, + TarutaruFemale = 0x0040, + Mithra = 0x0080, + Galka = 0x0100, + Hume = 0x0006, + Elvaan = 0x0018, + Tarutaru = 0x0060, + + Male = 0x012A, + Female = 0x00D4, + + All = 0x01FE, + }; + + /** + * Target Type Enumeration + */ + enum class TargetType { + None = 0x00, + Self = 0x01, + Player = 0x02, + PartyMember = 0x04, + AllianceMember = 0x08, + Npc = 0x10, + Enemy = 0x20, + Unknown = 0x40, + CorpseOnly = 0x80, + Corpse = 0x9D + }; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Vana'diel Related Enumerations + // + //////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Moon Phase Enumeration + */ + enum class MoonPhase { + New, + WaxingCrescent, + WaxingCrescent2, + FirstQuarter, + WaxingGibbous, + WaxingGibbous2, + Full, + WaningGibbous, + WaningGibbous2, + LastQuarter, + WaningCrescent, + WaningCrescent2, + + Unknown + }; + + /** + * Weekday Enumeration + */ + enum class Weekday { + Firesday, + Earthsday, + Watersday, + Windsday, + Iceday, + Lightningday, + Lightsday, + Darksday, + + Unknown + }; + + /** + * Weather Enumeration + */ + enum class Weather : uint32_t { + Clear = 0, + Sunny, + Cloudy, + Fog, + Fire, + FireTwo, + Water, + WaterTwo, + Earth, + EarthTwo, + Wind, + WindTwo, + Ice, + IceTwo, + Lightning, + LightningTwo, + Light, + LightTwo, + Dark, + DarkTwo + }; + }; // namespace Enums + }; // namespace FFXI +}; // namespace Ashita + +#endif // __ASHITA_AS_FFXI_ENUMS_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/ffxi/inventory.h b/plugins/ADK/ffxi/inventory.h new file mode 100644 index 0000000..6cdcb01 --- /dev/null +++ b/plugins/ADK/ffxi/inventory.h @@ -0,0 +1,92 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_FFXI_INVENTORY_INCLUDED__ +#define __ASHITA_AS_FFXI_INVENTORY_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +namespace Ashita { + namespace FFXI { + struct item_t + { + uint16_t Id; // The item id. + uint16_t Index; // The item index. + uint32_t Count; // The item count. + uint32_t Flags; // The item flags. (5 = Equipped, 25 = Bazaar) + uint32_t Price; // The item price, if being sold in bazaar. + uint8_t Extra[28]; // The item extra data. (Weaponskill Points, Charges, Augments, etc.) + }; + + struct items_t + { + item_t Item[81]; // The items within a storage container. + }; + + struct treasureitem_t + { + uint32_t Flags; // The item flags. + uint32_t ItemId; // The item id. + uint32_t Count; // The item count. + uint32_t Unknown0000[9]; // Unknown + uint32_t Status; // The item status. + uint16_t Lot; // The local players lot on the item. + uint16_t WinningLot; // The current winning lot. + uint32_t WinningEntityServerId; // The winning lotters server id. + uint32_t WinningEntityTargetIndex; // The winning lotters target index. + char WinningLotterName[16]; // The winning lotters name. + uint32_t TimeToLive; // The time left to til the item leaves the pool. + uint32_t DropTime; // The time the item entered the pool. + }; + + struct equipment_t + { + uint32_t Slot; // The slot id of the equipment. + uint32_t ItemIndex; // The item index where the item is located. + }; + + struct ffxi_inventory_t + { + uint8_t Unknown0000[0x9860]; + items_t Storage[(uint32_t)Enums::Containers::ContainerMax]; + uint8_t Unknown0001[0x021C]; // Potential future storage space. + treasureitem_t TreasurePool[0x000A]; + uint32_t Unknown0002; // Unknown (Treasure related. Set to 1 after zoning, 2 when something has dropped to the pool.) + uint8_t Unknown0003; // Unknown (Treasure related.) + uint8_t StorageMaxCapacity1[(uint32_t)Enums::Containers::ContainerMax]; + uint16_t StorageMaxCapacity2[(uint32_t)Enums::Containers::ContainerMax]; + uint32_t Unknown0004; + uint8_t Unknown0005[0x0184]; + equipment_t Equipment[(uint32_t)Enums::EquipmentSlots::EquipmentSlotMax]; + uint8_t Unknown0006[0x0240]; + uint8_t Unknown0007[0x00BC]; + uint32_t CraftWait; // Handles if the player is crafting or able to craft again. + }; + }; // namespace FFXI +}; // namespace Ashita + +#endif // __ASHITA_AS_FFXI_INVENTORY_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/ffxi/party.h b/plugins/ADK/ffxi/party.h new file mode 100644 index 0000000..c573360 --- /dev/null +++ b/plugins/ADK/ffxi/party.h @@ -0,0 +1,84 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_FFXI_PARTY_INCLUDED__ +#define __ASHITA_AS_FFXI_PARTY_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +namespace Ashita { + namespace FFXI { + struct alliance_t + { + uint32_t AllianceLeaderServerId; + uint32_t Party0LeaderServerId; + uint32_t Party1LeaderServerId; + uint32_t Party2LeaderServerId; + int8_t Party0Visible; + int8_t Party1Visible; + int8_t Party2Visible; + int8_t Party0MemberCount; + int8_t Party1MemberCount; + int8_t Party2MemberCount; + int8_t Invited; + int8_t Unknown0000; + }; + + struct partymember_t + { + alliance_t* AllianceInfo; // Information regarding the party alliance. + uint8_t Index; // The party members index. (Index of their current party.) + uint8_t MemberNumber; // The party members number. (Member number of their current party.) + int8_t Name[18]; // The party members name. + uint32_t ServerId; // The party members server id. + uint32_t TargetIndex; // The party members target index. + uint32_t Unknown0000; // Unknown (Some kind of timestamp.) + uint32_t CurrentHP; // The party members current health. + uint32_t CurrentMP; // The party members current mana. + uint32_t CurrentTP; // The party members current TP. + uint8_t CurrentHPP; // The party members current health percent. + uint8_t CurrentMPP; // The party members current mana percent. + uint16_t ZoneId; // The party members current zone id. + uint16_t Unknown0001; // Unknown (Zone id copy when not in the same zone as the member.) + uint16_t Unknown0002; // Unknown (Alaways 0.) + uint32_t FlagMask; // The party members flag mask. + uint8_t Unknown0003[49];// Unknown + uint8_t MainJob; // The party members main job id. + uint8_t MainJobLevel; // The party members main job level. + uint8_t SubJob; // The party members sub job id. + uint8_t SubJobLvl; // The party members sub job level. + uint8_t Unknown0004[3]; // Unknown + uint32_t ServerId2; // The party members server id. (Duplicate.) + uint8_t CurrentHPP2; // The party members current health percent. (Duplicate) + uint8_t CurrentMPP2; // The party members current mana percent. (Duplicate) + uint8_t Active; // The party members active state. (1 is active, 0 not active.) + uint8_t Unknown0005; // Unknown (Alignment padding.) + }; + }; // namespace FFXI +}; // namespace Ashita + +#endif // __ASHITA_AS_FFXI_PARTY_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/ffxi/player.h b/plugins/ADK/ffxi/player.h new file mode 100644 index 0000000..d1d7fd8 --- /dev/null +++ b/plugins/ADK/ffxi/player.h @@ -0,0 +1,193 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_FFXI_PLAYER_INCLUDED__ +#define __ASHITA_AS_FFXI_PLAYER_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +namespace Ashita { + namespace FFXI { + struct playerstats_t + { + int16_t Strength; + int16_t Dexterity; + int16_t Vitality; + int16_t Agility; + int16_t Intelligence; + int16_t Mind; + int16_t Charisma; + }; + + struct playerresists_t + { + int16_t Fire; + int16_t Ice; + int16_t Wind; + int16_t Earth; + int16_t Lightning; + int16_t Water; + int16_t Light; + int16_t Dark; + }; + + struct combatskill_t + { + uint16_t Raw; + + uint16_t GetSkill(void) const { return (uint16_t)(this->Raw & 0x7FFF); } + bool IsCapped(void) const { return (this->Raw & 0x8000) == 0 ? false : true; }; + }; + + struct craftskill_t + { + uint16_t Raw; + + uint16_t GetSkill(void) const { return (this->Raw & 0x1FE0) >> 5; } + uint16_t GetRank(void) const { return (uint16_t)(this->Raw & 0x1F); } + bool IsCapped(void) const { return (this->Raw & 0x8000) >> 15 == 0 ? false : true; }; + }; + + struct combatskills_t + { + combatskill_t Unknown; + combatskill_t HandToHand; + combatskill_t Dagger; + combatskill_t Sword; + combatskill_t GreatSword; + combatskill_t Axe; + combatskill_t GreatAxe; + combatskill_t Scythe; + combatskill_t Polearm; + combatskill_t Katana; + combatskill_t GreatKatana; + combatskill_t Club; + combatskill_t Staff; + combatskill_t Unused0000; + combatskill_t Unused0001; + combatskill_t Unused0002; + combatskill_t Unused0003; + combatskill_t Unused0004; + combatskill_t Unused0005; + combatskill_t Unused0006; + combatskill_t Unused0007; + combatskill_t Unused0008; + combatskill_t Unused0009; + combatskill_t Unused0010; + combatskill_t Unused0011; + combatskill_t Archery; + combatskill_t Marksmanship; + combatskill_t Throwing; + combatskill_t Guarding; + combatskill_t Evasion; + combatskill_t Shield; + combatskill_t Parrying; + combatskill_t Divine; + combatskill_t Healing; + combatskill_t Enhancing; + combatskill_t Enfeebling; + combatskill_t Elemental; + combatskill_t Dark; + combatskill_t Summon; + combatskill_t Ninjitsu; + combatskill_t Singing; + combatskill_t String; + combatskill_t Wind; + combatskill_t BlueMagic; + combatskill_t Unused0012; + combatskill_t Unused0013; + combatskill_t Unused0014; + combatskill_t Unused0015; + }; + + struct craftskills_t + { + craftskill_t Fishing; + craftskill_t Woodworking; + craftskill_t Smithing; + craftskill_t Goldsmithing; + craftskill_t Clothcraft; + craftskill_t Leathercraft; + craftskill_t Bonecraft; + craftskill_t Alchemy; + craftskill_t Cooking; + craftskill_t Synergy; + craftskill_t Riding; + craftskill_t Unused0000; + craftskill_t Unused0001; + craftskill_t Unused0002; + craftskill_t Unused0003; + craftskill_t Unused0004; + }; + + struct abilityrecast_t + { + uint16_t Recast; // The abilities recast timer at the time of use. + uint8_t Unknown0000; // Unknown + uint8_t RecastTimerId; // The abilities recast timer id. + uint32_t Unknown0001; // Unknown + }; + + struct playerinfo_t + { + uint32_t HealthMax; // The players max health. + uint32_t ManaMax; // The players max mana. + uint8_t MainJob; // The players main job id. + uint8_t MainJobLevel; // The players main job level. + uint8_t SubJob; // The players sub job id. + uint8_t SubJobLevel; // The players sub job level. + uint16_t ExpCurrent; // The players current experience points. + uint16_t ExpNeeded; // The players current experience points needed to level. + playerstats_t Stats; // The players base stats. + playerstats_t StatsModifiers; // The players stat modifiers. + int16_t Attack; // The players attack. + int16_t Defense; // The players defense. + playerresists_t Resists; // The players elemental resists. + uint16_t Title; // The players title id. + uint16_t Rank; // The players rank number. + uint16_t RankPoints; // The players rank points. + uint8_t Nation; // The players nation id. + uint8_t Residence; // The players residence id. + uint32_t Homepoint; // The players homepoint. (Homepoint & 0x0000FFFF) + combatskills_t CombatSkills; // The players combat skills. + craftskills_t CraftSkills; // The players crafting skills. + abilityrecast_t AbilityInfo[34]; // The players ability recast information. + uint8_t Unknown0000[6]; // Unknown - Potentially a 'start' delay time to offset the ability recasts from. + uint16_t LimitPoints; // The players current limit points. + uint8_t MeritPoints; // The players current merit points. + uint8_t LimitMode; // The players current limit mode. + uint32_t MeritPointsMax; // The players max merits. + uint8_t Unknown0001[214]; // Unknown + int16_t StatusIcons[32]; // The players status icons used for status timers. + int32_t StatusTimers[32]; // The players status timers. + uint8_t Unknown0002[104]; // Unknown + int16_t Buffs[32]; // The players current status effect icon ids. + }; + }; // namespace FFXI +}; // namespace Ashita + +#endif // __ASHITA_AS_FFXI_PLAYER_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/ffxi/target.h b/plugins/ADK/ffxi/target.h new file mode 100644 index 0000000..70fc8e6 --- /dev/null +++ b/plugins/ADK/ffxi/target.h @@ -0,0 +1,93 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_AS_FFXI_TARGET_INCLUDED__ +#define __ASHITA_AS_FFXI_TARGET_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +namespace Ashita { + namespace FFXI { + struct target_t + { + uint32_t TargetIndex; // The current target index. + uint32_t TargetServerId; // The current target server id. + uintptr_t TargetEntityPointer; // The current target entity pointer. + uintptr_t TargetWarpPointer; // The current target warp pointer. + uint32_t Unknown0000[4]; // Unknown + uint8_t TargetVisible; // 0/1 if the target is set and visible. + uint8_t Unknown0001[3]; // Unknown (Booleans) + uint16_t TargetMask; // The current target mask. + uint16_t TargetCalculatedId; // The targets calculated id. + uint32_t SubTargetIndex; // The current sub-target index. + uint32_t SubTargetServerId; // The current sub-target server id. + uintptr_t SubTargetEntityPointer; // The current sub-target entity pointer. + uintptr_t SubTargetWarpPointer; // The current sub-target warp pointer. + uint32_t Unknown0002[4]; // Unknown + uint8_t SubTargetVisible; // 0/1 if the sub-target is set and visible. + uint8_t Unknown0003[3]; // Unknown (Booleans) + uint16_t SubTargetMask; // The current sub-target mask. + uint8_t Unknown0004[4]; // Unknown + uint8_t SubTargetActive; // 1 if the main target is set and the game is making use the sub-target entry. + uint8_t TargetDeactivate; // If set to 1, will undo one step of the targeting windows. + uint8_t Unknown0005[8]; // Unknown (Involves graphics related things, such as blinking the targeted entity.) + uint8_t IsLockedOn; // 0/1 if the target is currently locked on. (Low bit 0x00 and 0x01.) + uint8_t Unknown0006[3]; // Unknown + uint32_t TargetSelectionMask; // The selection mask used to determine what can be targeted with the current action. + uint8_t Unknown0007[16]; // Unknown + uint8_t IsMenuOpen; // 0/1 if the menu is open. (ie. selecting a spell on a target.) 74 + }; + + struct targetwindow_t + { + uintptr_t TargetWindowVTablePointer; // The VTable pointer to the target window class. + uint32_t Unknown0000; // Unknown + uint32_t TargetWindowPointer; // Pointer to the target window object. + uint32_t Unknown0001; // Unknown + uint8_t Unknown0002; // Unknown + uint8_t Unknown0003[3]; // Unknown + int8_t Name[48]; // The targets name. + uint32_t Unknown0004; // Unknown + uint32_t TargetEntityPointer; // The targets entity pointer. + uint16_t FrameOffsetX; // The target window frame x offset. + uint16_t FrameOffsetY; // The target window frame y offset. + uint32_t IconPosition; // The target window frame icon position. + uint32_t Unknown0005; // Unknown + uint32_t Unknown0006; // Unknown + uint32_t Unknown0007; // Unknown + uint32_t TargetServerId; // The targets server id. + uint8_t HealthPercent; // The targets health percent. + uint8_t DeathFlag; // Dims the health bar when target is dead.. + uint8_t ReraiseFlag; // Dims the health bar when target is reraising.. (Death flag must be set!) + uint8_t Unknown0008; // Unknown + uint16_t Unknown0009; // Unknown + uint8_t Unknown0010; // Toggles 0 -> 1 when first targeting.. + }; + }; // namespace FFXI +}; // namespace Ashita + +#endif // __ASHITA_AS_FFXI_TARGET_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/imgui.h b/plugins/ADK/imgui.h new file mode 100644 index 0000000..2f3b1b2 --- /dev/null +++ b/plugins/ADK/imgui.h @@ -0,0 +1,1385 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_IMGUI_H_INCLUDED__ +#define __ASHITA_IMGUI_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// DO NOT EDIT THIS FILE! +// +// Ashita uses this file to properly compile ImGui into the Ashita project. This file contains +// various bits of information that is required for both Ashita and plugins to properly make use +// of the ImGui library. Editing this file can lead to your plugins not compiling properly or +// crashing at runtime! +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef IMGUI_API +#define IMGUI_API +#endif + +#ifndef IM_ASSERT +#include +#define IM_ASSERT(_EXPR) assert(_EXPR) +#endif + +#ifndef IM_PRINTFARGS +#define IM_PRINTFARGS(FMT) +#endif + +#include +#include // FLT_MAX +#include // Allocations + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ImGui Forward Declarations +// +// (Not defined by Ashita.) +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +// Forward declarations +struct ImDrawChannel; // Temporary storage for outputting drawing commands out of order, used by ImDrawList::ChannelsSplit() +struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call) +struct ImDrawData; // All draw command lists required to render the frame +struct ImDrawList; // A single draw command list (generally one per window) +struct ImDrawVert; // A single vertex (20 bytes by default, override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT) +struct ImFont; // Runtime data for a single font within a parent ImFontAtlas +struct ImFontAtlas; // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF font loader +struct ImFontConfig; // Configuration data when adding a font or merging fonts +struct ImColor; // Helper functions to create a color that can be converted to either u32 or float4 +struct ImGuiIO; // Main configuration and I/O between your application and ImGui +struct ImGuiOnceUponAFrame; // Simple helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro +struct ImGuiStorage; // Simple custom key value storage +struct ImGuiStyle; // Runtime data for styling/colors +struct ImGuiTextFilter; // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" +struct ImGuiTextBuffer; // Text buffer for logging/accumulating text +struct ImGuiTextEditCallbackData; // Shared state of ImGui::InputText() when using custom ImGuiTextEditCallback (rare/advanced use) +struct ImGuiSizeConstraintCallbackData;// Structure used to constraint window size in custom ways when using custom ImGuiSizeConstraintCallback (rare/advanced use) +struct ImGuiListClipper; // Helper to manually clip large list of items +struct ImGuiContext; // ImGui context (opaque) + + // Enumerations (declared as int for compatibility and to not pollute the top of this file) +typedef unsigned int ImU32; +typedef unsigned short ImWchar; // character for keyboard input/display +typedef void* ImTextureID; // user data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp) +typedef ImU32 ImGuiID; // unique ID used by widgets (typically hashed from a stack of string) +typedef int ImGuiCol; // a color identifier for styling // enum ImGuiCol_ +typedef int ImGuiStyleVar; // a variable identifier for styling // enum ImGuiStyleVar_ +typedef int ImGuiKey; // a key identifier (ImGui-side enum) // enum ImGuiKey_ +typedef int ImGuiAlign; // alignment // enum ImGuiAlign_ +typedef int ImGuiColorEditMode; // color edit mode for ColorEdit*() // enum ImGuiColorEditMode_ +typedef int ImGuiMouseCursor; // a mouse cursor identifier // enum ImGuiMouseCursor_ +typedef int ImGuiWindowFlags; // window flags for Begin*() // enum ImGuiWindowFlags_ +typedef int ImGuiSetCond; // condition flags for Set*() // enum ImGuiSetCond_ +typedef int ImGuiInputTextFlags; // flags for InputText*() // enum ImGuiInputTextFlags_ +typedef int ImGuiSelectableFlags; // flags for Selectable() // enum ImGuiSelectableFlags_ +typedef int ImGuiTreeNodeFlags; // flags for TreeNode*(), Collapsing*() // enum ImGuiTreeNodeFlags_ +typedef int(*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data); +typedef void(*ImGuiSizeConstraintCallback)(ImGuiSizeConstraintCallbackData* data); + +struct ImVec2 +{ + float x, y; + ImVec2() { x = y = 0.0f; } + ImVec2(float _x, float _y) { x = _x; y = _y; } +#ifdef IM_VEC2_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2. + IM_VEC2_CLASS_EXTRA +#endif +}; + +struct ImVec4 +{ + float x, y, z, w; + ImVec4() { x = y = z = w = 0.0f; } + ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; } +#ifdef IM_VEC4_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec4. + IM_VEC4_CLASS_EXTRA +#endif +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// IImGuiManager +// +// Gui Manager interface that exposes various gui functions. (ImGui) +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +interface IGuiManager +{ + virtual bool GetHideObjects(void) const = 0; + virtual void SetHideObjects(bool bHide) = 0; + + virtual ImGuiIO& GetIO(void) = 0; + virtual ImGuiStyle& GetStyle(void) = 0; + virtual ImDrawData* GetDrawData(void) = 0; + + virtual void ShowUserGuide(void) = 0; + virtual void ShowStyleEditor(ImGuiStyle* ref = NULL) = 0; + virtual void ShowTestWindow(bool* p_open = NULL) = 0; + virtual void ShowMetricsWindow(bool* p_open = NULL) = 0; + + virtual bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0) = 0; + virtual bool Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0) = 0; + virtual void End(void) = 0; + virtual bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0) = 0; + virtual bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0) = 0; + virtual void EndChild(void) = 0; + virtual ImVec2 GetContentRegionMax(void) = 0; + virtual ImVec2 GetContentRegionAvail(void) = 0; + virtual float GetContentRegionAvailWidth(void) = 0; + virtual ImVec2 GetWindowContentRegionMin(void) = 0; + virtual ImVec2 GetWindowContentRegionMax(void) = 0; + virtual float GetWindowContentRegionWidth(void) = 0; + virtual ImDrawList* GetWindowDrawList(void) = 0; + virtual ImVec2 GetWindowPos(void) = 0; + virtual ImVec2 GetWindowSize(void) = 0; + virtual float GetWindowWidth(void) = 0; + virtual float GetWindowHeight(void) = 0; + virtual bool IsWindowCollapsed(void) = 0; + virtual void SetWindowFontScale(float scale) = 0; + + virtual void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0) = 0; + virtual void SetNextWindowPosCenter(ImGuiSetCond cond = 0) = 0; + virtual void SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0) = 0; + virtual void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback = NULL, void* custom_callback_data = NULL) = 0; + virtual void SetNextWindowContentSize(const ImVec2& size) = 0; + virtual void SetNextWindowContentWidth(float width) = 0; + virtual void SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0) = 0; + virtual void SetNextWindowFocus(void) = 0; + virtual void SetWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0) = 0; + virtual void SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0) = 0; + virtual void SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0) = 0; + virtual void SetWindowFocus(void) = 0; + virtual void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0) = 0; + virtual void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0) = 0; + virtual void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0) = 0; + virtual void SetWindowFocus(const char* name) = 0; + + virtual float GetScrollX(void) = 0; + virtual float GetScrollY(void) = 0; + virtual float GetScrollMaxX(void) = 0; + virtual float GetScrollMaxY(void) = 0; + virtual void SetScrollX(float scroll_x) = 0; + virtual void SetScrollY(float scroll_y) = 0; + virtual void SetScrollHere(float center_y_ratio = 0.5f) = 0; + virtual void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f) = 0; + virtual void SetKeyboardFocusHere(int offset = 0) = 0; + virtual void SetStateStorage(ImGuiStorage* tree) = 0; + virtual ImGuiStorage* GetStateStorage(void) = 0; + + virtual void PushFont(ImFont* font) = 0; + virtual void PopFont(void) = 0; + virtual void PushStyleColor(ImGuiCol idx, const ImVec4& col) = 0; + virtual void PopStyleColor(int count = 1) = 0; + virtual void PushStyleVar(ImGuiStyleVar idx, float val) = 0; + virtual void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val) = 0; + virtual void PopStyleVar(int count = 1) = 0; + virtual ImFont* GetFont(void) = 0; + virtual float GetFontSize(void) = 0; + virtual ImVec2 GetFontTexUvWhitePixel(void) = 0; + virtual ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f) = 0; + virtual ImU32 GetColorU32(const ImVec4& col) = 0; + + virtual void PushItemWidth(float item_width) = 0; + virtual void PopItemWidth(void) = 0; + virtual float CalcItemWidth(void) = 0; + virtual void PushTextWrapPos(float wrap_pos_x = 0.0f) = 0; + virtual void PopTextWrapPos(void) = 0; + virtual void PushAllowKeyboardFocus(bool v) = 0; + virtual void PopAllowKeyboardFocus(void) = 0; + virtual void PushButtonRepeat(bool repeat) = 0; + virtual void PopButtonRepeat(void) = 0; + + virtual void Separator(void) = 0; + virtual void SameLine(float pos_x = 0.0f, float spacing_w = -1.0f) = 0; + virtual void NewLine(void) = 0; + virtual void Spacing(void) = 0; + virtual void Dummy(const ImVec2& size) = 0; + virtual void Indent(float indent_w = 0.0f) = 0; + virtual void Unindent(float indent_w = 0.0f) = 0; + virtual void BeginGroup(void) = 0; + virtual void EndGroup(void) = 0; + virtual ImVec2 GetCursorPos(void) = 0; + virtual float GetCursorPosX(void) = 0; + virtual float GetCursorPosY(void) = 0; + virtual void SetCursorPos(const ImVec2& local_pos) = 0; + virtual void SetCursorPosX(float x) = 0; + virtual void SetCursorPosY(float y) = 0; + virtual ImVec2 GetCursorStartPos(void) = 0; + virtual ImVec2 GetCursorScreenPos(void) = 0; + virtual void SetCursorScreenPos(const ImVec2& pos) = 0; + virtual void AlignFirstTextHeightToWidgets(void) = 0; + virtual float GetTextLineHeight(void) = 0; + virtual float GetTextLineHeightWithSpacing(void) = 0; + virtual float GetItemsLineHeightWithSpacing(void) = 0; + + virtual void Columns(int count = 1, const char* id = NULL, bool border = true) = 0; + virtual void NextColumn(void) = 0; + virtual int GetColumnIndex(void) = 0; + virtual float GetColumnOffset(int column_index = -1) = 0; + virtual void SetColumnOffset(int column_index, float offset_x) = 0; + virtual float GetColumnWidth(int column_index = -1) = 0; + virtual int GetColumnsCount(void) = 0; + + virtual void PushID(const char* str_id) = 0; + virtual void PushID(const char* str_id_begin, const char* str_id_end) = 0; + virtual void PushID(const void* ptr_id) = 0; + virtual void PushID(int int_id) = 0; + virtual void PopID(void) = 0; + virtual ImGuiID GetID(const char* str_id) = 0; + virtual ImGuiID GetID(const char* str_id_begin, const char* str_id_end) = 0; + virtual ImGuiID GetID(const void* ptr_id) = 0; + + virtual void Text(const char* fmt, ...) = 0; + virtual void TextV(const char* fmt, va_list args) = 0; + virtual void TextColored(const ImVec4& col, const char* fmt, ...) = 0; + virtual void TextColoredV(const ImVec4& col, const char* fmt, va_list args) = 0; + virtual void TextDisabled(const char* fmt, ...) = 0; + virtual void TextDisabledV(const char* fmt, va_list args) = 0; + virtual void TextWrapped(const char* fmt, ...) = 0; + virtual void TextWrappedV(const char* fmt, va_list args) = 0; + virtual void TextUnformatted(const char* text, const char* text_end = NULL) = 0; + virtual void LabelText(const char* label, const char* fmt, ...) = 0; + virtual void LabelTextV(const char* label, const char* fmt, va_list args) = 0; + virtual void Bullet(void) = 0; + virtual void BulletText(const char* fmt, ...) = 0; + virtual void BulletTextV(const char* fmt, va_list args) = 0; + virtual bool Button(const char* label, const ImVec2& size = ImVec2(0, 0)) = 0; + virtual bool SmallButton(const char* label) = 0; + virtual bool InvisibleButton(const char* str_id, const ImVec2& size) = 0; + virtual void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0)) = 0; + virtual bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1)) = 0; + virtual bool Checkbox(const char* label, bool* v) = 0; + virtual bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value) = 0; + virtual bool RadioButton(const char* label, bool active) = 0; + virtual bool RadioButton(const char* label, int* v, int v_button) = 0; + virtual bool Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1) = 0; + virtual bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1) = 0; + virtual bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1) = 0; + virtual bool ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true) = 0; + virtual bool ColorEdit3(const char* label, float col[3]) = 0; + virtual bool ColorEdit4(const char* label, float col[4], bool show_alpha = true) = 0; + virtual void ColorEditMode(ImGuiColorEditMode mode) = 0; + virtual void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float)) = 0; + virtual void PlotLines(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0)) = 0; + virtual void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float)) = 0; + virtual void PlotHistogram(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0)) = 0; + virtual void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1, 0), const char* overlay = NULL) = 0; + + virtual bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f) = 0; + virtual bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f) = 0; + virtual bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f) = 0; + virtual bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f) = 0; + virtual bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", const char* display_format_max = NULL, float power = 1.0f) = 0; + virtual bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f") = 0; + virtual bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f") = 0; + virtual bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f") = 0; + virtual bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f") = 0; + virtual bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f", const char* display_format_max = NULL) = 0; + + virtual bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL) = 0; + virtual bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL) = 0; + virtual bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0) = 0; + virtual bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0) = 0; + virtual bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0) = 0; + virtual bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0) = 0; + virtual bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0) = 0; + virtual bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0) = 0; + virtual bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0) = 0; + virtual bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0) = 0; + + virtual bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f) = 0; + virtual bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f) = 0; + virtual bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f) = 0; + virtual bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f) = 0; + virtual bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f) = 0; + virtual bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f") = 0; + virtual bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f") = 0; + virtual bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f") = 0; + virtual bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f") = 0; + virtual bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f) = 0; + virtual bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f") = 0; + + virtual bool TreeNode(const char* label) = 0; + virtual bool TreeNode(const char* str_id, const char* fmt, ...) = 0; + virtual bool TreeNode(const void* ptr_id, const char* fmt, ...) = 0; + virtual bool TreeNodeV(const char* str_id, const char* fmt, va_list args) = 0; + virtual bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args) = 0; + virtual bool TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0) = 0; + virtual bool TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) = 0; + virtual bool TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) = 0; + virtual bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) = 0; + virtual bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) = 0; + virtual void TreePush(const char* str_id = NULL) = 0; + virtual void TreePush(const void* ptr_id = NULL) = 0; + virtual void TreePop(void) = 0; + virtual void TreeAdvanceToLabelPos(void) = 0; + virtual float GetTreeNodeToLabelSpacing(void) = 0; + virtual void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0) = 0; + virtual bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0) = 0; + virtual bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0) = 0; + + virtual bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0)) = 0; + virtual bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0)) = 0; + virtual bool ListBox(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1) = 0; + virtual bool ListBox(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1) = 0; + virtual bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) = 0; + virtual bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1) = 0; + virtual void ListBoxFooter(void) = 0; + + virtual void Value(const char* prefix, bool b) = 0; + virtual void Value(const char* prefix, int v) = 0; + virtual void Value(const char* prefix, unsigned int v) = 0; + virtual void Value(const char* prefix, float v, const char* float_format = NULL) = 0; + virtual void ValueColor(const char* prefix, const ImVec4& v) = 0; + virtual void ValueColor(const char* prefix, unsigned int v) = 0; + + virtual void SetTooltip(const char* fmt, ...) = 0; + virtual void SetTooltipV(const char* fmt, va_list args) = 0; + virtual void BeginTooltip(void) = 0; + virtual void EndTooltip(void) = 0; + + virtual bool BeginMainMenuBar(void) = 0; + virtual void EndMainMenuBar(void) = 0; + virtual bool BeginMenuBar(void) = 0; + virtual void EndMenuBar(void) = 0; + virtual bool BeginMenu(const char* label, bool enabled = true) = 0; + virtual void EndMenu(void) = 0; + virtual bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true) = 0; + virtual bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true) = 0; + + virtual void OpenPopup(const char* str_id) = 0; + virtual bool BeginPopup(const char* str_id) = 0; + virtual bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags extra_flags = 0) = 0; + virtual bool BeginPopupContextItem(const char* str_id, int mouse_button = 1) = 0; + virtual bool BeginPopupContextWindow(bool also_over_items = true, const char* str_id = NULL, int mouse_button = 1) = 0; + virtual bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1) = 0; + virtual void EndPopup(void) = 0; + virtual void CloseCurrentPopup(void) = 0; + + virtual void LogToTTY(int max_depth = -1) = 0; + virtual void LogToFile(int max_depth = -1, const char* filename = NULL) = 0; + virtual void LogToClipboard(int max_depth = -1) = 0; + virtual void LogFinish(void) = 0; + virtual void LogButtons(void) = 0; + virtual void LogText(const char* fmt, ...) = 0; + + virtual void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect) = 0; + virtual void PopClipRect(void) = 0; + + virtual bool IsItemHovered(void) = 0; + virtual bool IsItemHoveredRect(void) = 0; + virtual bool IsItemActive(void) = 0; + virtual bool IsItemClicked(int mouse_button = 0) = 0; + virtual bool IsItemVisible(void) = 0; + virtual bool IsAnyItemHovered(void) = 0; + virtual bool IsAnyItemActive(void) = 0; + virtual ImVec2 GetItemRectMin(void) = 0; + virtual ImVec2 GetItemRectMax(void) = 0; + virtual ImVec2 GetItemRectSize(void) = 0; + virtual void SetItemAllowOverlap(void) = 0; + virtual bool IsWindowHovered(void) = 0; + virtual bool IsWindowFocused(void) = 0; + virtual bool IsRootWindowFocused(void) = 0; + virtual bool IsRootWindowOrAnyChildFocused(void) = 0; + virtual bool IsRootWindowOrAnyChildHovered(void) = 0; + virtual bool IsRectVisible(const ImVec2& size) = 0; + virtual bool IsPosHoveringAnyWindow(const ImVec2& pos) = 0; + virtual float GetTime(void) = 0; + virtual int GetFrameCount(void) = 0; + virtual const char* GetStyleColName(ImGuiCol idx) = 0; + virtual ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f) = 0; + virtual ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f) = 0; + virtual void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end) = 0; + + virtual bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags = 0) = 0; + virtual void EndChildFrame(void) = 0; + + virtual ImVec4 ColorConvertU32ToFloat4(ImU32 in) = 0; + virtual ImU32 ColorConvertFloat4ToU32(const ImVec4& in) = 0; + virtual void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v) = 0; + virtual void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b) = 0; + + virtual int GetKeyIndex(ImGuiKey key) = 0; + virtual bool IsKeyDown(int key_index) = 0; + virtual bool IsKeyPressed(int key_index, bool repeat = true) = 0; + virtual bool IsKeyReleased(int key_index) = 0; + virtual bool IsMouseDown(int button) = 0; + virtual bool IsMouseClicked(int button, bool repeat = false) = 0; + virtual bool IsMouseDoubleClicked(int button) = 0; + virtual bool IsMouseReleased(int button) = 0; + virtual bool IsMouseHoveringWindow(void) = 0; + virtual bool IsMouseHoveringAnyWindow(void) = 0; + virtual bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true) = 0; + virtual bool IsMouseDragging(int button = 0, float lock_threshold = -1.0f) = 0; + virtual ImVec2 GetMousePos(void) = 0; + virtual ImVec2 GetMousePosOnOpeningCurrentPopup(void) = 0; + virtual ImVec2 GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f) = 0; + virtual void ResetMouseDragDelta(int button = 0) = 0; + virtual ImGuiMouseCursor GetMouseCursor(void) = 0; + virtual void SetMouseCursor(ImGuiMouseCursor type) = 0; + virtual void CaptureKeyboardFromApp(bool capture = true) = 0; + virtual void CaptureMouseFromApp(bool capture = true) = 0; + + virtual void* MemAlloc(size_t sz) = 0; + virtual void MemFree(void* ptr) = 0; + virtual const char* GetClipboardText(void) = 0; + virtual void SetClipboardText(const char* text) = 0; + + virtual const char* GetVersion(void) = 0; + virtual ImGuiContext* CreateContext(void* (*malloc_fn)(size_t) = NULL, void(*free_fn)(void*) = NULL) = 0; + virtual void DestroyContext(ImGuiContext* ctx) = 0; + virtual ImGuiContext* GetCurrentContext(void) = 0; + virtual void SetCurrentContext(ImGuiContext* ctx) = 0; +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// BELOW THIS LINE IS DEFINITIONS SPECIFIC TO IMGUI AND DEFINED BY THE IMGUI LIBRARY! +// NOTHING BELOW THIS LINE IS DEFINED BY ASHITA SPECIFICALLY UNLESS OTHERWISE NOTED!! +// +// YOU SHOULD NOT EDIT ANYTHING IN THIS FILE! +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef ASHITA_INTERNAL_COMPILED + +// Flags for ImGui::Begin() +enum ImGuiWindowFlags_ +{ + // Default: 0 + ImGuiWindowFlags_NoTitleBar = 1 << 0, // Disable title-bar + ImGuiWindowFlags_NoResize = 1 << 1, // Disable user resizing with the lower-right grip + ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window + ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programatically) + ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel + ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it + ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame + ImGuiWindowFlags_ShowBorders = 1 << 7, // Show borders around windows and items + ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file + ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs + ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar + ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. + ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state + ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus) + ImGuiWindowFlags_AlwaysVerticalScrollbar = 1 << 14, // Always show vertical scrollbar (even if ContentSize.y < Size.y) + ImGuiWindowFlags_AlwaysHorizontalScrollbar = 1 << 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x) + ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) + // [Internal] + ImGuiWindowFlags_ChildWindow = 1 << 20, // Don't use! For internal use by BeginChild() + ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 21, // Don't use! For internal use by BeginChild() + ImGuiWindowFlags_ChildWindowAutoFitY = 1 << 22, // Don't use! For internal use by BeginChild() + ImGuiWindowFlags_ComboBox = 1 << 23, // Don't use! For internal use by ComboBox() + ImGuiWindowFlags_Tooltip = 1 << 24, // Don't use! For internal use by BeginTooltip() + ImGuiWindowFlags_Popup = 1 << 25, // Don't use! For internal use by BeginPopup() + ImGuiWindowFlags_Modal = 1 << 26, // Don't use! For internal use by BeginPopupModal() + ImGuiWindowFlags_ChildMenu = 1 << 27 // Don't use! For internal use by BeginMenu() +}; + +// Flags for ImGui::InputText() +enum ImGuiInputTextFlags_ +{ + // Default: 0 + ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/ + ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDEFabcdef + ImGuiInputTextFlags_CharsUppercase = 1 << 2, // Turn a..z into A..Z + ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, tabs + ImGuiInputTextFlags_AutoSelectAll = 1 << 4, // Select entire text when first taking mouse focus + ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to when the value was modified) + ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Call user function on pressing TAB (for completion handling) + ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Call user function on pressing Up/Down arrows (for history handling) + ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Call user function every time. User code may query cursor position, modify text buffer. + ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character. + ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field + ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, allow exiting edition by pressing Enter. Ctrl+Enter to add new line (by default adds new lines with Enter). + ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally + ImGuiInputTextFlags_AlwaysInsertMode = 1 << 13, // Insert mode + ImGuiInputTextFlags_ReadOnly = 1 << 14, // Read-only mode + ImGuiInputTextFlags_Password = 1 << 15, // Password mode, display all characters as '*' + // [Internal] + ImGuiInputTextFlags_Multiline = 1 << 20 // For internal use by InputTextMultiline() +}; + +// Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*() +enum ImGuiTreeNodeFlags_ +{ + ImGuiTreeNodeFlags_Selected = 1 << 0, // Draw as selected + ImGuiTreeNodeFlags_Framed = 1 << 1, // Full colored frame (e.g. for CollapsingHeader) + ImGuiTreeNodeFlags_AllowOverlapMode = 1 << 2, // Hit testing to allow subsequent widgets to overlap this one + ImGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3, // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack + ImGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4, // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) + ImGuiTreeNodeFlags_DefaultOpen = 1 << 5, // Default node to be open + ImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6, // Need double-click to open node + ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. + ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes). + ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow + ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoAutoOpenOnLog +}; + +// Flags for ImGui::Selectable() +enum ImGuiSelectableFlags_ +{ + // Default: 0 + ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this don't close parent popup window + ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column) + ImGuiSelectableFlags_AllowDoubleClick = 1 << 2 // Generate press events on double clicks too +}; + +// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array +enum ImGuiKey_ +{ + ImGuiKey_Tab, // for tabbing through fields + ImGuiKey_LeftArrow, // for text edit + ImGuiKey_RightArrow,// for text edit + ImGuiKey_UpArrow, // for text edit + ImGuiKey_DownArrow, // for text edit + ImGuiKey_PageUp, + ImGuiKey_PageDown, + ImGuiKey_Home, // for text edit + ImGuiKey_End, // for text edit + ImGuiKey_Delete, // for text edit + ImGuiKey_Backspace, // for text edit + ImGuiKey_Enter, // for text edit + ImGuiKey_Escape, // for text edit + ImGuiKey_A, // for text edit CTRL+A: select all + ImGuiKey_C, // for text edit CTRL+C: copy + ImGuiKey_V, // for text edit CTRL+V: paste + ImGuiKey_X, // for text edit CTRL+X: cut + ImGuiKey_Y, // for text edit CTRL+Y: redo + ImGuiKey_Z, // for text edit CTRL+Z: undo + ImGuiKey_COUNT +}; + +// Enumeration for PushStyleColor() / PopStyleColor() +enum ImGuiCol_ +{ + ImGuiCol_Text, + ImGuiCol_TextDisabled, + ImGuiCol_WindowBg, // Background of normal windows + ImGuiCol_ChildWindowBg, // Background of child windows + ImGuiCol_PopupBg, // Background of popups, menus, tooltips windows + ImGuiCol_Border, + ImGuiCol_BorderShadow, + ImGuiCol_FrameBg, // Background of checkbox, radio button, plot, slider, text input + ImGuiCol_FrameBgHovered, + ImGuiCol_FrameBgActive, + ImGuiCol_TitleBg, + ImGuiCol_TitleBgCollapsed, + ImGuiCol_TitleBgActive, + ImGuiCol_MenuBarBg, + ImGuiCol_ScrollbarBg, + ImGuiCol_ScrollbarGrab, + ImGuiCol_ScrollbarGrabHovered, + ImGuiCol_ScrollbarGrabActive, + ImGuiCol_ComboBg, + ImGuiCol_CheckMark, + ImGuiCol_SliderGrab, + ImGuiCol_SliderGrabActive, + ImGuiCol_Button, + ImGuiCol_ButtonHovered, + ImGuiCol_ButtonActive, + ImGuiCol_Header, + ImGuiCol_HeaderHovered, + ImGuiCol_HeaderActive, + ImGuiCol_Column, + ImGuiCol_ColumnHovered, + ImGuiCol_ColumnActive, + ImGuiCol_ResizeGrip, + ImGuiCol_ResizeGripHovered, + ImGuiCol_ResizeGripActive, + ImGuiCol_CloseButton, + ImGuiCol_CloseButtonHovered, + ImGuiCol_CloseButtonActive, + ImGuiCol_PlotLines, + ImGuiCol_PlotLinesHovered, + ImGuiCol_PlotHistogram, + ImGuiCol_PlotHistogramHovered, + ImGuiCol_TextSelectedBg, + ImGuiCol_ModalWindowDarkening, // darken entire screen when a modal window is active + ImGuiCol_COUNT +}; + +// Enumeration for PushStyleVar() / PopStyleVar() +// NB: the enum only refers to fields of ImGuiStyle() which makes sense to be pushed/poped in UI code. Feel free to add others. +enum ImGuiStyleVar_ +{ + ImGuiStyleVar_Alpha, // float + ImGuiStyleVar_WindowPadding, // ImVec2 + ImGuiStyleVar_WindowRounding, // float + ImGuiStyleVar_WindowMinSize, // ImVec2 + ImGuiStyleVar_ChildWindowRounding, // float + ImGuiStyleVar_FramePadding, // ImVec2 + ImGuiStyleVar_FrameRounding, // float + ImGuiStyleVar_ItemSpacing, // ImVec2 + ImGuiStyleVar_ItemInnerSpacing, // ImVec2 + ImGuiStyleVar_IndentSpacing, // float + ImGuiStyleVar_GrabMinSize // float +}; + +enum ImGuiAlign_ +{ + ImGuiAlign_Left = 1 << 0, + ImGuiAlign_Center = 1 << 1, + ImGuiAlign_Right = 1 << 2, + ImGuiAlign_Top = 1 << 3, + ImGuiAlign_VCenter = 1 << 4, + ImGuiAlign_Default = ImGuiAlign_Left | ImGuiAlign_Top +}; + +// Enumeration for ColorEditMode() +enum ImGuiColorEditMode_ +{ + ImGuiColorEditMode_UserSelect = -2, + ImGuiColorEditMode_UserSelectShowButton = -1, + ImGuiColorEditMode_RGB = 0, + ImGuiColorEditMode_HSV = 1, + ImGuiColorEditMode_HEX = 2 +}; + +// Enumeration for GetMouseCursor() +enum ImGuiMouseCursor_ +{ + ImGuiMouseCursor_Arrow = 0, + ImGuiMouseCursor_TextInput, // When hovering over InputText, etc. + ImGuiMouseCursor_Move, // Unused + ImGuiMouseCursor_ResizeNS, // Unused + ImGuiMouseCursor_ResizeEW, // When hovering over a column + ImGuiMouseCursor_ResizeNESW, // Unused + ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window + ImGuiMouseCursor_Count_ +}; + +// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions +// All those functions treat 0 as a shortcut to ImGuiSetCond_Always +enum ImGuiSetCond_ +{ + ImGuiSetCond_Always = 1 << 0, // Set the variable + ImGuiSetCond_Once = 1 << 1, // Only set the variable on the first call per runtime session + ImGuiSetCond_FirstUseEver = 1 << 2, // Only set the variable if the window doesn't exist in the .ini file + ImGuiSetCond_Appearing = 1 << 3 // Only set the variable if the window is appearing after being inactive (or the first time) +}; + +struct ImGuiStyle +{ + float Alpha; // Global alpha applies to everything in ImGui + ImVec2 WindowPadding; // Padding within a window + ImVec2 WindowMinSize; // Minimum window size + float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows + ImGuiAlign WindowTitleAlign; // Alignment for title bar text + float ChildWindowRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows + ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets) + float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). + ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines + ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label) + ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! + float IndentSpacing; // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). + float ColumnsMinSpacing; // Minimum horizontal spacing between two columns + float ScrollbarSize; // Width of the vertical scrollbar, Height of the horizontal scrollbar + float ScrollbarRounding; // Radius of grab corners for scrollbar + float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar + float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. + ImVec2 DisplayWindowPadding; // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows. + ImVec2 DisplaySafeAreaPadding; // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. + bool AntiAliasedLines; // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU. + bool AntiAliasedShapes; // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.) + float CurveTessellationTol; // Tessellation tolerance. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. + ImVec4 Colors[ImGuiCol_COUNT]; + + IMGUI_API ImGuiStyle(); +}; + +// This is where your app communicate with ImGui. Access via ImGui::GetIO(). +// Read 'Programmer guide' section in .cpp file for general usage. +struct ImGuiIO +{ + //------------------------------------------------------------------ + // Settings (fill once) // Default value: + //------------------------------------------------------------------ + + ImVec2 DisplaySize; // // Display size, in pixels. For clamping windows positions. + float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds. + float IniSavingRate; // = 5.0f // Maximum time between saving positions/sizes to .ini file, in seconds. + const char* IniFilename; // = "imgui.ini" // Path to .ini file. NULL to disable .ini saving. + const char* LogFilename; // = "imgui_log.txt" // Path to .log file (default parameter to ImGui::LogToFile when no file is specified). + float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds. + float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. + float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging + int KeyMap[ImGuiKey_COUNT]; // // Map of indices into the KeysDown[512] entries array + float KeyRepeatDelay; // = 0.250f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). + float KeyRepeatRate; // = 0.020f // When holding a key/button, rate at which it repeats, in seconds. + void* UserData; // = NULL // Store your own data for retrieval by callbacks. + + ImFontAtlas* Fonts; // // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array. + float FontGlobalScale; // = 1.0f // Global scale all fonts + bool FontAllowUserScaling; // = false // Allow user scaling text of individual window with CTRL+Wheel. + ImVec2 DisplayFramebufferScale; // = (1.0f,1.0f) // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui. + ImVec2 DisplayVisibleMin; // (0.0f,0.0f) // If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area. + ImVec2 DisplayVisibleMax; // (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize + + // Advanced/subtle behaviors + bool WordMovementUsesAltKey; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl + bool ShortcutsUseSuperKey; // = defined(__APPLE__) // OS X style: Shortcuts using Cmd/Super instead of Ctrl + bool DoubleClickSelectsWord; // = defined(__APPLE__) // OS X style: Double click selects by word instead of selecting whole text + bool MultiSelectUsesSuperKey; // = defined(__APPLE__) // OS X style: Multi-selection in lists uses Cmd/Super instead of Ctrl [unused yet] + + //------------------------------------------------------------------ + // User Functions + //------------------------------------------------------------------ + + // Rendering function, will be called in Render(). + // Alternatively you can keep this to NULL and call GetDrawData() after Render() to get the same pointer. + // See example applications if you are unsure of how to implement this. + void(*RenderDrawListsFn)(ImDrawData* data); + + // Optional: access OS clipboard + // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) + const char* (*GetClipboardTextFn)(); + void(*SetClipboardTextFn)(const char* text); + + // Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer. + // (default to posix malloc/free) + void* (*MemAllocFn)(size_t sz); + void(*MemFreeFn)(void* ptr); + + // Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME in Windows) + // (default to use native imm32 api on Windows) + void(*ImeSetInputScreenPosFn)(int x, int y); + void* ImeWindowHandle; // (Windows) Set this to your HWND to get automatic IME cursor positioning. + + //------------------------------------------------------------------ + // Input - Fill before calling NewFrame() + //------------------------------------------------------------------ + + ImVec2 MousePos; // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) + bool MouseDown[5]; // Mouse buttons: left, right, middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. + float MouseWheel; // Mouse wheel: 1 unit scrolls about 5 lines text. + bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). + bool KeyCtrl; // Keyboard modifier pressed: Control + bool KeyShift; // Keyboard modifier pressed: Shift + bool KeyAlt; // Keyboard modifier pressed: Alt + bool KeySuper; // Keyboard modifier pressed: Cmd/Super/Windows + bool KeysDown[512]; // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data) + ImWchar InputCharacters[16 + 1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper. + + // Functions + IMGUI_API void AddInputCharacter(ImWchar c); // Helper to add a new character into InputCharacters[] + IMGUI_API void AddInputCharactersUTF8(const char* utf8_chars); // Helper to add new characters into InputCharacters[] from an UTF-8 string + inline void ClearInputCharacters() { InputCharacters[0] = 0; } // Helper to clear the text input buffer + + //------------------------------------------------------------------ + // Output - Retrieve after calling NewFrame(), you can use them to discard inputs or hide them from the rest of your application + //------------------------------------------------------------------ + + bool WantCaptureMouse; // Mouse is hovering a window or widget is active (= ImGui will use your mouse input) + bool WantCaptureKeyboard; // Widget is active (= ImGui will use your keyboard input) + bool WantTextInput; // Some text input widget is active, which will read input characters from the InputCharacters array. + float Framerate; // Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames + int MetricsAllocs; // Number of active memory allocations + int MetricsRenderVertices; // Vertices output during last call to Render() + int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3 + int MetricsActiveWindows; // Number of visible windows (exclude child windows) + + //------------------------------------------------------------------ + // [Internal] ImGui will maintain those fields for you + //------------------------------------------------------------------ + + ImVec2 MousePosPrev; // Previous mouse position + ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are negative to allow mouse enabling/disabling. + bool MouseClicked[5]; // Mouse button went from !Down to Down + ImVec2 MouseClickedPos[5]; // Position at time of clicking + float MouseClickedTime[5]; // Time of last click (used to figure out double-click) + bool MouseDoubleClicked[5]; // Has mouse button been double-clicked? + bool MouseReleased[5]; // Mouse button went from Down to !Down + bool MouseDownOwned[5]; // Track if button was clicked inside a window. We don't request mouse capture from the application if click started outside ImGui bounds. + float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked) + float MouseDownDurationPrev[5]; // Previous time the mouse button has been down + float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the click point + float KeysDownDuration[512]; // Duration the keyboard key has been down (0.0f == just pressed) + float KeysDownDurationPrev[512]; // Previous duration the key has been down + + IMGUI_API ImGuiIO(); +}; + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +// Lightweight std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug). +// Our implementation does NOT call c++ constructors because we don't use them in ImGui. Don't use this class as a straight std::vector replacement in your code! +template +class ImVector +{ +public: + int Size; + int Capacity; + T* Data; + + typedef T value_type; + typedef value_type* iterator; + typedef const value_type* const_iterator; + + ImVector() { Size = Capacity = 0; Data = NULL; } + ~ImVector() { if (Data) free(Data); } + + inline bool empty() const { return Size == 0; } + inline int size() const { return Size; } + inline int capacity() const { return Capacity; } + + inline value_type& operator[](int i) { IM_ASSERT(i < Size); return Data[i]; } + inline const value_type& operator[](int i) const { IM_ASSERT(i < Size); return Data[i]; } + + inline void clear() { if (Data) { Size = Capacity = 0; free(Data); Data = NULL; } } + inline iterator begin() { return Data; } + inline const_iterator begin() const { return Data; } + inline iterator end() { return Data + Size; } + inline const_iterator end() const { return Data + Size; } + inline value_type& front() { IM_ASSERT(Size > 0); return Data[0]; } + inline const value_type& front() const { IM_ASSERT(Size > 0); return Data[0]; } + inline value_type& back() { IM_ASSERT(Size > 0); return Data[Size - 1]; } + inline const value_type& back() const { IM_ASSERT(Size > 0); return Data[Size - 1]; } + inline void swap(ImVector& rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; } + + inline int _grow_capacity(int new_size) { int new_capacity = Capacity ? (Capacity + Capacity / 2) : 8; return new_capacity > new_size ? new_capacity : new_size; } + + inline void resize(int new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; } + inline void reserve(int new_capacity) + { + if (new_capacity <= Capacity) return; + T* new_data = (value_type*)malloc((size_t)new_capacity * sizeof(value_type)); + memcpy(new_data, Data, (size_t)Size * sizeof(value_type)); + free(Data); + Data = new_data; + Capacity = new_capacity; + } + + inline void push_back(const value_type& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); Data[Size++] = v; } + inline void pop_back() { IM_ASSERT(Size > 0); Size--; } + + inline iterator erase(const_iterator it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; } + inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= Data && it <= Data + Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; return Data + off; } +}; + +// Helper: execute a block of code at maximum once a frame +// Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame. +// Usage: +// IMGUI_ONCE_UPON_A_FRAME +// { +// // code block will be executed one per frame +// } +// Attention! the macro expands into 2 statement so make sure you don't use it within e.g. an if() statement without curly braces. +//#define IMGUI_ONCE_UPON_A_FRAME static ImGuiOnceUponAFrame imgui_oaf##__LINE__; if (imgui_oaf##__LINE__) +//struct ImGuiOnceUponAFrame +//{ +// ImGuiOnceUponAFrame() { RefFrame = -1; } +// mutable int RefFrame; +// operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; } +//}; + +// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" +struct ImGuiTextFilter +{ + struct TextRange + { + const char* b; + const char* e; + + TextRange() { b = e = NULL; } + TextRange(const char* _b, const char* _e) { b = _b; e = _e; } + const char* begin() const { return b; } + const char* end() const { return e; } + bool empty() const { return b == e; } + char front() const { return *b; } + static bool is_blank(char c) { return c == ' ' || c == '\t'; } + void trim_blanks() { while (b < e && is_blank(*b)) b++; while (e > b && is_blank(*(e - 1))) e--; } + IMGUI_API void split(char separator, ImVector& out); + }; + + char InputBuf[256]; + ImVector Filters; + int CountGrep; + + ImGuiTextFilter(const char* default_filter = ""); + ~ImGuiTextFilter() {} + void Clear() { InputBuf[0] = 0; Build(); } + bool Draw(const char* label = "Filter (inc,-exc)", float width = 0.0f); // Helper calling InputText+Build + bool PassFilter(const char* text, const char* text_end = NULL) const; + bool IsActive() const { return !Filters.empty(); } + IMGUI_API void Build(); +}; + +// Helper: Text buffer for logging/accumulating text +struct ImGuiTextBuffer +{ + ImVector Buf; + + ImGuiTextBuffer() { Buf.push_back(0); } + inline char operator[](int i) { return Buf.Data[i]; } + const char* begin() const { return &Buf.front(); } + const char* end() const { return &Buf.back(); } // Buf is zero-terminated, so end() will point on the zero-terminator + int size() const { return Buf.Size - 1; } + bool empty() { return Buf.Size <= 1; } + void clear() { Buf.clear(); Buf.push_back(0); } + const char* c_str() const { return Buf.Data; } + IMGUI_API void append(const char* fmt, ...) IM_PRINTFARGS(2); + IMGUI_API void appendv(const char* fmt, va_list args); +}; + +// Helper: Simple Key->value storage +// - Store collapse state for a tree (Int 0/1) +// - Store color edit options (Int using values in ImGuiColorEditMode enum). +// - Custom user storage for temporary values. +// Typically you don't have to worry about this since a storage is held within each Window. +// Declare your own storage if: +// - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state). +// - You want to store custom debug data easily without adding or editing structures in your code. +// Types are NOT stored, so it is up to you to make sure your Key don't collide with different types. +struct ImGuiStorage +{ + struct Pair + { + ImGuiID key; + union { int val_i; float val_f; void* val_p; }; + Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; } + Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; } + Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; } + }; + ImVector Data; + + // - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N) + // - Set***() functions find pair, insertion on demand if missing. + // - Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair. + IMGUI_API void Clear(); + IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const; + IMGUI_API void SetInt(ImGuiID key, int val); + IMGUI_API bool GetBool(ImGuiID key, bool default_val = false) const; + IMGUI_API void SetBool(ImGuiID key, bool val); + IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const; + IMGUI_API void SetFloat(ImGuiID key, float val); + IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL + IMGUI_API void SetVoidPtr(ImGuiID key, void* val); + + // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. + // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. + // - A typical use case where this is convenient: + // float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar; + // - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application. + IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0); + IMGUI_API bool* GetBoolRef(ImGuiID key, bool default_val = false); + IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0.0f); + IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL); + + // Use on your own storage if you know only integer are being stored (open/close all tree nodes) + IMGUI_API void SetAllInt(int val); +}; + +// Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used and the corresponding callback is triggered. +struct ImGuiTextEditCallbackData +{ + ImGuiInputTextFlags EventFlag; // One of ImGuiInputTextFlags_Callback* // Read-only + ImGuiInputTextFlags Flags; // What user passed to InputText() // Read-only + void* UserData; // What user passed to InputText() // Read-only + bool ReadOnly; // Read-only mode // Read-only + + // CharFilter event: + ImWchar EventChar; // Character input // Read-write (replace character or set to zero) + + // Completion,History,Always events: + // If you modify the buffer contents make sure you update 'BufTextLen' and set 'BufDirty' to true. + ImGuiKey EventKey; // Key pressed (Up/Down/TAB) // Read-only + char* Buf; // Current text buffer // Read-write (pointed data only, can't replace the actual pointer) + int BufTextLen; // Current text length in bytes // Read-write + int BufSize; // Maximum text length in bytes // Read-only + bool BufDirty; // Set if you modify Buf/BufTextLen!! // Write + int CursorPos; // // Read-write + int SelectionStart; // // Read-write (== to SelectionEnd when no selection) + int SelectionEnd; // // Read-write + + // NB: Helper functions for text manipulation. Calling those function loses selection. + void DeleteChars(int pos, int bytes_count); + void InsertChars(int pos, const char* text, const char* text_end = NULL); + bool HasSelection() const { return SelectionStart != SelectionEnd; } +}; + +// Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin(). +// NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough. +struct ImGuiSizeConstraintCallbackData +{ + void* UserData; // Read-only. What user passed to SetNextWindowSizeConstraints() + ImVec2 Pos; // Read-only. Window position, for reference. + ImVec2 CurrentSize; // Read-only. Current window size. + ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. +}; + +// ImColor() helper to implicity converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float) +// Prefer using IM_COL32() macros if you want a guaranteed compile-time ImU32 for usage with ImDrawList API. +// Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class. +// None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. +struct ImColor +{ + ImVec4 Value; + + ImColor() { Value.x = Value.y = Value.z = Value.w = 0.0f; } + ImColor(int r, int g, int b, int a = 255) { float sc = 1.0f / 255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; } + ImColor(ImU32 rgba) { float sc = 1.0f / 255.0f; Value.x = (float)(rgba & 0xFF) * sc; Value.y = (float)((rgba >> 8) & 0xFF) * sc; Value.z = (float)((rgba >> 16) & 0xFF) * sc; Value.w = (float)(rgba >> 24) * sc; } + ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; } + ImColor(const ImVec4& col) { Value = col; } + //inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); } + inline operator ImVec4() const { return Value; } + + //inline void SetHSV(float h, float s, float v, float a = 1.0f) { ImGui::ColorConvertHSVtoRGB(h, s, v, Value.x, Value.y, Value.z); Value.w = a; } + + //static ImColor HSV(float h, float s, float v, float a = 1.0f) { float r, g, b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r, g, b, a); } +}; + +// Helper: Manually clip large list of items. +// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all. +// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. +// ImGui already clip items based on their bounds but it needs to measure text size to do so. Coarse clipping before submission makes this cost and your own data fetching/submission cost null. +// Usage: +// ImGuiListClipper clipper(1000); // we have 1000 elements, evenly spaced. +// while (clipper.Step()) +// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) +// ImGui::Text("line number %d", i); +// - Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height (step skipped if we passed a known height as second arg to constructor). +// - Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element. +// - (Step 2: dummy step only required if an explicit items_height was passed to constructor or Begin() and user call Step(). Does nothing and switch to Step 3.) +// - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop. +struct ImGuiListClipper +{ + float StartPosY; + float ItemsHeight; + int ItemsCount, StepNo, DisplayStart, DisplayEnd; + + // items_count: Use -1 to ignore (you can call Begin later). Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step). + // items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetItemsLineHeightWithSpacing(). + // If you don't specify an items_height, you NEED to call Step(). If you specify items_height you may call the old Begin()/End() api directly, but prefer calling Step(). + ImGuiListClipper(int items_count = -1, float items_height = -1.0f) { Begin(items_count, items_height); } // NB: Begin() initialize every fields (as we allow user to call Begin/End multiple times on a same instance if they want). + ~ImGuiListClipper() { IM_ASSERT(ItemsCount == -1); } // Assert if user forgot to call End() or Step() until false. + + IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items. + IMGUI_API void Begin(int items_count, float items_height = -1.0f); // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1. + IMGUI_API void End(); // Automatically called on the last call of Step() that returns false. +}; + +//----------------------------------------------------------------------------- +// Draw List +// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList. +//----------------------------------------------------------------------------- + +// Helpers macros to generate 32-bits encoded colors +#define IM_COL32(R,G,B,A) (((ImU32)(A)<<24) | ((ImU32)(B)<<16) | ((ImU32)(G)<<8) | ((ImU32)(R))) +#define IM_COL32_WHITE (0xFFFFFFFF) +#define IM_COL32_BLACK (0xFF000000) +#define IM_COL32_BLACK_TRANS (0x00000000) // Transparent black + +// Draw callbacks for advanced uses. +// NB- You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering (you can poke into the draw list for that) +// Draw callback may be useful for example, A) Change your GPU render state, B) render a complex 3D scene inside a UI element (without an intermediate texture/render target), etc. +// The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) cmd.UserCallback(parent_list, cmd); else RenderTriangles()' +typedef void(*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); + +// Typically, 1 command = 1 gpu draw call (unless command is a callback) +struct ImDrawCmd +{ + unsigned int ElemCount; // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[]. + ImVec4 ClipRect; // Clipping rectangle (x1, y1, x2, y2) + ImTextureID TextureId; // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas. + ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally. + void* UserCallbackData; // The draw callback code can access this. + + ImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = -8192.0f; ClipRect.z = ClipRect.w = +8192.0f; TextureId = NULL; UserCallback = NULL; UserCallbackData = NULL; } +}; + +// Vertex index (override with '#define ImDrawIdx unsigned int' inside in imconfig.h) +#ifndef ImDrawIdx +typedef unsigned short ImDrawIdx; +#endif + +// Vertex layout +#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT +struct ImDrawVert +{ + ImVec2 pos; + ImVec2 uv; + ImU32 col; +}; +#else +// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h +// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine. +// The type has to be described within the macro (you can either declare the struct or use a typedef) +IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT; +#endif + +// Draw channels are used by the Columns API to "split" the render list into different channels while building, so items of each column can be batched together. +// You can also use them to simulate drawing layers and submit primitives in a different order than how they will be rendered. +struct ImDrawChannel +{ + ImVector CmdBuffer; + ImVector IdxBuffer; +}; + +// Draw command list +// This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering. +// At the moment, each ImGui window contains its own ImDrawList but they could potentially be merged in the future. +// If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives. +// You can interleave normal ImGui:: calls and adding primitives to the current draw list. +// All positions are in screen coordinates (0,0=top-left, 1 pixel per unit). Primitives are always added to the list and not culled (culling is done at render time and at a higher-level by ImGui:: functions). +struct ImDrawList +{ + // This is what you have to render + ImVector CmdBuffer; // Commands. Typically 1 command = 1 gpu draw call. + ImVector IdxBuffer; // Index buffer. Each command consume ImDrawCmd::ElemCount of those + ImVector VtxBuffer; // Vertex buffer. + + // [Internal, used while building lists] + const char* _OwnerName; // Pointer to owner window's name (if any) for debugging + unsigned int _VtxCurrentIdx; // [Internal] == VtxBuffer.Size + ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) + ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) + ImVector _ClipRectStack; // [Internal] + ImVector _TextureIdStack; // [Internal] + ImVector _Path; // [Internal] current path building + int _ChannelsCurrent; // [Internal] current channel number (0) + int _ChannelsCount; // [Internal] number of active channels (1+) + ImVector _Channels; // [Internal] draw channels for columns API (not resized down so _ChannelsCount may be smaller than _Channels.Size) + + ImDrawList() { _OwnerName = NULL; Clear(); } + ~ImDrawList() { ClearFreeMemory(); } + IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) + IMGUI_API void PushClipRectFullScreen(); + IMGUI_API void PopClipRect(); + IMGUI_API void PushTextureID(const ImTextureID& texture_id); + IMGUI_API void PopTextureID(); + + // Primitives + IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f); + IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F, float thickness = 1.0f); // a: upper-left, b: lower-right + IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F); // a: upper-left, b: lower-right + IMGUI_API void AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left); + IMGUI_API void AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness = 1.0f); + IMGUI_API void AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col); + IMGUI_API void AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness = 1.0f); + IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col); + IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12, float thickness = 1.0f); + IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12); + IMGUI_API void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL); + IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL); + IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), ImU32 col = 0xFFFFFFFF); + IMGUI_API void AddPolyline(const ImVec2* points, const int num_points, ImU32 col, bool closed, float thickness, bool anti_aliased); + IMGUI_API void AddConvexPolyFilled(const ImVec2* points, const int num_points, ImU32 col, bool anti_aliased); + IMGUI_API void AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments = 0); + + // Stateful path API, add points then finish with PathFill() or PathStroke() + inline void PathClear() { _Path.resize(0); } + inline void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); } + inline void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); } + inline void PathFill(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col, true); PathClear(); } + inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness, true); PathClear(); } + IMGUI_API void PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 10); + IMGUI_API void PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle + IMGUI_API void PathBezierCurveTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0); + IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, int rounding_corners = 0x0F); + + // Channels + // - Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives) + // - Use to minimize draw calls (e.g. if going back-and-forth between multiple non-overlapping clipping rectangles, prefer to append into separate channels then merge at the end) + IMGUI_API void ChannelsSplit(int channels_count); + IMGUI_API void ChannelsMerge(); + IMGUI_API void ChannelsSetCurrent(int channel_index); + + // Advanced + IMGUI_API void AddCallback(ImDrawCallback callback, void* callback_data); // Your rendering function must check for 'UserCallback' in ImDrawCmd and call the function instead of rendering triangles. + IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible + + // Internal helpers + // NB: all primitives needs to be reserved via PrimReserve() beforehand! + IMGUI_API void Clear(); + IMGUI_API void ClearFreeMemory(); + IMGUI_API void PrimReserve(int idx_count, int vtx_count); + IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles) + IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col); + IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col); + inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; } + inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } + inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } + IMGUI_API void UpdateClipRect(); + IMGUI_API void UpdateTextureID(); +}; + +// All draw data to render an ImGui frame +struct ImDrawData +{ + bool Valid; // Only valid after Render() is called and before the next NewFrame() is called. + ImDrawList** CmdLists; + int CmdListsCount; + int TotalVtxCount; // For convenience, sum of all cmd_lists vtx_buffer.Size + int TotalIdxCount; // For convenience, sum of all cmd_lists idx_buffer.Size + + // Functions + ImDrawData() { Valid = false; CmdLists = NULL; CmdListsCount = TotalVtxCount = TotalIdxCount = 0; } + IMGUI_API void DeIndexAllBuffers(); // For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! + IMGUI_API void ScaleClipRects(const ImVec2& sc); // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than ImGui expects, or if there is a difference between your window resolution and framebuffer resolution. +}; + +struct ImFontConfig +{ + void* FontData; // // TTF data + int FontDataSize; // // TTF data size + bool FontDataOwnedByAtlas; // true // TTF data ownership taken by the container ImFontAtlas (will delete memory itself). Set to true + int FontNo; // 0 // Index of font within TTF file + float SizePixels; // // Size in pixels for rasterizer + int OversampleH, OversampleV; // 3, 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis. + bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1. + ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs + const ImWchar* GlyphRanges; // // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + bool MergeMode; // false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). + bool MergeGlyphCenterV; // false // When merging (multiple ImFontInput for one ImFont), vertically center new glyphs instead of aligning their baseline + + // [Internal] + char Name[32]; // Name (strictly for debugging) + ImFont* DstFont; + + IMGUI_API ImFontConfig(); +}; + +// Load and rasterize multiple TTF fonts into a same texture. +// Sharing a texture for multiple fonts allows us to reduce the number of draw calls during rendering. +// We also add custom graphic data into the texture that serves for ImGui. +// 1. (Optional) Call AddFont*** functions. If you don't call any, the default font will be loaded for you. +// 2. Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data. +// 3. Upload the pixels data into a texture within your graphics system. +// 4. Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture. This value will be passed back to you during rendering to identify the texture. +// 5. Call ClearTexData() to free textures memory on the heap. +// NB: If you use a 'glyph_ranges' array you need to make sure that your array persist up until the ImFont is cleared. We only copy the pointer, not the data. +struct ImFontAtlas +{ + IMGUI_API ImFontAtlas(); + IMGUI_API ~ImFontAtlas(); + IMGUI_API ImFont* AddFont(const ImFontConfig* font_cfg); + IMGUI_API ImFont* AddFontDefault(const ImFontConfig* font_cfg = NULL); + IMGUI_API ImFont* AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); + IMGUI_API ImFont* AddFontFromMemoryTTF(void* ttf_data, int ttf_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // Transfer ownership of 'ttf_data' to ImFontAtlas, will be deleted after Build() + IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_ttf_data' still owned by caller. Compress with binary_to_compressed_c.cpp + IMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_ttf_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 paramaeter + IMGUI_API void ClearTexData(); // Clear the CPU-side texture data. Saves RAM once the texture has been copied to graphics memory. + IMGUI_API void ClearInputData(); // Clear the input TTF data (inc sizes, glyph ranges) + IMGUI_API void ClearFonts(); // Clear the ImGui-side font data (glyphs storage, UV coordinates) + IMGUI_API void Clear(); // Clear all + + // Retrieve texture data + // User is in charge of copying the pixels into graphics memory, then call SetTextureUserID() + // After loading the texture into your graphic system, store your texture handle in 'TexID' (ignore if you aren't using multiple fonts nor images) + // RGBA32 format is provided for convenience and high compatibility, but note that all RGB pixels are white, so 75% of the memory is wasted. + // Pitch = Width * BytesPerPixels + IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel + IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel + void SetTexID(void* id) { TexID = id; } + + // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list) + // NB: Make sure that your string are UTF-8 and NOT in your local code page. See FAQ for details. + IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin + IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters + IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs + IMGUI_API const ImWchar* GetGlyphRangesChinese(); // Japanese + full set of about 21000 CJK Unified Ideographs + IMGUI_API const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters + + // Members + // (Access texture data via GetTexData*() calls which will setup a default font for you.) + void* TexID; // User data to refer to the texture once it has been uploaded to user's graphic systems. It ia passed back to you during rendering. + unsigned char* TexPixelsAlpha8; // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight + unsigned int* TexPixelsRGBA32; // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4 + int TexWidth; // Texture width calculated during Build(). + int TexHeight; // Texture height calculated during Build(). + int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. + ImVec2 TexUvWhitePixel; // Texture coordinates to a white pixel + ImVector Fonts; // Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font. + + // Private + ImVector ConfigData; // Internal data + IMGUI_API bool Build(); // Build pixels data. This is automatically for you by the GetTexData*** functions. + IMGUI_API void RenderCustomTexData(int pass, void* rects); +}; + +// Font runtime data and rendering +// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32(). +struct ImFont +{ + struct Glyph + { + ImWchar Codepoint; + float XAdvance; + float X0, Y0, X1, Y1; + float U0, V0, U1, V1; // Texture coordinates + }; + + // Members: Hot ~62/78 bytes + float FontSize; // // Height of characters, set during loading (don't change after loading) + float Scale; // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale() + ImVec2 DisplayOffset; // = (0.f,1.f) // Offset font rendering by xx pixels + ImVector Glyphs; // // All glyphs. + ImVector IndexXAdvance; // // Sparse. Glyphs->XAdvance in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI). + ImVector IndexLookup; // // Sparse. Index glyphs by Unicode code-point. + const Glyph* FallbackGlyph; // == FindGlyph(FontFallbackChar) + float FallbackXAdvance; // == FallbackGlyph->XAdvance + ImWchar FallbackChar; // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar() + + // Members: Cold ~18/26 bytes + short ConfigDataCount; // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont. + ImFontConfig* ConfigData; // // Pointer within ContainerAtlas->ConfigData + ImFontAtlas* ContainerAtlas; // // What we has been loaded into + float Ascent, Descent; // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] + + // Methods + IMGUI_API ImFont(); + IMGUI_API ~ImFont(); + IMGUI_API void Clear(); + IMGUI_API void BuildLookupTable(); + IMGUI_API const Glyph* FindGlyph(ImWchar c) const; + IMGUI_API void SetFallbackChar(ImWchar c); + float GetCharAdvance(ImWchar c) const { return ((int)c < IndexXAdvance.Size) ? IndexXAdvance[(int)c] : FallbackXAdvance; } + bool IsLoaded() const { return ContainerAtlas != NULL; } + + // 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. + // 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable. + IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8 + IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const; + IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const; + IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const; + + // Private + IMGUI_API void GrowIndex(int new_size); + IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built. +}; + +#endif + +#endif // __ASHITA_IMGUI_H_INCLUDED__ \ No newline at end of file diff --git a/plugins/ADK/newIDirectInputDevice8A.h b/plugins/ADK/newIDirectInputDevice8A.h new file mode 100644 index 0000000..12d599d --- /dev/null +++ b/plugins/ADK/newIDirectInputDevice8A.h @@ -0,0 +1,80 @@ +/** + * Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to + * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + * + * By using Ashita, you agree to the above license and its terms. + * + * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were + * made. You must do so in any reasonable manner, but not in any way that suggests the licensor + * endorses you or your use. + * + * Non-Commercial - You may not use the material (Ashita) for commercial purposes. + * + * No-Derivatives - If you remix, transform, or build upon the material (Ashita), you may not distribute the + * modified material. You are, however, allowed to submit the modified works back to the original + * Ashita project in attempt to have it added to the original project. + * + * You may not apply legal terms or technological measures that legally restrict others + * from doing anything the license permits. + * + * No warranties are given. + */ + +#ifndef __ASHITA_NEWIDIRECTINPUTDEVICE8A_H_INCLUDED__ +#define __ASHITA_NEWIDIRECTINPUTDEVICE8A_H_INCLUDED__ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include +#include + +interface newIDirectInputDevice8A : IDirectInputDevice8A +{ + virtual __declspec(nothrow) HRESULT __stdcall QueryInterface(REFIID riid, LPVOID * ppvObj) override; + virtual __declspec(nothrow) ULONG __stdcall AddRef(void) override; + virtual __declspec(nothrow) ULONG __stdcall Release(void) override; + virtual __declspec(nothrow) HRESULT __stdcall GetCapabilities(LPDIDEVCAPS lpDIDevCaps) override; + virtual __declspec(nothrow) HRESULT __stdcall EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) override; + virtual __declspec(nothrow) HRESULT __stdcall GetProperty(REFGUID rguidProp, LPDIPROPHEADER pdiph) override; + virtual __declspec(nothrow) HRESULT __stdcall SetProperty(REFGUID rguidProp, LPCDIPROPHEADER pdiph) override; + virtual __declspec(nothrow) HRESULT __stdcall Acquire(void) override; + virtual __declspec(nothrow) HRESULT __stdcall Unacquire(void) override; + virtual __declspec(nothrow) HRESULT __stdcall GetDeviceState(DWORD cbData, LPVOID lpvData) override; + virtual __declspec(nothrow) HRESULT __stdcall GetDeviceData(DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) override; + virtual __declspec(nothrow) HRESULT __stdcall SetDataFormat(LPCDIDATAFORMAT lpdf) override; + virtual __declspec(nothrow) HRESULT __stdcall SetEventNotification(HANDLE hEvent) override; + virtual __declspec(nothrow) HRESULT __stdcall SetCooperativeLevel(HWND hwnd, DWORD dwFlags) override; + virtual __declspec(nothrow) HRESULT __stdcall GetObjectInfo(LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) override; + virtual __declspec(nothrow) HRESULT __stdcall GetDeviceInfo(LPDIDEVICEINSTANCEA pdidi) override; + virtual __declspec(nothrow) HRESULT __stdcall RunControlPanel(HWND hwndOwner, DWORD dwFlags) override; + virtual __declspec(nothrow) HRESULT __stdcall Initialize(HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) override; + virtual __declspec(nothrow) HRESULT __stdcall CreateEffect(REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter) override; + virtual __declspec(nothrow) HRESULT __stdcall EnumEffects(LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwEffType) override; + virtual __declspec(nothrow) HRESULT __stdcall GetEffectInfo(LPDIEFFECTINFOA pdei, REFGUID rguid) override; + virtual __declspec(nothrow) HRESULT __stdcall GetForceFeedbackState(LPDWORD pdwOut) override; + virtual __declspec(nothrow) HRESULT __stdcall SendForceFeedbackCommand(DWORD dwFlags) override; + virtual __declspec(nothrow) HRESULT __stdcall EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl) override; + virtual __declspec(nothrow) HRESULT __stdcall Escape(LPDIEFFESCAPE pesc) override; + virtual __declspec(nothrow) HRESULT __stdcall Poll(void) override; + virtual __declspec(nothrow) HRESULT __stdcall SendDeviceData(DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl) override; + virtual __declspec(nothrow) HRESULT __stdcall EnumEffectsInFile(LPCSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags) override; + virtual __declspec(nothrow) HRESULT __stdcall WriteEffectToFile(LPCSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags) override; + virtual __declspec(nothrow) HRESULT __stdcall BuildActionMap(LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags) override; + virtual __declspec(nothrow) HRESULT __stdcall SetActionMap(LPDIACTIONFORMATA lpdiActionFormat, LPCSTR lptszUserName, DWORD dwFlags) override; + virtual __declspec(nothrow) HRESULT __stdcall GetImageInfo(LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) override; + + newIDirectInputDevice8A(); + newIDirectInputDevice8A(IDirectInputDevice8A** ppOriginalInterface); + virtual ~newIDirectInputDevice8A(void); + +protected: + IDirectInputDevice8A* m_DirectInputDevice; + UINT m_ReferenceCount; +}; + +#endif // __ASHITA_NEWIDIRECTINPUTDEVICE8A_H_INCLUDED__ \ No newline at end of file