Fixed all errors.

This commit is contained in:
Arron David Nelson 2023-12-18 02:13:20 -08:00
parent 3acb78f247
commit 0a6f5533ee
37 changed files with 950 additions and 1090 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include "EHS.h"
#include "Types.h"
#include "BaseObj.h"
#include <initializer_list>
#include <algorithm>
@ -11,7 +12,7 @@ namespace ehs
/// @tparam T Array data type to use.
/// @tparam N Number data type to use.
template<typename T, typename N = UInt_64>
class Array
class Array : public BaseObj
{
protected:
T* data;
@ -19,7 +20,7 @@ namespace ehs
public:
/// Frees any data created on the heap.
~Array()
~Array() override
{
delete[] data;
}
@ -28,6 +29,7 @@ namespace ehs
Array()
: data(nullptr), size(0)
{
AddType("Array");
}
/// Initializes an empty array with the given size.
@ -35,6 +37,7 @@ namespace ehs
explicit Array(const N size)
: data(new T[size]), size(size)
{
AddType("Array");
}
/// Initializes this array with an initializer list object.
@ -42,6 +45,8 @@ namespace ehs
Array(std::initializer_list<T> list)
: data(new T[list.size()]), size(list.size())
{
AddType("Array");
N i = 0;
for (auto v = list.begin(); v != list.end(); ++v)
data[i++] = std::move(*v);
@ -53,24 +58,43 @@ namespace ehs
Array(const T* const data, const N size)
: data(new T[size]), size(size)
{
AddType("Array");
for (N i = 0; i < size; ++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.
/// @param [in] array The array object to copy from.
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)
data[i] = array.data[i];
}
Array(Array&& array) noexcept
: data(array.data), size(array.size)
Array<T, N>& operator=(Array&& array) noexcept
{
if (this == &array)
return *this;
BaseObj::operator=((BaseObj&&)array);
delete[] data;
data = array.data;
size = array.size;
array.data = nullptr;
array.size = 0;
return *this;
}
/// Copies all members from the given array object.
@ -81,6 +105,8 @@ namespace ehs
if (this == &array)
return *this;
BaseObj::operator=(array);
delete[] data;
data = new T[array.size];
for (N i = 0; i < array.size; ++i)
@ -91,21 +117,6 @@ namespace ehs
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.
/// @param [in] list The initializer list object to copy from.
/// @returns The array that has been assigned to.

View File

@ -1,95 +1,52 @@
#pragma once
#include "EHS.h"
#include "Types.h"
#include "Type.h"
#include "Array.h"
#include "Log.h"
namespace ehs
{
class BaseObj
{
private:
Array<Type> hierarchy;
BaseObj* parent;
Type* hierarchy;
UInt_64 hierarchySize;
public:
virtual ~BaseObj();
BaseObj();
BaseObj(const BaseObj& base);
BaseObj(BaseObj&& base) noexcept;
BaseObj& operator=(const BaseObj& base);
BaseObj(const BaseObj& base);
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 HasType(const UInt_64 hashType) const;
const Type* GetHierarchy() const;
bool HasType(const Str_8& type) const;
UInt_64 GetHierarchySize() const;
protected:
bool AddType(Str_8 type);
bool HasType(UInt_64 typeHashId) const;
bool HasType(const Char_8* typeId) const;
public:
Type GetType() const;
Type GetType(const UInt_64 hashType) const;
Type GetType(const Str_8& type) const;
UInt_64 GetTypeIdSize() const;
const Char_8* GetTypeId() 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 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;
}
}

View File

@ -60,4 +60,4 @@ namespace ehs
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);

View File

@ -109,8 +109,8 @@ namespace ehs
#ifndef EHS_LOG
#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
#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

View File

@ -1,6 +1,7 @@
#pragma once
#include "EHS.h"
#include "Types.h"
#include "BaseObj.h"
#include "Util.h"
#include "Array.h"
#include "Vector.h"
@ -20,7 +21,7 @@
namespace ehs
{
template<typename N = UInt_64>
class Serializer
class Serializer : public BaseObj
{
private:
Endianness endianness;
@ -29,7 +30,7 @@ namespace ehs
N offset;
public:
~Serializer()
~Serializer() override
{
delete[] data;
}
@ -37,56 +38,45 @@ namespace ehs
Serializer()
: endianness(Endianness::BE), data(nullptr), size(0), offset(0)
{
AddType("Serializer");
}
Serializer(const Endianness endianness)
: endianness(endianness), data(nullptr), size(0), offset(0)
{
AddType("Serializer");
}
Serializer(const Endianness endianness, const N size)
: 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)
: endianness(endianness), data(new Byte[size]), size(size), offset(offset)
{
AddType("Serializer");
for (N i = 0; i < size; ++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
: 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.size = 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)
data[i] = serializer.data[i];
size = serializer.size;
offset = serializer.offset;
return *this;
}
Serializer& operator=(Serializer&& serializer) noexcept
@ -94,6 +84,8 @@ namespace ehs
if (this == &serializer)
return *this;
BaseObj::operator=((Serializer&&)serializer);
endianness = serializer.endianness;
delete[] data;
data = serializer.data;
@ -107,6 +99,26 @@ namespace ehs
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
{
if (size != in.size)

View File

@ -1,6 +1,7 @@
#pragma once
#include "Types.h"
#include "BaseObj.h"
#include "Util.h"
#include "Vector.h"
@ -24,7 +25,7 @@ namespace ehs
/// @tparam T The character's data type to use.
/// @tparam N The number data type to use.
template<typename T = Char_8, typename N = UInt_64>
class Str
class Str : public BaseObj
{
private:
N size;
@ -41,6 +42,7 @@ namespace ehs
Str()
: size(0), data(nullptr)
{
AddType("Str");
}
/// Initializes members with given C-style string.
@ -54,6 +56,8 @@ namespace ehs
Util::Copy(data, str, Size(true));
data[this->size] = 0;
AddType("Str");
}
/// Initializes members with given C-style string.
@ -66,6 +70,8 @@ namespace ehs
Util::Copy(data, str, Size(true));
data[size] = 0;
AddType("Str");
}
/// Initializes string with the given size.
@ -74,20 +80,12 @@ namespace ehs
: size(size), data(new T[size + 1])
{
data[size] = 0;
}
/// Copies all members from the given string object.
/// @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;
AddType("Str");
}
Str(Str&& str) noexcept
: size(str.size), data(str.data)
: BaseObj((BaseObj&&)str), size(str.size), data(str.data)
{
str.size = 0;
str.data = nullptr;
@ -95,20 +93,12 @@ namespace ehs
/// 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<T, N>& operator=(const Str<T, N>& str)
Str(const Str& 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));
data[size] = 0;
return *this;
data[size] = 0;
}
Str& operator=(Str&& str) noexcept
@ -116,6 +106,8 @@ namespace ehs
if (this == &str)
return *this;
BaseObj::operator=((BaseObj&&)str);
size = str.size;
delete[] data;
data = str.data;
@ -126,6 +118,26 @@ namespace ehs
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.
/// @param [in] str The C-style string to copy from.
/// @returns The string object that has been assigned to.
@ -1823,39 +1835,39 @@ namespace ehs
typedef Str<Char_8, UInt_64> Str_8;
}
template<typename T = lwe::Char_8, typename N = lwe::UInt_64>
bool operator==(const T* const first, const lwe::Str<T, N>& second)
template<typename T = ehs::Char_8, typename N = ehs::UInt_64>
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)
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>
bool operator!=(const T* const first, const lwe::Str<T, N>& second)
template<typename T = ehs::Char_8, typename N = ehs::UInt_64>
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)
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.
/// @param [in] first The given C-style string.
/// @param [in] second The given string.
/// @returns The result.
template<typename T = lwe::Char_8, typename N = lwe::UInt_64>
lwe::Str<T, N> operator+(const T* const first, const lwe::Str<T, N>& second)
template<typename T = ehs::Char_8, typename N = ehs::UInt_64>
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));
lwe::Util::Copy(&result[inSize], &second[0], second.Size(true));
ehs::Util::Copy(result, first, inSize * sizeof(T));
ehs::Util::Copy(&result[inSize], &second[0], second.Size(true));
result[inSize + second.Size()] = 0;

View File

@ -1,47 +1,55 @@
#pragma once
#include "EHS.h"
#include "Str.h"
#include "Types.h"
#include "Util.h"
namespace ehs
{
class Type
{
private:
friend class BaseObj;
UInt_64 size;
const Char_8* id;
UInt_64 hashId;
Str_8 id;
public:
Type();
Type(Str_8 id);
explicit Type(const Char_8* id);
Type(Type&& type) noexcept = default;
Type(const Type& type) = default;
Type(Type&& type) noexcept;
Type& operator=(Type&& type) noexcept = default;
Type& operator=(const Type& type);
Type& operator=(Type&& type) noexcept;
bool operator!() const;
Type& operator=(const Type& type) = default;
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;
Str_8 GetId() const;
bool IsValid() const;
private:
static UInt_64 CalcSize(const Char_8* id);
static UInt_64 GenHash(const Char_8* id, UInt_64 size);
};
}

View File

