Eddie O'Hagan's Portfolio » Ace Library

Ace Library

Ace Library is a Windows C++ library I created that contains a series of convenience functions. Below is a list of the functions currently included with the library.

Requirements

  1. C++ 11
  2. Windows

Update 2.0: I implemented all functions to use memory alignment. This is for two reasons, one is because with the advent of C++ 11, it is now much easier to have a more universal way to align memory. The second reason is by the definition of memory alignment; it is always more efficient to have aligned memory then unaligned. This is because modern processors silently handle unaligned memory but it causes a slight performance hit because it has to do two reads instead of one read, and when there are many instructions that can add up fast. Since Ace Library now uses memory alignment, you must use _aligned_free() to delete/free any output buffers or objects from Ace Library. Otherwise you will get a “triggered break point error” or a run-time error.

Update 3.0: I implemented standard math functions in compliance with the CERT Coding Standard. Math functions are now correctly checked for domain and range errors.

Update 5.0: I implemented #ifndef for some constants that might not be recognized by some compilers.

Update 6.0: Implemented const correctness for all functions and making const correct alternitive functions from the original ones provided. Also added additional support for Unicode text.

♠Download Ace Library 6.0♠

void* _Aligned_Malloc(size_t size, size_t alignment);
void* _Aligned_Calloc(size_t size, size_t alignment);
double AbsoluteValue(const double& num);
float AbsoluteValue(const float& num);
int AbsoluteValue(const int& num);
char* AllocateAndCopyString(const char* strToCopy);
wchar_t* AllocateAndCopyString(const wchar_t* wideStrToCopy);
double ArcCos(const double& numInRadians);
float ArcCos(const float& numInRadians);
int ArcCos(const int& numInRadians);
double ArcCosH(const double& numInRadians);
float ArcCosH(const float& numInRadians);
int ArcCosH(const int& numInRadians);
double ArcSin(const double& numInRadians);
float ArcSin(const float& numInRadians);
int ArcSin(const int& numInRadians);
double ArcSinH(const double& numInRadians);
float ArcSinH(const float& numInRadians);
int ArcSinH(const int& numInRadians);
double ArcTan(const double& numInRadians);
float ArcTan(const float& numInRadians);
int ArcTan(const int& numInRadians);
double ArcTanH(const double& numInRadians);
float ArcTanH(const float& numInRadians);
int ArcTanH(const int& numInRadians);
double ArcTan2(const double& yInRadians, const double& xInRadians);
float ArcTan2(const float& yInRadians, const float& xInRadians);
int ArcTan2(const int& yInRadians, const int& xInRadians);
void CalculateAspectRatio(const int& newWidth, const int& newHeight, const int& originalWidth, const int& originalHeight, int& outAdjustedWidth, int& outAdjustedHeight);
LONGLONG CalculateFileSize(const char* theFilePath);
LONGLONG CalculateFileSize(const wchar_t* theFilePath);
int CalculateNumLength(const int& num);
long CalculateNumLength(const long& num);
double Ceiling(const double& num);
float Ceiling(const float& num);
int Ceiling(const int& num);
bool ChangeWindowsConsoleFont(const wchar_t* fontName, const wchar_t* locale, const UINT& fontFamily, const UINT& fontWeight, const SHORT& fontWidth, const SHORT& fontHeight, const DWORD& fontIndex = 0);
char CharAt(const char* str, const int& index);
wchar_t CharAt(const wchar_t* str, const int& index);
double ComplementaryErrorFunction(const double& num);
float ComplementaryErrorFunction(const float& num);
int ComplementaryErrorFunction(const int& num);
char* ConcatenateStrings(const int& numStrings, char** stringArray);
wchar_t* ConcatenateStrings(const int& numStrings, wchar_t** stringArray);
char* ConcatenateStrings(const vector& stringVectorArray);
wchar_t* ConcatenateStrings(const vector& stringVectorArray);
bool ConcatenateStrings(char* destination, const int& numStrings, const char** stringArray);
bool ConcatenateStrings(wchar_t* destination, const int& numStrings, const wchar_t** stringArray);
bool ConcatenateStrings(char* destination, const vector& stringVectorArray);
bool ConcatenateStrings(wchar_t* destination, const vector& stringVectorArray);
char* Concatenate(int numStrings, …);
wchar_t* ConcatenateW(int numWideStrings, …);
bool Concatenate(char* destination, int numStrings, …);
bool ConcatenateW(wchar_t* destination, int numWideStrings, …);
bool Contains(const char* strToSearch, const char* strToLookFor);
bool Contains(const wchar_t* strToSearch, const wchar_t* strToLookFor);
bool ContainsIgnoreCase(const char* strToSearch, const char* strToLookFor);
bool ContainsIgnoreCase(const wchar_t* strToSearch, const wchar_t* strToLookFor);
bool ConvertDoubleToBool(const double& num);
bool ConvertFloatToBool(const float& num);
bool ConvertIntToBool(const int& num);
char* ConvertIntToString(const int& integerToConvert);
wchar_t* ConvertIntToWideString(const int& integerToConvert);
vector<char*> ConvertStringArrayToStringVectorArray(char** stringArray);
vector<wchar_t*> ConvertStringArrayToStringVectorArray(wchar_t** stringArray);
bool ConvertStringToBool(const char* str);
bool ConvertStringToBool(const wchar_t* str);
float* ConvertStringToFloatArray(const char* strToConvert, const char* delimiter, int& outNumItems);
float* ConvertStringToFloatArray(const wchar_t* strToConvert, const wchar_t* delimiter, int& outNumItems);
unsigned int ConvertStringToHex(const char* str);
unsigned int ConvertStringToHex(const wchar_t* str);
char* ConvertStringToOneLine(const char* strToConvert);
wchar_t* ConvertStringToOneLine(const wchar_t* strToConvert);
void ConvertStringToOneLineInPlace(char* strToConvert);
void ConvertStringToOneLineInPlace(wchar_t* strToConvert);
wchar_t* ConvertStringToWCharString(const char* strToConvert);
char** ConvertStringVectorArrayToStringArray(const vector& stringVectorArray, int& outStringArrayLength);
wchar_t** ConvertStringVectorArrayToStringArray(const vector& stringVectorArray, int& outStringArrayLength);
bool ConvertStringVectorArrayToStringArray(char** destinationStrArray, const vector& stringVectorArray, int& outStringArrayLength);
bool ConvertStringVectorArrayToStringArray(wchar_t** destinationStrArray, const vector& stringVectorArray, int& outStringArrayLength);
char ConvertToLowerCase(const char& character);
wchar_t ConvertToLowerCase(const wchar_t& character);
char ConvertToUpperCase(const char& character);
wchar_t ConvertToUpperCase(const wchar_t& character);
char* ConvertToLowerCase(const char* str);
wchar_t* ConvertToLowerCase(const wchar_t* str);
void ConvertToLowerCaseInPlace(char* str);
void ConvertToLowerCaseInPlace(wchar_t* str);
char* ConvertToUpperCase(const char* str);
wchar_t* ConvertToUpperCase(const wchar_t* str);
void ConvertToUpperCaseInPlace(char* str);
void ConvertToUpperCaseInPlace(wchar_t* str);
double Cos(const double& numInRadians);
float Cos(const float& numInRadians);
int Cos(const int& numInRadians);
double CosH(const double& numInRadians);
float CosH(const float& numInRadians);
int CosH(const int& numInRadians);
int CountNumOccurrences(const char* strToSearch, const char& charToLookFor);
int CountNumOccurrences(const wchar_t* strToSearch, const wchar_t& charToLookFor);
int CountNumOccurrences(const char* strToSearch, const char* strToLookFor);
int CountNumOccurrences(const wchar_t* strToSearch, const wchar_t* strToLookFor);
double CubeRoot(const double& num);
float CubeRoot(const float& num);
int CubeRoot(const int& num);
double DegreesToRadians(const double& degrees);
float DegreesToRadians(const float& degrees);
int DegreesToRadians(const int& degrees);
bool DoesFileExist(const char* fullFilePathWithNameAndExt);
bool DoesFileExist(const wchar_t* fullFilePathWithNameAndExt);
double ErrorFunction(const double& num);
float ErrorFunction(const float& num);
int ErrorFunction(const int& num);
bool Equals(const char* strToCompOne, const char* strToCompTwo);
bool Equals(const wchar_t* strToCompOne, const wchar_t* strToCompTwo);
bool EqualsIgnoreCase(const char* strToCompOne, const char* strToCompTwo);
bool EqualsIgnoreCase(const wchar_t* strToCompOne, const wchar_t* strToCompTwo);
double EToTheXPower(const double& power);
float EToTheXPower(const float& power);
int EToTheXPower(const int& power);
double EToTheXPowerMinusOne(const double& power);
float EToTheXPowerMinusOne(const float& power);
int EToTheXPowerMinusOne(const int& power);
char FirstChar(const char* str);
wchar_t FirstChar(const wchar_t* str);
double Floor(const double& num);
float Floor(const float& num);
int Floor(const int& num);
double GammaFunction(const double& num);
float GammaFunction(const float& num);
int GammaFunction(const int& num);
int GenerateRandomNum(const int& min, const int& max);
char* GetHResultDescription(const HRESULT& result);
wchar_t* GetHResultDescriptionW(const HRESULT& result);
void GetImageSize(const char* fileName, int* outWidth, int* outHeight);
void GetImageSizeW(const wchar_t* fileName, int* outWidth, int* outHeight);
void GetLastWindowsError(wchar_t* outLastWindowsErrorMessage);
double Hypotenuse(const double& x, const double& y);
float Hypotenuse(const float& x, const float& y);
int Hypotenuse(const int& x, const int& y);
int IndexOf(const char* strToSearch, const char& charToLookFor);
int IndexOf(const wchar_t* strToSearch, const wchar_t& charToLookFor);
int IndexOf(const char* strToSearch, const char* strToLookFor);
int IndexOf(const wchar_t* strToSearch, const wchar_t* strToLookFor);
int IndexOfFirstLetter(const char* strToSearch);
int IndexOfFirstLetter(const wchar_t* strToSearch);
int IndexOfIgnoreCase(const char* strToSearch, const char& charToLookFor);
int IndexOfIgnoreCase(const wchar_t* strToSearch, const wchar_t& charToLookFor);
int IndexOfIgnoreCase(const char* strToSearch, const char* strToLookFor);
int IndexOfIgnoreCase(const wchar_t* strToSearch, const wchar_t* strToLookFor);
char* InsertString(const char* strToReceive, const char* strToInsert, const int& startIndex);
wchar_t* InsertString(const wchar_t* strToReceive, const wchar_t* strToInsert, const int& startIndex);
bool InsertString(char* destination, const char* strToReceive, const char* strToInsert, const int& startIndex);
bool InsertString(wchar_t* destination, const wchar_t* strToReceive, const wchar_t* strToInsert, const int& startIndex);
bool IsAlphabetic(const char& character);
bool IsAlphabetic(const wchar_t& character);
bool IsDigit(const char& character);
bool IsDigit(const wchar_t& character);
bool IsEmpty(const char* str);
bool IsEmpty(const wchar_t* str);
bool IsNumber(const char* str);
bool IsNumber(const wchar_t* str);
bool IsPathADevice(const char* path);
bool IsPathADevice(const wchar_t* path);
bool IsWhitespace(const char& character);
bool IsWhitespace(const wchar_t& character);
double Largest(const double& numOne, const double& numTwo);
float Largest(const float& numOne, const float& numTwo);
int Largest(const int& numOne, const int& numTwo);
char LastChar(const char* str);
wchar_t LastChar(const wchar_t* str);
int LastIndexOf(const char* strToSearch, const char* strToLookFor);
int LastIndexOf(const wchar_t* strToSearch, const wchar_t* strToLookFor);
double LogBaseTen(const double& num);
float LogBaseTen(const float& num);
int LogBaseTen(const int& num);
double LogBaseTwo(const double& num);
float LogBaseTwo(const float& num);
int LogBaseTwo(const int& num);
double Mod(const double& numerator, const double& denominator);
float Mod(const float& numerator, const float& denominator);
int Mod(const int& numerator, const int& denominator);
double MultiplyThenAdd(const double& multOne, const double& multTwo, const double& add);
float MultiplyThenAdd(const float& multOne, const float& multTwo, const float& add);
int MultiplyThenAdd(const int& multOne, const int& multTwo, const int& add);
double NaturalLog(const double& num);
float NaturalLog(const float& num);
int NaturalLog(const int& num);
double NaturalLogGammaFunction(const double& num);
float NaturalLogGammaFunction(const float& num);
int NaturalLogGammaFunction(const int& num);
int NextIndexOf(const char* strToSearch, const char& charToLookFor, const int& startIndex);
int NextIndexOf(const wchar_t* strToSearch, const wchar_t& charToLookFor, const int& startIndex);
int NextIndexOf(const char* strToSearch, const char* strToLookFor, const int& startIndex);
int NextIndexOf(const wchar_t* strToSearch, const wchar_t* strToLookFor, const int& startIndex);
double NumTimesTwoToTheXPower(const double& num, const double& power);
float NumTimesTwoToTheXPower(const float& num, const float& power);
int NumTimesTwoToTheXPower(const int& num, const int& power);
double Power(const double& base, const double& exponent);
float Power(const float& base, const float& exponent);
int Power(const int& base, const int& exponent);
double PositiveDifference(const double& numOne, const double& numTwo);
float PositiveDifference(const float& numOne, const float& numTwo);
int PositiveDifference(const int& numOne, const int& numTwo);
double RadiansToDegrees(const double& radians);
float RadiansToDegrees(const float& radians);
int RadiansToDegrees(const int& radians);
char* ReadTextFile(const char* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const char* mode = “r”, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
wchar_t* ReadTextFileW(const wchar_t* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const wchar_t* mode = L”r, ccs=UTF-8″, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
void* ReadBinaryFile(const char* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const char* mode = “rb”, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
void* ReadBinaryFileW(const wchar_t* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const wchar_t* mode = L”rb, ccs=UTF-8″, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
bool ReadTextFile(char* destination, const char* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const char* mode = “r”, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
bool ReadTextFileW(wchar_t* destination, const wchar_t* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const wchar_t* mode = L”r, ccs=UTF-8″, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
bool ReadBinaryFile(void* destination, const char* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const char* mode = “rb”, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
bool ReadBinaryFileW(void* destination, const wchar_t* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const wchar_t* mode = L”rb, ccs=UTF-8″, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
double Remainder(const double& numerator, const double& denominator);
float Remainder(const float& numerator, const float& denominator);
int Remainder(const int& numerator, const int& denominator);
double RemainderWithQuotient(const double& numerator, const double& denominator, int* outQuotient);
float RemainderWithQuotient(const float& numerator, const float& denominator, int* outQuotient);
int RemainderWithQuotient(const int& numerator, const int& denominator, int* outQuotient);
char* RemoveAllWhitespace(const char* str);
wchar_t* RemoveAllWhitespace(const wchar_t* str);
void RemoveAllWhitespaceInPlace(char* str);
void RemoveAllWhitespaceInPlace(wchar_t* str);
char* RemoveCharactersFromString(const char* strToRemoveFrom, const char& charToRemove);
wchar_t* RemoveCharactersFromString(const wchar_t* strToRemoveFrom, const wchar_t& charToRemove);
void RemoveCharactersFromStringInPlace(char* strToRemoveFrom, const char& charToRemove);
void RemoveCharactersFromStringInPlace(wchar_t* strToRemoveFrom, const wchar_t& charToRemove);
char* RemoveStringFromString(const char* strToRemoveFrom, const char* strToRemove, const bool& removeOnlyFirstOccurrence = false);
wchar_t* RemoveStringFromString(const wchar_t* strToRemoveFrom, const wchar_t* strToRemove, const bool& removeOnlyFirstOccurrence = false);
void RemoveStringFromStringInPlace(char* strToRemoveFrom, const char* strToRemove, const bool& removeOnlyFirstOccurrence = false);
void RemoveStringFromStringInPlace(wchar_t* strToRemoveFrom, const wchar_t* strToRemove, const bool& removeOnlyFirstOccurrence = false);
char* ReplaceString(const char* strToSearch, const char* strToLookFor, const char* strToReplaceWith, const bool& removeOnlyFirstOccurrence = false);
wchar_t* ReplaceString(const wchar_t* strToSearch, const wchar_t* strToLookFor, const wchar_t* strToReplaceWith, const bool& removeOnlyFirstOccurrence = false);
bool ReplaceString(char* destination, const int& destinationLength, const char* strToSearch, const char* strToLookFor, const char* strToReplaceWith, const bool& removeOnlyFirstOccurrence = false);
bool ReplaceString(wchar_t* destination, const int& destinationLength, const wchar_t* strToSearch, const wchar_t* strToLookFor, const wchar_t* strToReplaceWith, const bool& removeOnlyFirstOccurrence = false);
char* RetrieveDataBetweenTags(const char* fileData, const char* startTag, const char* endTag);
wchar_t* RetrieveDataBetweenTags(const wchar_t* fileData, const wchar_t* startTag, const wchar_t* endTag);
char* RetrieveDataBetweenTags(const char* fileData, const int& startTagIndex, const int& endTagIndex);
wchar_t* RetrieveDataBetweenTags(const wchar_t* fileData, const int& startTagIndex, const int& endTagIndex);
bool RetrieveDataBetweenTags(char* destination, const char* fileData, const char* startTag, const char* endTag);
bool RetrieveDataBetweenTags(wchar_t* destination, const wchar_t* fileData, const wchar_t* startTag, const wchar_t* endTag);
bool RetrieveDataBetweenTags(char* destination, const char* fileData, const int& startTagIndex, const int& endTagIndex);
bool RetrieveDataBetweenTags(wchar_t* destination, const wchar_t* fileData, const int& startTagIndex, const int& endTagIndex);
char** RetrieveDataChunksBetweenTags(const char* fileData, const char* startTag, const char* endTag, int& outFinalBufferSize);
wchar_t** RetrieveDataChunksBetweenTags(const wchar_t* fileData, const wchar_t* startTag, const wchar_t* endTag, int& outFinalBufferSize);
bool RetrieveDataChunksBetweenTags(char** destination, const char* fileData, const char* startTag, const char* endTag);
bool RetrieveDataChunksBetweenTags(wchar_t** destination, const wchar_t* fileData, const wchar_t* startTag, const wchar_t* endTag);
vector<char*> RetrieveFileNames(const char* fullFilePath);
vector<wchar_t*> RetrieveFileNames(const wchar_t* fullFilePath);
vector<char*> RetrieveFolderNames(const char* fullFilePath);
vector<wchar_t*> RetrieveFolderNames(const wchar_t* fullFilePath);
bool RetrieveFileNames(vector& destination, const char* fullFilePath);
bool RetrieveFileNames(vector& destination, const wchar_t* fullFilePath);
bool RetrieveFolderNames(vector& destination, const char* fullFilePath);
bool RetrieveFolderNames(vector& destination, const wchar_t* fullFilePath);
char* ReverseString(const char* strToReverse);
wchar_t* ReverseString(const wchar_t* strToReverse);
void ReverseStringInPlace(char* strToReverse);
void ReverseStringInPlace(wchar_t* strToReverse);
long RoundToNearestInteger(const double& num);
long RoundToNearestInteger(const float& num);
long RoundToNearestInteger(const int& num);
long RoundUp(const double& num);
long RoundUp(const float& num);
long RoundUp(const int& num);
void ShowMessageBox(const HWND& hWindow, const char* message, const char* title = “Error”);
void ShowMessageBox(const HWND& hWindow, const wchar_t* message, const wchar_t* title = L”Error”);
double Sin(const double& numInRadians);
float Sin(const float& numInRadians);
int Sin(const int& numInRadians);
double SinH(const double& numInRadians);
float SinH(const float& numInRadians);
int SinH(const int& numInRadians);
double Smallest(const double& numOne, const double& numTwo);
float Smallest(const float& numOne, const float& numTwo);
int Smallest(const int& numOne, const int& numTwo);
double SquareRoot(const double& num);
float SquareRoot(const float& num);
int SquareRoot(const int& num);
char* SubString(const char* str, const int& startIndex, const int& upToButNotIncludingIndex = INT_MAX);
wchar_t* SubString(const wchar_t* str, const int& startIndex, const int& upToButNotIncludingIndex = INT_MAX);
bool SubString(char* destination, const char* str, const int& startIndex, const int& upToButNotIncludingIndex = INT_MAX);
bool SubString(wchar_t* destination, const wchar_t* str, const int& startIndex, const int& upToButNotIncludingIndex = INT_MAX);
double Tan(const double& numInRadians);
float Tan(const float& numInRadians);
int Tan(const int& numInRadians);
double TanH(const double& numInRadians);
float TanH(const float& numInRadians);
int TanH(const int& numInRadians);
char** Tokenize(const char* strToTokenize, const char* delimiter, int& outNumTokensFound);
wchar_t** Tokenize(const wchar_t* strToTokenize, const wchar_t* delimiter, int& outNumTokensFound);
bool Tokenize(char** destination, const char* strToTokenize, const char* delimiter, int& outNumTokensFound);
bool Tokenize(wchar_t** destination, const wchar_t* strToTokenize, const wchar_t* delimiter, int& outNumTokensFound);
double Truncate(const double& num);
float Truncate(const float& num);
double TwoToTheXPower(const double& power);
float TwoToTheXPower(const float& power);
int TwoToTheXPower(const int& power);
bool Validate(const HWND& hWnd, const HRESULT& result, const char* message, const char* title = “ERROR”);
bool Validate(const HWND& hWnd, const HRESULT& result, const wchar_t* message, const wchar_t* title = L”ERROR”);
size_t WriteTextFile(const char* filePath, const void* bufferToWrite, const size_t& bufferSize, const char* mode = “w”, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
size_t WriteTextFileW(const wchar_t* filePath, const void* bufferToWrite, const size_t& bufferSize, const wchar_t* mode = L”w, ccs=UTF-8″, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
size_t WriteBinaryFile(const char* filePath, const void* bufferToWrite, const size_t& bufferSize, const char* mode = “wb”, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
size_t WriteBinaryFileW(const wchar_t* filePath, const void* bufferToWrite, const size_t& bufferSize, const wchar_t* mode = L”wb, ccs=UTF-8″, const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
bool ZeroOutMemory(void* bufferToZero, const size_t& sizeOfBufferInBytes);

AceVR Library is a Windows C++ library I created that contains a series of convenience functions Specifically for Virtual Reality projects since it uses OpenVR. Below is a list of the functions currently included with the library.

Requirements

  1. C++ 11
  2. Windows
  3. OpenVR

I implemented all functions to use memory alignment. This is for two reasons, one is because with the advent of C++ 11, it is now much easier to have a more universal way to align memory. The second reason is by the definition of memory alignment; it is always more efficient to have aligned memory then unaligned. This is because modern processors silently handle unaligned memory but it causes a slight performance hit because it has to do two reads instead of one read, and when there are many instructions that can add up fast. Since Ace Library and AceVR Library now uses memory alignment, you must use _aligned_free() to delete/free any output buffers or objects from Ace Library and AceVR Library. Otherwise you will get a “triggered break point error” or a run-time error.

♠Download AceVR Library 1.2♠

XMMATRIX ConvertSteamVRMatrixToXMMATRIX(const HmdMatrix34_t& matPose)
bool GetContainsProximitySensor(IVRSystem* hmd, uint32_t deviceIndex)
bool GetControllerIsButtonPressed(IVRSystem* hmd, EVRButtonId button)
bool GetControllerIsButtonTouched(IVRSystem* hmd, EVRButtonId button)
XMMATRIX GetCurrentViewProjectionMatrix(IVRSystem* hmd, const XMMATRIX& projectionMat, const XMMATRIX& eyePose, const XMMATRIX& hmdPose)
float GetDeviceBatteryPercentage(IVRSystem* hmd, uint32_t deviceIndex)
uint64_t GetDeviceClass(IVRSystem* hmd, uint32_t deviceIndex)
bool GetDeviceIsCharging(IVRSystem* hmd, uint32_t deviceIndex)
bool GetDeviceIsWireless(IVRSystem* hmd, uint32_t deviceIndex)
bool GetDeviceProvidesBatteryStatus(IVRSystem* hmd, uint32_t deviceIndex)
char* GetFirmwareProgrammingTarget(IVRSystem* hmd, uint32_t deviceIndex)
uint64_t GetFirmwareVersion(IVRSystem* hmd, uint32_t deviceIndex)
uint64_t GetFPGAVersion(IVRSystem* hmd, uint32_t deviceIndex)
bool GetHasCamera(IVRSystem* hmd, uint32_t deviceIndex)
uint64_t GetHMDAudioFirmwareVersion(IVRSystem* hmd, uint32_t deviceIndex)
uint64_t GetHMDCameraCompatibilityMode(IVRSystem* hmd, uint32_t deviceIndex)
uint64_t GetHMDCurrentUniverseId(IVRSystem* hmd, uint32_t deviceIndex)
uint64_t GetHMDDisplayBootloaderVersion(IVRSystem* hmd, uint32_t deviceIndex)
uint64_t GetHMDDisplayFirmwareVersion(IVRSystem* hmd, uint32_t deviceIndex)
float GetHMDDisplayFrequency(IVRSystem* hmd, uint32_t deviceIndex)
uint64_t GetHMDDisplayHardwareVersion(IVRSystem* hmd, uint32_t deviceIndex)
XMMATRIX GetHMDEyePoseMatrix(IVRSystem* hmd, Hmd_Eye nEye);
XMMATRIX GetHMDEyeProjectionMatrix(IVRSystem* hmd, Hmd_Eye nEye, float nearClipPlane, float farClipPlane);
uint64_t GetHMDPreviousUniverseId(IVRSystem* hmd, uint32_t deviceIndex)
float GetHMDSecondsFromVsyncToPhotons(IVRSystem* hmd, uint32_t deviceIndex)
float GetHMDUserIpdMeters(IVRSystem* hmd, uint32_t deviceIndex)
bool GetIsFirmwareManualUpdate(IVRSystem* hmd, uint32_t deviceIndex)
bool GetIsFirmwareUpdateAvailable(IVRSystem* hmd, uint32_t deviceIndex)
char* GetManufacturerName(IVRSystem* hmd, uint32_t deviceIndex)
char* GetModelNumber(IVRSystem* hmd, uint32_t deviceIndex)
char* GetRenderModelName(IVRSystem* hmd, uint32_t deviceIndex)
char* GetSerialNumber(IVRSystem* hmd, uint32_t deviceIndex)
char* GetTrackingSystemName(IVRSystem* hmd, uint32_t deviceIndex)
char* SteamVRMatrix34ToString(const HmdMatrix34_t& mat)
char* SteamVRMatrix44ToString(const HmdMatrix44_t& mat)
char* XMMatrixToString(const XMMATRIX& mat)

♠Download AceVR Library 1.2♠

Comments are closed.