Fixed all errors.
This commit is contained in:
parent
3acb78f247
commit
0a6f5533ee
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "EHS.h"
|
#include "Types.h"
|
||||||
|
#include "BaseObj.h"
|
||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -11,7 +12,7 @@ namespace ehs
|
|||||||
/// @tparam T Array data type to use.
|
/// @tparam T Array data type to use.
|
||||||
/// @tparam N Number data type to use.
|
/// @tparam N Number data type to use.
|
||||||
template<typename T, typename N = UInt_64>
|
template<typename T, typename N = UInt_64>
|
||||||
class Array
|
class Array : public BaseObj
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
T* data;
|
T* data;
|
||||||
@ -19,7 +20,7 @@ namespace ehs
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// Frees any data created on the heap.
|
/// Frees any data created on the heap.
|
||||||
~Array()
|
~Array() override
|
||||||
{
|
{
|
||||||
delete[] data;
|
delete[] data;
|
||||||
}
|
}
|
||||||
@ -28,6 +29,7 @@ namespace ehs
|
|||||||
Array()
|
Array()
|
||||||
: data(nullptr), size(0)
|
: data(nullptr), size(0)
|
||||||
{
|
{
|
||||||
|
AddType("Array");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes an empty array with the given size.
|
/// Initializes an empty array with the given size.
|
||||||
@ -35,6 +37,7 @@ namespace ehs
|
|||||||
explicit Array(const N size)
|
explicit Array(const N size)
|
||||||
: data(new T[size]), size(size)
|
: data(new T[size]), size(size)
|
||||||
{
|
{
|
||||||
|
AddType("Array");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes this array with an initializer list object.
|
/// Initializes this array with an initializer list object.
|
||||||
@ -42,6 +45,8 @@ namespace ehs
|
|||||||
Array(std::initializer_list<T> list)
|
Array(std::initializer_list<T> list)
|
||||||
: data(new T[list.size()]), size(list.size())
|
: data(new T[list.size()]), size(list.size())
|
||||||
{
|
{
|
||||||
|
AddType("Array");
|
||||||
|
|
||||||
N i = 0;
|
N i = 0;
|
||||||
for (auto v = list.begin(); v != list.end(); ++v)
|
for (auto v = list.begin(); v != list.end(); ++v)
|
||||||
data[i++] = std::move(*v);
|
data[i++] = std::move(*v);
|
||||||
@ -53,24 +58,43 @@ namespace ehs
|
|||||||
Array(const T* const data, const N size)
|
Array(const T* const data, const N size)
|
||||||
: data(new T[size]), size(size)
|
: data(new T[size]), size(size)
|
||||||
{
|
{
|
||||||
|
AddType("Array");
|
||||||
|
|
||||||
for (N i = 0; i < size; ++i)
|
for (N i = 0; i < size; ++i)
|
||||||
this->data[i] = data[i];
|
this->data[i] = data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Array(Array&& array) noexcept
|
||||||
|
: BaseObj(array), data(array.data), size(array.size)
|
||||||
|
{
|
||||||
|
array.data = nullptr;
|
||||||
|
array.size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// Copies all members from the given array object.
|
/// Copies all members from the given array object.
|
||||||
/// @param [in] array The array object to copy from.
|
/// @param [in] array The array object to copy from.
|
||||||
Array(const Array& array)
|
Array(const Array& array)
|
||||||
: data(new T[array.size]), size(array.size)
|
: BaseObj((BaseObj&&)array), data(new T[array.size]), size(array.size)
|
||||||
{
|
{
|
||||||
for (N i = 0; i < size; ++i)
|
for (N i = 0; i < size; ++i)
|
||||||
data[i] = array.data[i];
|
data[i] = array.data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
Array(Array&& array) noexcept
|
Array<T, N>& operator=(Array&& array) noexcept
|
||||||
: data(array.data), size(array.size)
|
|
||||||
{
|
{
|
||||||
|
if (this == &array)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=((BaseObj&&)array);
|
||||||
|
|
||||||
|
delete[] data;
|
||||||
|
data = array.data;
|
||||||
|
size = array.size;
|
||||||
|
|
||||||
array.data = nullptr;
|
array.data = nullptr;
|
||||||
array.size = 0;
|
array.size = 0;
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Copies all members from the given array object.
|
/// Copies all members from the given array object.
|
||||||
@ -81,6 +105,8 @@ namespace ehs
|
|||||||
if (this == &array)
|
if (this == &array)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=(array);
|
||||||
|
|
||||||
delete[] data;
|
delete[] data;
|
||||||
data = new T[array.size];
|
data = new T[array.size];
|
||||||
for (N i = 0; i < array.size; ++i)
|
for (N i = 0; i < array.size; ++i)
|
||||||
@ -91,21 +117,6 @@ namespace ehs
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Array<T, N>& operator=(Array&& array) noexcept
|
|
||||||
{
|
|
||||||
if (this == &array)
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
delete[] data;
|
|
||||||
data = array.data;
|
|
||||||
size = array.size;
|
|
||||||
|
|
||||||
array.data = nullptr;
|
|
||||||
array.size = 0;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Copies all members from the given initializer list object.
|
/// Copies all members from the given initializer list object.
|
||||||
/// @param [in] list The initializer list object to copy from.
|
/// @param [in] list The initializer list object to copy from.
|
||||||
/// @returns The array that has been assigned to.
|
/// @returns The array that has been assigned to.
|
||||||
|
@ -1,95 +1,52 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "EHS.h"
|
#include "Types.h"
|
||||||
#include "Type.h"
|
#include "Type.h"
|
||||||
#include "Array.h"
|
|
||||||
#include "Log.h"
|
|
||||||
|
|
||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
class BaseObj
|
class BaseObj
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Array<Type> hierarchy;
|
Type* hierarchy;
|
||||||
BaseObj* parent;
|
UInt_64 hierarchySize;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~BaseObj();
|
virtual ~BaseObj();
|
||||||
|
|
||||||
BaseObj();
|
BaseObj();
|
||||||
|
|
||||||
BaseObj(const BaseObj& base);
|
|
||||||
|
|
||||||
BaseObj(BaseObj&& base) noexcept;
|
BaseObj(BaseObj&& base) noexcept;
|
||||||
|
|
||||||
BaseObj& operator=(const BaseObj& base);
|
BaseObj(const BaseObj& base);
|
||||||
|
|
||||||
BaseObj& operator=(BaseObj&& base) noexcept;
|
BaseObj& operator=(BaseObj&& base) noexcept;
|
||||||
|
|
||||||
bool operator!() const;
|
BaseObj& operator=(const BaseObj& base);
|
||||||
|
|
||||||
bool operator==(const BaseObj& base) const;
|
bool operator==(const BaseObj& base) const;
|
||||||
|
|
||||||
bool operator!=(const BaseObj& base) const;
|
bool operator!=(const BaseObj& base) const;
|
||||||
|
|
||||||
bool HasType(const UInt_64 hashType) const;
|
const Type* GetHierarchy() const;
|
||||||
|
|
||||||
bool HasType(const Str_8& type) const;
|
UInt_64 GetHierarchySize() const;
|
||||||
|
|
||||||
protected:
|
bool HasType(UInt_64 typeHashId) const;
|
||||||
bool AddType(Str_8 type);
|
|
||||||
|
bool HasType(const Char_8* typeId) const;
|
||||||
|
|
||||||
public:
|
|
||||||
Type GetType() const;
|
Type GetType() const;
|
||||||
|
|
||||||
Type GetType(const UInt_64 hashType) const;
|
UInt_64 GetTypeIdSize() const;
|
||||||
|
|
||||||
Type GetType(const Str_8& type) const;
|
|
||||||
|
|
||||||
const Char_8* GetTypeId() const;
|
const Char_8* GetTypeId() const;
|
||||||
|
|
||||||
UInt_64 GetTypeHashId() const;
|
UInt_64 GetTypeHashId() const;
|
||||||
|
|
||||||
const Array<Type>& GetHierarchy() const;
|
|
||||||
|
|
||||||
void SetParent(BaseObj* newParent);
|
|
||||||
|
|
||||||
BaseObj* GetParent();
|
|
||||||
|
|
||||||
BaseObj* GetParent(const UInt_64 hashType);
|
|
||||||
|
|
||||||
BaseObj* GetParent(const Str_8& type);
|
|
||||||
|
|
||||||
virtual BaseObj* Clone() const;
|
virtual BaseObj* Clone() const;
|
||||||
|
|
||||||
virtual bool IsValid() const;
|
protected:
|
||||||
|
void AddType(const Char_8* id);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool BaseObj::HasType(const UInt_64 hashType) const
|
|
||||||
{
|
|
||||||
for (UInt_64 i = 0; i < hierarchy.Size(); ++i)
|
|
||||||
if (hashType == hierarchy[i].GetHashId())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Type BaseObj::GetType(const UInt_64 hashType) const
|
|
||||||
{
|
|
||||||
for (UInt_64 i = 0; i < hierarchy.Size(); ++i)
|
|
||||||
if (hashType == hierarchy[i].GetHashId())
|
|
||||||
return hierarchy[i];
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
inline BaseObj* BaseObj::GetParent(const UInt_64 hashType)
|
|
||||||
{
|
|
||||||
BaseObj* result = GetParent();
|
|
||||||
|
|
||||||
while (result && !result->HasType(hashType))
|
|
||||||
result = result->GetParent();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -60,4 +60,4 @@ namespace ehs
|
|||||||
Version GetAppVersion();
|
Version GetAppVersion();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern lwe::SInt_32 Main(lwe::Str_8* appName, lwe::Str_8* appVerId, lwe::Version* appVer);
|
extern ehs::SInt_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer);
|
@ -109,8 +109,8 @@ namespace ehs
|
|||||||
|
|
||||||
#ifndef EHS_LOG
|
#ifndef EHS_LOG
|
||||||
#ifdef EHS_DEBUG
|
#ifdef EHS_DEBUG
|
||||||
#define EHS_LOG(type, code, msg) lwe::Log::Raise({{type, lwe::GetAppName_8(), EHS_FILE, EHS_FUNC, lwe::Str_8::FromNum((lwe::UInt_32)EHS_LINE)}, code, msg})
|
#define EHS_LOG(type, code, msg) ehs::Log::Raise({{type, ehs::GetAppName_8(), EHS_FILE, EHS_FUNC, ehs::Str_8::FromNum((ehs::UInt_32)EHS_LINE)}, code, msg})
|
||||||
#else
|
#else
|
||||||
#define EHS_LOG(type, code, msg) lwe::Log::Raise({{type, lwe::GetAppName_8(), EHS_FUNC}, code, msg})
|
#define EHS_LOG(type, code, msg) ehs::Log::Raise({{type, ehs::GetAppName_8(), EHS_FUNC}, code, msg})
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "EHS.h"
|
#include "Types.h"
|
||||||
|
#include "BaseObj.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "Array.h"
|
#include "Array.h"
|
||||||
#include "Vector.h"
|
#include "Vector.h"
|
||||||
@ -20,7 +21,7 @@
|
|||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
template<typename N = UInt_64>
|
template<typename N = UInt_64>
|
||||||
class Serializer
|
class Serializer : public BaseObj
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Endianness endianness;
|
Endianness endianness;
|
||||||
@ -29,7 +30,7 @@ namespace ehs
|
|||||||
N offset;
|
N offset;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~Serializer()
|
~Serializer() override
|
||||||
{
|
{
|
||||||
delete[] data;
|
delete[] data;
|
||||||
}
|
}
|
||||||
@ -37,56 +38,45 @@ namespace ehs
|
|||||||
Serializer()
|
Serializer()
|
||||||
: endianness(Endianness::BE), data(nullptr), size(0), offset(0)
|
: endianness(Endianness::BE), data(nullptr), size(0), offset(0)
|
||||||
{
|
{
|
||||||
|
AddType("Serializer");
|
||||||
}
|
}
|
||||||
|
|
||||||
Serializer(const Endianness endianness)
|
Serializer(const Endianness endianness)
|
||||||
: endianness(endianness), data(nullptr), size(0), offset(0)
|
: endianness(endianness), data(nullptr), size(0), offset(0)
|
||||||
{
|
{
|
||||||
|
AddType("Serializer");
|
||||||
}
|
}
|
||||||
|
|
||||||
Serializer(const Endianness endianness, const N size)
|
Serializer(const Endianness endianness, const N size)
|
||||||
: endianness(endianness), data(new Byte[size]), size(size), offset(0)
|
: endianness(endianness), data(new Byte[size]), size(size), offset(0)
|
||||||
{
|
{
|
||||||
|
AddType("Serializer");
|
||||||
}
|
}
|
||||||
|
|
||||||
Serializer(const Endianness endianness, const Byte* const data, const N size, const N offset = 0)
|
Serializer(const Endianness endianness, const Byte* const data, const N size, const N offset = 0)
|
||||||
: endianness(endianness), data(new Byte[size]), size(size), offset(offset)
|
: endianness(endianness), data(new Byte[size]), size(size), offset(offset)
|
||||||
{
|
{
|
||||||
|
AddType("Serializer");
|
||||||
|
|
||||||
for (N i = 0; i < size; ++i)
|
for (N i = 0; i < size; ++i)
|
||||||
this->data[i] = data[i];
|
this->data[i] = data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
Serializer(const Serializer& serializer)
|
|
||||||
: endianness(serializer.endianness), data(new Byte[serializer.size]), size(serializer.size), offset(serializer.offset)
|
|
||||||
{
|
|
||||||
for (N i = 0; i < serializer.size; ++i)
|
|
||||||
data[i] = serializer.data[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
Serializer(Serializer&& serializer) noexcept
|
Serializer(Serializer&& serializer) noexcept
|
||||||
: endianness(serializer.endianness), data(serializer.data), size(serializer.size), offset(serializer.offset)
|
: BaseObj((BaseObj&&)serializer), endianness(serializer.endianness), data(serializer.data),
|
||||||
|
size(serializer.size), offset(serializer.offset)
|
||||||
{
|
{
|
||||||
serializer.data = nullptr;
|
serializer.data = nullptr;
|
||||||
serializer.size = 0;
|
serializer.size = 0;
|
||||||
serializer.offset = 0;
|
serializer.offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Serializer& operator=(const Serializer& serializer)
|
Serializer(const Serializer& serializer)
|
||||||
|
: BaseObj(serializer), endianness(serializer.endianness), data(new Byte[serializer.size]),
|
||||||
|
size(serializer.size), offset(serializer.offset)
|
||||||
{
|
{
|
||||||
if (this == &serializer)
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
endianness = serializer.endianness;
|
|
||||||
|
|
||||||
delete[] data;
|
|
||||||
data = new Byte[serializer.size];
|
|
||||||
for (N i = 0; i < serializer.size; ++i)
|
for (N i = 0; i < serializer.size; ++i)
|
||||||
data[i] = serializer.data[i];
|
data[i] = serializer.data[i];
|
||||||
|
|
||||||
size = serializer.size;
|
|
||||||
offset = serializer.offset;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Serializer& operator=(Serializer&& serializer) noexcept
|
Serializer& operator=(Serializer&& serializer) noexcept
|
||||||
@ -94,6 +84,8 @@ namespace ehs
|
|||||||
if (this == &serializer)
|
if (this == &serializer)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=((Serializer&&)serializer);
|
||||||
|
|
||||||
endianness = serializer.endianness;
|
endianness = serializer.endianness;
|
||||||
delete[] data;
|
delete[] data;
|
||||||
data = serializer.data;
|
data = serializer.data;
|
||||||
@ -107,6 +99,26 @@ namespace ehs
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Serializer& operator=(const Serializer& serializer)
|
||||||
|
{
|
||||||
|
if (this == &serializer)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=(serializer);
|
||||||
|
|
||||||
|
endianness = serializer.endianness;
|
||||||
|
|
||||||
|
delete[] data;
|
||||||
|
data = new Byte[serializer.size];
|
||||||
|
for (N i = 0; i < serializer.size; ++i)
|
||||||
|
data[i] = serializer.data[i];
|
||||||
|
|
||||||
|
size = serializer.size;
|
||||||
|
offset = serializer.offset;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const Serializer& in) const
|
bool operator==(const Serializer& in) const
|
||||||
{
|
{
|
||||||
if (size != in.size)
|
if (size != in.size)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
|
#include "BaseObj.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "Vector.h"
|
#include "Vector.h"
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ namespace ehs
|
|||||||
/// @tparam T The character's data type to use.
|
/// @tparam T The character's data type to use.
|
||||||
/// @tparam N The number data type to use.
|
/// @tparam N The number data type to use.
|
||||||
template<typename T = Char_8, typename N = UInt_64>
|
template<typename T = Char_8, typename N = UInt_64>
|
||||||
class Str
|
class Str : public BaseObj
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
N size;
|
N size;
|
||||||
@ -41,6 +42,7 @@ namespace ehs
|
|||||||
Str()
|
Str()
|
||||||
: size(0), data(nullptr)
|
: size(0), data(nullptr)
|
||||||
{
|
{
|
||||||
|
AddType("Str");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes members with given C-style string.
|
/// Initializes members with given C-style string.
|
||||||
@ -54,6 +56,8 @@ namespace ehs
|
|||||||
Util::Copy(data, str, Size(true));
|
Util::Copy(data, str, Size(true));
|
||||||
|
|
||||||
data[this->size] = 0;
|
data[this->size] = 0;
|
||||||
|
|
||||||
|
AddType("Str");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes members with given C-style string.
|
/// Initializes members with given C-style string.
|
||||||
@ -66,6 +70,8 @@ namespace ehs
|
|||||||
Util::Copy(data, str, Size(true));
|
Util::Copy(data, str, Size(true));
|
||||||
|
|
||||||
data[size] = 0;
|
data[size] = 0;
|
||||||
|
|
||||||
|
AddType("Str");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes string with the given size.
|
/// Initializes string with the given size.
|
||||||
@ -74,20 +80,12 @@ namespace ehs
|
|||||||
: size(size), data(new T[size + 1])
|
: size(size), data(new T[size + 1])
|
||||||
{
|
{
|
||||||
data[size] = 0;
|
data[size] = 0;
|
||||||
}
|
|
||||||
|
|
||||||
/// Copies all members from the given string object.
|
AddType("Str");
|
||||||
/// @param [in] str The string object to copy from.
|
|
||||||
Str(const Str& str)
|
|
||||||
: size(str.size), data(new T[size + 1])
|
|
||||||
{
|
|
||||||
Util::Copy(data, str.data, Size(true));
|
|
||||||
|
|
||||||
data[size] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Str(Str&& str) noexcept
|
Str(Str&& str) noexcept
|
||||||
: size(str.size), data(str.data)
|
: BaseObj((BaseObj&&)str), size(str.size), data(str.data)
|
||||||
{
|
{
|
||||||
str.size = 0;
|
str.size = 0;
|
||||||
str.data = nullptr;
|
str.data = nullptr;
|
||||||
@ -95,20 +93,12 @@ namespace ehs
|
|||||||
|
|
||||||
/// Copies all members from the given string object.
|
/// Copies all members from the given string object.
|
||||||
/// @param [in] str The string object to copy from.
|
/// @param [in] str The string object to copy from.
|
||||||
/// @returns The string that has been assigned to.
|
Str(const Str& str)
|
||||||
Str<T, N>& operator=(const Str<T, N>& str)
|
: BaseObj(str), size(str.size), data(new T[size + 1])
|
||||||
{
|
{
|
||||||
if (&str == this)
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
size = str.size;
|
|
||||||
|
|
||||||
delete[] data;
|
|
||||||
data = new T[size + 1];
|
|
||||||
Util::Copy(data, str.data, Size(true));
|
Util::Copy(data, str.data, Size(true));
|
||||||
data[size] = 0;
|
|
||||||
|
|
||||||
return *this;
|
data[size] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Str& operator=(Str&& str) noexcept
|
Str& operator=(Str&& str) noexcept
|
||||||
@ -116,6 +106,8 @@ namespace ehs
|
|||||||
if (this == &str)
|
if (this == &str)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=((BaseObj&&)str);
|
||||||
|
|
||||||
size = str.size;
|
size = str.size;
|
||||||
delete[] data;
|
delete[] data;
|
||||||
data = str.data;
|
data = str.data;
|
||||||
@ -126,6 +118,26 @@ namespace ehs
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Copies all members from the given string object.
|
||||||
|
/// @param [in] str The string object to copy from.
|
||||||
|
/// @returns The string that has been assigned to.
|
||||||
|
Str& operator=(const Str& str)
|
||||||
|
{
|
||||||
|
if (&str == this)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=(str);
|
||||||
|
|
||||||
|
size = str.size;
|
||||||
|
|
||||||
|
delete[] data;
|
||||||
|
data = new T[size + 1];
|
||||||
|
Util::Copy(data, str.data, Size(true));
|
||||||
|
data[size] = 0;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/// Copies the given C-style string and retrieves the size.
|
/// Copies the given C-style string and retrieves the size.
|
||||||
/// @param [in] str The C-style string to copy from.
|
/// @param [in] str The C-style string to copy from.
|
||||||
/// @returns The string object that has been assigned to.
|
/// @returns The string object that has been assigned to.
|
||||||
@ -1823,39 +1835,39 @@ namespace ehs
|
|||||||
typedef Str<Char_8, UInt_64> Str_8;
|
typedef Str<Char_8, UInt_64> Str_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T = lwe::Char_8, typename N = lwe::UInt_64>
|
template<typename T = ehs::Char_8, typename N = ehs::UInt_64>
|
||||||
bool operator==(const T* const first, const lwe::Str<T, N>& second)
|
bool operator==(const T* const first, const ehs::Str<T, N>& second)
|
||||||
{
|
{
|
||||||
N inSize = lwe::Str<T, N>::Len(first);
|
N inSize = ehs::Str<T, N>::Len(first);
|
||||||
if (second.Size() != inSize)
|
if (second.Size() != inSize)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return lwe::Util::IsEqual(first, second, second.Size(true));
|
return ehs::Util::IsEqual(first, second, second.Size(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T = lwe::Char_8, typename N = lwe::UInt_64>
|
template<typename T = ehs::Char_8, typename N = ehs::UInt_64>
|
||||||
bool operator!=(const T* const first, const lwe::Str<T, N>& second)
|
bool operator!=(const T* const first, const ehs::Str<T, N>& second)
|
||||||
{
|
{
|
||||||
N inSize = lwe::Str<T, N>::Len(first);
|
N inSize = ehs::Str<T, N>::Len(first);
|
||||||
if (second.Size() != inSize)
|
if (second.Size() != inSize)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return !lwe::Util::IsEqual(first, second, second.Size(true));
|
return !ehs::Util::IsEqual(first, second, second.Size(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Concatenates a C-style string with a string.
|
/// Concatenates a C-style string with a string.
|
||||||
/// @param [in] first The given C-style string.
|
/// @param [in] first The given C-style string.
|
||||||
/// @param [in] second The given string.
|
/// @param [in] second The given string.
|
||||||
/// @returns The result.
|
/// @returns The result.
|
||||||
template<typename T = lwe::Char_8, typename N = lwe::UInt_64>
|
template<typename T = ehs::Char_8, typename N = ehs::UInt_64>
|
||||||
lwe::Str<T, N> operator+(const T* const first, const lwe::Str<T, N>& second)
|
ehs::Str<T, N> operator+(const T* const first, const ehs::Str<T, N>& second)
|
||||||
{
|
{
|
||||||
N inSize = lwe::Str<T, N>::Len(first);
|
N inSize = ehs::Str<T, N>::Len(first);
|
||||||
|
|
||||||
lwe::Str<T, N> result(inSize + second.Size());
|
ehs::Str<T, N> result(inSize + second.Size());
|
||||||
|
|
||||||
lwe::Util::Copy(result, first, inSize * sizeof(T));
|
ehs::Util::Copy(result, first, inSize * sizeof(T));
|
||||||
lwe::Util::Copy(&result[inSize], &second[0], second.Size(true));
|
ehs::Util::Copy(&result[inSize], &second[0], second.Size(true));
|
||||||
|
|
||||||
result[inSize + second.Size()] = 0;
|
result[inSize + second.Size()] = 0;
|
||||||
|
|
||||||
|
@ -1,47 +1,55 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "EHS.h"
|
#include "Types.h"
|
||||||
#include "Str.h"
|
#include "Util.h"
|
||||||
|
|
||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
class Type
|
class Type
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
friend class BaseObj;
|
||||||
|
|
||||||
|
UInt_64 size;
|
||||||
|
const Char_8* id;
|
||||||
UInt_64 hashId;
|
UInt_64 hashId;
|
||||||
Str_8 id;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Type();
|
Type();
|
||||||
|
|
||||||
Type(Str_8 id);
|
explicit Type(const Char_8* id);
|
||||||
|
|
||||||
|
Type(Type&& type) noexcept = default;
|
||||||
|
|
||||||
Type(const Type& type) = default;
|
Type(const Type& type) = default;
|
||||||
|
|
||||||
Type(Type&& type) noexcept;
|
Type& operator=(Type&& type) noexcept = default;
|
||||||
|
|
||||||
Type& operator=(const Type& type);
|
Type& operator=(const Type& type) = default;
|
||||||
|
|
||||||
Type& operator=(Type&& type) noexcept;
|
|
||||||
|
|
||||||
bool operator!() const;
|
|
||||||
|
|
||||||
bool operator==(const Type& type) const;
|
bool operator==(const Type& type) const;
|
||||||
|
|
||||||
bool operator!=(const Type& type) const;
|
bool operator!=(const Type& type) const;
|
||||||
|
|
||||||
bool operator==(const UInt_64 hashId) const;
|
bool operator==(UInt_64 inHashId) const;
|
||||||
|
|
||||||
bool operator!=(const UInt_64 hashId) const;
|
bool operator!=(UInt_64 inHashId) const;
|
||||||
|
|
||||||
bool operator==(const Str_8& type) const;
|
bool operator==(const Char_8* inStr) const;
|
||||||
|
|
||||||
bool operator!=(const Str_8& type) const;
|
bool operator!=(const Char_8* inStr) const;
|
||||||
|
|
||||||
|
UInt_64 GetSize() const;
|
||||||
|
|
||||||
|
const Char_8* GetId() const;
|
||||||
|
|
||||||
UInt_64 GetHashId() const;
|
UInt_64 GetHashId() const;
|
||||||
|
|
||||||
Str_8 GetId() const;
|
|
||||||
|
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static UInt_64 CalcSize(const Char_8* id);
|
||||||
|
|
||||||
|
static UInt_64 GenHash(const Char_8* id, UInt_64 size);
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "BaseObj.h"
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
|
#include "Util.h"
|
||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "Util.h"
|
|
||||||
|
|
||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
/// An array with extra memory pre-allocated for fast pushes.
|
/// An array with extra memory pre-allocated for fast pushes.
|
||||||
@ -14,7 +14,7 @@ namespace ehs
|
|||||||
/// @tparam N Number data type to use.
|
/// @tparam N Number data type to use.
|
||||||
/// @note If extra memory is set to five then each time that memory is filled it will add five extra.
|
/// @note If extra memory is set to five then each time that memory is filled it will add five extra.
|
||||||
template<typename T, typename N = UInt_64>
|
template<typename T, typename N = UInt_64>
|
||||||
class Vector
|
class Vector : public BaseObj
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
N rawSize;
|
N rawSize;
|
||||||
@ -24,7 +24,7 @@ namespace ehs
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// Frees any data created on the heap.
|
/// Frees any data created on the heap.
|
||||||
~Vector()
|
~Vector() override
|
||||||
{
|
{
|
||||||
delete[] data;
|
delete[] data;
|
||||||
}
|
}
|
||||||
@ -33,6 +33,7 @@ namespace ehs
|
|||||||
Vector()
|
Vector()
|
||||||
: rawSize(0), size(0), stride(5), data(nullptr)
|
: rawSize(0), size(0), stride(5), data(nullptr)
|
||||||
{
|
{
|
||||||
|
AddType("Vector");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes members for pre-allocated memory to write to later.
|
/// Initializes members for pre-allocated memory to write to later.
|
||||||
@ -41,6 +42,7 @@ namespace ehs
|
|||||||
Vector(const N size, const N stride)
|
Vector(const N size, const N stride)
|
||||||
: rawSize(size + stride), size(size), stride(stride), data(new T[rawSize])
|
: rawSize(size + stride), size(size), stride(stride), data(new T[rawSize])
|
||||||
{
|
{
|
||||||
|
AddType("Vector");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes this vector with an initializer list object.
|
/// Initializes this vector with an initializer list object.
|
||||||
@ -49,6 +51,8 @@ namespace ehs
|
|||||||
Vector(std::initializer_list<T> list, const N stride = 5)
|
Vector(std::initializer_list<T> list, const N stride = 5)
|
||||||
: rawSize(0), size(list.size()), stride(stride), data(nullptr)
|
: rawSize(0), size(list.size()), stride(stride), data(nullptr)
|
||||||
{
|
{
|
||||||
|
AddType("Vector");
|
||||||
|
|
||||||
if (stride)
|
if (stride)
|
||||||
{
|
{
|
||||||
rawSize = list.size() / stride * stride;
|
rawSize = list.size() / stride * stride;
|
||||||
@ -74,6 +78,8 @@ namespace ehs
|
|||||||
Vector(const T* data, const N size, const N stride)
|
Vector(const T* data, const N size, const N stride)
|
||||||
: rawSize(0), size(size), stride(stride), data(nullptr)
|
: rawSize(0), size(size), stride(stride), data(nullptr)
|
||||||
{
|
{
|
||||||
|
AddType("Vector");
|
||||||
|
|
||||||
if (stride)
|
if (stride)
|
||||||
{
|
{
|
||||||
rawSize = size / stride * stride;
|
rawSize = size / stride * stride;
|
||||||
@ -94,14 +100,14 @@ namespace ehs
|
|||||||
/// Copies all members from the given vector object.
|
/// Copies all members from the given vector object.
|
||||||
/// @param [in] vec The vector object to copy from.
|
/// @param [in] vec The vector object to copy from.
|
||||||
Vector(const Vector& vec)
|
Vector(const Vector& vec)
|
||||||
: rawSize(vec.rawSize), size(vec.size), stride(vec.stride), data(new T[rawSize])
|
: BaseObj(vec), rawSize(vec.rawSize), size(vec.size), stride(vec.stride), data(new T[rawSize])
|
||||||
{
|
{
|
||||||
for (N i = 0; i < size; ++i)
|
for (N i = 0; i < size; ++i)
|
||||||
data[i] = vec.data[i];
|
data[i] = vec.data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector(Vector&& vec) noexcept
|
Vector(Vector&& vec) noexcept
|
||||||
: rawSize(vec.rawSize), size(vec.size), stride(vec.stride), data(vec.data)
|
: BaseObj((BaseObj&&)vec), rawSize(vec.rawSize), size(vec.size), stride(vec.stride), data(vec.data)
|
||||||
{
|
{
|
||||||
vec.rawSize = 0;
|
vec.rawSize = 0;
|
||||||
vec.size = 0;
|
vec.size = 0;
|
||||||
@ -117,6 +123,8 @@ namespace ehs
|
|||||||
if (this == &vec)
|
if (this == &vec)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=(vec);
|
||||||
|
|
||||||
rawSize = vec.rawSize;
|
rawSize = vec.rawSize;
|
||||||
size = vec.size;
|
size = vec.size;
|
||||||
stride = vec.stride;
|
stride = vec.stride;
|
||||||
@ -135,6 +143,8 @@ namespace ehs
|
|||||||
if (this == &vec)
|
if (this == &vec)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=((BaseObj&&)vec);
|
||||||
|
|
||||||
rawSize = vec.rawSize;
|
rawSize = vec.rawSize;
|
||||||
size = vec.size;
|
size = vec.size;
|
||||||
stride = vec.stride;
|
stride = vec.stride;
|
||||||
@ -268,9 +278,12 @@ namespace ehs
|
|||||||
/// @param [in] dstOffset The offset index to copy the given C-style array to.
|
/// @param [in] dstOffset The offset index to copy the given C-style array to.
|
||||||
/// @param [in] src The given C-style array.
|
/// @param [in] src The given C-style array.
|
||||||
/// @param [in] size The size from the given C-style array to copy.
|
/// @param [in] size The size from the given C-style array to copy.
|
||||||
void Copy(const N dstOffset, const T* src, const N size)
|
void Copy(const N dstOffset, const T* src, const N inSize)
|
||||||
{
|
{
|
||||||
for (N i = 0; i < size; ++i)
|
if (dstOffset + inSize > size)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (N i = 0; i < inSize; ++i)
|
||||||
data[i + dstOffset] = src[i];
|
data[i + dstOffset] = src[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace ehs
|
|||||||
|
|
||||||
UInt_64 GetGlyphScale() const;
|
UInt_64 GetGlyphScale() const;
|
||||||
|
|
||||||
Glyph GetGlyph(const Char_32 code) const;
|
Glyph GetGlyph(Char_32 code) const;
|
||||||
|
|
||||||
Vec2_f CalculateSize(const Str_8& text) const;
|
Vec2_f CalculateSize(const Str_8& text) const;
|
||||||
|
|
||||||
@ -41,8 +41,6 @@ namespace ehs
|
|||||||
|
|
||||||
UInt_64 CalculateIndexAtPoint(const Str_8& text, const Vec2_f& point) const;
|
UInt_64 CalculateIndexAtPoint(const Str_8& text, const Vec2_f& point) const;
|
||||||
|
|
||||||
Mesh Generate(const Anchor anchor, const Str_8& text) const;
|
Mesh Generate(Anchor anchor, const Str_8& text) const;
|
||||||
|
|
||||||
FontAtlas* Clone() const override;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "EHS.h"
|
#include "Types.h"
|
||||||
|
#include "BaseObj.h"
|
||||||
#include "DataType.h"
|
#include "DataType.h"
|
||||||
#include "Str.h"
|
#include "Str.h"
|
||||||
#include "Serializer.h"
|
#include "Serializer.h"
|
||||||
@ -10,10 +11,12 @@
|
|||||||
|
|
||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
class Audio : public Resource
|
class Audio : public BaseObj
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static Array<AudioCodec> codecs;
|
static Array<AudioCodec> codecs;
|
||||||
|
UInt_64 hashId;
|
||||||
|
Str_8 id;
|
||||||
UInt_64 sampleRate;
|
UInt_64 sampleRate;
|
||||||
DataType dataType;
|
DataType dataType;
|
||||||
UInt_8 byteDepth;
|
UInt_8 byteDepth;
|
||||||
@ -24,29 +27,31 @@ namespace ehs
|
|||||||
Byte* peak;
|
Byte* peak;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool HasCodec(const UInt_64 hashExt);
|
static bool HasCodec(UInt_64 hashExt);
|
||||||
|
|
||||||
static bool HasCodec(const Str_8& ext);
|
static bool HasCodec(const Str_8& ext);
|
||||||
|
|
||||||
static bool AddCodec(AudioCodec codec);
|
static bool AddCodec(AudioCodec codec);
|
||||||
|
|
||||||
static const AudioCodec* GetCodec(const UInt_64 hashExt);
|
static const AudioCodec* GetCodec(UInt_64 hashExt);
|
||||||
|
|
||||||
static const AudioCodec* GetCodec(const Str_8& ext);
|
static const AudioCodec* GetCodec(const Str_8& ext);
|
||||||
|
|
||||||
~Audio() override;
|
~Audio();
|
||||||
|
|
||||||
Audio();
|
Audio();
|
||||||
|
|
||||||
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const UInt_64 frames, const Byte* const data);
|
Audio(Str_8 id);
|
||||||
|
|
||||||
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Serializer<UInt_64>& data);
|
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, UInt_64 frames, const Byte* data);
|
||||||
|
|
||||||
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Vector<Byte>& data);
|
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, const Serializer<UInt_64>& data);
|
||||||
|
|
||||||
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Array<Byte>& data);
|
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, const Vector<Byte>& data);
|
||||||
|
|
||||||
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const UInt_64 frames);
|
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, const Array<Byte>& data);
|
||||||
|
|
||||||
|
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, UInt_64 frames);
|
||||||
|
|
||||||
Audio(Audio&& audio) noexcept;
|
Audio(Audio&& audio) noexcept;
|
||||||
|
|
||||||
@ -60,6 +65,14 @@ namespace ehs
|
|||||||
|
|
||||||
operator Byte*();
|
operator Byte*();
|
||||||
|
|
||||||
|
void Release();
|
||||||
|
|
||||||
|
UInt_64 GetHashId() const;
|
||||||
|
|
||||||
|
void SetId(Str_8 newId);
|
||||||
|
|
||||||
|
Str_8 GetId() const;
|
||||||
|
|
||||||
UInt_64 GetSampleRate() const;
|
UInt_64 GetSampleRate() const;
|
||||||
|
|
||||||
DataType GetDataType() const;
|
DataType GetDataType() const;
|
||||||
@ -78,23 +91,23 @@ namespace ehs
|
|||||||
|
|
||||||
float GetLength() const;
|
float GetLength() const;
|
||||||
|
|
||||||
Array<Byte> FrameAsMono(const UInt_64 frameIndex) const;
|
Array<Byte> FrameAsMono(UInt_64 frameIndex) const;
|
||||||
|
|
||||||
Array<Byte> FrameAsStereo(const UInt_64 frameIndex) const;
|
Array<Byte> FrameAsStereo(UInt_64 frameIndex) const;
|
||||||
|
|
||||||
Array<Byte> FrameAsFive_One(const UInt_64 frameIndex) const;
|
Array<Byte> FrameAsFive_One(UInt_64 frameIndex) const;
|
||||||
|
|
||||||
Array<Byte> FrameAsSeven_One(const UInt_64 frameIndex) const;
|
Array<Byte> FrameAsSeven_One(UInt_64 frameIndex) const;
|
||||||
|
|
||||||
SInt_8 SampleAsSInt_8(const UInt_64 sampleIndex) const;
|
SInt_8 SampleAsSInt_8(UInt_64 sampleIndex) const;
|
||||||
|
|
||||||
SInt_16 SampleAsSInt_16(const UInt_64 sampleIndex) const;
|
SInt_16 SampleAsSInt_16(UInt_64 sampleIndex) const;
|
||||||
|
|
||||||
float SampleAsFloat(const UInt_64 sampleIndex) const;
|
float SampleAsFloat(UInt_64 sampleIndex) const;
|
||||||
|
|
||||||
SInt_32 SampleAsSInt_32(const UInt_64 sampleIndex) const;
|
SInt_32 SampleAsSInt_32(UInt_64 sampleIndex) const;
|
||||||
|
|
||||||
SInt_64 SampleAsSInt_64(const UInt_64 sampleIndex) const;
|
SInt_64 SampleAsSInt_64(UInt_64 sampleIndex) const;
|
||||||
|
|
||||||
SInt_8 PeakAsSInt_8() const;
|
SInt_8 PeakAsSInt_8() const;
|
||||||
|
|
||||||
@ -106,17 +119,17 @@ namespace ehs
|
|||||||
|
|
||||||
SInt_64 PeakAsSInt_64() const;
|
SInt_64 PeakAsSInt_64() const;
|
||||||
|
|
||||||
void SetPeak(const UInt_64 size, const Byte* newPeak);
|
void SetPeak(UInt_64 size, const Byte* newPeak);
|
||||||
|
|
||||||
const Byte* GetPeak() const;
|
const Byte* GetPeak() const;
|
||||||
|
|
||||||
void ToDataType(const DataType newDataType);
|
void ToDataType(DataType newDataType);
|
||||||
|
|
||||||
Audio GetAsDataType(const DataType newDataType) const;
|
Audio GetAsDataType(DataType newDataType) const;
|
||||||
|
|
||||||
void ToChannels(const UInt_8 newChannels);
|
void ToChannels(UInt_8 newChannels);
|
||||||
|
|
||||||
Audio GetAsChannels(const UInt_8 newChannels) const;
|
Audio GetAsChannels(UInt_8 newChannels) const;
|
||||||
|
|
||||||
bool ToFile(const Str_8& filePath) const;
|
bool ToFile(const Str_8& filePath) const;
|
||||||
|
|
||||||
@ -124,32 +137,32 @@ namespace ehs
|
|||||||
|
|
||||||
static Audio* FromFile_Heap(const Str_8& filePath);
|
static Audio* FromFile_Heap(const Str_8& filePath);
|
||||||
|
|
||||||
static Audio FromFile(const Str_8& filePath, const DataType required);
|
static Audio FromFile(const Str_8& filePath, DataType required);
|
||||||
|
|
||||||
static Audio* FromFile_Heap(const Str_8& filePath, const DataType required);
|
static Audio* FromFile_Heap(const Str_8& filePath, DataType required);
|
||||||
|
|
||||||
static Audio FromData(const Str_8& ext, const Str_8& id, Serializer<UInt_64>& data);
|
static Audio FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ToMono(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void ToMono(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
void Mono_to_Stereo(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void Mono_to_Stereo(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
void Five_One_to_Stereo(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void Five_One_to_Stereo(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
void Seven_One_to_Stereo(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void Seven_One_to_Stereo(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
void Mono_to_Five_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void Mono_to_Five_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
void Stereo_to_Five_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void Stereo_to_Five_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
void Seven_One_to_Five_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void Seven_One_to_Five_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
void Mono_to_Seven_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void Mono_to_Seven_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
void Stereo_to_Seven_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void Stereo_to_Seven_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
void Five_One_to_Seven_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
|
void Five_One_to_Seven_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
|
||||||
|
|
||||||
// To SInt_8
|
// To SInt_8
|
||||||
void SInt_16_to_SInt_8(Byte* newData, Byte* newPeak) const;
|
void SInt_16_to_SInt_8(Byte* newData, Byte* newPeak) const;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "EHS.h"
|
#include "Types.h"
|
||||||
|
#include "BaseObj.h"
|
||||||
#include "Str.h"
|
#include "Str.h"
|
||||||
#include "ImgCodec.h"
|
#include "ImgCodec.h"
|
||||||
|
|
||||||
@ -12,12 +13,14 @@ namespace ehs
|
|||||||
NEAREST_NEIGHBOR
|
NEAREST_NEIGHBOR
|
||||||
};
|
};
|
||||||
|
|
||||||
class Img
|
class Img : public BaseObj
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static Array<ImgCodec> codecs;
|
static Array<ImgCodec> codecs;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
UInt_64 hashId;
|
||||||
|
Str_8 id;
|
||||||
UInt_8 bitDepth;
|
UInt_8 bitDepth;
|
||||||
UInt_8 channels;
|
UInt_8 channels;
|
||||||
UInt_64 width;
|
UInt_64 width;
|
||||||
@ -40,9 +43,11 @@ namespace ehs
|
|||||||
|
|
||||||
Img();
|
Img();
|
||||||
|
|
||||||
Img(UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height, const Byte* data);
|
Img(Str_8 id);
|
||||||
|
|
||||||
Img(UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height);
|
Img(Str_8 id, UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height, const Byte* data);
|
||||||
|
|
||||||
|
Img(Str_8 id, UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height);
|
||||||
|
|
||||||
Img(Img&& img) noexcept;
|
Img(Img&& img) noexcept;
|
||||||
|
|
||||||
@ -58,6 +63,12 @@ namespace ehs
|
|||||||
|
|
||||||
void Release();
|
void Release();
|
||||||
|
|
||||||
|
UInt_64 GetHashId() const;
|
||||||
|
|
||||||
|
void SetId(Str_8 newId);
|
||||||
|
|
||||||
|
Str_8 GetId() const;
|
||||||
|
|
||||||
UInt_8 BitDepth() const;
|
UInt_8 BitDepth() const;
|
||||||
|
|
||||||
UInt_8 Channels() const;
|
UInt_8 Channels() const;
|
||||||
@ -120,7 +131,7 @@ namespace ehs
|
|||||||
|
|
||||||
static Img* FromFile_Heap(const Str_8& filePath);
|
static Img* FromFile_Heap(const Str_8& filePath);
|
||||||
|
|
||||||
static Img FromData(const Str_8& ext, Serializer<UInt_64>& data);
|
static Img FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Img GetNearestNeighbor(UInt_64 newWidth, UInt_64 newHeight) const;
|
Img GetNearestNeighbor(UInt_64 newWidth, UInt_64 newHeight) const;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "EHS.h"
|
#include "EHS.h"
|
||||||
#include "Array.h"
|
#include "Array.h"
|
||||||
#include "Vertex.h"
|
#include "Vertex.h"
|
||||||
|
#include "BaseObj.h"
|
||||||
|
|
||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
@ -38,15 +39,13 @@ namespace ehs
|
|||||||
1
|
1
|
||||||
});
|
});
|
||||||
|
|
||||||
class Mesh : public Resource
|
class Mesh final : public BaseObj
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
UInt_64 hashId;
|
||||||
|
Str_8 id;
|
||||||
Array<Vertex_f> vertices;
|
Array<Vertex_f> vertices;
|
||||||
Array<UInt_32> indices;
|
Array<UInt_32> indices;
|
||||||
GpuBuffer srcVertBuffer;
|
|
||||||
GpuBuffer dstVertBuffer;
|
|
||||||
GpuBuffer srcIndBuffer;
|
|
||||||
GpuBuffer dstIndBuffer;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mesh();
|
Mesh();
|
||||||
@ -55,8 +54,6 @@ namespace ehs
|
|||||||
|
|
||||||
Mesh(Str_8 id, Array<Vertex_f> vertices);
|
Mesh(Str_8 id, Array<Vertex_f> vertices);
|
||||||
|
|
||||||
Mesh(Str_8 id);
|
|
||||||
|
|
||||||
Mesh(Mesh&& mesh) noexcept;
|
Mesh(Mesh&& mesh) noexcept;
|
||||||
|
|
||||||
Mesh(const Mesh& mesh);
|
Mesh(const Mesh& mesh);
|
||||||
@ -65,19 +62,13 @@ namespace ehs
|
|||||||
|
|
||||||
Mesh& operator=(const Mesh& mesh);
|
Mesh& operator=(const Mesh& mesh);
|
||||||
|
|
||||||
bool UploadToGpu(GpuCmdBuffer* cmdBuffer) override;
|
void Release();
|
||||||
|
|
||||||
bool PostGpuUpload() override;
|
UInt_64 GetHashId() const;
|
||||||
|
|
||||||
bool HasPostGpuUploaded() const override;
|
void SetId(Str_8 newId);
|
||||||
|
|
||||||
bool ReleaseFromGpu() override;
|
Str_8 GetId() const;
|
||||||
|
|
||||||
bool IsUploaded() const override;
|
|
||||||
|
|
||||||
void Bind(GpuCmdBuffer* cmdBuffer);
|
|
||||||
|
|
||||||
void Draw(GpuCmdBuffer* cmdBuffer, const UInt_32 instances = 1);
|
|
||||||
|
|
||||||
void SetVertices(const Array<Vertex_f>& newVertices);
|
void SetVertices(const Array<Vertex_f>& newVertices);
|
||||||
|
|
||||||
|
@ -14,9 +14,11 @@ namespace ehs
|
|||||||
EHM
|
EHM
|
||||||
};
|
};
|
||||||
|
|
||||||
class Model : public Resource
|
class Model : public BaseObj
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
UInt_64 hashId;
|
||||||
|
Str_8 id;
|
||||||
Array<Mesh> meshes;
|
Array<Mesh> meshes;
|
||||||
Bone skeleton;
|
Bone skeleton;
|
||||||
Array<Animation> animations;
|
Array<Animation> animations;
|
||||||
@ -40,29 +42,27 @@ namespace ehs
|
|||||||
|
|
||||||
Model& operator=(const Model& model) = default;
|
Model& operator=(const Model& model) = default;
|
||||||
|
|
||||||
bool UploadToGpu(GpuCmdBuffer* cmdBuffer) override;
|
void Release();
|
||||||
|
|
||||||
bool PostGpuUpload() override;
|
UInt_64 GetHashId() const;
|
||||||
|
|
||||||
bool ReleaseFromGpu() override;
|
void SetId(Str_8 newId);
|
||||||
|
|
||||||
bool IsUploaded() const override;
|
Str_8 GetId() const;
|
||||||
|
|
||||||
void Draw(GpuCmdBuffer* cmdBuffer, const UInt_32 instances = 1);
|
|
||||||
|
|
||||||
Array<Mesh> GetMeshes() const;
|
Array<Mesh> GetMeshes() const;
|
||||||
|
|
||||||
Array<Mesh>& GetMeshes();
|
Array<Mesh>& GetMeshes();
|
||||||
|
|
||||||
Mesh* GetMesh(const UInt_64 hashId);
|
Mesh* GetMesh(UInt_64 inHashId);
|
||||||
|
|
||||||
Mesh* GetMesh(const Str_8& id);
|
Mesh* GetMesh(const Str_8& inId);
|
||||||
|
|
||||||
Bone GetSkeleton() const;
|
Bone GetSkeleton() const;
|
||||||
|
|
||||||
Bone& GetSkeleton();
|
Bone& GetSkeleton();
|
||||||
|
|
||||||
Animation* GetAnimation(const UInt_64 hashId);
|
Animation* GetAnimation(UInt_64 inHashId);
|
||||||
|
|
||||||
Array<Animation> GetAnimations() const;
|
Array<Animation> GetAnimations() const;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ namespace ehs
|
|||||||
|
|
||||||
void Calculate();
|
void Calculate();
|
||||||
|
|
||||||
void Export(const Str_8& filePath, const ModelEncoding encoding);
|
void Export(const Str_8& filePath, ModelEncoding encoding);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ToEHM(File& file);
|
void ToEHM(File& file);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "EHS.h"
|
#include "EHS.h"
|
||||||
|
#include "Vec4.h"
|
||||||
#include "Vec3.h"
|
#include "Vec3.h"
|
||||||
#include "Vec2.h"
|
#include "Vec2.h"
|
||||||
#include "Color4.h"
|
#include "Color4.h"
|
||||||
|
@ -19,6 +19,8 @@ namespace ehs
|
|||||||
class Comms : public BaseObj
|
class Comms : public BaseObj
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
friend class Endpoint;
|
||||||
|
|
||||||
static const Version ver;
|
static const Version ver;
|
||||||
static const UInt_64 internalSys;
|
static const UInt_64 internalSys;
|
||||||
static const UInt_64 connectOp;
|
static const UInt_64 connectOp;
|
||||||
|
@ -17,7 +17,7 @@ namespace ehs
|
|||||||
class Endpoint : public BaseObj
|
class Endpoint : public BaseObj
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Socket hdl;
|
Comms* owner;
|
||||||
EndDisp disposition;
|
EndDisp disposition;
|
||||||
Status status;
|
Status status;
|
||||||
Architecture arch;
|
Architecture arch;
|
||||||
@ -40,10 +40,10 @@ namespace ehs
|
|||||||
public:
|
public:
|
||||||
Endpoint();
|
Endpoint();
|
||||||
|
|
||||||
Endpoint(const Socket hdl, const EndDisp disposition, const Architecture arch, const Str_8& id,
|
Endpoint(Comms* owner, const EndDisp disposition, const Architecture arch, const Str_8& id,
|
||||||
const AddrType& type, const Str_8& address, const UInt_16 port);
|
const AddrType& type, const Str_8& address, const UInt_16 port);
|
||||||
|
|
||||||
Endpoint(const Socket hdl, const AddrType& type, const Str_8& address, const UInt_16 port);
|
Endpoint(Comms* owner, const AddrType& type, const Str_8& address, const UInt_16 port);
|
||||||
|
|
||||||
Endpoint(const Endpoint& end);
|
Endpoint(const Endpoint& end);
|
||||||
|
|
||||||
|
155
src/BaseObj.cpp
155
src/BaseObj.cpp
@ -4,35 +4,27 @@ namespace ehs
|
|||||||
{
|
{
|
||||||
BaseObj::~BaseObj()
|
BaseObj::~BaseObj()
|
||||||
{
|
{
|
||||||
|
delete[] hierarchy;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseObj::BaseObj()
|
BaseObj::BaseObj()
|
||||||
: parent(nullptr)
|
: hierarchy(nullptr), hierarchySize(0)
|
||||||
{
|
{
|
||||||
AddType("BaseObj");
|
AddType("BaseObj");
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseObj::BaseObj(const BaseObj& base)
|
|
||||||
: hierarchy(base.hierarchy), parent(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseObj::BaseObj(BaseObj&& base) noexcept
|
BaseObj::BaseObj(BaseObj&& base) noexcept
|
||||||
: hierarchy(std::move(base.hierarchy)), parent(base.parent)
|
: hierarchy(base.hierarchy), hierarchySize(base.hierarchySize)
|
||||||
{
|
{
|
||||||
base.hierarchy = Array<Type>();
|
base.hierarchy = nullptr;
|
||||||
base.parent = nullptr;
|
base.hierarchySize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseObj& BaseObj::operator=(const BaseObj& base)
|
BaseObj::BaseObj(const BaseObj& base)
|
||||||
|
: hierarchy(new Type[base.hierarchySize]), hierarchySize(base.hierarchySize)
|
||||||
{
|
{
|
||||||
if (this == &base)
|
for (UInt_64 i = 0; i < hierarchySize; i++)
|
||||||
return *this;
|
hierarchy[i] = base.hierarchy[i];
|
||||||
|
|
||||||
hierarchy = base.hierarchy;
|
|
||||||
parent = nullptr;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseObj& BaseObj::operator=(BaseObj&& base) noexcept
|
BaseObj& BaseObj::operator=(BaseObj&& base) noexcept
|
||||||
@ -40,83 +32,99 @@ namespace ehs
|
|||||||
if (this == &base)
|
if (this == &base)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
hierarchy = std::move(base.hierarchy);
|
delete[] hierarchy;
|
||||||
parent = base.parent;
|
|
||||||
|
|
||||||
base.hierarchy = Array<Type>();
|
hierarchy = base.hierarchy;
|
||||||
base.parent = nullptr;
|
hierarchySize = base.hierarchySize;
|
||||||
|
|
||||||
|
base.hierarchy = nullptr;
|
||||||
|
base.hierarchySize = 0;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseObj::operator!() const
|
BaseObj& BaseObj::operator=(const BaseObj& base)
|
||||||
{
|
{
|
||||||
return IsValid();
|
if (this == &base)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
delete[] hierarchy;
|
||||||
|
|
||||||
|
hierarchy = new Type[base.hierarchySize];
|
||||||
|
for (UInt_64 i = 0; i < base.hierarchySize; i++)
|
||||||
|
hierarchy[i] = base.hierarchy[i];
|
||||||
|
|
||||||
|
hierarchySize = base.hierarchySize;
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseObj::operator==(const BaseObj& base) const
|
bool BaseObj::operator==(const BaseObj& base) const
|
||||||
{
|
{
|
||||||
return hierarchy == base.hierarchy;
|
if (hierarchySize != base.hierarchySize)
|
||||||
}
|
|
||||||
|
|
||||||
bool BaseObj::operator!=(const BaseObj& base) const
|
|
||||||
{
|
|
||||||
return hierarchy != base.hierarchy;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BaseObj::HasType(const Str_8& type) const
|
|
||||||
{
|
|
||||||
return HasType(type.Hash_64());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BaseObj::AddType(Str_8 type)
|
|
||||||
{
|
|
||||||
if (HasType(type))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
hierarchy.Push(std::move(type));
|
for (UInt_64 i = 0; i < hierarchySize; i++)
|
||||||
|
if (hierarchy[i] != base.hierarchy[i])
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type BaseObj::GetType() const
|
bool BaseObj::operator!=(const BaseObj& base) const
|
||||||
{
|
{
|
||||||
return hierarchy[hierarchy.End()];
|
if (hierarchySize != base.hierarchySize)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (UInt_64 i = 0; i < hierarchySize; i++)
|
||||||
|
if (hierarchy[i] != base.hierarchy[i])
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type BaseObj::GetType(const Str_8& type) const
|
const Type* BaseObj::GetHierarchy() const
|
||||||
{
|
|
||||||
return GetType(type.Hash_64());
|
|
||||||
}
|
|
||||||
|
|
||||||
const Char_8* BaseObj::GetTypeId() const
|
|
||||||
{
|
|
||||||
return GetType().GetId();
|
|
||||||
}
|
|
||||||
|
|
||||||
UInt_64 BaseObj::GetTypeHashId() const
|
|
||||||
{
|
|
||||||
return GetType().GetHashId();
|
|
||||||
}
|
|
||||||
|
|
||||||
const Array<Type>& BaseObj::GetHierarchy() const
|
|
||||||
{
|
{
|
||||||
return hierarchy;
|
return hierarchy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseObj::SetParent(BaseObj* newParent)
|
UInt_64 BaseObj::GetHierarchySize() const
|
||||||
{
|
{
|
||||||
parent = newParent;
|
return hierarchySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseObj* BaseObj::GetParent()
|
bool BaseObj::HasType(UInt_64 typeHashId) const
|
||||||
{
|
{
|
||||||
return parent;
|
for (UInt_64 i = 0; i < hierarchySize; i++)
|
||||||
|
if (hierarchy[i] == typeHashId)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseObj* BaseObj::GetParent(const Str_8& type)
|
bool BaseObj::HasType(const Char_8* typeId) const
|
||||||
{
|
{
|
||||||
return GetParent(type.Hash_64());
|
return HasType(Type::GenHash(typeId, Type::CalcSize(typeId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Type BaseObj::GetType() const
|
||||||
|
{
|
||||||
|
return hierarchy[hierarchySize - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt_64 BaseObj::GetTypeIdSize() const
|
||||||
|
{
|
||||||
|
return hierarchy[hierarchySize - 1].GetSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
const Char_8* BaseObj::GetTypeId() const
|
||||||
|
{
|
||||||
|
return hierarchy[hierarchySize - 1].GetId();
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt_64 BaseObj::GetTypeHashId() const
|
||||||
|
{
|
||||||
|
return hierarchy[hierarchySize - 1].GetHashId();
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseObj* BaseObj::Clone() const
|
BaseObj* BaseObj::Clone() const
|
||||||
@ -124,8 +132,23 @@ namespace ehs
|
|||||||
return new BaseObj(*this);
|
return new BaseObj(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseObj::IsValid() const
|
void BaseObj::AddType(const Char_8* const id)
|
||||||
{
|
{
|
||||||
return hierarchy.Size();
|
Type newType(id);
|
||||||
|
|
||||||
|
for (UInt_64 i = 0; i < hierarchySize; i++)
|
||||||
|
if (hierarchy[i] == newType)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Type* result = new Type[hierarchySize + 1];
|
||||||
|
|
||||||
|
result[0] = newType;
|
||||||
|
|
||||||
|
for (UInt_64 i = 1; i < hierarchySize; i++)
|
||||||
|
result[i] = hierarchy[i];
|
||||||
|
|
||||||
|
hierarchySize++;
|
||||||
|
delete[] hierarchy;
|
||||||
|
hierarchy = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
70
src/EHS.cpp
70
src/EHS.cpp
@ -15,15 +15,15 @@
|
|||||||
|
|
||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
constexpr Char_32 name_32[] = U"Lone Wolf Engine";
|
constexpr Char_32 name_32[] = U"Event Horizon Suite";
|
||||||
constexpr Char_16 name_16[] = L"Lone Wolf Engine";
|
constexpr Char_16 name_16[] = L"Event Horizon Suite";
|
||||||
constexpr Char_8 name_8[] = "Lone Wolf Engine";
|
constexpr Char_8 name_8[] = "Event Horizon Suite";
|
||||||
constexpr Char_32 acronym_32[] = U"LWE";
|
constexpr Char_32 acronym_32[] = U"EHS";
|
||||||
constexpr Char_16 acronym_16[] = L"LWE";
|
constexpr Char_16 acronym_16[] = L"EHS";
|
||||||
constexpr Char_8 acronym_8[] = "LWE";
|
constexpr Char_8 acronym_8[] = "EHS";
|
||||||
constexpr Char_32 versionId_32[] = U"Beta";
|
constexpr Char_32 versionId_32[] = U"Release";
|
||||||
constexpr Char_16 versionId_16[] = L"Beta";
|
constexpr Char_16 versionId_16[] = L"Release";
|
||||||
constexpr Char_8 versionId_8[] = "Beta";
|
constexpr Char_8 versionId_8[] = "Release";
|
||||||
|
|
||||||
Str_8 appName;
|
Str_8 appName;
|
||||||
Str_8 appVerId;
|
Str_8 appVerId;
|
||||||
@ -94,7 +94,7 @@ namespace ehs
|
|||||||
return appVer;
|
return appVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DecodeWAV(const lwe::AudioCodec* const codec, lwe::Serializer<lwe::UInt_64>& in, lwe::Audio* out)
|
bool DecodeWAV(const ehs::AudioCodec* const codec, ehs::Serializer<ehs::UInt_64>& in, ehs::Audio* out)
|
||||||
{
|
{
|
||||||
RIFF riff(in);
|
RIFF riff(in);
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ namespace ehs
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EncodeEHA(const lwe::AudioCodec* const codec, lwe::Serializer<lwe::UInt_64>& out, const lwe::Audio* in)
|
bool EncodeEHA(const ehs::AudioCodec* const codec, ehs::Serializer<ehs::UInt_64>& out, const ehs::Audio* in)
|
||||||
{
|
{
|
||||||
Serializer<UInt_64> result(codec->GetEndianness());
|
Serializer<UInt_64> result(codec->GetEndianness());
|
||||||
result.WriteVersion({1, 0, 0});
|
result.WriteVersion({1, 0, 0});
|
||||||
@ -277,7 +277,7 @@ namespace ehs
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DecodeEHA(const lwe::AudioCodec* const codec, lwe::Serializer<lwe::UInt_64>& in, lwe::Audio* out)
|
bool DecodeEHA(const ehs::AudioCodec* const codec, ehs::Serializer<ehs::UInt_64>& in, ehs::Audio* out)
|
||||||
{
|
{
|
||||||
Version version = in.ReadVersion();
|
Version version = in.ReadVersion();
|
||||||
if (version != Version(1, 0, 0))
|
if (version != Version(1, 0, 0))
|
||||||
@ -303,7 +303,7 @@ namespace ehs
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DecodePNG(const lwe::ImgCodec* const codec, lwe::Serializer<lwe::UInt_64>& in, lwe::Img* out)
|
bool DecodePNG(const ehs::ImgCodec* const codec, ehs::Serializer<ehs::UInt_64>& in, ehs::Img* out)
|
||||||
{
|
{
|
||||||
PNG png(out->GetId(), in);
|
PNG png(out->GetId(), in);
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ namespace ehs
|
|||||||
else if (colorType == 6)
|
else if (colorType == 6)
|
||||||
channels = 4;
|
channels = 4;
|
||||||
|
|
||||||
*out = Img(out->GetId(), bitDepth, channels, width, height, out->GetAspect(), true);
|
*out = Img(out->GetId(), bitDepth, channels, width, height);
|
||||||
|
|
||||||
UInt_8 compression = ihdrData->Read<UInt_8>();
|
UInt_8 compression = ihdrData->Read<UInt_8>();
|
||||||
if (compression)
|
if (compression)
|
||||||
@ -417,7 +417,7 @@ namespace ehs
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EncodeQOI(const lwe::ImgCodec* const codec, lwe::Serializer<lwe::UInt_64>& out, const lwe::Img* in)
|
bool EncodeQOI(const ehs::ImgCodec* const codec, ehs::Serializer<ehs::UInt_64>& out, const ehs::Img* in)
|
||||||
{
|
{
|
||||||
UInt_8 channels = in->Channels();
|
UInt_8 channels = in->Channels();
|
||||||
UInt_64 width = in->Width();
|
UInt_64 width = in->Width();
|
||||||
@ -536,7 +536,7 @@ namespace ehs
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DecodeQOI(const lwe::ImgCodec* const codec, lwe::Serializer<lwe::UInt_64>& in, lwe::Img* out)
|
bool DecodeQOI(const ehs::ImgCodec* const codec, ehs::Serializer<ehs::UInt_64>& in, ehs::Img* out)
|
||||||
{
|
{
|
||||||
Str_8 imgType = in.ReadStr<Char_8, UInt_64>(4);
|
Str_8 imgType = in.ReadStr<Char_8, UInt_64>(4);
|
||||||
if (imgType != "qoif")
|
if (imgType != "qoif")
|
||||||
@ -555,7 +555,7 @@ namespace ehs
|
|||||||
|
|
||||||
UInt_64 size = width * channels * height;
|
UInt_64 size = width * channels * height;
|
||||||
|
|
||||||
*out = Img(out->GetId(), bitDepth, channels, width, height, out->GetAspect(), true);
|
*out = Img(out->GetId(), bitDepth, channels, width, height);
|
||||||
|
|
||||||
Byte prevPixel[4] = {0, 0, 0, 255};
|
Byte prevPixel[4] = {0, 0, 0, 255};
|
||||||
|
|
||||||
@ -623,45 +623,45 @@ namespace ehs
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
lwe::Audio::AddCodec({
|
ehs::Audio::AddCodec({
|
||||||
"Waveform Audio",
|
"Waveform Audio",
|
||||||
"wav",
|
"wav",
|
||||||
lwe::Endianness::LE,
|
ehs::Endianness::LE,
|
||||||
nullptr,
|
nullptr,
|
||||||
lwe::DecodeWAV
|
ehs::DecodeWAV
|
||||||
});
|
});
|
||||||
|
|
||||||
lwe::Audio::AddCodec({
|
ehs::Audio::AddCodec({
|
||||||
"Event Horizon Audio",
|
"Event Horizon Audio",
|
||||||
"eha",
|
"eha",
|
||||||
lwe::Endianness::LE,
|
ehs::Endianness::LE,
|
||||||
lwe::EncodeEHA,
|
ehs::EncodeEHA,
|
||||||
lwe::DecodeEHA
|
ehs::DecodeEHA
|
||||||
});
|
});
|
||||||
|
|
||||||
lwe::Img::AddCodec({
|
ehs::Img::AddCodec({
|
||||||
"Portable Network Graphic",
|
"Portable Network Graphic",
|
||||||
"png",
|
"png",
|
||||||
lwe::Endianness::BE,
|
ehs::Endianness::BE,
|
||||||
nullptr,
|
nullptr,
|
||||||
lwe::DecodePNG
|
ehs::DecodePNG
|
||||||
});
|
});
|
||||||
|
|
||||||
lwe::Img::AddCodec({
|
ehs::Img::AddCodec({
|
||||||
"Quite OK Image",
|
"Quite OK Image",
|
||||||
"qoi",
|
"qoi",
|
||||||
lwe::Endianness::BE,
|
ehs::Endianness::BE,
|
||||||
lwe::EncodeQOI,
|
ehs::EncodeQOI,
|
||||||
lwe::DecodeQOI
|
ehs::DecodeQOI
|
||||||
});
|
});
|
||||||
|
|
||||||
lwe::GarbageCollector::Start();
|
ehs::GarbageCollector::Start();
|
||||||
|
|
||||||
const lwe::SInt_32 code = Main(&lwe::appName, &lwe::appVerId, &lwe::appVer);
|
const ehs::SInt_32 code = Main(&ehs::appName, &ehs::appVerId, &ehs::appVer);
|
||||||
if (code)
|
if (code)
|
||||||
EHS_LOG("Warning", 0, "Executable exited with code #" + lwe::Str_8::FromNum(code) + ".");
|
EHS_LOG("Warning", 0, "Executable exited with code #" + ehs::Str_8::FromNum(code) + ".");
|
||||||
|
|
||||||
lwe::GarbageCollector::Stop();
|
ehs::GarbageCollector::Stop();
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
@ -104,12 +104,6 @@ namespace ehs
|
|||||||
|
|
||||||
while (i < garbage.Size())
|
while (i < garbage.Size())
|
||||||
{
|
{
|
||||||
if (garbage[i]->HasType(10756214933709508260ull) && ((GpuDependant*)garbage[i])->GetDependantCount()) // Has type of GpuDependant.
|
|
||||||
{
|
|
||||||
++i;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
garbage.Swap(i, garbage.End());
|
garbage.Swap(i, garbage.End());
|
||||||
delete garbage.Pop();
|
delete garbage.Pop();
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
global _ZN3lwe4HRNG16GenerateSeed_u64Ev
|
global _ZN3ehs4HRNG16GenerateSeed_u64Ev
|
||||||
global _ZN3lwe4HRNG12Generate_u64Emm
|
global _ZN3ehs4HRNG12Generate_u64Emm
|
||||||
global _ZN3lwe4HRNG12Generate_u64Ev
|
global _ZN3ehs4HRNG12Generate_u64Ev
|
||||||
global _ZN3lwe4HRNG16GenerateSeed_s64Ev
|
global _ZN3ehs4HRNG16GenerateSeed_s64Ev
|
||||||
global _ZN3lwe4HRNG12Generate_s64Ell
|
global _ZN3ehs4HRNG12Generate_s64Ell
|
||||||
global _ZN3lwe4HRNG12Generate_s64Ev
|
global _ZN3ehs4HRNG12Generate_s64Ev
|
||||||
global _ZN3lwe4HRNG16GenerateSeed_u32Ev
|
global _ZN3ehs4HRNG16GenerateSeed_u32Ev
|
||||||
global _ZN3lwe4HRNG12Generate_u32Ejj
|
global _ZN3ehs4HRNG12Generate_u32Ejj
|
||||||
global _ZN3lwe4HRNG12Generate_u32Ev
|
global _ZN3ehs4HRNG12Generate_u32Ev
|
||||||
global _ZN3lwe4HRNG16GenerateSeed_s32Ev
|
global _ZN3ehs4HRNG16GenerateSeed_s32Ev
|
||||||
global _ZN3lwe4HRNG12Generate_s32Eii
|
global _ZN3ehs4HRNG12Generate_s32Eii
|
||||||
global _ZN3lwe4HRNG12Generate_s32Ev
|
global _ZN3ehs4HRNG12Generate_s32Ev
|
||||||
global _ZN3lwe4HRNG16GenerateSeed_u16Ev
|
global _ZN3ehs4HRNG16GenerateSeed_u16Ev
|
||||||
global _ZN3lwe4HRNG12Generate_u16Ett
|
global _ZN3ehs4HRNG12Generate_u16Ett
|
||||||
global _ZN3lwe4HRNG12Generate_u16Ev
|
global _ZN3ehs4HRNG12Generate_u16Ev
|
||||||
global _ZN3lwe4HRNG16GenerateSeed_s16Ev
|
global _ZN3ehs4HRNG16GenerateSeed_s16Ev
|
||||||
global _ZN3lwe4HRNG12Generate_s16Ess
|
global _ZN3ehs4HRNG12Generate_s16Ess
|
||||||
global _ZN3lwe4HRNG12Generate_s16Ev
|
global _ZN3ehs4HRNG12Generate_s16Ev
|
||||||
global _ZN3lwe4HRNG15GenerateSeed_u8Ev
|
global _ZN3ehs4HRNG15GenerateSeed_u8Ev
|
||||||
global _ZN3lwe4HRNG11Generate_u8Ehh
|
global _ZN3ehs4HRNG11Generate_u8Ehh
|
||||||
global _ZN3lwe4HRNG11Generate_u8Ev
|
global _ZN3ehs4HRNG11Generate_u8Ev
|
||||||
global _ZN3lwe4HRNG15GenerateSeed_s8Ev
|
global _ZN3ehs4HRNG15GenerateSeed_s8Ev
|
||||||
global _ZN3lwe4HRNG11Generate_s8Eaa
|
global _ZN3ehs4HRNG11Generate_s8Eaa
|
||||||
global _ZN3lwe4HRNG11Generate_s8Ev
|
global _ZN3ehs4HRNG11Generate_s8Ev
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
_ZN3lwe4HRNG16GenerateSeed_u64Ev:
|
_ZN3ehs4HRNG16GenerateSeed_u64Ev:
|
||||||
RDSEED RAX
|
RDSEED RAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_u64Emm:
|
_ZN3ehs4HRNG12Generate_u64Emm:
|
||||||
RDRAND RAX
|
RDRAND RAX
|
||||||
SUB RSI, RDI
|
SUB RSI, RDI
|
||||||
MOV R8, RSI
|
MOV R8, RSI
|
||||||
@ -38,15 +38,15 @@ section .text
|
|||||||
ADD RAX, RDI
|
ADD RAX, RDI
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_u64Ev:
|
_ZN3ehs4HRNG12Generate_u64Ev:
|
||||||
RDRAND RAX
|
RDRAND RAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG16GenerateSeed_s64Ev:
|
_ZN3ehs4HRNG16GenerateSeed_s64Ev:
|
||||||
RDSEED RAX
|
RDSEED RAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_s64Ell:
|
_ZN3ehs4HRNG12Generate_s64Ell:
|
||||||
RDRAND RAX
|
RDRAND RAX
|
||||||
SUB RSI, RDI
|
SUB RSI, RDI
|
||||||
MOV R8, RSI
|
MOV R8, RSI
|
||||||
@ -56,15 +56,15 @@ section .text
|
|||||||
ADD RAX, RDI
|
ADD RAX, RDI
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_s64Ev:
|
_ZN3ehs4HRNG12Generate_s64Ev:
|
||||||
RDRAND RAX
|
RDRAND RAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG16GenerateSeed_u32Ev:
|
_ZN3ehs4HRNG16GenerateSeed_u32Ev:
|
||||||
RDSEED EAX
|
RDSEED EAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_u32Ejj:
|
_ZN3ehs4HRNG12Generate_u32Ejj:
|
||||||
RDRAND EAX
|
RDRAND EAX
|
||||||
SUB ESI, EDI
|
SUB ESI, EDI
|
||||||
MOV R8D, ESI
|
MOV R8D, ESI
|
||||||
@ -74,15 +74,15 @@ section .text
|
|||||||
ADD EAX, EDI
|
ADD EAX, EDI
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_u32Ev:
|
_ZN3ehs4HRNG12Generate_u32Ev:
|
||||||
RDRAND EAX
|
RDRAND EAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG16GenerateSeed_s32Ev:
|
_ZN3ehs4HRNG16GenerateSeed_s32Ev:
|
||||||
RDSEED EAX
|
RDSEED EAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_s32Eii:
|
_ZN3ehs4HRNG12Generate_s32Eii:
|
||||||
RDRAND EAX
|
RDRAND EAX
|
||||||
SUB ESI, EDI
|
SUB ESI, EDI
|
||||||
MOV R8D, ESI
|
MOV R8D, ESI
|
||||||
@ -92,15 +92,15 @@ section .text
|
|||||||
ADD EAX, EDI
|
ADD EAX, EDI
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_s32Ev:
|
_ZN3ehs4HRNG12Generate_s32Ev:
|
||||||
RDRAND EAX
|
RDRAND EAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG16GenerateSeed_u16Ev:
|
_ZN3ehs4HRNG16GenerateSeed_u16Ev:
|
||||||
RDSEED AX
|
RDSEED AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_u16Ett:
|
_ZN3ehs4HRNG12Generate_u16Ett:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
SUB SI, DI
|
SUB SI, DI
|
||||||
MOV R8W, SI
|
MOV R8W, SI
|
||||||
@ -110,15 +110,15 @@ section .text
|
|||||||
ADD AX, DI
|
ADD AX, DI
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_u16Ev:
|
_ZN3ehs4HRNG12Generate_u16Ev:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG16GenerateSeed_s16Ev:
|
_ZN3ehs4HRNG16GenerateSeed_s16Ev:
|
||||||
RDSEED AX
|
RDSEED AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_s16Ess:
|
_ZN3ehs4HRNG12Generate_s16Ess:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
SUB SI, DI
|
SUB SI, DI
|
||||||
MOV R8W, SI
|
MOV R8W, SI
|
||||||
@ -128,15 +128,15 @@ section .text
|
|||||||
ADD AX, DI
|
ADD AX, DI
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG12Generate_s16Ev:
|
_ZN3ehs4HRNG12Generate_s16Ev:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG15GenerateSeed_u8Ev:
|
_ZN3ehs4HRNG15GenerateSeed_u8Ev:
|
||||||
RDSEED AX
|
RDSEED AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG11Generate_u8Ehh:
|
_ZN3ehs4HRNG11Generate_u8Ehh:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
XOR AH, AH
|
XOR AH, AH
|
||||||
SUB SIL, DIL
|
SUB SIL, DIL
|
||||||
@ -146,15 +146,15 @@ section .text
|
|||||||
ADD AL, DIL
|
ADD AL, DIL
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG11Generate_u8Ev:
|
_ZN3ehs4HRNG11Generate_u8Ev:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG15GenerateSeed_s8Ev:
|
_ZN3ehs4HRNG15GenerateSeed_s8Ev:
|
||||||
RDSEED AX
|
RDSEED AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG11Generate_s8Eaa:
|
_ZN3ehs4HRNG11Generate_s8Eaa:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
XOR AH, AH
|
XOR AH, AH
|
||||||
SUB SIL, DIL
|
SUB SIL, DIL
|
||||||
@ -164,6 +164,6 @@ section .text
|
|||||||
ADD AL, DIL
|
ADD AL, DIL
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4HRNG11Generate_s8Ev:
|
_ZN3ehs4HRNG11Generate_s8Ev:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
RET
|
RET
|
@ -1,34 +1,34 @@
|
|||||||
global ?GenerateSeed_u64@HRNG@lwe@@SA_KXZ
|
global ?GenerateSeed_u64@HRNG@ehs@@SA_KXZ
|
||||||
global ?Generate_u64@HRNG@lwe@@SA_K_K0@Z
|
global ?Generate_u64@HRNG@ehs@@SA_K_K0@Z
|
||||||
global ?Generate_u64@HRNG@lwe@@SA_KXZ
|
global ?Generate_u64@HRNG@ehs@@SA_KXZ
|
||||||
global ?GenerateSeed_s64@HRNG@lwe@@SA_JXZ
|
global ?GenerateSeed_s64@HRNG@ehs@@SA_JXZ
|
||||||
global ?Generate_s64@HRNG@lwe@@SA_J_J0@Z
|
global ?Generate_s64@HRNG@ehs@@SA_J_J0@Z
|
||||||
global ?Generate_s64@HRNG@lwe@@SA_JXZ
|
global ?Generate_s64@HRNG@ehs@@SA_JXZ
|
||||||
global ?GenerateSeed_u32@HRNG@lwe@@SAIXZ
|
global ?GenerateSeed_u32@HRNG@ehs@@SAIXZ
|
||||||
global ?Generate_u32@HRNG@lwe@@SAIII@Z
|
global ?Generate_u32@HRNG@ehs@@SAIII@Z
|
||||||
global ?Generate_u32@HRNG@lwe@@SAIXZ
|
global ?Generate_u32@HRNG@ehs@@SAIXZ
|
||||||
global ?GenerateSeed_s32@HRNG@lwe@@SAHXZ
|
global ?GenerateSeed_s32@HRNG@ehs@@SAHXZ
|
||||||
global ?Generate_s32@HRNG@lwe@@SAHHH@Z
|
global ?Generate_s32@HRNG@ehs@@SAHHH@Z
|
||||||
global ?Generate_s32@HRNG@lwe@@SAHXZ
|
global ?Generate_s32@HRNG@ehs@@SAHXZ
|
||||||
global ?GenerateSeed_u16@HRNG@lwe@@SAIXZ
|
global ?GenerateSeed_u16@HRNG@ehs@@SAIXZ
|
||||||
global ?Generate_u16@HRNG@lwe@@SAGGG@Z
|
global ?Generate_u16@HRNG@ehs@@SAGGG@Z
|
||||||
global ?Generate_u16@HRNG@lwe@@SAGXZ
|
global ?Generate_u16@HRNG@ehs@@SAGXZ
|
||||||
global ?GenerateSeed_s16@HRNG@lwe@@SAFXZ
|
global ?GenerateSeed_s16@HRNG@ehs@@SAFXZ
|
||||||
global ?Generate_s16@HRNG@lwe@@SAFFF@Z
|
global ?Generate_s16@HRNG@ehs@@SAFFF@Z
|
||||||
global ?Generate_s16@HRNG@lwe@@SAFXZ
|
global ?Generate_s16@HRNG@ehs@@SAFXZ
|
||||||
global ?GenerateSeed_u8@HRNG@lwe@@SAEXZ
|
global ?GenerateSeed_u8@HRNG@ehs@@SAEXZ
|
||||||
global ?Generate_u8@HRNG@lwe@@SAEEE@Z
|
global ?Generate_u8@HRNG@ehs@@SAEEE@Z
|
||||||
global ?Generate_u8@HRNG@lwe@@SAEXZ
|
global ?Generate_u8@HRNG@ehs@@SAEXZ
|
||||||
global ?GenerateSeed_s8@HRNG@lwe@@SACXZ
|
global ?GenerateSeed_s8@HRNG@ehs@@SACXZ
|
||||||
global ?Generate_s8@HRNG@lwe@@SACCC@Z
|
global ?Generate_s8@HRNG@ehs@@SACCC@Z
|
||||||
global ?Generate_s8@HRNG@lwe@@SACXZ
|
global ?Generate_s8@HRNG@ehs@@SACXZ
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
?GenerateSeed_u64@HRNG@lwe@@SA_KXZ:
|
?GenerateSeed_u64@HRNG@ehs@@SA_KXZ:
|
||||||
RDSEED RAX
|
RDSEED RAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_u64@HRNG@lwe@@SA_K_K0@Z:
|
?Generate_u64@HRNG@ehs@@SA_K_K0@Z:
|
||||||
RDRAND RAX
|
RDRAND RAX
|
||||||
MOV R8, RDX
|
MOV R8, RDX
|
||||||
SUB R8, RCX
|
SUB R8, RCX
|
||||||
@ -38,15 +38,15 @@ section .text
|
|||||||
ADD RAX, RCX
|
ADD RAX, RCX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_u64@HRNG@lwe@@SA_KXZ:
|
?Generate_u64@HRNG@ehs@@SA_KXZ:
|
||||||
RDRAND RAX
|
RDRAND RAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GenerateSeed_s64@HRNG@lwe@@SA_JXZ:
|
?GenerateSeed_s64@HRNG@ehs@@SA_JXZ:
|
||||||
RDSEED RAX
|
RDSEED RAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_s64@HRNG@lwe@@SA_J_J0@Z:
|
?Generate_s64@HRNG@ehs@@SA_J_J0@Z:
|
||||||
RDRAND RAX
|
RDRAND RAX
|
||||||
MOV R8, RDX
|
MOV R8, RDX
|
||||||
SUB R8, RCX
|
SUB R8, RCX
|
||||||
@ -56,15 +56,15 @@ section .text
|
|||||||
ADD RAX, RCX
|
ADD RAX, RCX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_s64@HRNG@lwe@@SA_JXZ:
|
?Generate_s64@HRNG@ehs@@SA_JXZ:
|
||||||
RDRAND RAX
|
RDRAND RAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GenerateSeed_u32@HRNG@lwe@@SAIXZ:
|
?GenerateSeed_u32@HRNG@ehs@@SAIXZ:
|
||||||
RDSEED EAX
|
RDSEED EAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_u32@HRNG@lwe@@SAIII@Z:
|
?Generate_u32@HRNG@ehs@@SAIII@Z:
|
||||||
RDRAND EAX
|
RDRAND EAX
|
||||||
MOV R8D, EDX
|
MOV R8D, EDX
|
||||||
SUB R8D, ECX
|
SUB R8D, ECX
|
||||||
@ -74,15 +74,15 @@ section .text
|
|||||||
ADD EAX, ECX
|
ADD EAX, ECX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_u32@HRNG@lwe@@SAIXZ:
|
?Generate_u32@HRNG@ehs@@SAIXZ:
|
||||||
RDRAND EAX
|
RDRAND EAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GenerateSeed_s32@HRNG@lwe@@SAHXZ:
|
?GenerateSeed_s32@HRNG@ehs@@SAHXZ:
|
||||||
RDSEED EAX
|
RDSEED EAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_s32@HRNG@lwe@@SAHHH@Z:
|
?Generate_s32@HRNG@ehs@@SAHHH@Z:
|
||||||
RDRAND EAX
|
RDRAND EAX
|
||||||
MOV R8D, EDX
|
MOV R8D, EDX
|
||||||
SUB R8D, ECX
|
SUB R8D, ECX
|
||||||
@ -92,15 +92,15 @@ section .text
|
|||||||
ADD EAX, ECX
|
ADD EAX, ECX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_s32@HRNG@lwe@@SAHXZ:
|
?Generate_s32@HRNG@ehs@@SAHXZ:
|
||||||
RDRAND EAX
|
RDRAND EAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GenerateSeed_u16@HRNG@lwe@@SAIXZ:
|
?GenerateSeed_u16@HRNG@ehs@@SAIXZ:
|
||||||
RDSEED AX
|
RDSEED AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_u16@HRNG@lwe@@SAGGG@Z:
|
?Generate_u16@HRNG@ehs@@SAGGG@Z:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
MOV R8W, DX
|
MOV R8W, DX
|
||||||
SUB R8W, CX
|
SUB R8W, CX
|
||||||
@ -110,15 +110,15 @@ section .text
|
|||||||
ADD AX, CX
|
ADD AX, CX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_u16@HRNG@lwe@@SAGXZ:
|
?Generate_u16@HRNG@ehs@@SAGXZ:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GenerateSeed_s16@HRNG@lwe@@SAFXZ:
|
?GenerateSeed_s16@HRNG@ehs@@SAFXZ:
|
||||||
RDSEED AX
|
RDSEED AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_s16@HRNG@lwe@@SAFFF@Z:
|
?Generate_s16@HRNG@ehs@@SAFFF@Z:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
MOV R8W, DX
|
MOV R8W, DX
|
||||||
SUB R8W, CX
|
SUB R8W, CX
|
||||||
@ -128,15 +128,15 @@ section .text
|
|||||||
ADD AX, CX
|
ADD AX, CX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_s16@HRNG@lwe@@SAFXZ:
|
?Generate_s16@HRNG@ehs@@SAFXZ:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GenerateSeed_u8@HRNG@lwe@@SAEXZ:
|
?GenerateSeed_u8@HRNG@ehs@@SAEXZ:
|
||||||
RDSEED AX
|
RDSEED AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_u8@HRNG@lwe@@SAEEE@Z:
|
?Generate_u8@HRNG@ehs@@SAEEE@Z:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
MOV R8W, DX
|
MOV R8W, DX
|
||||||
SUB R8W, CX
|
SUB R8W, CX
|
||||||
@ -146,15 +146,15 @@ section .text
|
|||||||
ADD AX, CX
|
ADD AX, CX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_u8@HRNG@lwe@@SAEXZ:
|
?Generate_u8@HRNG@ehs@@SAEXZ:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GenerateSeed_s8@HRNG@lwe@@SACXZ:
|
?GenerateSeed_s8@HRNG@ehs@@SACXZ:
|
||||||
RDSEED AX
|
RDSEED AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_s8@HRNG@lwe@@SACCC@Z:
|
?Generate_s8@HRNG@ehs@@SACCC@Z:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
MOV R8W, DX
|
MOV R8W, DX
|
||||||
SUB R8W, CX
|
SUB R8W, CX
|
||||||
@ -164,6 +164,6 @@ section .text
|
|||||||
ADD AX, CX
|
ADD AX, CX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Generate_s8@HRNG@lwe@@SACXZ:
|
?Generate_s8@HRNG@ehs@@SACXZ:
|
||||||
RDRAND AX
|
RDRAND AX
|
||||||
RET
|
RET
|
@ -1,61 +1,61 @@
|
|||||||
global _ZN3lwe4Math8Sqrt_AVXEf
|
global _ZN3ehs4Math8Sqrt_AVXEf
|
||||||
global _ZN3lwe4Math8Sqrt_AVXEd
|
global _ZN3ehs4Math8Sqrt_AVXEd
|
||||||
global _ZN3lwe4Math8Sqrt_SSEEf
|
global _ZN3ehs4Math8Sqrt_SSEEf
|
||||||
global _ZN3lwe4Math9Sqrt_SSE2Ed
|
global _ZN3ehs4Math9Sqrt_SSE2Ed
|
||||||
global _ZN3lwe4Math4NearEf
|
global _ZN3ehs4Math4NearEf
|
||||||
global _ZN3lwe4Math4NearEd
|
global _ZN3ehs4Math4NearEd
|
||||||
global _ZN3lwe4Math5FloorEf
|
global _ZN3ehs4Math5FloorEf
|
||||||
global _ZN3lwe4Math5FloorEd
|
global _ZN3ehs4Math5FloorEd
|
||||||
global _ZN3lwe4Math4CeilEf
|
global _ZN3ehs4Math4CeilEf
|
||||||
global _ZN3lwe4Math4CeilEd
|
global _ZN3ehs4Math4CeilEd
|
||||||
global _ZN3lwe4Math5TruncEf
|
global _ZN3ehs4Math5TruncEf
|
||||||
global _ZN3lwe4Math5TruncEd
|
global _ZN3ehs4Math5TruncEd
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
_ZN3lwe4Math8Sqrt_AVXEf:
|
_ZN3ehs4Math8Sqrt_AVXEf:
|
||||||
VSQRTPS XMM0, XMM0
|
VSQRTPS XMM0, XMM0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math8Sqrt_AVXEd:
|
_ZN3ehs4Math8Sqrt_AVXEd:
|
||||||
VSQRTPD XMM0, XMM0
|
VSQRTPD XMM0, XMM0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math8Sqrt_SSEEf:
|
_ZN3ehs4Math8Sqrt_SSEEf:
|
||||||
SQRTPS XMM0, XMM0
|
SQRTPS XMM0, XMM0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math9Sqrt_SSE2Ed:
|
_ZN3ehs4Math9Sqrt_SSE2Ed:
|
||||||
SQRTPD XMM0, XMM0
|
SQRTPD XMM0, XMM0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math4NearEf:
|
_ZN3ehs4Math4NearEf:
|
||||||
ROUNDPS XMM0, XMM0, 0
|
ROUNDPS XMM0, XMM0, 0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math4NearEd:
|
_ZN3ehs4Math4NearEd:
|
||||||
ROUNDPD XMM0, XMM0, 0
|
ROUNDPD XMM0, XMM0, 0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math5FloorEf:
|
_ZN3ehs4Math5FloorEf:
|
||||||
ROUNDPS XMM0, XMM0, 1
|
ROUNDPS XMM0, XMM0, 1
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math5FloorEd:
|
_ZN3ehs4Math5FloorEd:
|
||||||
ROUNDPD XMM0, XMM0, 1
|
ROUNDPD XMM0, XMM0, 1
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math4CeilEf:
|
_ZN3ehs4Math4CeilEf:
|
||||||
ROUNDPS XMM0, XMM0, 2
|
ROUNDPS XMM0, XMM0, 2
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math4CeilEd:
|
_ZN3ehs4Math4CeilEd:
|
||||||
ROUNDPD XMM0, XMM0, 2
|
ROUNDPD XMM0, XMM0, 2
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math5TruncEf:
|
_ZN3ehs4Math5TruncEf:
|
||||||
ROUNDPS XMM0, XMM0, 3
|
ROUNDPS XMM0, XMM0, 3
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe4Math5TruncEd:
|
_ZN3ehs4Math5TruncEd:
|
||||||
ROUNDPD XMM0, XMM0, 3
|
ROUNDPD XMM0, XMM0, 3
|
||||||
RET
|
RET
|
@ -1,61 +1,61 @@
|
|||||||
global ?Sqrt_AVX@Math@lwe@@CAMM@Z
|
global ?Sqrt_AVX@Math@ehs@@CAMM@Z
|
||||||
global ?Sqrt_AVX@Math@lwe@@CANN@Z
|
global ?Sqrt_AVX@Math@ehs@@CANN@Z
|
||||||
global ?Sqrt_SSE@Math@lwe@@CAMM@Z
|
global ?Sqrt_SSE@Math@ehs@@CAMM@Z
|
||||||
global ?Sqrt_SSE2@Math@lwe@@CANN@Z
|
global ?Sqrt_SSE2@Math@ehs@@CANN@Z
|
||||||
global ?Near@Math@lwe@@SAMM@Z
|
global ?Near@Math@ehs@@SAMM@Z
|
||||||
global ?Near@Math@lwe@@SANN@Z
|
global ?Near@Math@ehs@@SANN@Z
|
||||||
global ?Floor@Math@lwe@@SAMM@Z
|
global ?Floor@Math@ehs@@SAMM@Z
|
||||||
global ?Floor@Math@lwe@@SANN@Z
|
global ?Floor@Math@ehs@@SANN@Z
|
||||||
global ?Ceil@Math@lwe@@SAMM@Z
|
global ?Ceil@Math@ehs@@SAMM@Z
|
||||||
global ?Ceil@Math@lwe@@SANN@Z
|
global ?Ceil@Math@ehs@@SANN@Z
|
||||||
global ?Trunc@Math@lwe@@SAMM@Z
|
global ?Trunc@Math@ehs@@SAMM@Z
|
||||||
global ?Trunc@Math@lwe@@SANN@Z
|
global ?Trunc@Math@ehs@@SANN@Z
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
?Sqrt_AVX@Math@lwe@@CAMM@Z:
|
?Sqrt_AVX@Math@ehs@@CAMM@Z:
|
||||||
VSQRTPS XMM0, XMM0
|
VSQRTPS XMM0, XMM0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Sqrt_AVX@Math@lwe@@CANN@Z:
|
?Sqrt_AVX@Math@ehs@@CANN@Z:
|
||||||
VSQRTPD XMM0, XMM0
|
VSQRTPD XMM0, XMM0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Sqrt_SSE@Math@lwe@@CAMM@Z:
|
?Sqrt_SSE@Math@ehs@@CAMM@Z:
|
||||||
SQRTPS XMM0, XMM0
|
SQRTPS XMM0, XMM0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Sqrt_SSE2@Math@lwe@@CANN@Z:
|
?Sqrt_SSE2@Math@ehs@@CANN@Z:
|
||||||
SQRTPD XMM0, XMM0
|
SQRTPD XMM0, XMM0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Near@Math@lwe@@SAMM@Z:
|
?Near@Math@ehs@@SAMM@Z:
|
||||||
ROUNDPS XMM0, XMM0, 0
|
ROUNDPS XMM0, XMM0, 0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Near@Math@lwe@@SANN@Z:
|
?Near@Math@ehs@@SANN@Z:
|
||||||
ROUNDPD XMM0, XMM0, 0
|
ROUNDPD XMM0, XMM0, 0
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Floor@Math@lwe@@SAMM@Z:
|
?Floor@Math@ehs@@SAMM@Z:
|
||||||
ROUNDPS XMM0, XMM0, 1
|
ROUNDPS XMM0, XMM0, 1
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Floor@Math@lwe@@SANN@Z:
|
?Floor@Math@ehs@@SANN@Z:
|
||||||
ROUNDPD XMM0, XMM0, 1
|
ROUNDPD XMM0, XMM0, 1
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Ceil@Math@lwe@@SAMM@Z:
|
?Ceil@Math@ehs@@SAMM@Z:
|
||||||
ROUNDPS XMM0, XMM0, 2
|
ROUNDPS XMM0, XMM0, 2
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Ceil@Math@lwe@@SANN@Z:
|
?Ceil@Math@ehs@@SANN@Z:
|
||||||
ROUNDPD XMM0, XMM0, 2
|
ROUNDPD XMM0, XMM0, 2
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Trunc@Math@lwe@@SAMM@Z:
|
?Trunc@Math@ehs@@SAMM@Z:
|
||||||
ROUNDPS XMM0, XMM0, 3
|
ROUNDPS XMM0, XMM0, 3
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?Trunc@Math@lwe@@SANN@Z:
|
?Trunc@Math@ehs@@SANN@Z:
|
||||||
ROUNDPD XMM0, XMM0, 3
|
ROUNDPD XMM0, XMM0, 3
|
||||||
RET
|
RET
|
@ -2,31 +2,31 @@
|
|||||||
#include "Str.h"
|
#include "Str.h"
|
||||||
#include "io/Console.h"
|
#include "io/Console.h"
|
||||||
|
|
||||||
lwe::Int_32 Main(lwe::Str_8* appName, lwe::Str_8* appVerId, lwe::Version* appVer)
|
ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer)
|
||||||
{
|
{
|
||||||
*appName = "StrToHash";
|
*appName = "StrToHash";
|
||||||
*appVerId = "Release";
|
*appVerId = "Release";
|
||||||
*appVer = {1, 0, 0};
|
*appVer = {1, 0, 0};
|
||||||
|
|
||||||
lwe::Console::Attach();
|
ehs::Console::Attach();
|
||||||
|
|
||||||
lwe::Vector<lwe::Str_8> args = lwe::Console::GetArgs_8();
|
ehs::Vector<ehs::Str_8> args = ehs::Console::GetArgs_8();
|
||||||
|
|
||||||
if (args.Size() > 1)
|
if (args.Size() > 1)
|
||||||
{
|
{
|
||||||
for (lwe::UInt_64 i = 1; i < args.Size(); ++i)
|
for (ehs::UInt_64 i = 1; i < args.Size(); ++i)
|
||||||
lwe::Console::Write_8("Result " + lwe::Str_8::FromNum(i) + ": " + lwe::Str_8::FromNum(args[i].Hash_64()));
|
ehs::Console::Write_8("Result " + ehs::Str_8::FromNum(i) + ": " + ehs::Str_8::FromNum(args[i].Hash_64()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lwe::Console::Write_8("String: ", false);
|
ehs::Console::Write_8("String: ", false);
|
||||||
lwe::Str_8 in = lwe::Console::Read_8();
|
ehs::Str_8 in = ehs::Console::Read_8();
|
||||||
lwe::Console::Write_8("Result: " + lwe::Str_8::FromNum(in.Hash_64()));
|
ehs::Console::Write_8("Result: " + ehs::Str_8::FromNum(in.Hash_64()));
|
||||||
|
|
||||||
lwe::Console::Read_8();
|
ehs::Console::Read_8();
|
||||||
}
|
}
|
||||||
|
|
||||||
lwe::Console::Free();
|
ehs::Console::Free();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ namespace ehs
|
|||||||
working = false;
|
working = false;
|
||||||
available = new Semaphore(0);
|
available = new Semaphore(0);
|
||||||
done = new Semaphore(0);
|
done = new Semaphore(0);
|
||||||
cbArgs = new Serializer<lwe::UInt_64>*(new Serializer<UInt_64>());
|
cbArgs = new Serializer<ehs::UInt_64>*(new Serializer<UInt_64>());
|
||||||
callback = new TaskCb(nullptr);
|
callback = new TaskCb(nullptr);
|
||||||
|
|
||||||
threadArgs = new Serializer<UInt_64>(Endianness::LE);
|
threadArgs = new Serializer<UInt_64>(Endianness::LE);
|
||||||
|
105
src/Type.cpp
105
src/Type.cpp
@ -3,50 +3,15 @@
|
|||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
Type::Type()
|
Type::Type()
|
||||||
: hashId(0)
|
: size(0), id(nullptr), hashId(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Type::Type(Str_8 id)
|
Type::Type(const Char_8* const id)
|
||||||
: hashId(id.Hash_64()), id(std::move(id))
|
: size(CalcSize(id)), id(id), hashId(GenHash(id, size))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Type::Type(Type&& type) noexcept
|
|
||||||
: hashId(type.hashId), id(std::move(type.id))
|
|
||||||
{
|
|
||||||
type.hashId = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Type& Type::operator=(const Type& type)
|
|
||||||
{
|
|
||||||
if (this == &type)
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
hashId = type.hashId;
|
|
||||||
id = type.id;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Type& Type::operator=(Type&& type) noexcept
|
|
||||||
{
|
|
||||||
if (this == &type)
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
hashId = type.hashId;
|
|
||||||
id = std::move(type.id);
|
|
||||||
|
|
||||||
type.hashId = 0;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Type::operator!() const
|
|
||||||
{
|
|
||||||
return IsValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Type::operator==(const Type& type) const
|
bool Type::operator==(const Type& type) const
|
||||||
{
|
{
|
||||||
return hashId == type.hashId;
|
return hashId == type.hashId;
|
||||||
@ -57,24 +22,40 @@ namespace ehs
|
|||||||
return hashId != type.hashId;
|
return hashId != type.hashId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Type::operator==(const UInt_64 hashId) const
|
bool Type::operator==(const UInt_64 inHashId) const
|
||||||
{
|
{
|
||||||
return this->hashId == hashId;
|
return hashId == inHashId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Type::operator!=(const UInt_64 hashId) const
|
bool Type::operator!=(const UInt_64 inHashId) const
|
||||||
{
|
{
|
||||||
return this->hashId == hashId;
|
return hashId != inHashId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Type::operator==(const Str_8& type) const
|
bool Type::operator==(const Char_8* const inStr) const
|
||||||
{
|
{
|
||||||
return id == type;
|
if (size != CalcSize(inStr))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return Util::IsEqual(id, inStr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Type::operator!=(const Str_8& type) const
|
bool Type::operator!=(const Char_8* const inStr) const
|
||||||
{
|
{
|
||||||
return id != type;
|
if (size != CalcSize(inStr))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return !Util::IsEqual(id, inStr, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt_64 Type::GetSize() const
|
||||||
|
{
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Char_8* Type::GetId() const
|
||||||
|
{
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt_64 Type::GetHashId() const
|
UInt_64 Type::GetHashId() const
|
||||||
@ -82,13 +63,33 @@ namespace ehs
|
|||||||
return hashId;
|
return hashId;
|
||||||
}
|
}
|
||||||
|
|
||||||
Str_8 Type::GetId() const
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Type::IsValid() const
|
bool Type::IsValid() const
|
||||||
{
|
{
|
||||||
return hashId;
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt_64 Type::CalcSize(const Char_8* const id)
|
||||||
|
{
|
||||||
|
UInt_64 result = 0;
|
||||||
|
|
||||||
|
while (id[result])
|
||||||
|
result++;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt_64 Type::GenHash(const Char_8* const id, const UInt_64 size)
|
||||||
|
{
|
||||||
|
if (!size)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
const Byte* const bytes = (Byte*)id;
|
||||||
|
|
||||||
|
UInt_64 hash = 14695981039346656037ull;
|
||||||
|
|
||||||
|
for (UInt_64 i = 0; i < size; ++i)
|
||||||
|
hash = (hash ^ bytes[i]) * 1099511628211;
|
||||||
|
|
||||||
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,14 +7,11 @@ namespace ehs
|
|||||||
FontAtlas::FontAtlas()
|
FontAtlas::FontAtlas()
|
||||||
: glyphScale(0)
|
: glyphScale(0)
|
||||||
{
|
{
|
||||||
AddType("FontAtlas");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FontAtlas::FontAtlas(const Str_8& filePath)
|
FontAtlas::FontAtlas(const Str_8& filePath)
|
||||||
: glyphScale(0)
|
: glyphScale(0)
|
||||||
{
|
{
|
||||||
AddType("FontAtlas");
|
|
||||||
|
|
||||||
File fontFile(filePath, Mode::READ, Disposition::OPEN);
|
File fontFile(filePath, Mode::READ, Disposition::OPEN);
|
||||||
|
|
||||||
hashId = fontFile.GetName().Hash_64();
|
hashId = fontFile.GetName().Hash_64();
|
||||||
@ -44,7 +41,6 @@ namespace ehs
|
|||||||
height = fData.Read<UInt_64>();
|
height = fData.Read<UInt_64>();
|
||||||
data = new Byte[width * height * (bitDepth / 8) * channels];
|
data = new Byte[width * height * (bitDepth / 8) * channels];
|
||||||
fData.ReadArray(data, &size);
|
fData.ReadArray(data, &size);
|
||||||
aspect = IMG_ASPECT_COLOR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FontAtlas::FontAtlas(FontAtlas&& fa) noexcept
|
FontAtlas::FontAtlas(FontAtlas&& fa) noexcept
|
||||||
@ -229,11 +225,6 @@ namespace ehs
|
|||||||
pos.x += (float)glyph.GetAdvance().x;
|
pos.x += (float)glyph.GetAdvance().x;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {"Label", std::move(verts), std::move(indices)};
|
return {id, std::move(verts), std::move(indices)};
|
||||||
}
|
|
||||||
|
|
||||||
FontAtlas* FontAtlas::Clone() const
|
|
||||||
{
|
|
||||||
return new FontAtlas(*this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,11 @@
|
|||||||
#include "io/Window_XCB.h"
|
#include "io/Window_XCB.h"
|
||||||
#include "UTF.h"
|
#include "UTF.h"
|
||||||
|
#include "Vec2.h"
|
||||||
#include "io/hid/Keyboard.h"
|
#include "io/hid/Keyboard.h"
|
||||||
#include "io/hid/Mouse.h"
|
#include "io/hid/Mouse.h"
|
||||||
#include "io/Console.h"
|
#include "io/Console.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <xcb/xfixes.h>
|
#include <xcb/xfixes.h>
|
||||||
#include <xcb/xcb_cursor.h>
|
#include <xcb/xcb_cursor.h>
|
||||||
|
@ -51,64 +51,73 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
|
|
||||||
Audio::Audio()
|
Audio::Audio()
|
||||||
: sampleRate(0), dataType(DataType::FLOAT), byteDepth(ToByteDepth(dataType)), channels(0), frames(0), length(0.0f),
|
: hashId(0), sampleRate(0), dataType(DataType::FLOAT), byteDepth(0), channels(0), frames(0),
|
||||||
data(nullptr), peak(nullptr)
|
length(0.0f), data(nullptr), peak(nullptr)
|
||||||
{
|
{
|
||||||
AddType("Audio");
|
AddType("Audio");
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const UInt_64 frames, const Byte* const data)
|
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const UInt_64 frames, const Byte* const data)
|
||||||
: Resource(std::move(id)), dataType(dataType), byteDepth(ToByteDepth(dataType)), sampleRate(sampleRate),
|
: hashId(id.Hash_64()), id((Str_8&&)id), dataType(dataType), byteDepth(ToByteDepth(dataType)), sampleRate(sampleRate),
|
||||||
channels(channels), frames(frames), length((float)frames / (float)sampleRate),
|
channels(channels), frames(frames), length((float)frames / (float)sampleRate),
|
||||||
data(new Byte[GetSize()]), peak(new Byte[byteDepth])
|
data(new Byte[GetSize()]), peak(new Byte[byteDepth])
|
||||||
{
|
{
|
||||||
AddType("Audio");
|
|
||||||
|
|
||||||
Util::Copy(this->data, data, GetSize());
|
Util::Copy(this->data, data, GetSize());
|
||||||
|
|
||||||
|
AddType("Audio");
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Serializer<UInt_64>& data)
|
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Serializer<UInt_64>& data)
|
||||||
: Resource(std::move(id)), sampleRate(sampleRate), dataType(dataType), byteDepth(ToByteDepth(dataType)),
|
: hashId(id.Hash_64()), id((Str_8&&)id), sampleRate(sampleRate), dataType(dataType), byteDepth(ToByteDepth(dataType)),
|
||||||
channels(channels), frames(data.Size() / channels / byteDepth), length((float)frames / (float)sampleRate),
|
channels(channels), frames(data.Size() / channels / byteDepth), length((float)frames / (float)sampleRate),
|
||||||
data(new Byte[data.Size()]), peak(new Byte[byteDepth])
|
data(new Byte[data.Size()]), peak(new Byte[byteDepth])
|
||||||
{
|
{
|
||||||
AddType("Audio");
|
|
||||||
|
|
||||||
Util::Copy(this->data, data, data.Size());
|
Util::Copy(this->data, data, data.Size());
|
||||||
|
|
||||||
|
AddType("Audio");
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Vector<Byte>& data)
|
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Vector<Byte>& data)
|
||||||
: Resource(std::move(id)), sampleRate(sampleRate), dataType(dataType), byteDepth(ToByteDepth(dataType)),
|
: hashId(id.Hash_64()), id((Str_8&&)id), sampleRate(sampleRate), dataType(dataType), byteDepth(ToByteDepth(dataType)),
|
||||||
channels(channels), frames(data.Size() / channels / byteDepth), length((float)frames / (float)sampleRate),
|
channels(channels), frames(data.Size() / channels / byteDepth), length((float)frames / (float)sampleRate),
|
||||||
data(new Byte[data.Size()]), peak(new Byte[byteDepth])
|
data(new Byte[data.Size()]), peak(new Byte[byteDepth])
|
||||||
{
|
{
|
||||||
AddType("Audio");
|
|
||||||
|
|
||||||
Util::Copy(this->data, data, data.Size());
|
Util::Copy(this->data, data, data.Size());
|
||||||
|
|
||||||
|
AddType("Audio");
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Array<Byte>& data)
|
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Array<Byte>& data)
|
||||||
: Resource(std::move(id)), sampleRate(sampleRate), dataType(dataType), byteDepth(ToByteDepth(dataType)),
|
: hashId(id.Hash_64()), id((Str_8&&)id), sampleRate(sampleRate), dataType(dataType), byteDepth(ToByteDepth(dataType)),
|
||||||
channels(channels), frames(data.Size() / channels / byteDepth), length((float)frames / (float)sampleRate),
|
channels(channels), frames(data.Size() / channels / byteDepth), length((float)frames / (float)sampleRate),
|
||||||
data(new Byte[data.Size()]), peak(new Byte[byteDepth])
|
data(new Byte[data.Size()]), peak(new Byte[byteDepth])
|
||||||
{
|
{
|
||||||
AddType("Audio");
|
|
||||||
|
|
||||||
Util::Copy(this->data, data, data.Size());
|
Util::Copy(this->data, data, data.Size());
|
||||||
|
|
||||||
|
AddType("Audio");
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const UInt_64 frames)
|
Audio::Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const UInt_64 frames)
|
||||||
: Resource(std::move(id)), sampleRate(sampleRate), dataType(dataType), byteDepth(ToByteDepth(dataType)),
|
: hashId(id.Hash_64()), id((Str_8&&)id), sampleRate(sampleRate), dataType(dataType), byteDepth(ToByteDepth(dataType)),
|
||||||
channels(channels), frames(frames), length((float)frames / (float)sampleRate),
|
channels(channels), frames(frames), length((float)frames / (float)sampleRate),
|
||||||
data(new Byte[GetSize()]), peak(new Byte[byteDepth])
|
data(new Byte[GetSize()]), peak(new Byte[byteDepth])
|
||||||
{
|
{
|
||||||
AddType("Audio");
|
AddType("Audio");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Audio::Audio(Str_8 id)
|
||||||
|
: hashId(id.Hash_64()), id((Str_8&&)id), sampleRate(0), dataType(DataType::FLOAT), byteDepth(0), channels(0),
|
||||||
|
frames(0), length(0.0f), data(nullptr), peak(nullptr)
|
||||||
|
{
|
||||||
|
AddType("Audio");
|
||||||
|
}
|
||||||
|
|
||||||
Audio::Audio(Audio&& audio) noexcept
|
Audio::Audio(Audio&& audio) noexcept
|
||||||
: Resource(std::move(audio)), sampleRate(audio.sampleRate), dataType(audio.dataType), byteDepth(audio.byteDepth),
|
: BaseObj((BaseObj&&)audio), hashId(audio.hashId), id((Str_8&&)id), sampleRate(audio.sampleRate),
|
||||||
channels(audio.channels), frames(audio.frames), length(audio.length), data(audio.data), peak(audio.peak)
|
dataType(audio.dataType), byteDepth(audio.byteDepth), channels(audio.channels), frames(audio.frames),
|
||||||
|
length(audio.length), data(audio.data), peak(audio.peak)
|
||||||
{
|
{
|
||||||
|
audio.hashId = 0;
|
||||||
audio.sampleRate = 0;
|
audio.sampleRate = 0;
|
||||||
audio.dataType = DataType::FLOAT;
|
audio.dataType = DataType::FLOAT;
|
||||||
audio.byteDepth = ToByteDepth(audio.dataType);
|
audio.byteDepth = ToByteDepth(audio.dataType);
|
||||||
@ -120,9 +129,9 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
|
|
||||||
Audio::Audio(const Audio& audio)
|
Audio::Audio(const Audio& audio)
|
||||||
: Resource(audio), sampleRate(audio.sampleRate), dataType(audio.dataType), byteDepth(audio.byteDepth),
|
: BaseObj(audio), hashId(audio.hashId), id(audio.id), sampleRate(audio.sampleRate), dataType(audio.dataType),
|
||||||
channels(audio.channels), frames(audio.frames), length(audio.length), data(new Byte[GetSize()]),
|
byteDepth(audio.byteDepth), channels(audio.channels), frames(audio.frames), length(audio.length),
|
||||||
peak(new Byte[audio.byteDepth])
|
data(new Byte[GetSize()]), peak(new Byte[audio.byteDepth])
|
||||||
{
|
{
|
||||||
Util::Copy(data, audio.data, GetSize());
|
Util::Copy(data, audio.data, GetSize());
|
||||||
}
|
}
|
||||||
@ -132,15 +141,22 @@ namespace ehs
|
|||||||
if (this == &audio)
|
if (this == &audio)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=((BaseObj&&)audio);
|
||||||
|
|
||||||
|
hashId = audio.hashId;
|
||||||
|
id = (Str_8&&)audio.id;
|
||||||
sampleRate = audio.sampleRate;
|
sampleRate = audio.sampleRate;
|
||||||
dataType = audio.dataType;
|
dataType = audio.dataType;
|
||||||
byteDepth = audio.byteDepth;
|
byteDepth = audio.byteDepth;
|
||||||
channels = audio.channels;
|
channels = audio.channels;
|
||||||
frames = audio.frames;
|
frames = audio.frames;
|
||||||
length = audio.length;
|
length = audio.length;
|
||||||
|
delete[] data;
|
||||||
data = audio.data;
|
data = audio.data;
|
||||||
|
delete[] peak;
|
||||||
peak = audio.peak;
|
peak = audio.peak;
|
||||||
|
|
||||||
|
audio.hashId = 0;
|
||||||
audio.sampleRate = 0;
|
audio.sampleRate = 0;
|
||||||
audio.dataType = DataType::FLOAT;
|
audio.dataType = DataType::FLOAT;
|
||||||
audio.byteDepth = ToByteDepth(audio.dataType);
|
audio.byteDepth = ToByteDepth(audio.dataType);
|
||||||
@ -150,8 +166,6 @@ namespace ehs
|
|||||||
audio.data = nullptr;
|
audio.data = nullptr;
|
||||||
audio.peak = nullptr;
|
audio.peak = nullptr;
|
||||||
|
|
||||||
Resource::operator=(std::move(audio));
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +174,10 @@ namespace ehs
|
|||||||
if (this == &audio)
|
if (this == &audio)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=(audio);
|
||||||
|
|
||||||
|
hashId = audio.hashId;
|
||||||
|
id = audio.id;
|
||||||
sampleRate = audio.sampleRate;
|
sampleRate = audio.sampleRate;
|
||||||
dataType = audio.dataType;
|
dataType = audio.dataType;
|
||||||
byteDepth = audio.byteDepth;
|
byteDepth = audio.byteDepth;
|
||||||
@ -168,11 +186,12 @@ namespace ehs
|
|||||||
frames = audio.frames;
|
frames = audio.frames;
|
||||||
|
|
||||||
delete[] data;
|
delete[] data;
|
||||||
data = new Byte[audio.frames];
|
data = new Byte[audio.GetSize()];
|
||||||
|
Util::Copy(data, audio.data, audio.GetSize());
|
||||||
|
|
||||||
Util::Copy(data, audio.data, frames);
|
delete[] peak;
|
||||||
|
peak = new Byte[audio.byteDepth];
|
||||||
Resource::operator=(audio);
|
Util::Copy(peak, audio.peak, audio.byteDepth);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -187,6 +206,36 @@ namespace ehs
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Audio::Release()
|
||||||
|
{
|
||||||
|
sampleRate = 0;
|
||||||
|
dataType = DataType::FLOAT;
|
||||||
|
byteDepth = 0;
|
||||||
|
channels = 0;
|
||||||
|
frames = 0;
|
||||||
|
length = 0.0f;
|
||||||
|
delete[] data;
|
||||||
|
data = nullptr;
|
||||||
|
delete[] peak;
|
||||||
|
peak = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt_64 Audio::GetHashId() const
|
||||||
|
{
|
||||||
|
return hashId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Audio::SetId(Str_8 newId)
|
||||||
|
{
|
||||||
|
hashId = newId.Hash_64();
|
||||||
|
id = (Str_8&&)newId;
|
||||||
|
}
|
||||||
|
|
||||||
|
Str_8 Audio::GetId() const
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
UInt_64 Audio::GetSampleRate() const
|
UInt_64 Audio::GetSampleRate() const
|
||||||
{
|
{
|
||||||
return sampleRate;
|
return sampleRate;
|
||||||
@ -657,7 +706,7 @@ namespace ehs
|
|||||||
if (!data || newChannels == channels)
|
if (!data || newChannels == channels)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Byte* result = nullptr;
|
Byte* result;
|
||||||
|
|
||||||
if (newChannels == 1)
|
if (newChannels == 1)
|
||||||
{
|
{
|
||||||
@ -837,12 +886,12 @@ namespace ehs
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Serializer<UInt_64> data;
|
Serializer<UInt_64> result;
|
||||||
if (!codec->Encode(data, this))
|
if (!codec->Encode(result, this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
File file(filePath, Mode::WRITE, Disposition::CREATE_PERSISTENT);
|
File file(filePath, Mode::WRITE, Disposition::CREATE_PERSISTENT);
|
||||||
file.WriteSerializer_64(data);
|
file.WriteSerializer_64(result);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -852,7 +901,7 @@ namespace ehs
|
|||||||
File file(filePath, Mode::READ, Disposition::OPEN);
|
File file(filePath, Mode::READ, Disposition::OPEN);
|
||||||
Str_8 ext = file.GetExtension();
|
Str_8 ext = file.GetExtension();
|
||||||
|
|
||||||
Audio result;
|
Audio result(file.GetName());
|
||||||
|
|
||||||
const AudioCodec* codec = GetCodec(ext);
|
const AudioCodec* codec = GetCodec(ext);
|
||||||
if (!codec)
|
if (!codec)
|
||||||
@ -861,8 +910,6 @@ namespace ehs
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.id = file.GetName();
|
|
||||||
|
|
||||||
Serializer<UInt_64> data = file.ReadSerializer_64(codec->GetEndianness(), file.Size());
|
Serializer<UInt_64> data = file.ReadSerializer_64(codec->GetEndianness(), file.Size());
|
||||||
|
|
||||||
file.Release();
|
file.Release();
|
||||||
@ -887,8 +934,7 @@ namespace ehs
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = new Audio();
|
result = new Audio(file.GetName());
|
||||||
result->id = file.GetName();
|
|
||||||
|
|
||||||
Serializer<UInt_64> data = file.ReadSerializer_64(codec->GetEndianness(), file.Size());
|
Serializer<UInt_64> data = file.ReadSerializer_64(codec->GetEndianness(), file.Size());
|
||||||
|
|
||||||
@ -923,9 +969,9 @@ namespace ehs
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio Audio::FromData(const Str_8& ext, const Str_8& id, Serializer<UInt_64>& data)
|
Audio Audio::FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data)
|
||||||
{
|
{
|
||||||
Audio result;
|
Audio result((Str_8&&)id);
|
||||||
|
|
||||||
const AudioCodec* codec = GetCodec(ext);
|
const AudioCodec* codec = GetCodec(ext);
|
||||||
if (!codec)
|
if (!codec)
|
||||||
@ -934,8 +980,6 @@ namespace ehs
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.id = id;
|
|
||||||
|
|
||||||
if (!codec->Decode(data, &result))
|
if (!codec->Decode(data, &result))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
@ -48,26 +48,36 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
|
|
||||||
Img::Img()
|
Img::Img()
|
||||||
: data(nullptr), bitDepth(0), channels(0), width(0), height(0), size(0)
|
: hashId(0), data(nullptr), bitDepth(0), channels(0), width(0), height(0), size(0)
|
||||||
{
|
{
|
||||||
|
AddType("Img");
|
||||||
}
|
}
|
||||||
|
|
||||||
Img::Img(const UInt_8 bitDepth, const UInt_8 channels, const UInt_64 width, const UInt_64 height, const Byte* const data)
|
Img::Img(Str_8 id, const UInt_8 bitDepth, const UInt_8 channels, const UInt_64 width, const UInt_64 height, const Byte* const data)
|
||||||
: bitDepth(bitDepth), channels(channels), width(width), height(height),
|
: hashId(id.Hash_64()), id((Str_8&&)id), bitDepth(bitDepth), channels(channels), width(width), height(height),
|
||||||
size(width * (bitDepth / 8) * channels * height), data(new Byte[size])
|
size(width * (bitDepth / 8) * channels * height), data(new Byte[size])
|
||||||
{
|
{
|
||||||
Util::Copy(this->data, data, size);
|
Util::Copy(this->data, data, size);
|
||||||
|
|
||||||
|
AddType("Img");
|
||||||
}
|
}
|
||||||
|
|
||||||
Img::Img(const UInt_8 bitDepth, const UInt_8 channels, const UInt_64 width, const UInt_64 height)
|
Img::Img(Str_8 id, const UInt_8 bitDepth, const UInt_8 channels, const UInt_64 width, const UInt_64 height)
|
||||||
: bitDepth(bitDepth), channels(channels), width(width), height(height),
|
: hashId(id.Hash_64()), id((Str_8&&)id), bitDepth(bitDepth), channels(channels), width(width), height(height),
|
||||||
size(width * (bitDepth / 8) * channels * height), data(new Byte[size])
|
size(width * (bitDepth / 8) * channels * height), data(new Byte[size])
|
||||||
{
|
{
|
||||||
|
AddType("Img");
|
||||||
|
}
|
||||||
|
|
||||||
|
Img::Img(Str_8 id)
|
||||||
|
: hashId(id.Hash_64()), id((Str_8&&)id), bitDepth(0), channels(0), width(0), height(0), size(0), data(nullptr)
|
||||||
|
{
|
||||||
|
AddType("Img");
|
||||||
}
|
}
|
||||||
|
|
||||||
Img::Img(Img&& img) noexcept
|
Img::Img(Img&& img) noexcept
|
||||||
: bitDepth(img.bitDepth), channels(img.channels), width(img.width), height(img.height), size(img.size),
|
: BaseObj((BaseObj&&)img), hashId(img.hashId), id((Str_8&&)img.id), bitDepth(img.bitDepth),
|
||||||
data(img.data)
|
channels(img.channels), width(img.width), height(img.height), size(img.size), data(img.data)
|
||||||
{
|
{
|
||||||
img.bitDepth = 0;
|
img.bitDepth = 0;
|
||||||
img.channels = 0;
|
img.channels = 0;
|
||||||
@ -78,8 +88,8 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
|
|
||||||
Img::Img(const Img& img)
|
Img::Img(const Img& img)
|
||||||
: bitDepth(img.bitDepth), channels(img.channels), width(img.width), height(img.height), size(img.size),
|
: BaseObj(img), hashId(img.hashId), id(img.id), bitDepth(img.bitDepth), channels(img.channels), width(img.width),
|
||||||
data(new Byte[img.size])
|
height(img.height), size(img.size), data(new Byte[img.size])
|
||||||
{
|
{
|
||||||
Util::Copy(data, img.data, img.size);
|
Util::Copy(data, img.data, img.size);
|
||||||
}
|
}
|
||||||
@ -89,13 +99,14 @@ namespace ehs
|
|||||||
if (this == &img)
|
if (this == &img)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
Release();
|
BaseObj::operator=((BaseObj&&)img);
|
||||||
|
|
||||||
bitDepth = img.bitDepth;
|
bitDepth = img.bitDepth;
|
||||||
channels = img.channels;
|
channels = img.channels;
|
||||||
width = img.width;
|
width = img.width;
|
||||||
height = img.height;
|
height = img.height;
|
||||||
size = img.size;
|
size = img.size;
|
||||||
|
delete[] data;
|
||||||
data = img.data;
|
data = img.data;
|
||||||
|
|
||||||
img.bitDepth = 0;
|
img.bitDepth = 0;
|
||||||
@ -113,7 +124,7 @@ namespace ehs
|
|||||||
if (this == &img)
|
if (this == &img)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
Release();
|
BaseObj::operator=(img);
|
||||||
|
|
||||||
bitDepth = img.bitDepth;
|
bitDepth = img.bitDepth;
|
||||||
channels = img.channels;
|
channels = img.channels;
|
||||||
@ -139,10 +150,31 @@ namespace ehs
|
|||||||
|
|
||||||
void Img::Release()
|
void Img::Release()
|
||||||
{
|
{
|
||||||
|
bitDepth = 0;
|
||||||
|
channels = 0;
|
||||||
|
width = 0;
|
||||||
|
height = 0;
|
||||||
|
size = 0;
|
||||||
delete[] data;
|
delete[] data;
|
||||||
data = nullptr;
|
data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UInt_64 Img::GetHashId() const
|
||||||
|
{
|
||||||
|
return hashId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Img::SetId(Str_8 newId)
|
||||||
|
{
|
||||||
|
hashId = newId.Hash_64();
|
||||||
|
id = (Str_8&&)newId;
|
||||||
|
}
|
||||||
|
|
||||||
|
Str_8 Img::GetId() const
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
UInt_8 Img::BitDepth() const
|
UInt_8 Img::BitDepth() const
|
||||||
{
|
{
|
||||||
return bitDepth;
|
return bitDepth;
|
||||||
@ -276,19 +308,19 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 4, width, height);
|
Img result(id, bitDepth, 4, width, height);
|
||||||
RGB_To_RGBA(result.Size(), result);
|
RGB_To_RGBA(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 4, width, height);
|
Img result(id, bitDepth, 4, width, height);
|
||||||
MonoA_To_RGBA(result.Size(), result);
|
MonoA_To_RGBA(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 4, width, height);
|
Img result(id, bitDepth, 4, width, height);
|
||||||
Mono_To_RGBA(result.Size(), result);
|
Mono_To_RGBA(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -346,7 +378,7 @@ namespace ehs
|
|||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 3, width, height);
|
Img result(id, bitDepth, 3, width, height);
|
||||||
RGBA_To_RGB(result.Size(), result);
|
RGBA_To_RGB(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -356,13 +388,13 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 3, width, height);
|
Img result(id, bitDepth, 3, width, height);
|
||||||
MonoA_To_RGB(result.Size(), result);
|
MonoA_To_RGB(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 3, width, height);
|
Img result(id, bitDepth, 3, width, height);
|
||||||
Mono_To_RGB(result.Size(), result);
|
Mono_To_RGB(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -420,13 +452,13 @@ namespace ehs
|
|||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 2, width, height);
|
Img result(id, bitDepth, 2, width, height);
|
||||||
RGBA_To_MonoA(result.Size(), result);
|
RGBA_To_MonoA(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 2, width, height);
|
Img result(id, bitDepth, 2, width, height);
|
||||||
RGB_To_MonoA(result.Size(), result);
|
RGB_To_MonoA(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -436,7 +468,7 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 2, width, height);
|
Img result(id, bitDepth, 2, width, height);
|
||||||
Mono_To_MonoA(result.Size(), result);
|
Mono_To_MonoA(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -494,19 +526,19 @@ namespace ehs
|
|||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 1, width, height);
|
Img result(id, bitDepth, 1, width, height);
|
||||||
RGBA_To_Mono(result.Size(), result);
|
RGBA_To_Mono(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 1, width, height);
|
Img result(id, bitDepth, 1, width, height);
|
||||||
RGB_To_Mono(result.Size(), result);
|
RGB_To_Mono(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
Img result(bitDepth, 1, width, height);
|
Img result(id, bitDepth, 1, width, height);
|
||||||
MonoA_To_Mono(result.Size(), result);
|
MonoA_To_Mono(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -572,19 +604,19 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
case 24:
|
case 24:
|
||||||
{
|
{
|
||||||
Img result(32, channels, width, height);
|
Img result(id, 32, channels, width, height);
|
||||||
BD24_to_BD32(result.Size(), result);
|
BD24_to_BD32(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
Img result(32, channels, width, height);
|
Img result(id, 32, channels, width, height);
|
||||||
BD16_to_BD32(result.Size(), result);
|
BD16_to_BD32(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
Img result(32, channels, width, height);
|
Img result(id, 32, channels, width, height);
|
||||||
BD8_to_BD32(result.Size(), result);
|
BD8_to_BD32(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -642,7 +674,7 @@ namespace ehs
|
|||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
Img result(24, channels, width, height);
|
Img result(id, 24, channels, width, height);
|
||||||
BD32_to_BD24(result.Size(), result);
|
BD32_to_BD24(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -652,13 +684,13 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
Img result(24, channels, width, height);
|
Img result(id, 24, channels, width, height);
|
||||||
BD16_to_BD24(result.Size(), result);
|
BD16_to_BD24(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
Img result(24, channels, width, height);
|
Img result(id, 24, channels, width, height);
|
||||||
BD8_to_BD24(result.Size(), result);
|
BD8_to_BD24(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -716,13 +748,13 @@ namespace ehs
|
|||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
Img result(16, channels, width, height);
|
Img result(id, 16, channels, width, height);
|
||||||
BD32_to_BD16(result.Size(), result);
|
BD32_to_BD16(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 24:
|
case 24:
|
||||||
{
|
{
|
||||||
Img result(16, channels, width, height);
|
Img result(id, 16, channels, width, height);
|
||||||
BD24_to_BD16(result.Size(), result);
|
BD24_to_BD16(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -732,7 +764,7 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
Img result(16, channels, width, height);
|
Img result(id, 16, channels, width, height);
|
||||||
BD8_to_BD16(result.Size(), result);
|
BD8_to_BD16(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -790,19 +822,19 @@ namespace ehs
|
|||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
Img result(8, channels, width, height);
|
Img result(id, 8, channels, width, height);
|
||||||
BD32_to_BD8(result.Size(), result);
|
BD32_to_BD8(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 24:
|
case 24:
|
||||||
{
|
{
|
||||||
Img result(8, channels, width, height);
|
Img result(id, 8, channels, width, height);
|
||||||
BD24_to_BD8(result.Size(), result);
|
BD24_to_BD8(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
Img result(8, channels, width, height);
|
Img result(id, 8, channels, width, height);
|
||||||
BD16_to_BD8(result.Size(), result);
|
BD16_to_BD8(result.Size(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -848,7 +880,7 @@ namespace ehs
|
|||||||
File file(filePath, Mode::READ, Disposition::OPEN);
|
File file(filePath, Mode::READ, Disposition::OPEN);
|
||||||
Str_8 ext = file.GetExtension();
|
Str_8 ext = file.GetExtension();
|
||||||
|
|
||||||
Img result;
|
Img result(file.GetName());
|
||||||
|
|
||||||
const ImgCodec* codec = GetCodec(ext);
|
const ImgCodec* codec = GetCodec(ext);
|
||||||
if (!codec)
|
if (!codec)
|
||||||
@ -881,7 +913,7 @@ namespace ehs
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = new Img();
|
result = new Img(file.GetName());
|
||||||
|
|
||||||
Serializer<UInt_64> data = file.ReadSerializer_64(codec->GetEndianness(), file.Size());
|
Serializer<UInt_64> data = file.ReadSerializer_64(codec->GetEndianness(), file.Size());
|
||||||
|
|
||||||
@ -896,9 +928,9 @@ namespace ehs
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Img Img::FromData(const Str_8& ext, Serializer<UInt_64>& data)
|
Img Img::FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data)
|
||||||
{
|
{
|
||||||
Img result;
|
Img result((Str_8&&)id);
|
||||||
|
|
||||||
const ImgCodec* codec = GetCodec(ext);
|
const ImgCodec* codec = GetCodec(ext);
|
||||||
if (!codec)
|
if (!codec)
|
||||||
@ -917,7 +949,7 @@ namespace ehs
|
|||||||
{
|
{
|
||||||
UInt_8 bytes = bitDepth / 8;
|
UInt_8 bytes = bitDepth / 8;
|
||||||
|
|
||||||
Img result(bitDepth, channels, newWidth, newHeight);
|
Img result(id, bitDepth, channels, newWidth, newHeight);
|
||||||
|
|
||||||
double xRatio = (double)width / (double)newWidth;
|
double xRatio = (double)width / (double)newWidth;
|
||||||
double yRatio = (double)height / (double)newWidth;
|
double yRatio = (double)height / (double)newWidth;
|
||||||
|
@ -3,37 +3,33 @@
|
|||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
Mesh::Mesh()
|
Mesh::Mesh()
|
||||||
|
: hashId(0)
|
||||||
{
|
{
|
||||||
AddType("Mesh");
|
AddType("Mesh");
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh::Mesh(Str_8 id, Array<Vertex_f> vertices, Array<UInt_32> indices)
|
Mesh::Mesh(Str_8 id, Array<Vertex_f> vertices, Array<UInt_32> indices)
|
||||||
: Resource(std::move(id)), vertices(std::move(vertices)), indices(std::move(indices))
|
: hashId(id.Hash_64()), id((Str_8&&)id), vertices((Array<Vertex_f>&&)vertices),
|
||||||
|
indices((Array<UInt_32>&&)indices)
|
||||||
{
|
{
|
||||||
AddType("Mesh");
|
AddType("Mesh");
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh::Mesh(Str_8 id, Array<Vertex_f> vertices)
|
Mesh::Mesh(Str_8 id, Array<Vertex_f> vertices)
|
||||||
: Resource(std::move(id)), vertices(std::move(vertices))
|
: hashId(id.Hash_64()), id((Str_8&&)id), vertices((Array<Vertex_f>&&)vertices)
|
||||||
{
|
|
||||||
AddType("Mesh");
|
|
||||||
}
|
|
||||||
|
|
||||||
Mesh::Mesh(Str_8 id)
|
|
||||||
: Resource(std::move(id))
|
|
||||||
{
|
{
|
||||||
AddType("Mesh");
|
AddType("Mesh");
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh::Mesh(Mesh&& mesh) noexcept
|
Mesh::Mesh(Mesh&& mesh) noexcept
|
||||||
: Resource(std::move(mesh)), vertices(std::move(mesh.vertices)),
|
: BaseObj((BaseObj&&)mesh), hashId(mesh.hashId), id((Str_8&&)mesh.id), vertices((Array<Vertex_f>&&)mesh.vertices),
|
||||||
indices(std::move(mesh.indices))
|
indices((Array<UInt_32>&&)mesh.indices)
|
||||||
{
|
{
|
||||||
|
mesh.hashId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh::Mesh(const Mesh& mesh)
|
Mesh::Mesh(const Mesh& mesh)
|
||||||
: Resource(mesh), vertices(mesh.vertices), indices(mesh.indices), srcVertBuffer(mesh.srcVertBuffer),
|
: BaseObj((BaseObj&&)mesh), hashId(mesh.hashId), id(mesh.id), vertices(mesh.vertices), indices(mesh.indices)
|
||||||
dstVertBuffer(mesh.dstVertBuffer), srcIndBuffer(mesh.srcIndBuffer), dstIndBuffer(mesh.dstIndBuffer)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,14 +38,14 @@ namespace ehs
|
|||||||
if (this == &mesh)
|
if (this == &mesh)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
vertices = std::move(mesh.vertices);
|
BaseObj::operator=((BaseObj&&)mesh);
|
||||||
indices = std::move(mesh.indices);
|
|
||||||
srcVertBuffer = std::move(mesh.srcVertBuffer);
|
|
||||||
dstVertBuffer = std::move(mesh.dstVertBuffer);
|
|
||||||
srcIndBuffer = std::move(mesh.srcIndBuffer);
|
|
||||||
dstIndBuffer = std::move(mesh.dstIndBuffer);
|
|
||||||
|
|
||||||
Resource::operator=(std::move(mesh));
|
hashId = mesh.hashId;
|
||||||
|
id = (Str_8&&)mesh.id;
|
||||||
|
vertices = (Array<Vertex_f>&&)mesh.vertices;
|
||||||
|
indices = (Array<UInt_32>&&)mesh.indices;
|
||||||
|
|
||||||
|
mesh.hashId = 0;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -59,237 +55,36 @@ namespace ehs
|
|||||||
if (this == &mesh)
|
if (this == &mesh)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=(mesh);
|
||||||
|
|
||||||
|
hashId = mesh.hashId;
|
||||||
|
id = mesh.id;
|
||||||
vertices = mesh.vertices;
|
vertices = mesh.vertices;
|
||||||
indices = mesh.indices;
|
indices = mesh.indices;
|
||||||
srcVertBuffer = mesh.srcVertBuffer;
|
|
||||||
dstVertBuffer = mesh.dstVertBuffer;
|
|
||||||
srcIndBuffer = mesh.srcIndBuffer;
|
|
||||||
dstIndBuffer = mesh.dstIndBuffer;
|
|
||||||
|
|
||||||
Resource::operator=(mesh);
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mesh::UploadToGpu(GpuCmdBuffer* cmdBuffer)
|
void Mesh::Release()
|
||||||
{
|
{
|
||||||
GameLoop* gl = (GameLoop*)GetParent("GameLoop");
|
vertices.Clear();
|
||||||
if (!gl)
|
indices.Clear();
|
||||||
return false;
|
|
||||||
|
|
||||||
RenderWindow* win = gl->GetWindow();
|
|
||||||
if (!win)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
GpuInterface* inf = win->GetInterface();
|
|
||||||
|
|
||||||
if (readOnly)
|
|
||||||
{
|
|
||||||
srcVertBuffer = {
|
|
||||||
inf,
|
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
|
||||||
sizeof(Vertex_f) * vertices.Size()
|
|
||||||
};
|
|
||||||
|
|
||||||
Byte* data = (Byte*)srcVertBuffer.MapMemory();
|
|
||||||
|
|
||||||
for (UInt_64 i = 0; i < vertices.Size(); ++i)
|
|
||||||
for (UInt_64 v = 0; v < sizeof(Vertex_f); ++v)
|
|
||||||
data[sizeof(Vertex_f) * i + v] = ((Byte*) &vertices[i])[v];
|
|
||||||
|
|
||||||
srcVertBuffer.UnMapMemory();
|
|
||||||
|
|
||||||
dstVertBuffer = {
|
|
||||||
inf,
|
|
||||||
VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
|
|
||||||
srcVertBuffer.Size(),
|
|
||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
|
|
||||||
};
|
|
||||||
|
|
||||||
VK_MEMORY_PROPERTY_HOST
|
|
||||||
|
|
||||||
VkBufferMemoryBarrier barrier = {};
|
|
||||||
barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
|
||||||
barrier.pNext = nullptr;
|
|
||||||
barrier.srcAccessMask = 0;
|
|
||||||
barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
|
||||||
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.buffer = dstVertBuffer;
|
|
||||||
barrier.offset = 0;
|
|
||||||
barrier.size = VK_WHOLE_SIZE;
|
|
||||||
|
|
||||||
cmdBuffer->BufferBarrier(
|
|
||||||
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
|
||||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
&barrier
|
|
||||||
);
|
|
||||||
|
|
||||||
GpuBuffer::Copy(cmdBuffer, &srcVertBuffer, &dstVertBuffer);
|
|
||||||
|
|
||||||
barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
|
||||||
barrier.pNext = nullptr;
|
|
||||||
barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
|
||||||
barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
|
|
||||||
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.buffer = dstVertBuffer;
|
|
||||||
barrier.offset = 0;
|
|
||||||
barrier.size = VK_WHOLE_SIZE;
|
|
||||||
|
|
||||||
cmdBuffer->BufferBarrier(
|
|
||||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
|
||||||
VK_PIPELINE_STAGE_VERTEX_SHADER_BIT,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
&barrier
|
|
||||||
);
|
|
||||||
|
|
||||||
if (indices.Size())
|
|
||||||
{
|
|
||||||
srcIndBuffer = {
|
|
||||||
inf,
|
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
|
||||||
sizeof(UInt_32) * indices.Size()
|
|
||||||
};
|
|
||||||
|
|
||||||
UInt_32* indMem = (UInt_32*)srcIndBuffer.MapMemory();
|
|
||||||
|
|
||||||
for (UInt_64 i = 0; i < indices.Size(); ++i)
|
|
||||||
indMem[i] = indices[i];
|
|
||||||
|
|
||||||
srcIndBuffer.UnMapMemory();
|
|
||||||
|
|
||||||
dstIndBuffer = {
|
|
||||||
inf,
|
|
||||||
VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
|
|
||||||
srcIndBuffer.Size(),
|
|
||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
|
|
||||||
};
|
|
||||||
|
|
||||||
barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
|
||||||
barrier.pNext = nullptr;
|
|
||||||
barrier.srcAccessMask = 0;
|
|
||||||
barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
|
||||||
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.buffer = dstIndBuffer;
|
|
||||||
barrier.offset = 0;
|
|
||||||
barrier.size = VK_WHOLE_SIZE;
|
|
||||||
|
|
||||||
cmdBuffer->BufferBarrier(
|
|
||||||
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
|
||||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
&barrier
|
|
||||||
);
|
|
||||||
|
|
||||||
GpuBuffer::Copy(cmdBuffer, &srcIndBuffer, &dstIndBuffer);
|
|
||||||
|
|
||||||
barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
|
||||||
barrier.pNext = nullptr;
|
|
||||||
barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
|
||||||
barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
|
|
||||||
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.buffer = dstIndBuffer;
|
|
||||||
barrier.offset = 0;
|
|
||||||
barrier.size = VK_WHOLE_SIZE;
|
|
||||||
|
|
||||||
cmdBuffer->BufferBarrier(
|
|
||||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
|
||||||
VK_PIPELINE_STAGE_VERTEX_SHADER_BIT,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
&barrier
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdBuffer->AddDependency(this);
|
UInt_64 Mesh::GetHashId() const
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
dstVertBuffer = {
|
return hashId;
|
||||||
inf,
|
}
|
||||||
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
|
|
||||||
sizeof(Vertex_f) * vertices.Size()
|
|
||||||
};
|
|
||||||
|
|
||||||
void* data = dstVertBuffer.MapMemory();
|
void Mesh::SetId(Str_8 newId)
|
||||||
Util::Copy(data, &vertices[0], dstVertBuffer.Size());
|
|
||||||
dstVertBuffer.UnMapMemory();
|
|
||||||
|
|
||||||
if (indices.Size())
|
|
||||||
{
|
{
|
||||||
dstIndBuffer = {
|
hashId = newId.Hash_64();
|
||||||
inf,
|
id = (Str_8&&)newId;
|
||||||
VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
|
|
||||||
sizeof(UInt_32) * indices.Size()
|
|
||||||
};
|
|
||||||
|
|
||||||
data = dstIndBuffer.MapMemory();
|
|
||||||
Util::Copy(data, &indices[0], dstIndBuffer.Size());
|
|
||||||
dstIndBuffer.UnMapMemory();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
Str_8 Mesh::GetId() const
|
||||||
}
|
|
||||||
|
|
||||||
bool Mesh::PostGpuUpload()
|
|
||||||
{
|
{
|
||||||
srcVertBuffer.Release();
|
return id;
|
||||||
srcIndBuffer.Release();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Mesh::HasPostGpuUploaded() const
|
|
||||||
{
|
|
||||||
return !srcVertBuffer.IsValid() && !srcIndBuffer.IsValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Mesh::ReleaseFromGpu()
|
|
||||||
{
|
|
||||||
srcVertBuffer.Release();
|
|
||||||
srcIndBuffer.Release();
|
|
||||||
dstVertBuffer.Release();
|
|
||||||
dstIndBuffer.Release();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Mesh::IsUploaded() const
|
|
||||||
{
|
|
||||||
return dstVertBuffer.IsValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mesh::Bind(GpuCmdBuffer* cmdBuffer)
|
|
||||||
{
|
|
||||||
cmdBuffer->AddDependency(this);
|
|
||||||
|
|
||||||
if (dstIndBuffer.IsValid())
|
|
||||||
{
|
|
||||||
cmdBuffer->AddDependency(&dstIndBuffer);
|
|
||||||
vkCmdBindIndexBuffer(*cmdBuffer, dstIndBuffer.GetBuffer(), 0, VK_INDEX_TYPE_UINT32);
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdBuffer->AddDependency(&dstVertBuffer);
|
|
||||||
|
|
||||||
VkDeviceSize offset = 0;
|
|
||||||
VkBuffer vertB = dstVertBuffer.GetBuffer();
|
|
||||||
vkCmdBindVertexBuffers(*cmdBuffer, 0, 1, &vertB, &offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mesh::Draw(GpuCmdBuffer* cmdBuffer, const UInt_32 instances)
|
|
||||||
{
|
|
||||||
if (dstIndBuffer.IsValid())
|
|
||||||
vkCmdDrawIndexed(*cmdBuffer, indices.Size(), instances, 0, 0, 0);
|
|
||||||
else
|
|
||||||
vkCmdDraw(*cmdBuffer, vertices.Size(), instances, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::SetVertices(const Array<Vertex_f>& newVertices)
|
void Mesh::SetVertices(const Array<Vertex_f>& newVertices)
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
Model::Model()
|
Model::Model()
|
||||||
|
: hashId(0)
|
||||||
{
|
{
|
||||||
AddType("Model");
|
AddType("Model");
|
||||||
}
|
}
|
||||||
@ -23,27 +24,27 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
|
|
||||||
Model::Model(Str_8 id, Array<Mesh> meshes, Bone skeleton, Array<Animation> animations)
|
Model::Model(Str_8 id, Array<Mesh> meshes, Bone skeleton, Array<Animation> animations)
|
||||||
: Resource(std::move(id)), meshes(std::move(meshes)), skeleton(std::move(skeleton)),
|
: hashId(id.Hash_64()), id((Str_8&&)id), meshes((Array<Mesh>&&)meshes), skeleton((Bone&&)skeleton),
|
||||||
animations(std::move(animations))
|
animations((Array<Animation>&&)animations)
|
||||||
{
|
{
|
||||||
AddType("Model");
|
AddType("Model");
|
||||||
}
|
}
|
||||||
|
|
||||||
Model::Model(Str_8 id, Array<Mesh> meshes, Bone skeleton)
|
Model::Model(Str_8 id, Array<Mesh> meshes, Bone skeleton)
|
||||||
: Resource(std::move(id)), meshes(std::move(meshes)), skeleton(std::move(skeleton))
|
: hashId(id.Hash_64()), id((Str_8&&)id), meshes((Array<Mesh>&&)meshes), skeleton((Bone&&)skeleton)
|
||||||
{
|
{
|
||||||
AddType("Model");
|
AddType("Model");
|
||||||
}
|
}
|
||||||
|
|
||||||
Model::Model(Str_8 id, Array<Mesh> meshes)
|
Model::Model(Str_8 id, Array<Mesh> meshes)
|
||||||
: Resource(std::move(id)), meshes(std::move(meshes))
|
: hashId(id.Hash_64()), id((Str_8&&)id), meshes((Array<Mesh>&&)meshes)
|
||||||
{
|
{
|
||||||
AddType("Model");
|
AddType("Model");
|
||||||
}
|
}
|
||||||
|
|
||||||
Model::Model(Model&& model) noexcept
|
Model::Model(Model&& model) noexcept
|
||||||
: Resource(std::move(model)), meshes(std::move(model.meshes)),
|
: BaseObj((BaseObj&&)model), hashId(model.hashId), id((Str_8&&)model.id), meshes((Array<Mesh>&&)model.meshes),
|
||||||
skeleton(std::move(model.skeleton)), animations(std::move(model.animations))
|
skeleton((Bone&&)model.skeleton), animations((Array<Animation>&&)model.animations)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,60 +53,40 @@ namespace ehs
|
|||||||
if (this == &model)
|
if (this == &model)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
BaseObj::operator=((BaseObj&&)model);
|
||||||
|
|
||||||
hashId = model.hashId;
|
hashId = model.hashId;
|
||||||
id = std::move(model.id);
|
id = (Str_8&&)model.id;
|
||||||
meshes = std::move(model.meshes);
|
meshes = (Array<Mesh>&&)model.meshes;
|
||||||
skeleton = std::move(model.skeleton);
|
skeleton = (Bone&&)model.skeleton;
|
||||||
animations = std::move(model.animations);
|
animations = (Array<Animation>&&)model.animations;
|
||||||
|
|
||||||
model.hashId = 0;
|
model.hashId = 0;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::UploadToGpu(GpuCmdBuffer* cmdBuffer)
|
void Model::Release()
|
||||||
{
|
{
|
||||||
for (UInt_64 i = 0; i < meshes.Size(); ++i)
|
meshes.Clear();
|
||||||
if (!meshes[i].UploadToGpu(cmdBuffer))
|
skeleton = {};
|
||||||
return false;
|
animations.Clear();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::PostGpuUpload()
|
UInt_64 Model::GetHashId() const
|
||||||
{
|
{
|
||||||
bool result = true;
|
return hashId;
|
||||||
|
|
||||||
for (UInt_64 i = 0; i < meshes.Size(); ++i)
|
|
||||||
if (!meshes[i].PostGpuUpload())
|
|
||||||
result = false;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::ReleaseFromGpu()
|
void Model::SetId(Str_8 newId)
|
||||||
{
|
{
|
||||||
bool result = true;
|
hashId = newId.Hash_64();
|
||||||
|
id = (Str_8&&)newId;
|
||||||
for (UInt_64 i = 0; i < meshes.Size(); ++i)
|
|
||||||
if (!meshes[i].ReleaseFromGpu())
|
|
||||||
result = false;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::IsUploaded() const
|
Str_8 Model::GetId() const
|
||||||
{
|
{
|
||||||
return meshes[0].IsUploaded();
|
return id;
|
||||||
}
|
|
||||||
|
|
||||||
void Model::Draw(GpuCmdBuffer* cmdBuffer, const UInt_32 instances)
|
|
||||||
{
|
|
||||||
for (UInt_64 i = 0; i < meshes.Size(); ++i)
|
|
||||||
{
|
|
||||||
meshes[i].Bind(cmdBuffer);
|
|
||||||
meshes[i].Draw(cmdBuffer, instances);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Array<Mesh> Model::GetMeshes() const
|
Array<Mesh> Model::GetMeshes() const
|
||||||
@ -118,18 +99,18 @@ namespace ehs
|
|||||||
return meshes;
|
return meshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh* Model::GetMesh(const UInt_64 hashId)
|
Mesh* Model::GetMesh(const UInt_64 inHashId)
|
||||||
{
|
{
|
||||||
for (UInt_64 i = 0; i < meshes.Size(); ++i)
|
for (UInt_64 i = 0; i < meshes.Size(); ++i)
|
||||||
if (meshes[i].GetHashId() == hashId)
|
if (meshes[i].GetHashId() == inHashId)
|
||||||
return &meshes[i];
|
return &meshes[i];
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh* Model::GetMesh(const Str_8& id)
|
Mesh* Model::GetMesh(const Str_8& inId)
|
||||||
{
|
{
|
||||||
return GetMesh(id.Hash_64());
|
return GetMesh(inId.Hash_64());
|
||||||
}
|
}
|
||||||
|
|
||||||
Bone Model::GetSkeleton() const
|
Bone Model::GetSkeleton() const
|
||||||
@ -142,10 +123,10 @@ namespace ehs
|
|||||||
return skeleton;
|
return skeleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation* Model::GetAnimation(const UInt_64 hashId)
|
Animation* Model::GetAnimation(const UInt_64 inHashId)
|
||||||
{
|
{
|
||||||
for (UInt_64 i = 0; i < animations.Size(); ++i)
|
for (UInt_64 i = 0; i < animations.Size(); ++i)
|
||||||
if (animations[i].GetHashId() == hashId)
|
if (animations[i].GetHashId() == inHashId)
|
||||||
return &animations[i];
|
return &animations[i];
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -224,7 +205,6 @@ namespace ehs
|
|||||||
for (UInt_64 i = 0; i < meshes.Size(); ++i)
|
for (UInt_64 i = 0; i < meshes.Size(); ++i)
|
||||||
{
|
{
|
||||||
meshes[i].SetId(data.ReadStr<Char_8, UInt_64>());
|
meshes[i].SetId(data.ReadStr<Char_8, UInt_64>());
|
||||||
meshes[i].SetParent(this);
|
|
||||||
|
|
||||||
Array<Vertex_f>& vertices = meshes[i].GetVertices();
|
Array<Vertex_f>& vertices = meshes[i].GetVertices();
|
||||||
vertices.Resize(data.Read<UInt_64>());
|
vertices.Resize(data.Read<UInt_64>());
|
||||||
|
@ -226,8 +226,7 @@ namespace ehs
|
|||||||
payload.WriteVersion(ver);
|
payload.WriteVersion(ver);
|
||||||
payload.WriteVersion(appVer);
|
payload.WriteVersion(appVer);
|
||||||
|
|
||||||
Endpoint* end = new Endpoint(hdl, type, address, port);
|
Endpoint* end = new Endpoint(this, type, address, port);
|
||||||
end->SetParent(this);
|
|
||||||
end->Send(false, true, false, "Internal", "Connect", payload);
|
end->Send(false, true, false, "Internal", "Connect", payload);
|
||||||
|
|
||||||
endpoints.Push(end);
|
endpoints.Push(end);
|
||||||
@ -316,9 +315,8 @@ namespace ehs
|
|||||||
Architecture rArch = payload.Read<Architecture>();
|
Architecture rArch = payload.Read<Architecture>();
|
||||||
Str_8 rId = payload.ReadStr<Char_8, UInt_64>();
|
Str_8 rId = payload.ReadStr<Char_8, UInt_64>();
|
||||||
|
|
||||||
Endpoint* end = new Endpoint(hdl, header.disposition, rArch, rId, type, rAddress, rPort);
|
Endpoint* end = new Endpoint(this, header.disposition, rArch, rId, type, rAddress, rPort);
|
||||||
end->SetStatus(Status::PENDING);
|
end->SetStatus(Status::PENDING);
|
||||||
end->SetParent(this);
|
|
||||||
|
|
||||||
Serializer sPayload(Endianness::LE);
|
Serializer sPayload(Endianness::LE);
|
||||||
|
|
||||||
@ -415,10 +413,9 @@ namespace ehs
|
|||||||
Architecture arch = payload.Read<Architecture>();
|
Architecture arch = payload.Read<Architecture>();
|
||||||
Str_8 id = payload.ReadStr<Char_8, UInt_64>();
|
Str_8 id = payload.ReadStr<Char_8, UInt_64>();
|
||||||
|
|
||||||
*end = Endpoint(hdl, header.disposition, arch, id, type, rAddress, rPort);
|
*end = Endpoint(this, header.disposition, arch, id, type, rAddress, rPort);
|
||||||
end->SetStatus(payload.Read<Status>());
|
end->SetStatus(payload.Read<Status>());
|
||||||
end->SetQueueSlot(payload.Read<UInt_64>());
|
end->SetQueueSlot(payload.Read<UInt_64>());
|
||||||
end->SetParent(this);
|
|
||||||
|
|
||||||
if (connectedCb)
|
if (connectedCb)
|
||||||
connectedCb(this, end);
|
connectedCb(this, end);
|
||||||
|
@ -20,24 +20,24 @@
|
|||||||
namespace ehs
|
namespace ehs
|
||||||
{
|
{
|
||||||
Endpoint::Endpoint()
|
Endpoint::Endpoint()
|
||||||
: hdl(EHS_INVALID_SOCKET), disposition(EndDisp::UNKNOWN), status(Status::PENDING), arch(Architecture::UNKNOWN),
|
: owner(nullptr), disposition(EndDisp::UNKNOWN), status(Status::PENDING), arch(Architecture::UNKNOWN),
|
||||||
hashId(0), nextSendId(0), nextRecvId(0), port(0), deltaDuration(0.0f), deltaRate(1.0f / 60.0f),
|
hashId(0), nextSendId(0), nextRecvId(0), port(0), deltaDuration(0.0f), deltaRate(1.0f / 60.0f),
|
||||||
timeout(0.0f), lastPing(0.0f), oldLatency(0.0f), latency(0.0f), queueSlot(0)
|
timeout(0.0f), lastPing(0.0f), oldLatency(0.0f), latency(0.0f), queueSlot(0)
|
||||||
{
|
{
|
||||||
AddType("Endpoint");
|
AddType("Endpoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
Endpoint::Endpoint(Socket hdl, const EndDisp disposition, const Architecture arch, const Str_8& id,
|
Endpoint::Endpoint(Comms* owner, const EndDisp disposition, const Architecture arch, const Str_8& id,
|
||||||
const AddrType& type, const Str_8& address, const UInt_16 port)
|
const AddrType& type, const Str_8& address, const UInt_16 port)
|
||||||
: hdl(hdl), disposition(disposition), status(Status::ACTIVE), arch(arch), id(id), hashId(id.Hash_32()), nextSendId(0),
|
: owner(owner), disposition(disposition), status(Status::ACTIVE), arch(arch), id(id), hashId(id.Hash_32()), nextSendId(0),
|
||||||
nextRecvId(0), address(address), port(port), deltaDuration(0.0f), deltaRate(1.0f / 60.0f), timeout(0.0f),
|
nextRecvId(0), address(address), port(port), deltaDuration(0.0f), deltaRate(1.0f / 60.0f), timeout(0.0f),
|
||||||
lastPing(0.0f), oldLatency(0.0f), latency(0.0f), queueSlot(0)
|
lastPing(0.0f), oldLatency(0.0f), latency(0.0f), queueSlot(0)
|
||||||
{
|
{
|
||||||
AddType("Endpoint");
|
AddType("Endpoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
Endpoint::Endpoint(Socket hdl, const AddrType& type, const Str_8& address, const UInt_16 port)
|
Endpoint::Endpoint(Comms* owner, const AddrType& type, const Str_8& address, const UInt_16 port)
|
||||||
: hdl(hdl), disposition(EndDisp::UNKNOWN), status(Status::PENDING), arch(Architecture::UNKNOWN), hashId(0),
|
: owner(owner), disposition(EndDisp::UNKNOWN), status(Status::PENDING), arch(Architecture::UNKNOWN), hashId(0),
|
||||||
nextSendId(0), nextRecvId(0), address(address), port(port), deltaDuration(0.0f), deltaRate(1.0f / 60.0f),
|
nextSendId(0), nextRecvId(0), address(address), port(port), deltaDuration(0.0f), deltaRate(1.0f / 60.0f),
|
||||||
timeout(0.0f), lastPing(0.0f), oldLatency(0.0f), latency(0.0f), queueSlot(0)
|
timeout(0.0f), lastPing(0.0f), oldLatency(0.0f), latency(0.0f), queueSlot(0)
|
||||||
{
|
{
|
||||||
@ -45,7 +45,7 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
|
|
||||||
Endpoint::Endpoint(const Endpoint& end)
|
Endpoint::Endpoint(const Endpoint& end)
|
||||||
: BaseObj(end), hdl(EHS_INVALID_SOCKET), disposition(end.disposition), status(Status::PENDING), arch(end.arch),
|
: BaseObj(end), owner(nullptr), disposition(end.disposition), status(Status::PENDING), arch(end.arch),
|
||||||
id(end.id), hashId(end.hashId), nextSendId(0), nextRecvId(0), address(end.address), port(end.port),
|
id(end.id), hashId(end.hashId), nextSendId(0), nextRecvId(0), address(end.address), port(end.port),
|
||||||
deltaDuration(0.0f), deltaRate(1.0f / 60.0f), timeout(0.0f), lastPing(0.0f),
|
deltaDuration(0.0f), deltaRate(1.0f / 60.0f), timeout(0.0f), lastPing(0.0f),
|
||||||
oldLatency(0.0f), latency(0.0f), queueSlot(0)
|
oldLatency(0.0f), latency(0.0f), queueSlot(0)
|
||||||
@ -82,7 +82,7 @@ namespace ehs
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hdl = EHS_INVALID_SOCKET;
|
owner = nullptr;
|
||||||
disposition = end.disposition;
|
disposition = end.disposition;
|
||||||
status = Status::PENDING;
|
status = Status::PENDING;
|
||||||
arch = end.arch;
|
arch = end.arch;
|
||||||
@ -108,13 +108,6 @@ namespace ehs
|
|||||||
|
|
||||||
void Endpoint::Poll(const float delta)
|
void Endpoint::Poll(const float delta)
|
||||||
{
|
{
|
||||||
Comms* comms = (Comms*)GetParent();
|
|
||||||
if (!comms)
|
|
||||||
{
|
|
||||||
EHS_LOG_INT("Error", 0, "Endpoint must be a child of a Socket object.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SortReceived();
|
SortReceived();
|
||||||
|
|
||||||
if (deltaDuration >= deltaRate)
|
if (deltaDuration >= deltaRate)
|
||||||
@ -129,7 +122,7 @@ namespace ehs
|
|||||||
for (UInt_64 i = 0; i < sent.Size(); ++i)
|
for (UInt_64 i = 0; i < sent.Size(); ++i)
|
||||||
{
|
{
|
||||||
sent[i].lastResend += delta;
|
sent[i].lastResend += delta;
|
||||||
if (sent[i].lastResend >= comms->GetResendRate())
|
if (sent[i].lastResend >= owner->GetResendRate())
|
||||||
{
|
{
|
||||||
Serializer result(Endianness::LE);
|
Serializer result(Endianness::LE);
|
||||||
result.Write(sent[i].header);
|
result.Write(sent[i].header);
|
||||||
@ -138,17 +131,17 @@ namespace ehs
|
|||||||
if (sent[i].header.encrypted)
|
if (sent[i].header.encrypted)
|
||||||
Encryption::Encrypt_64(result.Size() - sizeof(bool), &result[sizeof(bool)]);
|
Encryption::Encrypt_64(result.Size() - sizeof(bool), &result[sizeof(bool)]);
|
||||||
|
|
||||||
if (comms->GetAddressType() == AddrType::IPV6)
|
if (owner->GetAddressType() == AddrType::IPV6)
|
||||||
Send_v6(result);
|
Send_v6(result);
|
||||||
else if (comms->GetAddressType() == AddrType::IPV4)
|
else if (owner->GetAddressType() == AddrType::IPV4)
|
||||||
Send_v4(result);
|
Send_v4(result);
|
||||||
|
|
||||||
sent[i].lastResend = Math::Mod(sent[i].lastResend, comms->GetResendRate());
|
sent[i].lastResend = Math::Mod(sent[i].lastResend, owner->GetResendRate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comms->GetDisposition() == EndDisp::SERVICE)
|
if (owner->GetDisposition() == EndDisp::SERVICE)
|
||||||
{
|
{
|
||||||
lastPing += delta;
|
lastPing += delta;
|
||||||
if (lastPing >= 1.0f)
|
if (lastPing >= 1.0f)
|
||||||
@ -194,13 +187,6 @@ namespace ehs
|
|||||||
void Endpoint::Send(const bool deltaLocked, const bool encrypted, const bool ensure, const UInt_64 sys,
|
void Endpoint::Send(const bool deltaLocked, const bool encrypted, const bool ensure, const UInt_64 sys,
|
||||||
const UInt_64 op, const Serializer<>& payload)
|
const UInt_64 op, const Serializer<>& payload)
|
||||||
{
|
{
|
||||||
Comms* comms = (Comms*)GetParent();
|
|
||||||
if (!comms)
|
|
||||||
{
|
|
||||||
EHS_LOG_INT("Error", 0, "Endpoint must be a child of a Socket object.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (deltaLocked && deltaDuration < deltaRate)
|
if (deltaLocked && deltaDuration < deltaRate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -210,13 +196,13 @@ namespace ehs
|
|||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
ensure,
|
ensure,
|
||||||
comms->GetDisposition(),
|
owner->GetDisposition(),
|
||||||
comms->GetHashId(),
|
owner->GetHashId(),
|
||||||
sys,
|
sys,
|
||||||
op
|
op
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((comms->GetAddressType() == AddrType::IPV6 && payload.Size() > COMMS_IPV6_PAYLOAD) || (comms->GetAddressType() == AddrType::IPV4 && payload.Size() > COMMS_IPV4_PAYLOAD))
|
if ((owner->GetAddressType() == AddrType::IPV6 && payload.Size() > COMMS_IPV6_PAYLOAD) || (owner->GetAddressType() == AddrType::IPV4 && payload.Size() > COMMS_IPV4_PAYLOAD))
|
||||||
{
|
{
|
||||||
Fragments frags = FragmentData(header, payload);
|
Fragments frags = FragmentData(header, payload);
|
||||||
for (UInt_64 i = 0; i < frags.Size(); ++i)
|
for (UInt_64 i = 0; i < frags.Size(); ++i)
|
||||||
@ -380,16 +366,9 @@ namespace ehs
|
|||||||
|
|
||||||
Fragments Endpoint::FragmentData(const Header& header, const Serializer<>& data)
|
Fragments Endpoint::FragmentData(const Header& header, const Serializer<>& data)
|
||||||
{
|
{
|
||||||
Comms* comms = (Comms*)GetParent();
|
|
||||||
if (!comms)
|
|
||||||
{
|
|
||||||
EHS_LOG_INT("Error", 0, "Endpoint must be a child of a Socket object.");
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
Fragments result;
|
Fragments result;
|
||||||
|
|
||||||
if (comms->GetAddressType() == AddrType::IPV6)
|
if (owner->GetAddressType() == AddrType::IPV6)
|
||||||
{
|
{
|
||||||
UInt_64 frags = data.Size() / COMMS_IPV6_PAYLOAD;
|
UInt_64 frags = data.Size() / COMMS_IPV6_PAYLOAD;
|
||||||
if (data.Size() % COMMS_IPV6_PAYLOAD)
|
if (data.Size() % COMMS_IPV6_PAYLOAD)
|
||||||
@ -408,7 +387,7 @@ namespace ehs
|
|||||||
result[i] = {data.GetEndianness(), &data[i * COMMS_IPV6_PAYLOAD], size};
|
result[i] = {data.GetEndianness(), &data[i * COMMS_IPV6_PAYLOAD], size};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (comms->GetAddressType() == AddrType::IPV4)
|
else if (owner->GetAddressType() == AddrType::IPV4)
|
||||||
{
|
{
|
||||||
UInt_64 frags = data.Size() / COMMS_IPV4_PAYLOAD;
|
UInt_64 frags = data.Size() / COMMS_IPV4_PAYLOAD;
|
||||||
if (data.Size() % COMMS_IPV4_PAYLOAD)
|
if (data.Size() % COMMS_IPV4_PAYLOAD)
|
||||||
@ -433,13 +412,6 @@ namespace ehs
|
|||||||
|
|
||||||
void Endpoint::Send(const Header& header, const Serializer<>& payload)
|
void Endpoint::Send(const Header& header, const Serializer<>& payload)
|
||||||
{
|
{
|
||||||
Comms* comms = (Comms*)GetParent();
|
|
||||||
if (!comms)
|
|
||||||
{
|
|
||||||
EHS_LOG_INT("Error", 0, "Endpoint must be a child of a Socket object.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Serializer result(Endianness::LE);
|
Serializer result(Endianness::LE);
|
||||||
result.Write(header);
|
result.Write(header);
|
||||||
result.WriteSer(payload);
|
result.WriteSer(payload);
|
||||||
@ -450,9 +422,9 @@ namespace ehs
|
|||||||
if (header.ensure)
|
if (header.ensure)
|
||||||
sent.Push({header, payload});
|
sent.Push({header, payload});
|
||||||
|
|
||||||
if (comms->GetAddressType() == AddrType::IPV6)
|
if (owner->GetAddressType() == AddrType::IPV6)
|
||||||
Send_v6(result);
|
Send_v6(result);
|
||||||
else if (comms->GetAddressType() == AddrType::IPV4)
|
else if (owner->GetAddressType() == AddrType::IPV4)
|
||||||
Send_v4(result);
|
Send_v4(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,7 +484,7 @@ namespace ehs
|
|||||||
|
|
||||||
UInt_16 Endpoint::Send_v6(const Serializer<>& payload)
|
UInt_16 Endpoint::Send_v6(const Serializer<>& payload)
|
||||||
{
|
{
|
||||||
if (hdl == EHS_INVALID_SOCKET)
|
if (!owner)
|
||||||
{
|
{
|
||||||
EHS_LOG_INT("Info", 0, "Attempted to send while socket is not initialized.");
|
EHS_LOG_INT("Info", 0, "Attempted to send while socket is not initialized.");
|
||||||
return 0;
|
return 0;
|
||||||
@ -549,7 +521,7 @@ namespace ehs
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Int_32 sent = sendto(hdl, (char*)&payload[0], (int)payload.Size(), 0, (sockaddr*)&result, sizeof(sockaddr_in6));
|
Int_32 sent = sendto(owner->hdl, (char*)&payload[0], (int)payload.Size(), 0, (sockaddr*)&result, sizeof(sockaddr_in6));
|
||||||
#if defined(EHS_OS_WINDOWS)
|
#if defined(EHS_OS_WINDOWS)
|
||||||
if (sent == SOCKET_ERROR)
|
if (sent == SOCKET_ERROR)
|
||||||
#elif defined(EHS_OS_LINUX)
|
#elif defined(EHS_OS_LINUX)
|
||||||
@ -566,7 +538,7 @@ namespace ehs
|
|||||||
|
|
||||||
EHS_LOG_INT("Error", 4, "Failed to send with error #" + Str_8::FromNum(dCode) + ".");
|
EHS_LOG_INT("Error", 4, "Failed to send with error #" + Str_8::FromNum(dCode) + ".");
|
||||||
|
|
||||||
((Comms*)GetParent())->UnInitialize();
|
owner->UnInitialize();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -576,7 +548,7 @@ namespace ehs
|
|||||||
|
|
||||||
UInt_16 Endpoint::Send_v4(const Serializer<>& payload)
|
UInt_16 Endpoint::Send_v4(const Serializer<>& payload)
|
||||||
{
|
{
|
||||||
if (hdl == EHS_INVALID_SOCKET)
|
if (!owner)
|
||||||
{
|
{
|
||||||
EHS_LOG_INT("Info", 0, "Attempted to send while socket is not initialized.");
|
EHS_LOG_INT("Info", 0, "Attempted to send while socket is not initialized.");
|
||||||
return 0;
|
return 0;
|
||||||
@ -613,7 +585,7 @@ namespace ehs
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SInt_64 sent = sendto(hdl, (char*)&payload[0], (int)payload.Size(), 0, (sockaddr*)&result, sizeof(sockaddr_in));
|
SInt_64 sent = sendto(owner->hdl, (char*)&payload[0], (int)payload.Size(), 0, (sockaddr*)&result, sizeof(sockaddr_in));
|
||||||
#if defined(EHS_OS_WINDOWS)
|
#if defined(EHS_OS_WINDOWS)
|
||||||
if (sent == SOCKET_ERROR)
|
if (sent == SOCKET_ERROR)
|
||||||
#elif defined(EHS_OS_LINUX)
|
#elif defined(EHS_OS_LINUX)
|
||||||
@ -636,7 +608,7 @@ namespace ehs
|
|||||||
{
|
{
|
||||||
EHS_LOG_INT("Error", 3, "Failed to send with error #" + Str_8::FromNum(dCode) + ".");
|
EHS_LOG_INT("Error", 3, "Failed to send with error #" + Str_8::FromNum(dCode) + ".");
|
||||||
|
|
||||||
((Comms*)GetParent())->UnInitialize();
|
owner->UnInitialize();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Int_32 dCode = 0;
|
Int_32 dCode = 0;
|
||||||
|
@ -53,7 +53,7 @@ namespace ehs
|
|||||||
if (initialized)
|
if (initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
client = TCP(lwe::AddrType::IPV4);
|
client = TCP(ehs::AddrType::IPV4);
|
||||||
client.Connect(DNS::Resolve(AddrType::IPV4, "irc.chat.twitch.tv"), 6667);
|
client.Connect(DNS::Resolve(AddrType::IPV4, "irc.chat.twitch.tv"), 6667);
|
||||||
client.SetBlocking(false);
|
client.SetBlocking(false);
|
||||||
|
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
global _ZN3lwe3CPU6RDTSCPEPNS_3TSCE
|
global _ZN3ehs3CPU6RDTSCPEPNS_3TSCE
|
||||||
global _ZN3lwe3CPU15GetManufacturerEPc
|
global _ZN3ehs3CPU15GetManufacturerEPc
|
||||||
global _ZN3lwe3CPU11GetInfoBitsEv
|
global _ZN3ehs3CPU11GetInfoBitsEv
|
||||||
global _ZN3lwe3CPU16GetFeatureBits_1Ev
|
global _ZN3ehs3CPU16GetFeatureBits_1Ev
|
||||||
global _ZN3lwe3CPU16GetFeatureBits_2Ev
|
global _ZN3ehs3CPU16GetFeatureBits_2Ev
|
||||||
global _ZN3lwe3CPU19GetExtFeatureBits_1Ev
|
global _ZN3ehs3CPU19GetExtFeatureBits_1Ev
|
||||||
global _ZN3lwe3CPU19GetExtFeatureBits_2Ev
|
global _ZN3ehs3CPU19GetExtFeatureBits_2Ev
|
||||||
global _ZN3lwe3CPU19GetExtFeatureBits_3Ev
|
global _ZN3ehs3CPU19GetExtFeatureBits_3Ev
|
||||||
global _ZN3lwe3CPU8GetBrandEPc
|
global _ZN3ehs3CPU8GetBrandEPc
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
_ZN3lwe3CPU6RDTSCPEPNS_3TSCE:
|
_ZN3ehs3CPU6RDTSCPEPNS_3TSCE:
|
||||||
RDTSCP
|
RDTSCP
|
||||||
MOV DWORD [RDI], ECX
|
MOV DWORD [RDI], ECX
|
||||||
MOV DWORD [RDI + 4], EDX
|
MOV DWORD [RDI + 4], EDX
|
||||||
MOV DWORD [RDI + 8], EAX
|
MOV DWORD [RDI + 8], EAX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe3CPU15GetManufacturerEPc:
|
_ZN3ehs3CPU15GetManufacturerEPc:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
XOR EAX, EAX
|
XOR EAX, EAX
|
||||||
@ -30,7 +30,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe3CPU11GetInfoBitsEv:
|
_ZN3ehs3CPU11GetInfoBitsEv:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 1
|
MOV EAX, 1
|
||||||
@ -40,7 +40,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe3CPU16GetFeatureBits_1Ev:
|
_ZN3ehs3CPU16GetFeatureBits_1Ev:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 1
|
MOV EAX, 1
|
||||||
@ -52,7 +52,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe3CPU16GetFeatureBits_2Ev:
|
_ZN3ehs3CPU16GetFeatureBits_2Ev:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 1
|
MOV EAX, 1
|
||||||
@ -64,7 +64,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe3CPU19GetExtFeatureBits_1Ev:
|
_ZN3ehs3CPU19GetExtFeatureBits_1Ev:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 7
|
MOV EAX, 7
|
||||||
@ -77,7 +77,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe3CPU19GetExtFeatureBits_2Ev:
|
_ZN3ehs3CPU19GetExtFeatureBits_2Ev:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 7
|
MOV EAX, 7
|
||||||
@ -90,7 +90,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe3CPU19GetExtFeatureBits_3Ev:
|
_ZN3ehs3CPU19GetExtFeatureBits_3Ev:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 7
|
MOV EAX, 7
|
||||||
@ -103,7 +103,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
_ZN3lwe3CPU8GetBrandEPc:
|
_ZN3ehs3CPU8GetBrandEPc:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 80000002h
|
MOV EAX, 80000002h
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
global ?GetManufacturer@CPU@lwe@@SAXPEAD@Z
|
global ?GetManufacturer@CPU@ehs@@SAXPEAD@Z
|
||||||
global ?GetInfoBits@CPU@lwe@@SAIXZ
|
global ?GetInfoBits@CPU@ehs@@SAIXZ
|
||||||
global ?GetFeatureBits_1@CPU@lwe@@SAIXZ
|
global ?GetFeatureBits_1@CPU@ehs@@SAIXZ
|
||||||
global ?GetFeatureBits_2@CPU@lwe@@SAIXZ
|
global ?GetFeatureBits_2@CPU@ehs@@SAIXZ
|
||||||
global ?GetExtFeatureBits_1@CPU@lwe@@SAIXZ
|
global ?GetExtFeatureBits_1@CPU@ehs@@SAIXZ
|
||||||
global ?GetExtFeatureBits_2@CPU@lwe@@SAKXZ
|
global ?GetExtFeatureBits_2@CPU@ehs@@SAKXZ
|
||||||
global ?GetExtFeatureBits_3@CPU@lwe@@SAKXZ
|
global ?GetExtFeatureBits_3@CPU@ehs@@SAKXZ
|
||||||
global ?GetBrand@CPU@lwe@@SAXPEAD@Z
|
global ?GetBrand@CPU@ehs@@SAXPEAD@Z
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
?GetManufacturer@CPU@lwe@@SAXPEAD@Z:
|
?GetManufacturer@CPU@ehs@@SAXPEAD@Z:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
XOR EAX, EAX
|
XOR EAX, EAX
|
||||||
@ -23,7 +23,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GetInfoBits@CPU@lwe@@SAIXZ:
|
?GetInfoBits@CPU@ehs@@SAIXZ:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 1
|
MOV EAX, 1
|
||||||
@ -33,7 +33,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GetFeatureBits_1@CPU@lwe@@SAIXZ:
|
?GetFeatureBits_1@CPU@ehs@@SAIXZ:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 1
|
MOV EAX, 1
|
||||||
@ -45,7 +45,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GetFeatureBits_2@CPU@lwe@@SAIXZ:
|
?GetFeatureBits_2@CPU@ehs@@SAIXZ:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 1
|
MOV EAX, 1
|
||||||
@ -57,7 +57,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GetExtFeatureBits_1@CPU@lwe@@SAIXZ:
|
?GetExtFeatureBits_1@CPU@ehs@@SAIXZ:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 7
|
MOV EAX, 7
|
||||||
@ -70,7 +70,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GetExtFeatureBits_2@CPU@lwe@@SAKXZ:
|
?GetExtFeatureBits_2@CPU@ehs@@SAKXZ:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 7
|
MOV EAX, 7
|
||||||
@ -83,7 +83,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GetExtFeatureBits_3@CPU@lwe@@SAKXZ:
|
?GetExtFeatureBits_3@CPU@ehs@@SAKXZ:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV EAX, 7
|
MOV EAX, 7
|
||||||
@ -96,7 +96,7 @@ section .text
|
|||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
?GetBrand@CPU@lwe@@SAXPEAD@Z:
|
?GetBrand@CPU@ehs@@SAXPEAD@Z:
|
||||||
PUSH RBX
|
PUSH RBX
|
||||||
|
|
||||||
MOV R8, RCX
|
MOV R8, RCX
|
||||||
|
Loading…
Reference in New Issue
Block a user