@ -1,12 +1,12 @@
#pragma once
#include "BaseObj.h"
#include "Types.h"
#include "Util.h"
#include <initializer_list>
#include <utility>
#include "Util.h"
namespace ehs
{
/// An array with extra memory pre-allocated for fast pushes.
@ -14,7 +14,7 @@ namespace ehs
/// @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.
template<typename T, typename N = UInt_64>
class Vector
class Vector : public BaseObj
{
protected:
N rawSize;
@ -24,7 +24,7 @@ namespace ehs
public:
/// Frees any data created on the heap.
~Vector()
~Vector() override
{
delete[] data;
}
@ -33,6 +33,7 @@ namespace ehs
Vector()
: rawSize(0), size(0), stride(5), data(nullptr)
{
AddType("Vector");
}
/// Initializes members for pre-allocated memory to write to later.
@ -41,6 +42,7 @@ namespace ehs
Vector(const N size, const N stride)
: rawSize(size + stride), size(size), stride(stride), data(new T[rawSize])
{
AddType("Vector");
}
/// Initializes this vector with an initializer list object.
@ -49,6 +51,8 @@ namespace ehs
Vector(std::initializer_list<T> list, const N stride = 5)
: rawSize(0), size(list.size()), stride(stride), data(nullptr)
{
AddType("Vector");
if (stride)
{
rawSize = list.size() / stride * stride;
@ -74,6 +78,8 @@ namespace ehs
Vector(const T* data, const N size, const N stride)
: rawSize(0), size(size), stride(stride), data(nullptr)
{
AddType("Vector");
if (stride)
{
rawSize = size / stride * stride;
@ -94,14 +100,14 @@ namespace ehs
/// Copies all members from the given vector object.
/// @param [in] vec The vector object to copy from.
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)
data[i] = vec.data[i];
}
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.size = 0;
@ -117,6 +123,8 @@ namespace ehs
if (this == &vec)
return *this;
BaseObj::operator=(vec);
rawSize = vec.rawSize;
size = vec.size;
stride = vec.stride;
@ -135,6 +143,8 @@ namespace ehs
if (this == &vec)
return *this;
BaseObj::operator=((BaseObj&&)vec);
rawSize = vec.rawSize;
size = vec.size;
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] src The given C-style array.
/// @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];
}

View File

@ -31,7 +31,7 @@ namespace ehs
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;
@ -41,8 +41,6 @@ namespace ehs
UInt_64 CalculateIndexAtPoint(const Str_8& text, const Vec2_f& point) const;
Mesh Generate(const Anchor anchor, const Str_8& text) const;
FontAtlas* Clone() const override;
Mesh Generate(Anchor anchor, const Str_8& text) const;
};
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "EHS.h"
#include "Types.h"
#include "BaseObj.h"
#include "DataType.h"
#include "Str.h"
#include "Serializer.h"
@ -10,10 +11,12 @@
namespace ehs
{
class Audio : public Resource
class Audio : public BaseObj
{
private:
static Array<AudioCodec> codecs;
UInt_64 hashId;
Str_8 id;
UInt_64 sampleRate;
DataType dataType;
UInt_8 byteDepth;
@ -24,29 +27,31 @@ namespace ehs
Byte* peak;
public:
static bool HasCodec(const UInt_64 hashExt);
static bool HasCodec(UInt_64 hashExt);
static bool HasCodec(const Str_8& ext);
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);
~Audio() override;
~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;
@ -60,6 +65,14 @@ namespace ehs
operator Byte*();
void Release();
UInt_64 GetHashId() const;
void SetId(Str_8 newId);
Str_8 GetId() const;
UInt_64 GetSampleRate() const;
DataType GetDataType() const;
@ -78,23 +91,23 @@ namespace ehs
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;
@ -106,17 +119,17 @@ namespace ehs
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;
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;
@ -124,32 +137,32 @@ namespace ehs
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:
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
void SInt_16_to_SInt_8(Byte* newData, Byte* newPeak) const;

View File

@ -1,6 +1,7 @@
#pragma once
#include "EHS.h"
#include "Types.h"
#include "BaseObj.h"
#include "Str.h"
#include "ImgCodec.h"
@ -12,12 +13,14 @@ namespace ehs
NEAREST_NEIGHBOR
};
class Img
class Img : public BaseObj
{
private:
static Array<ImgCodec> codecs;
protected:
UInt_64 hashId;
Str_8 id;
UInt_8 bitDepth;
UInt_8 channels;
UInt_64 width;
@ -40,9 +43,11 @@ namespace ehs
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;
@ -58,6 +63,12 @@ namespace ehs
void Release();
UInt_64 GetHashId() const;
void SetId(Str_8 newId);
Str_8 GetId() const;
UInt_8 BitDepth() const;
UInt_8 Channels() const;
@ -120,7 +131,7 @@ namespace ehs
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:
Img GetNearestNeighbor(UInt_64 newWidth, UInt_64 newHeight) const;

View File

@ -3,6 +3,7 @@
#include "EHS.h"
#include "Array.h"
#include "Vertex.h"
#include "BaseObj.h"
namespace ehs
{
@ -38,15 +39,13 @@ namespace ehs
1
});
class Mesh : public Resource
class Mesh final : public BaseObj
{
protected:
UInt_64 hashId;
Str_8 id;
Array<Vertex_f> vertices;
Array<UInt_32> indices;
GpuBuffer srcVertBuffer;
GpuBuffer dstVertBuffer;
GpuBuffer srcIndBuffer;
GpuBuffer dstIndBuffer;
public:
Mesh();
@ -55,8 +54,6 @@ namespace ehs
Mesh(Str_8 id, Array<Vertex_f> vertices);
Mesh(Str_8 id);
Mesh(Mesh&& mesh) noexcept;
Mesh(const Mesh& mesh);
@ -65,19 +62,13 @@ namespace ehs
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;
bool IsUploaded() const override;
void Bind(GpuCmdBuffer* cmdBuffer);
void Draw(GpuCmdBuffer* cmdBuffer, const UInt_32 instances = 1);
Str_8 GetId() const;
void SetVertices(const Array<Vertex_f>& newVertices);

View File

@ -14,9 +14,11 @@ namespace ehs
EHM
};
class Model : public Resource
class Model : public BaseObj
{
protected:
UInt_64 hashId;
Str_8 id;
Array<Mesh> meshes;
Bone skeleton;
Array<Animation> animations;
@ -40,29 +42,27 @@ namespace ehs
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;
void Draw(GpuCmdBuffer* cmdBuffer, const UInt_32 instances = 1);
Str_8 GetId() const;
Array<Mesh> GetMeshes() const;
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();
Animation* GetAnimation(const UInt_64 hashId);
Animation* GetAnimation(UInt_64 inHashId);
Array<Animation> GetAnimations() const;
@ -70,7 +70,7 @@ namespace ehs
void Calculate();
void Export(const Str_8& filePath, const ModelEncoding encoding);
void Export(const Str_8& filePath, ModelEncoding encoding);
private:
void ToEHM(File& file);

View File

@ -1,6 +1,7 @@
#pragma once
#include "EHS.h"
#include "Vec4.h"
#include "Vec3.h"
#include "Vec2.h"
#include "Color4.h"

View File

@ -19,6 +19,8 @@ namespace ehs
class Comms : public BaseObj
{
private:
friend class Endpoint;
static const Version ver;
static const UInt_64 internalSys;
static const UInt_64 connectOp;

View File

@ -17,7 +17,7 @@ namespace ehs
class Endpoint : public BaseObj
{
private:
Socket hdl;
Comms* owner;
EndDisp disposition;
Status status;
Architecture arch;
@ -40,10 +40,10 @@ namespace ehs
public:
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);
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);

View File

@ -4,35 +4,27 @@ namespace ehs
{
BaseObj::~BaseObj()
{
delete[] hierarchy;
}
BaseObj::BaseObj()
: parent(nullptr)
: hierarchy(nullptr), hierarchySize(0)
{
AddType("BaseObj");
}
BaseObj::BaseObj(const BaseObj& base)
: hierarchy(base.hierarchy), parent(nullptr)
{
}
BaseObj::BaseObj(BaseObj&& base) noexcept
: hierarchy(std::move(base.hierarchy)), parent(base.parent)
: hierarchy(base.hierarchy), hierarchySize(base.hierarchySize)
{
base.hierarchy = Array<Type>();
base.parent = nullptr;
base.hierarchy = 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)
return *this;
hierarchy = base.hierarchy;
parent = nullptr;
return *this;
for (UInt_64 i = 0; i < hierarchySize; i++)
hierarchy[i] = base.hierarchy[i];
}
BaseObj& BaseObj::operator=(BaseObj&& base) noexcept
@ -40,83 +32,99 @@ namespace ehs
if (this == &base)
return *this;
hierarchy = std::move(base.hierarchy);
parent = base.parent;
delete[] hierarchy;
base.hierarchy = Array<Type>();
base.parent = nullptr;
hierarchy = base.hierarchy;
hierarchySize = base.hierarchySize;
base.hierarchy = nullptr;
base.hierarchySize = 0;
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
{
return hierarchy == base.hierarchy;
}
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))
if (hierarchySize != base.hierarchySize)
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;
}
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
{
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
const Type* BaseObj::GetHierarchy() const
{
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
@ -124,8 +132,23 @@ namespace ehs
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;
}
}

View File

