atom0s
8 years ago
39 changed files with 20245 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,267 @@
@@ -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__
|
@ -0,0 +1,232 @@
@@ -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 <Windows.h> |
||||
#include <vector> |
||||
|
||||
// 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<typename T> |
||||
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<typename T> |
||||
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<typename T> |
||||
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<typename T> |
||||
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<typename T> |
||||
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<std::string>* 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__
|
@ -0,0 +1,103 @@
@@ -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 <Windows.h> |
||||
|
||||
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__
|
@ -0,0 +1,149 @@
@@ -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 <Windows.h> |
||||
#include <eh.h> |
||||
|
||||
// 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__
|
@ -0,0 +1,79 @@
@@ -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 <Windows.h> |
||||
|
||||
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__
|
@ -0,0 +1,126 @@
@@ -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 <Windows.h> |
||||
#include <algorithm> |
||||
#include <sstream> |
||||
#include <vector> |
||||
|
||||
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<uint8_t> 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<std::pair<uint8_t, bool>> 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<uint8_t, bool> 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__
|
@ -0,0 +1,128 @@
@@ -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 <Windows.h> |
||||
|
||||
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__
|
@ -0,0 +1,141 @@
@@ -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 <Windows.h> |
||||
|
||||
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__
|
@ -0,0 +1,236 @@
@@ -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 <Windows.h> |
||||
#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__
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,364 @@
@@ -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_ */ |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,45 @@
@@ -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 <limits.h> |
||||
|
||||
#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__
|
||||
|
@ -0,0 +1,563 @@
@@ -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__
|
@ -0,0 +1,226 @@
@@ -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__
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,760 @@
@@ -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__
|
||||
|
||||
|
@ -0,0 +1,220 @@
@@ -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__
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,100 @@
@@ -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_
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,204 @@
@@ -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__
|
@ -0,0 +1,659 @@
@@ -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__
|
@ -0,0 +1,92 @@
@@ -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__
|
@ -0,0 +1,84 @@
@@ -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__
|
@ -0,0 +1,193 @@
@@ -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__
|
@ -0,0 +1,93 @@
@@ -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__
|
@ -0,0 +1,80 @@
@@ -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 <Windows.h> |
||||
#include <dinput.h> |
||||
|
||||
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__
|
Loading…
Reference in new issue