@ -15,15 +15,15 @@
namespace ehs
{
constexpr Char_32 name_32[] = U"Lone Wolf Engine";
constexpr Char_16 name_16[] = L"Lone Wolf Engine";
constexpr Char_8 name_8[] = "Lone Wolf Engine";
constexpr Char_32 acronym_32[] = U"LWE";
constexpr Char_16 acronym_16[] = L"LWE";
constexpr Char_8 acronym_8[] = "LWE";
constexpr Char_32 versionId_32[] = U"Beta";
constexpr Char_16 versionId_16[] = L"Beta";
constexpr Char_8 versionId_8[] = "Beta";
constexpr Char_32 name_32[] = U"Event Horizon Suite";
constexpr Char_16 name_16[] = L"Event Horizon Suite";
constexpr Char_8 name_8[] = "Event Horizon Suite";
constexpr Char_32 acronym_32[] = U"EHS";
constexpr Char_16 acronym_16[] = L"EHS";
constexpr Char_8 acronym_8[] = "EHS";
constexpr Char_32 versionId_32[] = U"Release";
constexpr Char_16 versionId_16[] = L"Release";
constexpr Char_8 versionId_8[] = "Release";
Str_8 appName;
Str_8 appVerId;
@ -94,7 +94,7 @@ namespace ehs
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);
@ -255,7 +255,7 @@ namespace ehs
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());
result.WriteVersion({1, 0, 0});
@ -277,7 +277,7 @@ namespace ehs
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();
if (version != Version(1, 0, 0))
@ -303,7 +303,7 @@ namespace ehs
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);
@ -329,7 +329,7 @@ namespace ehs
else if (colorType == 6)
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>();
if (compression)
@ -417,7 +417,7 @@ namespace ehs
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_64 width = in->Width();
@ -536,7 +536,7 @@ namespace ehs
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);
if (imgType != "qoif")
@ -555,7 +555,7 @@ namespace ehs
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};
@ -623,45 +623,45 @@ namespace ehs
int main()
{
lwe::Audio::AddCodec({
ehs::Audio::AddCodec({
"Waveform Audio",
"wav",
lwe::Endianness::LE,
ehs::Endianness::LE,
nullptr,
lwe::DecodeWAV
ehs::DecodeWAV
});
lwe::Audio::AddCodec({
ehs::Audio::AddCodec({
"Event Horizon Audio",
"eha",
lwe::Endianness::LE,
lwe::EncodeEHA,
lwe::DecodeEHA
ehs::Endianness::LE,
ehs::EncodeEHA,
ehs::DecodeEHA
});
lwe::Img::AddCodec({
ehs::Img::AddCodec({
"Portable Network Graphic",
"png",
lwe::Endianness::BE,
ehs::Endianness::BE,
nullptr,
lwe::DecodePNG
ehs::DecodePNG
});
lwe::Img::AddCodec({
ehs::Img::AddCodec({
"Quite OK Image",
"qoi",
lwe::Endianness::BE,
lwe::EncodeQOI,
lwe::DecodeQOI
ehs::Endianness::BE,
ehs::EncodeQOI,
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)
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;
}

View File

@ -104,12 +104,6 @@ namespace ehs
while (i < garbage.Size())
{
if (garbage[i]->HasType(10756214933709508260ull) && ((GpuDependant*)garbage[i])->GetDependantCount()) // Has type of GpuDependant.
{
++i;
continue;
}
garbage.Swap(i, garbage.End());
delete garbage.Pop();
}

View File

@ -1,34 +1,34 @@
global _ZN3lwe4HRNG16GenerateSeed_u64Ev
global _ZN3lwe4HRNG12Generate_u64Emm
global _ZN3lwe4HRNG12Generate_u64Ev
global _ZN3lwe4HRNG16GenerateSeed_s64Ev
global _ZN3lwe4HRNG12Generate_s64Ell
global _ZN3lwe4HRNG12Generate_s64Ev
global _ZN3lwe4HRNG16GenerateSeed_u32Ev
global _ZN3lwe4HRNG12Generate_u32Ejj
global _ZN3lwe4HRNG12Generate_u32Ev
global _ZN3lwe4HRNG16GenerateSeed_s32Ev
global _ZN3lwe4HRNG12Generate_s32Eii
global _ZN3lwe4HRNG12Generate_s32Ev
global _ZN3lwe4HRNG16GenerateSeed_u16Ev
global _ZN3lwe4HRNG12Generate_u16Ett
global _ZN3lwe4HRNG12Generate_u16Ev
global _ZN3lwe4HRNG16GenerateSeed_s16Ev
global _ZN3lwe4HRNG12Generate_s16Ess
global _ZN3lwe4HRNG12Generate_s16Ev
global _ZN3lwe4HRNG15GenerateSeed_u8Ev
global _ZN3lwe4HRNG11Generate_u8Ehh
global _ZN3lwe4HRNG11Generate_u8Ev
global _ZN3lwe4HRNG15GenerateSeed_s8Ev
global _ZN3lwe4HRNG11Generate_s8Eaa
global _ZN3lwe4HRNG11Generate_s8Ev
global _ZN3ehs4HRNG16GenerateSeed_u64Ev
global _ZN3ehs4HRNG12Generate_u64Emm
global _ZN3ehs4HRNG12Generate_u64Ev
global _ZN3ehs4HRNG16GenerateSeed_s64Ev
global _ZN3ehs4HRNG12Generate_s64Ell
global _ZN3ehs4HRNG12Generate_s64Ev
global _ZN3ehs4HRNG16GenerateSeed_u32Ev
global _ZN3ehs4HRNG12Generate_u32Ejj
global _ZN3ehs4HRNG12Generate_u32Ev
global _ZN3ehs4HRNG16GenerateSeed_s32Ev
global _ZN3ehs4HRNG12Generate_s32Eii
global _ZN3ehs4HRNG12Generate_s32Ev
global _ZN3ehs4HRNG16GenerateSeed_u16Ev
global _ZN3ehs4HRNG12Generate_u16Ett
global _ZN3ehs4HRNG12Generate_u16Ev
global _ZN3ehs4HRNG16GenerateSeed_s16Ev
global _ZN3ehs4HRNG12Generate_s16Ess
global _ZN3ehs4HRNG12Generate_s16Ev
global _ZN3ehs4HRNG15GenerateSeed_u8Ev
global _ZN3ehs4HRNG11Generate_u8Ehh
global _ZN3ehs4HRNG11Generate_u8Ev
global _ZN3ehs4HRNG15GenerateSeed_s8Ev
global _ZN3ehs4HRNG11Generate_s8Eaa
global _ZN3ehs4HRNG11Generate_s8Ev
section .text
_ZN3lwe4HRNG16GenerateSeed_u64Ev:
_ZN3ehs4HRNG16GenerateSeed_u64Ev:
RDSEED RAX
RET
_ZN3lwe4HRNG12Generate_u64Emm:
_ZN3ehs4HRNG12Generate_u64Emm:
RDRAND RAX
SUB RSI, RDI
MOV R8, RSI
@ -38,15 +38,15 @@ section .text
ADD RAX, RDI
RET
_ZN3lwe4HRNG12Generate_u64Ev:
_ZN3ehs4HRNG12Generate_u64Ev:
RDRAND RAX
RET
_ZN3lwe4HRNG16GenerateSeed_s64Ev:
_ZN3ehs4HRNG16GenerateSeed_s64Ev:
RDSEED RAX
RET
_ZN3lwe4HRNG12Generate_s64Ell:
_ZN3ehs4HRNG12Generate_s64Ell:
RDRAND RAX
SUB RSI, RDI
MOV R8, RSI
@ -56,15 +56,15 @@ section .text
ADD RAX, RDI
RET
_ZN3lwe4HRNG12Generate_s64Ev:
_ZN3ehs4HRNG12Generate_s64Ev:
RDRAND RAX
RET
_ZN3lwe4HRNG16GenerateSeed_u32Ev:
_ZN3ehs4HRNG16GenerateSeed_u32Ev:
RDSEED EAX
RET
_ZN3lwe4HRNG12Generate_u32Ejj:
_ZN3ehs4HRNG12Generate_u32Ejj:
RDRAND EAX
SUB ESI, EDI
MOV R8D, ESI
@ -74,15 +74,15 @@ section .text
ADD EAX, EDI
RET
_ZN3lwe4HRNG12Generate_u32Ev:
_ZN3ehs4HRNG12Generate_u32Ev:
RDRAND EAX
RET
_ZN3lwe4HRNG16GenerateSeed_s32Ev:
_ZN3ehs4HRNG16GenerateSeed_s32Ev:
RDSEED EAX
RET
_ZN3lwe4HRNG12Generate_s32Eii:
_ZN3ehs4HRNG12Generate_s32Eii:
RDRAND EAX
SUB ESI, EDI
MOV R8D, ESI
@ -92,15 +92,15 @@ section .text
ADD EAX, EDI
RET
_ZN3lwe4HRNG12Generate_s32Ev:
_ZN3ehs4HRNG12Generate_s32Ev:
RDRAND EAX
RET
_ZN3lwe4HRNG16GenerateSeed_u16Ev:
_ZN3ehs4HRNG16GenerateSeed_u16Ev:
RDSEED AX
RET
_ZN3lwe4HRNG12Generate_u16Ett:
_ZN3ehs4HRNG12Generate_u16Ett:
RDRAND AX
SUB SI, DI
MOV R8W, SI
@ -110,15 +110,15 @@ section .text
ADD AX, DI
RET
_ZN3lwe4HRNG12Generate_u16Ev:
_ZN3ehs4HRNG12Generate_u16Ev:
RDRAND AX
RET
_ZN3lwe4HRNG16GenerateSeed_s16Ev:
_ZN3ehs4HRNG16GenerateSeed_s16Ev:
RDSEED AX
RET
_ZN3lwe4HRNG12Generate_s16Ess:
_ZN3ehs4HRNG12Generate_s16Ess:
RDRAND AX
SUB SI, DI
MOV R8W, SI
@ -128,15 +128,15 @@ section .text
ADD AX, DI
RET
_ZN3lwe4HRNG12Generate_s16Ev:
_ZN3ehs4HRNG12Generate_s16Ev:
RDRAND AX
RET
_ZN3lwe4HRNG15GenerateSeed_u8Ev:
_ZN3ehs4HRNG15GenerateSeed_u8Ev:
RDSEED AX
RET
_ZN3lwe4HRNG11Generate_u8Ehh:
_ZN3ehs4HRNG11Generate_u8Ehh:
RDRAND AX
XOR AH, AH
SUB SIL, DIL
@ -146,15 +146,15 @@ section .text
ADD AL, DIL
RET
_ZN3lwe4HRNG11Generate_u8Ev:
_ZN3ehs4HRNG11Generate_u8Ev:
RDRAND AX
RET
_ZN3lwe4HRNG15GenerateSeed_s8Ev:
_ZN3ehs4HRNG15GenerateSeed_s8Ev:
RDSEED AX
RET
_ZN3lwe4HRNG11Generate_s8Eaa:
_ZN3ehs4HRNG11Generate_s8Eaa:
RDRAND AX
XOR AH, AH
SUB SIL, DIL
@ -164,6 +164,6 @@ section .text
ADD AL, DIL
RET
_ZN3lwe4HRNG11Generate_s8Ev:
_ZN3ehs4HRNG11Generate_s8Ev:
RDRAND AX
RET

View File

@ -1,34 +1,34 @@
global ?GenerateSeed_u64@HRNG@lwe@@SA_KXZ
global ?Generate_u64@HRNG@lwe@@SA_K_K0@Z
global ?Generate_u64@HRNG@lwe@@SA_KXZ
global ?GenerateSeed_s64@HRNG@lwe@@SA_JXZ
global ?Generate_s64@HRNG@lwe@@SA_J_J0@Z
global ?Generate_s64@HRNG@lwe@@SA_JXZ
global ?GenerateSeed_u32@HRNG@lwe@@SAIXZ
global ?Generate_u32@HRNG@lwe@@SAIII@Z
global ?Generate_u32@HRNG@lwe@@SAIXZ
global ?GenerateSeed_s32@HRNG@lwe@@SAHXZ
global ?Generate_s32@HRNG@lwe@@SAHHH@Z
global ?Generate_s32@HRNG@lwe@@SAHXZ
global ?GenerateSeed_u16@HRNG@lwe@@SAIXZ
global ?Generate_u16@HRNG@lwe@@SAGGG@Z
global ?Generate_u16@HRNG@lwe@@SAGXZ
global ?GenerateSeed_s16@HRNG@lwe@@SAFXZ
global ?Generate_s16@HRNG@lwe@@SAFFF@Z
global ?Generate_s16@HRNG@lwe@@SAFXZ
global ?GenerateSeed_u8@HRNG@lwe@@SAEXZ
global ?Generate_u8@HRNG@lwe@@SAEEE@Z
global ?Generate_u8@HRNG@lwe@@SAEXZ
global ?GenerateSeed_s8@HRNG@lwe@@SACXZ
global ?Generate_s8@HRNG@lwe@@SACCC@Z
global ?Generate_s8@HRNG@lwe@@SACXZ
global ?GenerateSeed_u64@HRNG@ehs@@SA_KXZ
global ?Generate_u64@HRNG@ehs@@SA_K_K0@Z
global ?Generate_u64@HRNG@ehs@@SA_KXZ
global ?GenerateSeed_s64@HRNG@ehs@@SA_JXZ
global ?Generate_s64@HRNG@ehs@@SA_J_J0@Z
global ?Generate_s64@HRNG@ehs@@SA_JXZ
global ?GenerateSeed_u32@HRNG@ehs@@SAIXZ
global ?Generate_u32@HRNG@ehs@@SAIII@Z
global ?Generate_u32@HRNG@ehs@@SAIXZ
global ?GenerateSeed_s32@HRNG@ehs@@SAHXZ
global ?Generate_s32@HRNG@ehs@@SAHHH@Z
global ?Generate_s32@HRNG@ehs@@SAHXZ
global ?GenerateSeed_u16@HRNG@ehs@@SAIXZ
global ?Generate_u16@HRNG@ehs@@SAGGG@Z
global ?Generate_u16@HRNG@ehs@@SAGXZ
global ?GenerateSeed_s16@HRNG@ehs@@SAFXZ
global ?Generate_s16@HRNG@ehs@@SAFFF@Z
global ?Generate_s16@HRNG@ehs@@SAFXZ
global ?GenerateSeed_u8@HRNG@ehs@@SAEXZ
global ?Generate_u8@HRNG@ehs@@SAEEE@Z
global ?Generate_u8@HRNG@ehs@@SAEXZ
global ?GenerateSeed_s8@HRNG@ehs@@SACXZ
global ?Generate_s8@HRNG@ehs@@SACCC@Z
global ?Generate_s8@HRNG@ehs@@SACXZ
section .text
?GenerateSeed_u64@HRNG@lwe@@SA_KXZ:
?GenerateSeed_u64@HRNG@ehs@@SA_KXZ:
RDSEED RAX
RET
?Generate_u64@HRNG@lwe@@SA_K_K0@Z:
?Generate_u64@HRNG@ehs@@SA_K_K0@Z:
RDRAND RAX
MOV R8, RDX
SUB R8, RCX
@ -38,15 +38,15 @@ section .text
ADD RAX, RCX
RET
?Generate_u64@HRNG@lwe@@SA_KXZ:
?Generate_u64@HRNG@ehs@@SA_KXZ:
RDRAND RAX
RET
?GenerateSeed_s64@HRNG@lwe@@SA_JXZ:
?GenerateSeed_s64@HRNG@ehs@@SA_JXZ:
RDSEED RAX
RET
?Generate_s64@HRNG@lwe@@SA_J_J0@Z:
?Generate_s64@HRNG@ehs@@SA_J_J0@Z:
RDRAND RAX
MOV R8, RDX
SUB R8, RCX
@ -56,15 +56,15 @@ section .text
ADD RAX, RCX
RET
?Generate_s64@HRNG@lwe@@SA_JXZ:
?Generate_s64@HRNG@ehs@@SA_JXZ:
RDRAND RAX
RET
?GenerateSeed_u32@HRNG@lwe@@SAIXZ:
?GenerateSeed_u32@HRNG@ehs@@SAIXZ:
RDSEED EAX
RET
?Generate_u32@HRNG@lwe@@SAIII@Z:
?Generate_u32@HRNG@ehs@@SAIII@Z:
RDRAND EAX
MOV R8D, EDX
SUB R8D, ECX
@ -74,15 +74,15 @@ section .text
ADD EAX, ECX
RET
?Generate_u32@HRNG@lwe@@SAIXZ:
?Generate_u32@HRNG@ehs@@SAIXZ:
RDRAND EAX
RET
?GenerateSeed_s32@HRNG@lwe@@SAHXZ:
?GenerateSeed_s32@HRNG@ehs@@SAHXZ:
RDSEED EAX
RET
?Generate_s32@HRNG@lwe@@SAHHH@Z:
?Generate_s32@HRNG@ehs@@SAHHH@Z:
RDRAND EAX
MOV R8D, EDX
SUB R8D, ECX
@ -92,15 +92,15 @@ section .text
ADD EAX, ECX
RET
?Generate_s32@HRNG@lwe@@SAHXZ:
?Generate_s32@HRNG@ehs@@SAHXZ:
RDRAND EAX
RET
?GenerateSeed_u16@HRNG@lwe@@SAIXZ:
?GenerateSeed_u16@HRNG@ehs@@SAIXZ:
RDSEED AX
RET
?Generate_u16@HRNG@lwe@@SAGGG@Z:
?Generate_u16@HRNG@ehs@@SAGGG@Z:
RDRAND AX
MOV R8W, DX
SUB R8W, CX
@ -110,15 +110,15 @@ section .text
ADD AX, CX
RET
?Generate_u16@HRNG@lwe@@SAGXZ:
?Generate_u16@HRNG@ehs@@SAGXZ:
RDRAND AX
RET
?GenerateSeed_s16@HRNG@lwe@@SAFXZ:
?GenerateSeed_s16@HRNG@ehs@@SAFXZ:
RDSEED AX
RET
?Generate_s16@HRNG@lwe@@SAFFF@Z:
?Generate_s16@HRNG@ehs@@SAFFF@Z:
RDRAND AX
MOV R8W, DX
SUB R8W, CX
@ -128,15 +128,15 @@ section .text
ADD AX, CX
RET
?Generate_s16@HRNG@lwe@@SAFXZ:
?Generate_s16@HRNG@ehs@@SAFXZ:
RDRAND AX
RET
?GenerateSeed_u8@HRNG@lwe@@SAEXZ:
?GenerateSeed_u8@HRNG@ehs@@SAEXZ:
RDSEED AX
RET
?Generate_u8@HRNG@lwe@@SAEEE@Z:
?Generate_u8@HRNG@ehs@@SAEEE@Z:
RDRAND AX
MOV R8W, DX
SUB R8W, CX
@ -146,15 +146,15 @@ section .text
ADD AX, CX
RET
?Generate_u8@HRNG@lwe@@SAEXZ:
?Generate_u8@HRNG@ehs@@SAEXZ:
RDRAND AX
RET
?GenerateSeed_s8@HRNG@lwe@@SACXZ:
?GenerateSeed_s8@HRNG@ehs@@SACXZ:
RDSEED AX
RET
?Generate_s8@HRNG@lwe@@SACCC@Z:
?Generate_s8@HRNG@ehs@@SACCC@Z:
RDRAND AX
MOV R8W, DX
SUB R8W, CX
@ -164,6 +164,6 @@ section .text
ADD AX, CX
RET
?Generate_s8@HRNG@lwe@@SACXZ:
?Generate_s8@HRNG@ehs@@SACXZ:
RDRAND AX
RET

View File

@ -1,61 +1,61 @@
global _ZN3lwe4Math8Sqrt_AVXEf
global _ZN3lwe4Math8Sqrt_AVXEd
global _ZN3lwe4Math8Sqrt_SSEEf
global _ZN3lwe4Math9Sqrt_SSE2Ed
global _ZN3lwe4Math4NearEf
global _ZN3lwe4Math4NearEd
global _ZN3lwe4Math5FloorEf
global _ZN3lwe4Math5FloorEd
global _ZN3lwe4Math4CeilEf
global _ZN3lwe4Math4CeilEd
global _ZN3lwe4Math5TruncEf
global _ZN3lwe4Math5TruncEd
global _ZN3ehs4Math8Sqrt_AVXEf
global _ZN3ehs4Math8Sqrt_AVXEd
global _ZN3ehs4Math8Sqrt_SSEEf
global _ZN3ehs4Math9Sqrt_SSE2Ed
global _ZN3ehs4Math4NearEf
global _ZN3ehs4Math4NearEd
global _ZN3ehs4Math5FloorEf
global _ZN3ehs4Math5FloorEd
global _ZN3ehs4Math4CeilEf
global _ZN3ehs4Math4CeilEd
global _ZN3ehs4Math5TruncEf
global _ZN3ehs4Math5TruncEd
section .text
_ZN3lwe4Math8Sqrt_AVXEf:
_ZN3ehs4Math8Sqrt_AVXEf:
VSQRTPS XMM0, XMM0
RET
_ZN3lwe4Math8Sqrt_AVXEd:
_ZN3ehs4Math8Sqrt_AVXEd:
VSQRTPD XMM0, XMM0
RET
_ZN3lwe4Math8Sqrt_SSEEf:
_ZN3ehs4Math8Sqrt_SSEEf:
SQRTPS XMM0, XMM0
RET
_ZN3lwe4Math9Sqrt_SSE2Ed:
_ZN3ehs4Math9Sqrt_SSE2Ed:
SQRTPD XMM0, XMM0
RET
_ZN3lwe4Math4NearEf:
_ZN3ehs4Math4NearEf:
ROUNDPS XMM0, XMM0, 0
RET
_ZN3lwe4Math4NearEd:
_ZN3ehs4Math4NearEd:
ROUNDPD XMM0, XMM0, 0
RET
_ZN3lwe4Math5FloorEf:
_ZN3ehs4Math5FloorEf:
ROUNDPS XMM0, XMM0, 1
RET
_ZN3lwe4Math5FloorEd:
_ZN3ehs4Math5FloorEd:
ROUNDPD XMM0, XMM0, 1
RET
_ZN3lwe4Math4CeilEf:
_ZN3ehs4Math4CeilEf:
ROUNDPS XMM0, XMM0, 2
RET
_ZN3lwe4Math4CeilEd:
_ZN3ehs4Math4CeilEd:
ROUNDPD XMM0, XMM0, 2
RET
_ZN3lwe4Math5TruncEf:
_ZN3ehs4Math5TruncEf:
ROUNDPS XMM0, XMM0, 3
RET
_ZN3lwe4Math5TruncEd:
_ZN3ehs4Math5TruncEd:
ROUNDPD XMM0, XMM0, 3
RET

View File

@ -1,61 +1,61 @@
global ?Sqrt_AVX@Math@lwe@@CAMM@Z
global ?Sqrt_AVX@Math@lwe@@CANN@Z
global ?Sqrt_SSE@Math@lwe@@CAMM@Z
global ?Sqrt_SSE2@Math@lwe@@CANN@Z
global ?Near@Math@lwe@@SAMM@Z
global ?Near@Math@lwe@@SANN@Z
global ?Floor@Math@lwe@@SAMM@Z
global ?Floor@Math@lwe@@SANN@Z
global ?Ceil@Math@lwe@@SAMM@Z
global ?Ceil@Math@lwe@@SANN@Z
global ?Trunc@Math@lwe@@SAMM@Z
global ?Trunc@Math@lwe@@SANN@Z
global ?Sqrt_AVX@Math@ehs@@CAMM@Z
global ?Sqrt_AVX@Math@ehs@@CANN@Z
global ?Sqrt_SSE@Math@ehs@@CAMM@Z
global ?Sqrt_SSE2@Math@ehs@@CANN@Z
global ?Near@Math@ehs@@SAMM@Z
global ?Near@Math@ehs@@SANN@Z
global ?Floor@Math@ehs@@SAMM@Z
global ?Floor@Math@ehs@@SANN@Z
global ?Ceil@Math@ehs@@SAMM@Z
global ?Ceil@Math@ehs@@SANN@Z
global ?Trunc@Math@ehs@@SAMM@Z
global ?Trunc@Math@ehs@@SANN@Z
section .text
?Sqrt_AVX@Math@lwe@@CAMM@Z:
?Sqrt_AVX@Math@ehs@@CAMM@Z:
VSQRTPS XMM0, XMM0
RET
?Sqrt_AVX@Math@lwe@@CANN@Z:
?Sqrt_AVX@Math@ehs@@CANN@Z:
VSQRTPD XMM0, XMM0
RET
?Sqrt_SSE@Math@lwe@@CAMM@Z:
?Sqrt_SSE@Math@ehs@@CAMM@Z:
SQRTPS XMM0, XMM0
RET
?Sqrt_SSE2@Math@lwe@@CANN@Z:
?Sqrt_SSE2@Math@ehs@@CANN@Z:
SQRTPD XMM0, XMM0
RET
?Near@Math@lwe@@SAMM@Z:
?Near@Math@ehs@@SAMM@Z:
ROUNDPS XMM0, XMM0, 0
RET
?Near@Math@lwe@@SANN@Z:
?Near@Math@ehs@@SANN@Z:
ROUNDPD XMM0, XMM0, 0
RET
?Floor@Math@lwe@@SAMM@Z:
?Floor@Math@ehs@@SAMM@Z:
ROUNDPS XMM0, XMM0, 1
RET
?Floor@Math@lwe@@SANN@Z:
?Floor@Math@ehs@@SANN@Z:
ROUNDPD XMM0, XMM0, 1
RET
?Ceil@Math@lwe@@SAMM@Z:
?Ceil@Math@ehs@@SAMM@Z:
ROUNDPS XMM0, XMM0, 2
RET
?Ceil@Math@lwe@@SANN@Z:
?Ceil@Math@ehs@@SANN@Z:
ROUNDPD XMM0, XMM0, 2
RET
?Trunc@Math@lwe@@SAMM@Z:
?Trunc@Math@ehs@@SAMM@Z:
ROUNDPS XMM0, XMM0, 3
RET
?Trunc@Math@lwe@@SANN@Z:
?Trunc@Math@ehs@@SANN@Z:
ROUNDPD XMM0, XMM0, 3
RET

View File

@ -2,31 +2,31 @@
#include "Str.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";
*appVerId = "Release";
*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)
{
for (lwe::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()));
for (ehs::UInt_64 i = 1; i < args.Size(); ++i)
ehs::Console::Write_8("Result " + ehs::Str_8::FromNum(i) + ": " + ehs::Str_8::FromNum(args[i].Hash_64()));
}
else
{
lwe::Console::Write_8("String: ", false);
lwe::Str_8 in = lwe::Console::Read_8();
lwe::Console::Write_8("Result: " + lwe::Str_8::FromNum(in.Hash_64()));
ehs::Console::Write_8("String: ", false);
ehs::Str_8 in = ehs::Console::Read_8();
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;
}

View File

@ -137,7 +137,7 @@ namespace ehs
working = false;
available = 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);
threadArgs = new Serializer<UInt_64>(Endianness::LE);

View File

@ -3,50 +3,15 @@
namespace ehs
{
Type::Type()
: hashId(0)
: size(0), id(nullptr), hashId(0)
{
}
Type::Type(Str_8 id)
: hashId(id.Hash_64()), id(std::move(id))
Type::Type(const Char_8* const 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
{
return hashId == type.hashId;
@ -57,24 +22,40 @@ namespace ehs
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
@ -82,13 +63,33 @@ namespace ehs
return hashId;
}
Str_8 Type::GetId() const
{
return id;
}
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;
}
}

View File

@ -7,14 +7,11 @@ namespace ehs
FontAtlas::FontAtlas()
: glyphScale(0)
{
AddType("FontAtlas");
}
FontAtlas::FontAtlas(const Str_8& filePath)
: glyphScale(0)
{
AddType("FontAtlas");
File fontFile(filePath, Mode::READ, Disposition::OPEN);
hashId = fontFile.GetName().Hash_64();
@ -44,7 +41,6 @@ namespace ehs
height = fData.Read<UInt_64>();
data = new Byte[width * height * (bitDepth / 8) * channels];
fData.ReadArray(data, &size);
aspect = IMG_ASPECT_COLOR;
}
FontAtlas::FontAtlas(FontAtlas&& fa) noexcept
@ -229,11 +225,6 @@ namespace ehs
pos.x += (float)glyph.GetAdvance().x;
}
return {"Label", std::move(verts), std::move(indices)};
}
FontAtlas* FontAtlas::Clone() const
{
return new FontAtlas(*this);
return {id, std::move(verts), std::move(indices)};
}
}

View File

@ -1,9 +1,11 @@
#include "io/Window_XCB.h"
#include "UTF.h"
#include "Vec2.h"
#include "io/hid/Keyboard.h"
#include "io/hid/Mouse.h"
#include "io/Console.h"
#include <cstddef>
#include <cstdlib>
#include <xcb/xfixes.h>
#include <xcb/xcb_cursor.h>

View File

@ -51,64 +51,73 @@ namespace ehs
}
Audio::Audio()
: sampleRate(0), dataType(DataType::FLOAT), byteDepth(ToByteDepth(dataType)), channels(0), frames(0), length(0.0f),
data(nullptr), peak(nullptr)
: hashId(0), sampleRate(0), dataType(DataType::FLOAT), byteDepth(0), channels(0), frames(0),
length(0.0f), data(nullptr), peak(nullptr)
{
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)
: 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),
data(new Byte[GetSize()]), peak(new Byte[byteDepth])
{
AddType("Audio");
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)
: 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),
data(new Byte[data.Size()]), peak(new Byte[byteDepth])
{
AddType("Audio");
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)
: 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),
data(new Byte[data.Size()]), peak(new Byte[byteDepth])
{
AddType("Audio");
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)
: 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),
data(new Byte[data.Size()]), peak(new Byte[byteDepth])
{
AddType("Audio");
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)
: 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),
data(new Byte[GetSize()]), peak(new Byte[byteDepth])
{
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
: Resource(std::move(audio)), sampleRate(audio.sampleRate), dataType(audio.dataType), byteDepth(audio.byteDepth),
channels(audio.channels), frames(audio.frames), length(audio.length), data(audio.data), peak(audio.peak)
: BaseObj((BaseObj&&)audio), hashId(audio.hashId), id((Str_8&&)id), sampleRate(audio.sampleRate),
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.dataType = DataType::FLOAT;
audio.byteDepth = ToByteDepth(audio.dataType);
@ -120,9 +129,9 @@ namespace ehs
}
Audio::Audio(const Audio& audio)
: Resource(audio), sampleRate(audio.sampleRate), dataType(audio.dataType), byteDepth(audio.byteDepth),
channels(audio.channels), frames(audio.frames), length(audio.length), data(new Byte[GetSize()]),
peak(new Byte[audio.byteDepth])
: BaseObj(audio), hashId(audio.hashId), id(audio.id), sampleRate(audio.sampleRate), dataType(audio.dataType),
byteDepth(audio.byteDepth), channels(audio.channels), frames(audio.frames), length(audio.length),
data(new Byte[GetSize()]), peak(new Byte[audio.byteDepth])
{
Util::Copy(data, audio.data, GetSize());
}
@ -132,15 +141,22 @@ namespace ehs
if (this == &audio)
return *this;
BaseObj::operator=((BaseObj&&)audio);
hashId = audio.hashId;
id = (Str_8&&)audio.id;
sampleRate = audio.sampleRate;
dataType = audio.dataType;
byteDepth = audio.byteDepth;
channels = audio.channels;
frames = audio.frames;
length = audio.length;
delete[] data;
data = audio.data;
delete[] peak;
peak = audio.peak;
audio.hashId = 0;
audio.sampleRate = 0;
audio.dataType = DataType::FLOAT;
audio.byteDepth = ToByteDepth(audio.dataType);
@ -150,8 +166,6 @@ namespace ehs
audio.data = nullptr;
audio.peak = nullptr;
Resource::operator=(std::move(audio));
return *this;
}
@ -160,6 +174,10 @@ namespace ehs
if (this == &audio)
return *this;
BaseObj::operator=(audio);
hashId = audio.hashId;
id = audio.id;
sampleRate = audio.sampleRate;
dataType = audio.dataType;
byteDepth = audio.byteDepth;
@ -168,11 +186,12 @@ namespace ehs
frames = audio.frames;
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);
Resource::operator=(audio);
delete[] peak;
peak = new Byte[audio.byteDepth];
Util::Copy(peak, audio.peak, audio.byteDepth);
return *this;
}
@ -187,6 +206,36 @@ namespace ehs
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
{
return sampleRate;
@ -657,7 +706,7 @@ namespace ehs
if (!data || newChannels == channels)
return;
Byte* result = nullptr;
Byte* result;
if (newChannels == 1)
{
@ -837,12 +886,12 @@ namespace ehs
return false;
}
Serializer<UInt_64> data;
if (!codec->Encode(data, this))
Serializer<UInt_64> result;
if (!codec->Encode(result, this))
return false;
File file(filePath, Mode::WRITE, Disposition::CREATE_PERSISTENT);
file.WriteSerializer_64(data);
file.WriteSerializer_64(result);
return true;
}
@ -852,7 +901,7 @@ namespace ehs
File file(filePath, Mode::READ, Disposition::OPEN);
Str_8 ext = file.GetExtension();
Audio result;
Audio result(file.GetName());
const AudioCodec* codec = GetCodec(ext);
if (!codec)
@ -861,8 +910,6 @@ namespace ehs
return result;
}
result.id = file.GetName();
Serializer<UInt_64> data = file.ReadSerializer_64(codec->GetEndianness(), file.Size());
file.Release();
@ -887,8 +934,7 @@ namespace ehs
return result;
}
result = new Audio();
result->id = file.GetName();
result = new Audio(file.GetName());
Serializer<UInt_64> data = file.ReadSerializer_64(codec->GetEndianness(), file.Size());
@ -923,9 +969,9 @@ namespace ehs
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);
if (!codec)
@ -934,8 +980,6 @@ namespace ehs
return result;
}
result.id = id;
if (!codec->Decode(data, &result))
return {};

View File

@ -48,26 +48,36 @@ namespace ehs
}
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)
: bitDepth(bitDepth), channels(channels), width(width), height(height),
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)
: 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])
{
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)
: bitDepth(bitDepth), channels(channels), width(width), height(height),
Img::Img(Str_8 id, const UInt_8 bitDepth, const UInt_8 channels, const UInt_64 width, const UInt_64 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])
{
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
: bitDepth(img.bitDepth), channels(img.channels), width(img.width), height(img.height), size(img.size),
data(img.data)
: BaseObj((BaseObj&&)img), hashId(img.hashId), id((Str_8&&)img.id), bitDepth(img.bitDepth),
channels(img.channels), width(img.width), height(img.height), size(img.size), data(img.data)
{
img.bitDepth = 0;
img.channels = 0;
@ -78,8 +88,8 @@ namespace ehs
}
Img::Img(const Img& img)
: bitDepth(img.bitDepth), channels(img.channels), width(img.width), height(img.height), size(img.size),
data(new Byte[img.size])
: BaseObj(img), hashId(img.hashId), id(img.id), bitDepth(img.bitDepth), channels(img.channels), width(img.width),
height(img.height), size(img.size), data(new Byte[img.size])
{
Util::Copy(data, img.data, img.size);
}
@ -89,13 +99,14 @@ namespace ehs
if (this == &img)
return *this;
Release();
BaseObj::operator=((BaseObj&&)img);
bitDepth = img.bitDepth;
channels = img.channels;
width = img.width;
height = img.height;
size = img.size;
delete[] data;
data = img.data;
img.bitDepth = 0;
@ -113,7 +124,7 @@ namespace ehs
if (this == &img)
return *this;
Release();
BaseObj::operator=(img);
bitDepth = img.bitDepth;
channels = img.channels;
@ -139,10 +150,31 @@ namespace ehs
void Img::Release()
{
bitDepth = 0;
channels = 0;
width = 0;
height = 0;
size = 0;
delete[] data;
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
{
return bitDepth;
@ -276,19 +308,19 @@ namespace ehs
}
case 3:
{
Img result(bitDepth, 4, width, height);
Img result(id, bitDepth, 4, width, height);
RGB_To_RGBA(result.Size(), result);
return result;
}
case 2:
{
Img result(bitDepth, 4, width, height);
Img result(id, bitDepth, 4, width, height);
MonoA_To_RGBA(result.Size(), result);
return result;
}
case 1:
{
Img result(bitDepth, 4, width, height);
Img result(id, bitDepth, 4, width, height);
Mono_To_RGBA(result.Size(), result);
return result;
}
@ -346,7 +378,7 @@ namespace ehs
{
case 4:
{
Img result(bitDepth, 3, width, height);
Img result(id, bitDepth, 3, width, height);
RGBA_To_RGB(result.Size(), result);
return result;
}
@ -356,13 +388,13 @@ namespace ehs
}
case 2:
{
Img result(bitDepth, 3, width, height);
Img result(id, bitDepth, 3, width, height);
MonoA_To_RGB(result.Size(), result);
return result;
}
case 1:
{
Img result(bitDepth, 3, width, height);
Img result(id, bitDepth, 3, width, height);
Mono_To_RGB(result.Size(), result);
return result;
}
@ -420,13 +452,13 @@ namespace ehs
{
case 4:
{
Img result(bitDepth, 2, width, height);
Img result(id, bitDepth, 2, width, height);
RGBA_To_MonoA(result.Size(), result);
return result;
}
case 3:
{
Img result(bitDepth, 2, width, height);
Img result(id, bitDepth, 2, width, height);
RGB_To_MonoA(result.Size(), result);
return result;
}
@ -436,7 +468,7 @@ namespace ehs
}
case 1:
{
Img result(bitDepth, 2, width, height);
Img result(id, bitDepth, 2, width, height);
Mono_To_MonoA(result.Size(), result);
return result;
}
@ -494,19 +526,19 @@ namespace ehs
{
case 4:
{
Img result(bitDepth, 1, width, height);
Img result(id, bitDepth, 1, width, height);
RGBA_To_Mono(result.Size(), result);
return result;
}
case 3:
{
Img result(bitDepth, 1, width, height);
Img result(id, bitDepth, 1, width, height);
RGB_To_Mono(result.Size(), result);
return result;
}
case 2:
{
Img result(bitDepth, 1, width, height);
Img result(id, bitDepth, 1, width, height);
MonoA_To_Mono(result.Size(), result);
return result;
}
@ -572,19 +604,19 @@ namespace ehs
}
case 24:
{
Img result(32, channels, width, height);
Img result(id, 32, channels, width, height);
BD24_to_BD32(result.Size(), result);
return result;
}
case 16:
{
Img result(32, channels, width, height);
Img result(id, 32, channels, width, height);
BD16_to_BD32(result.Size(), result);
return result;
}
case 8:
{
Img result(32, channels, width, height);
Img result(id, 32, channels, width, height);
BD8_to_BD32(result.Size(), result);
return result;
}
@ -642,7 +674,7 @@ namespace ehs
{
case 32:
{
Img result(24, channels, width, height);
Img result(id, 24, channels, width, height);
BD32_to_BD24(result.Size(), result);
return result;
}
@ -652,13 +684,13 @@ namespace ehs
}
case 16:
{
Img result(24, channels, width, height);
Img result(id, 24, channels, width, height);
BD16_to_BD24(result.Size(), result);
return result;
}
case 8:
{
Img result(24, channels, width, height);
Img result(id, 24, channels, width, height);
BD8_to_BD24(result.Size(), result);
return result;
}
@ -716,13 +748,13 @@ namespace ehs
{
case 32:
{
Img result(16, channels, width, height);
Img result(id, 16, channels, width, height);
BD32_to_BD16(result.Size(), result);
return result;
}
case 24:
{
Img result(16, channels, width, height);
Img result(id, 16, channels, width, height);
BD24_to_BD16(result.Size(), result);
return result;
}
@ -732,7 +764,7 @@ namespace ehs
}
case 8:
{
Img result(16, channels, width, height);
Img result(id, 16, channels, width, height);
BD8_to_BD16(result.Size(), result);
return result;
}
@ -790,19 +822,19 @@ namespace ehs
{
case 32:
{
Img result(8, channels, width, height);
Img result(id, 8, channels, width, height);
BD32_to_BD8(result.Size(), result);
return result;
}
case 24:
{
Img result(8, channels, width, height);
Img result(id, 8, channels, width, height);
BD24_to_BD8(result.Size(), result);
return result;
}
case 16:
{
Img result(8, channels, width, height);
Img result(id, 8, channels, width, height);
BD16_to_BD8(result.Size(), result);
return result;
}
@ -848,7 +880,7 @@ namespace ehs
File file(filePath, Mode::READ, Disposition::OPEN);
Str_8 ext = file.GetExtension();
Img result;
Img result(file.GetName());
const ImgCodec* codec = GetCodec(ext);
if (!codec)
@ -881,7 +913,7 @@ namespace ehs
return result;
}
result = new Img();
result = new Img(file.GetName());
Serializer<UInt_64> data = file.ReadSerializer_64(codec->GetEndianness(), file.Size());
@ -896,9 +928,9 @@ namespace ehs
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);
if (!codec)
@ -917,7 +949,7 @@ namespace ehs
{
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 yRatio = (double)height / (double)newWidth;

View File

@ -3,37 +3,33 @@
namespace ehs
{
Mesh::Mesh()
: hashId(0)
{
AddType("Mesh");
}
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");
}
Mesh::Mesh(Str_8 id, Array<Vertex_f> vertices)
: Resource(std::move(id)), vertices(std::move(vertices))
{
AddType("Mesh");
}
Mesh::Mesh(Str_8 id)
: Resource(std::move(id))
: hashId(id.Hash_64()), id((Str_8&&)id), vertices((Array<Vertex_f>&&)vertices)
{
AddType("Mesh");
}
Mesh::Mesh(Mesh&& mesh) noexcept
: Resource(std::move(mesh)), vertices(std::move(mesh.vertices)),
indices(std::move(mesh.indices))
: BaseObj((BaseObj&&)mesh), hashId(mesh.hashId), id((Str_8&&)mesh.id), vertices((Array<Vertex_f>&&)mesh.vertices),
indices((Array<UInt_32>&&)mesh.indices)
{
mesh.hashId = 0;
}
Mesh::Mesh(const Mesh& mesh)
: Resource(mesh), vertices(mesh.vertices), indices(mesh.indices), srcVertBuffer(mesh.srcVertBuffer),
dstVertBuffer(mesh.dstVertBuffer), srcIndBuffer(mesh.srcIndBuffer), dstIndBuffer(mesh.dstIndBuffer)
: BaseObj((BaseObj&&)mesh), hashId(mesh.hashId), id(mesh.id), vertices(mesh.vertices), indices(mesh.indices)
{
}
@ -42,14 +38,14 @@ namespace ehs
if (this == &mesh)
return *this;
vertices = std::move(mesh.vertices);
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);
BaseObj::operator=((BaseObj&&)mesh);
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;
}
@ -59,237 +55,36 @@ namespace ehs
if (this == &mesh)
return *this;
BaseObj::operator=(mesh);
hashId = mesh.hashId;
id = mesh.id;
vertices = mesh.vertices;
indices = mesh.indices;
srcVertBuffer = mesh.srcVertBuffer;
dstVertBuffer = mesh.dstVertBuffer;
srcIndBuffer = mesh.srcIndBuffer;
dstIndBuffer = mesh.dstIndBuffer;
Resource::operator=(mesh);
return *this;
}
bool Mesh::UploadToGpu(GpuCmdBuffer* cmdBuffer)
void Mesh::Release()
{
GameLoop* gl = (GameLoop*)GetParent("GameLoop");
if (!gl)
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
);
vertices.Clear();
indices.Clear();
}
cmdBuffer->AddDependency(this);
}
else
UInt_64 Mesh::GetHashId() const
{
dstVertBuffer = {
inf,
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
sizeof(Vertex_f) * vertices.Size()
};
return hashId;
}
void* data = dstVertBuffer.MapMemory();
Util::Copy(data, &vertices[0], dstVertBuffer.Size());
dstVertBuffer.UnMapMemory();
if (indices.Size())
void Mesh::SetId(Str_8 newId)
{
dstIndBuffer = {
inf,
VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
sizeof(UInt_32) * indices.Size()
};
data = dstIndBuffer.MapMemory();
Util::Copy(data, &indices[0], dstIndBuffer.Size());
dstIndBuffer.UnMapMemory();
}
hashId = newId.Hash_64();
id = (Str_8&&)newId;
}
return true;
}
bool Mesh::PostGpuUpload()
Str_8 Mesh::GetId() const
{
srcVertBuffer.Release();
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);
return id;
}
void Mesh::SetVertices(const Array<Vertex_f>& newVertices)

View File

@ -3,6 +3,7 @@
namespace ehs
{
Model::Model()
: hashId(0)
{
AddType("Model");
}
@ -23,27 +24,27 @@ namespace ehs
}
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)),
animations(std::move(animations))
: hashId(id.Hash_64()), id((Str_8&&)id), meshes((Array<Mesh>&&)meshes), skeleton((Bone&&)skeleton),
animations((Array<Animation>&&)animations)
{
AddType("Model");
}
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");
}
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");
}
Model::Model(Model&& model) noexcept
: Resource(std::move(model)), meshes(std::move(model.meshes)),
skeleton(std::move(model.skeleton)), animations(std::move(model.animations))
: BaseObj((BaseObj&&)model), hashId(model.hashId), id((Str_8&&)model.id), meshes((Array<Mesh>&&)model.meshes),
skeleton((Bone&&)model.skeleton), animations((Array<Animation>&&)model.animations)
{
}
@ -52,60 +53,40 @@ namespace ehs
if (this == &model)
return *this;
BaseObj::operator=((BaseObj&&)model);
hashId = model.hashId;
id = std::move(model.id);
meshes = std::move(model.meshes);
skeleton = std::move(model.skeleton);
animations = std::move(model.animations);
id = (Str_8&&)model.id;
meshes = (Array<Mesh>&&)model.meshes;
skeleton = (Bone&&)model.skeleton;
animations = (Array<Animation>&&)model.animations;
model.hashId = 0;
return *this;
}
bool Model::UploadToGpu(GpuCmdBuffer* cmdBuffer)
void Model::Release()
{
for (UInt_64 i = 0; i < meshes.Size(); ++i)
if (!meshes[i].UploadToGpu(cmdBuffer))
return false;
return true;
meshes.Clear();
skeleton = {};
animations.Clear();
}
bool Model::PostGpuUpload()
UInt_64 Model::GetHashId() const
{
bool result = true;
for (UInt_64 i = 0; i < meshes.Size(); ++i)
if (!meshes[i].PostGpuUpload())
result = false;
return result;
return hashId;
}
bool Model::ReleaseFromGpu()
void Model::SetId(Str_8 newId)
{
bool result = true;
for (UInt_64 i = 0; i < meshes.Size(); ++i)
if (!meshes[i].ReleaseFromGpu())
result = false;
return result;
hashId = newId.Hash_64();
id = (Str_8&&)newId;
}
bool Model::IsUploaded() const
Str_8 Model::GetId() const
{
return meshes[0].IsUploaded();
}
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);
}
return id;
}
Array<Mesh> Model::GetMeshes() const
@ -118,18 +99,18 @@ namespace ehs
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)
if (meshes[i].GetHashId() == hashId)
if (meshes[i].GetHashId() == inHashId)
return &meshes[i];
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
@ -142,10 +123,10 @@ namespace ehs
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)
if (animations[i].GetHashId() == hashId)
if (animations[i].GetHashId() == inHashId)
return &animations[i];
return nullptr;
@ -224,7 +205,6 @@ namespace ehs
for (UInt_64 i = 0; i < meshes.Size(); ++i)
{
meshes[i].SetId(data.ReadStr<Char_8, UInt_64>());
meshes[i].SetParent(this);
Array<Vertex_f>& vertices = meshes[i].GetVertices();
vertices.Resize(data.Read<UInt_64>());

View File

@ -226,8 +226,7 @@ namespace ehs
payload.WriteVersion(ver);
payload.WriteVersion(appVer);
Endpoint* end = new Endpoint(hdl, type, address, port);
end->SetParent(this);
Endpoint* end = new Endpoint(this, type, address, port);
end->Send(false, true, false, "Internal", "Connect", payload);
endpoints.Push(end);
@ -316,9 +315,8 @@ namespace ehs
Architecture rArch = payload.Read<Architecture>();
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->SetParent(this);
Serializer sPayload(Endianness::LE);
@ -415,10 +413,9 @@ namespace ehs
Architecture arch = payload.Read<Architecture>();
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->SetQueueSlot(payload.Read<UInt_64>());
end->SetParent(this);
if (connectedCb)
connectedCb(this, end);

View File

@ -20,24 +20,24 @@
namespace ehs
{
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),
timeout(0.0f), lastPing(0.0f), oldLatency(0.0f), latency(0.0f), queueSlot(0)
{
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)
: 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),
lastPing(0.0f), oldLatency(0.0f), latency(0.0f), queueSlot(0)
{
AddType("Endpoint");
}
Endpoint::Endpoint(Socket hdl, const AddrType& type, const Str_8& address, const UInt_16 port)
: hdl(hdl), disposition(EndDisp::UNKNOWN), status(Status::PENDING), arch(Architecture::UNKNOWN), hashId(0),
Endpoint::Endpoint(Comms* owner, const AddrType& type, const Str_8& address, const UInt_16 port)
: 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),
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)
: 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),
deltaDuration(0.0f), deltaRate(1.0f / 60.0f), timeout(0.0f), lastPing(0.0f),
oldLatency(0.0f), latency(0.0f), queueSlot(0)
@ -82,7 +82,7 @@ namespace ehs
}
else
{
hdl = EHS_INVALID_SOCKET;
owner = nullptr;
disposition = end.disposition;
status = Status::PENDING;
arch = end.arch;
@ -108,13 +108,6 @@ namespace ehs
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();
if (deltaDuration >= deltaRate)
@ -129,7 +122,7 @@ namespace ehs
for (UInt_64 i = 0; i < sent.Size(); ++i)
{
sent[i].lastResend += delta;
if (sent[i].lastResend >= comms->GetResendRate())
if (sent[i].lastResend >= owner->GetResendRate())
{
Serializer result(Endianness::LE);
result.Write(sent[i].header);
@ -138,17 +131,17 @@ namespace ehs
if (sent[i].header.encrypted)
Encryption::Encrypt_64(result.Size() - sizeof(bool), &result[sizeof(bool)]);
if (comms->GetAddressType() == AddrType::IPV6)
if (owner->GetAddressType() == AddrType::IPV6)
Send_v6(result);
else if (comms->GetAddressType() == AddrType::IPV4)
else if (owner->GetAddressType() == AddrType::IPV4)
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;
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,
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)
return;
@ -210,13 +196,13 @@ namespace ehs
1,
0,
ensure,
comms->GetDisposition(),
comms->GetHashId(),
owner->GetDisposition(),
owner->GetHashId(),
sys,
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);
for (UInt_64 i = 0; i < frags.Size(); ++i)
@ -380,16 +366,9 @@ namespace ehs
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;
if (comms->GetAddressType() == AddrType::IPV6)
if (owner->GetAddressType() == AddrType::IPV6)
{
UInt_64 frags = 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};
}
}
else if (comms->GetAddressType() == AddrType::IPV4)
else if (owner->GetAddressType() == AddrType::IPV4)
{
UInt_64 frags = 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)
{
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);
result.Write(header);
result.WriteSer(payload);
@ -450,9 +422,9 @@ namespace ehs
if (header.ensure)
sent.Push({header, payload});
if (comms->GetAddressType() == AddrType::IPV6)
if (owner->GetAddressType() == AddrType::IPV6)
Send_v6(result);
else if (comms->GetAddressType() == AddrType::IPV4)
else if (owner->GetAddressType() == AddrType::IPV4)
Send_v4(result);
}
@ -512,7 +484,7 @@ namespace ehs
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.");
return 0;
@ -549,7 +521,7 @@ namespace ehs
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 (sent == SOCKET_ERROR)
#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) + ".");
((Comms*)GetParent())->UnInitialize();
owner->UnInitialize();
return 0;
}
@ -576,7 +548,7 @@ namespace ehs
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.");
return 0;
@ -613,7 +585,7 @@ namespace ehs
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 (sent == SOCKET_ERROR)
#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) + ".");
((Comms*)GetParent())->UnInitialize();
owner->UnInitialize();
}
#else
Int_32 dCode = 0;

View File

@ -53,7 +53,7 @@ namespace ehs
if (initialized)
return;
client = TCP(lwe::AddrType::IPV4);
client = TCP(ehs::AddrType::IPV4);
client.Connect(DNS::Resolve(AddrType::IPV4, "irc.chat.twitch.tv"), 6667);
client.SetBlocking(false);

View File

@ -1,22 +1,22 @@
global _ZN3lwe3CPU6RDTSCPEPNS_3TSCE
global _ZN3lwe3CPU15GetManufacturerEPc
global _ZN3lwe3CPU11GetInfoBitsEv
global _ZN3lwe3CPU16GetFeatureBits_1Ev
global _ZN3lwe3CPU16GetFeatureBits_2Ev
global _ZN3lwe3CPU19GetExtFeatureBits_1Ev
global _ZN3lwe3CPU19GetExtFeatureBits_2Ev
global _ZN3lwe3CPU19GetExtFeatureBits_3Ev
global _ZN3lwe3CPU8GetBrandEPc
global _ZN3ehs3CPU6RDTSCPEPNS_3TSCE
global _ZN3ehs3CPU15GetManufacturerEPc
global _ZN3ehs3CPU11GetInfoBitsEv
global _ZN3ehs3CPU16GetFeatureBits_1Ev
global _ZN3ehs3CPU16GetFeatureBits_2Ev
global _ZN3ehs3CPU19GetExtFeatureBits_1Ev
global _ZN3ehs3CPU19GetExtFeatureBits_2Ev
global _ZN3ehs3CPU19GetExtFeatureBits_3Ev
global _ZN3ehs3CPU8GetBrandEPc
section .text
_ZN3lwe3CPU6RDTSCPEPNS_3TSCE:
_ZN3ehs3CPU6RDTSCPEPNS_3TSCE:
RDTSCP
MOV DWORD [RDI], ECX
MOV DWORD [RDI + 4], EDX
MOV DWORD [RDI + 8], EAX
RET
_ZN3lwe3CPU15GetManufacturerEPc:
_ZN3ehs3CPU15GetManufacturerEPc:
PUSH RBX
XOR EAX, EAX
@ -30,7 +30,7 @@ section .text
RET
_ZN3lwe3CPU11GetInfoBitsEv:
_ZN3ehs3CPU11GetInfoBitsEv:
PUSH RBX
MOV EAX, 1
@ -40,7 +40,7 @@ section .text
RET
_ZN3lwe3CPU16GetFeatureBits_1Ev:
_ZN3ehs3CPU16GetFeatureBits_1Ev:
PUSH RBX
MOV EAX, 1
@ -52,7 +52,7 @@ section .text
RET
_ZN3lwe3CPU16GetFeatureBits_2Ev:
_ZN3ehs3CPU16GetFeatureBits_2Ev:
PUSH RBX
MOV EAX, 1
@ -64,7 +64,7 @@ section .text
RET
_ZN3lwe3CPU19GetExtFeatureBits_1Ev:
_ZN3ehs3CPU19GetExtFeatureBits_1Ev:
PUSH RBX
MOV EAX, 7
@ -77,7 +77,7 @@ section .text
RET
_ZN3lwe3CPU19GetExtFeatureBits_2Ev:
_ZN3ehs3CPU19GetExtFeatureBits_2Ev:
PUSH RBX
MOV EAX, 7
@ -90,7 +90,7 @@ section .text
RET
_ZN3lwe3CPU19GetExtFeatureBits_3Ev:
_ZN3ehs3CPU19GetExtFeatureBits_3Ev:
PUSH RBX
MOV EAX, 7
@ -103,7 +103,7 @@ section .text
RET
_ZN3lwe3CPU8GetBrandEPc:
_ZN3ehs3CPU8GetBrandEPc:
PUSH RBX
MOV EAX, 80000002h

View File

@ -1,14 +1,14 @@
global ?GetManufacturer@CPU@lwe@@SAXPEAD@Z
global ?GetInfoBits@CPU@lwe@@SAIXZ
global ?GetFeatureBits_1@CPU@lwe@@SAIXZ
global ?GetFeatureBits_2@CPU@lwe@@SAIXZ
global ?GetExtFeatureBits_1@CPU@lwe@@SAIXZ
global ?GetExtFeatureBits_2@CPU@lwe@@SAKXZ
global ?GetExtFeatureBits_3@CPU@lwe@@SAKXZ
global ?GetBrand@CPU@lwe@@SAXPEAD@Z
global ?GetManufacturer@CPU@ehs@@SAXPEAD@Z
global ?GetInfoBits@CPU@ehs@@SAIXZ
global ?GetFeatureBits_1@CPU@ehs@@SAIXZ
global ?GetFeatureBits_2@CPU@ehs@@SAIXZ
global ?GetExtFeatureBits_1@CPU@ehs@@SAIXZ
global ?GetExtFeatureBits_2@CPU@ehs@@SAKXZ
global ?GetExtFeatureBits_3@CPU@ehs@@SAKXZ
global ?GetBrand@CPU@ehs@@SAXPEAD@Z
section .text
?GetManufacturer@CPU@lwe@@SAXPEAD@Z:
?GetManufacturer@CPU@ehs@@SAXPEAD@Z:
PUSH RBX
XOR EAX, EAX
@ -23,7 +23,7 @@ section .text
RET
?GetInfoBits@CPU@lwe@@SAIXZ:
?GetInfoBits@CPU@ehs@@SAIXZ:
PUSH RBX
MOV EAX, 1
@ -33,7 +33,7 @@ section .text
RET
?GetFeatureBits_1@CPU@lwe@@SAIXZ:
?GetFeatureBits_1@CPU@ehs@@SAIXZ:
PUSH RBX
MOV EAX, 1
@ -45,7 +45,7 @@ section .text
RET
?GetFeatureBits_2@CPU@lwe@@SAIXZ:
?GetFeatureBits_2@CPU@ehs@@SAIXZ:
PUSH RBX
MOV EAX, 1
@ -57,7 +57,7 @@ section .text
RET
?GetExtFeatureBits_1@CPU@lwe@@SAIXZ:
?GetExtFeatureBits_1@CPU@ehs@@SAIXZ:
PUSH RBX
MOV EAX, 7
@ -70,7 +70,7 @@ section .text
RET
?GetExtFeatureBits_2@CPU@lwe@@SAKXZ:
?GetExtFeatureBits_2@CPU@ehs@@SAKXZ:
PUSH RBX
MOV EAX, 7
@ -83,7 +83,7 @@ section .text
RET
?GetExtFeatureBits_3@CPU@lwe@@SAKXZ:
?GetExtFeatureBits_3@CPU@ehs@@SAKXZ:
PUSH RBX
MOV EAX, 7
@ -96,7 +96,7 @@ section .text
RET
?GetBrand@CPU@lwe@@SAXPEAD@Z:
?GetBrand@CPU@ehs@@SAXPEAD@Z:
PUSH RBX
MOV R8, RCX