2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-05-15 14:31:22 +00:00

Merge branch 'master' of ssh://git.axiodl.com:6431/AxioDL/hecl

This commit is contained in:
Jack Andersen 2019-09-30 21:30:17 -10:00
commit 88e68e8aa3
37 changed files with 806 additions and 470 deletions

View File

@ -52,6 +52,7 @@ function(add_shader file)
add_stage_rep(shader_${name} ${CMAKE_CURRENT_BINARY_DIR}/${dir}/shader_${name}.hpp) add_stage_rep(shader_${name} ${CMAKE_CURRENT_BINARY_DIR}/${dir}/shader_${name}.hpp)
add_pipeline_rep(shader_${name} ${CMAKE_CURRENT_BINARY_DIR}/${dir}/shader_${name}.hpp UNIVERSAL) add_pipeline_rep(shader_${name} ${CMAKE_CURRENT_BINARY_DIR}/${dir}/shader_${name}.hpp UNIVERSAL)
add_library(shader_${name} ${CMAKE_CURRENT_BINARY_DIR}/${dir}/shader_${name}.hpp ${CMAKE_CURRENT_BINARY_DIR}/${dir}/shader_${name}.cpp) add_library(shader_${name} ${CMAKE_CURRENT_BINARY_DIR}/${dir}/shader_${name}.hpp ${CMAKE_CURRENT_BINARY_DIR}/${dir}/shader_${name}.cpp)
target_link_libraries(shader_${name} PUBLIC boo hecl-light)
add_shader_target(shader_${name}) add_shader_target(shader_${name})
endfunction() endfunction()
@ -59,5 +60,6 @@ function(add_special_shader name)
add_stage_rep(${name} ${name}.hpp) add_stage_rep(${name} ${name}.hpp)
add_pipeline_rep(${name} ${name}.hpp UNIVERSAL) add_pipeline_rep(${name} ${name}.hpp UNIVERSAL)
add_library(${name} ${name}.hpp ${ARGN}) add_library(${name} ${name}.hpp ${ARGN})
target_link_libraries(${name} PUBLIC boo hecl-light)
add_shader_target(${name}) add_shader_target(${name})
endfunction() endfunction()

View File

@ -1,6 +1,14 @@
#pragma once #pragma once
#include "boo/graphicsdev/IGraphicsDataFactory.hpp" #include <cstddef>
#include <cstdint>
#include <string_view>
#include <vector>
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include "hecl.hpp"
#include "../extern/boo/xxhash/xxhash.h"
namespace hecl::Backend { namespace hecl::Backend {
struct ExtensionSlot; struct ExtensionSlot;
@ -186,7 +194,7 @@ struct Function {
}; };
struct ExtensionSlot { struct ExtensionSlot {
const char* shaderMacro; const char* shaderMacro = nullptr;
size_t texCount = 0; size_t texCount = 0;
const Backend::TextureInfo* texs = nullptr; const Backend::TextureInfo* texs = nullptr;
Backend::BlendFactor srcFactor = Backend::BlendFactor::Original; Backend::BlendFactor srcFactor = Backend::BlendFactor::Original;
@ -201,14 +209,13 @@ struct ExtensionSlot {
bool forceAlphaTest = false; bool forceAlphaTest = false;
bool diffuseOnly = false; bool diffuseOnly = false;
ExtensionSlot(size_t texCount = 0, constexpr ExtensionSlot(size_t texCount = 0, const Backend::TextureInfo* texs = nullptr,
const Backend::TextureInfo* texs = nullptr,
Backend::BlendFactor srcFactor = Backend::BlendFactor::Original, Backend::BlendFactor srcFactor = Backend::BlendFactor::Original,
Backend::BlendFactor dstFactor = Backend::BlendFactor::Original, Backend::BlendFactor dstFactor = Backend::BlendFactor::Original,
Backend::ZTest depthTest = Backend::ZTest::Original, Backend::ZTest depthTest = Backend::ZTest::Original,
Backend::CullMode cullMode = Backend::CullMode::Backface, bool noDepthWrite = false, Backend::CullMode cullMode = Backend::CullMode::Backface, bool noDepthWrite = false,
bool noColorWrite = false, bool noAlphaWrite = false, bool noAlphaOverwrite = false, bool noColorWrite = false, bool noAlphaWrite = false, bool noAlphaOverwrite = false,
bool noReflection = false, bool forceAlphaTest = false, bool diffuseOnly = false) bool noReflection = false, bool forceAlphaTest = false, bool diffuseOnly = false) noexcept
: texCount(texCount) : texCount(texCount)
, texs(texs) , texs(texs)
, srcFactor(srcFactor) , srcFactor(srcFactor)

View File

@ -1,12 +1,21 @@
#pragma once #pragma once
#include "hecl/hecl.hpp"
#include <functional>
#include <vector>
#include "hecl/FourCC.hpp" #include "hecl/FourCC.hpp"
#include "athena/DNA.hpp" #include "hecl/SystemChar.hpp"
#include "athena/MemoryReader.hpp"
#include <athena/DNA.hpp>
namespace athena::io {
class MemoryReader;
}
namespace hecl::blender { namespace hecl::blender {
enum class BlendType;
struct SDNABlock : public athena::io::DNA<athena::Little> { struct SDNABlock : public athena::io::DNA<athena::Endian::Little> {
AT_DECL_DNA AT_DECL_DNA
DNAFourCC magic; DNAFourCC magic;
DNAFourCC nameMagic; DNAFourCC nameMagic;
@ -22,11 +31,11 @@ struct SDNABlock : public athena::io::DNA<athena::Little> {
Align<4> align3; Align<4> align3;
DNAFourCC strcMagic; DNAFourCC strcMagic;
Value<atUint32> numStrcs; Value<atUint32> numStrcs;
struct SDNAStruct : public athena::io::DNA<athena::Little> { struct SDNAStruct : public athena::io::DNA<athena::Endian::Little> {
AT_DECL_DNA AT_DECL_DNA
Value<atUint16> type; Value<atUint16> type;
Value<atUint16> numFields; Value<atUint16> numFields;
struct SDNAField : public athena::io::DNA<athena::Little> { struct SDNAField : public athena::io::DNA<athena::Endian::Little> {
AT_DECL_DNA AT_DECL_DNA
Value<atUint16> type; Value<atUint16> type;
Value<atUint16> name; Value<atUint16> name;
@ -42,7 +51,7 @@ struct SDNABlock : public athena::io::DNA<athena::Little> {
const SDNAStruct* lookupStruct(const char* n, atUint32& idx) const; const SDNAStruct* lookupStruct(const char* n, atUint32& idx) const;
}; };
struct FileBlock : public athena::io::DNA<athena::Little> { struct FileBlock : public athena::io::DNA<athena::Endian::Little> {
AT_DECL_DNA AT_DECL_DNA
DNAFourCC type; DNAFourCC type;
Value<atUint32> size; Value<atUint32> size;

View File

@ -1,17 +1,19 @@
#pragma once #pragma once
#include <string>
#include <functional> #include <functional>
#include <athena/Types.hpp> #include <string>
#include <athena/Global.hpp> #include <vector>
#include <athena/DNAYaml.hpp> #include <athena/DNAYaml.hpp>
#include <athena/Global.hpp>
#include <athena/Types.hpp>
namespace hecl { namespace hecl {
namespace DNACVAR { namespace DNACVAR {
enum class EType : atUint8 { Boolean, Integer, Float, Literal, Vec4f }; enum class EType : atUint8 { Boolean, Signed, Unsigned, Real, Literal, Vec2f, Vec2d, Vec3f, Vec3d, Vec4f, Vec4d };
enum EFlags { enum class EFlags {
None = -1, None = 0,
System = (1 << 0), System = (1 << 0),
Game = (1 << 1), Game = (1 << 1),
Editor = (1 << 2), Editor = (1 << 2),
@ -22,18 +24,21 @@ enum EFlags {
Archive = (1 << 7), Archive = (1 << 7),
InternalArchivable = (1 << 8), InternalArchivable = (1 << 8),
Modified = (1 << 9), Modified = (1 << 9),
ModifyRestart = (1 << 10) /*!< If this bit is set, any modification will inform the user that a restart is required */ ModifyRestart = (1 << 10), //!< If this bit is set, any modification will inform the user that a restart is required
Color = (1 << 11), //!< If this bit is set, Vec3f and Vec4f will be displayed in the console with a colored square
NoDeveloper = (1 << 12), //!< Not even developer mode can modify this
Any = -1
}; };
ENABLE_BITWISE_ENUM(EFlags) ENABLE_BITWISE_ENUM(EFlags)
class CVar : public athena::io::DNA<athena::Big> { class CVar : public athena::io::DNA<athena::Endian::Big> {
public: public:
AT_DECL_DNA AT_DECL_DNA
String<-1> m_name; String<-1> m_name;
String<-1> m_value; String<-1> m_value;
}; };
struct CVarContainer : public athena::io::DNA<athena::Big> { struct CVarContainer : public athena::io::DNA<athena::Endian::Big> {
AT_DECL_DNA AT_DECL_DNA
Value<atUint32> magic = 'CVAR'; Value<atUint32> magic = 'CVAR';
Value<atUint32> cvarCount; Value<atUint32> cvarCount;
@ -53,40 +58,61 @@ public:
using EType = DNACVAR::EType; using EType = DNACVAR::EType;
using EFlags = DNACVAR::EFlags; using EFlags = DNACVAR::EFlags;
CVar(std::string_view name, std::string_view value, std::string_view help, EType type, EFlags flags, CVar(std::string_view name, std::string_view value, std::string_view help, EFlags flags);
CVarManager& parent); CVar(std::string_view name, const atVec2f& value, std::string_view help, EFlags flags);
CVar(std::string_view name, std::string_view value, std::string_view help, EFlags flags, CVarManager& parent); CVar(std::string_view name, const atVec2d& value, std::string_view help, EFlags flags);
CVar(std::string_view name, float value, std::string_view help, EFlags flags, CVarManager& parent); CVar(std::string_view name, const atVec3f& value, std::string_view help, EFlags flags);
CVar(std::string_view name, bool value, std::string_view help, EFlags flags, CVarManager& parent); CVar(std::string_view name, const atVec3d& value, std::string_view help, EFlags flags);
CVar(std::string_view name, int value, std::string_view help, EFlags flags, CVarManager& parent); CVar(std::string_view name, const atVec4f& value, std::string_view help, EFlags flags);
CVar(std::string_view name, const atVec4f& value, std::string_view help, EFlags flags, CVarManager& parent); CVar(std::string_view name, const atVec4d& value, std::string_view help, EFlags flags);
CVar(std::string_view name, double value, std::string_view help, EFlags flags);
CVar(std::string_view name, bool value, std::string_view help, EFlags flags);
CVar(std::string_view name, int32_t value, std::string_view help, EFlags flags);
CVar(std::string_view name, uint32_t value, std::string_view help, EFlags flags);
std::string_view name() const { return m_name; } std::string_view name() const { return m_name; }
std::string_view rawHelp() const { return m_help; } std::string_view rawHelp() const { return m_help; }
std::string help() const; std::string help() const;
std::string value() const { return m_value; } std::string value() const { return m_value; }
atVec2f toVec2f(bool* isValid = nullptr) const;
atVec2d toVec2d(bool* isValie = nullptr) const;
atVec3f toVec3f(bool* isValid = nullptr) const;
atVec3d toVec3d(bool* isValie = nullptr) const;
atVec4f toVec4f(bool* isValid = nullptr) const; atVec4f toVec4f(bool* isValid = nullptr) const;
float toFloat(bool* isValid = nullptr) const; atVec4d toVec4d(bool* isValie = nullptr) const;
double toReal(bool* isValid = nullptr) const;
bool toBoolean(bool* isValid = nullptr) const; bool toBoolean(bool* isValid = nullptr) const;
int toInteger(bool* isValid = nullptr) const; int32_t toSigned(bool* isValid = nullptr) const;
uint32_t toUnsigned(bool* isValid = nullptr) const;
std::wstring toWideLiteral(bool* isValid = nullptr) const; std::wstring toWideLiteral(bool* isValid = nullptr) const;
std::string toLiteral(bool* isValid = nullptr) const; std::string toLiteral(bool* isValid = nullptr) const;
bool fromVec2f(const atVec2f& val);
bool fromVec2d(const atVec2d& val);
bool fromVec3f(const atVec3f& val);
bool fromVec3d(const atVec3d& val);
bool fromVec4f(const atVec4f& val); bool fromVec4f(const atVec4f& val);
bool fromFloat(float val); bool fromVec4d(const atVec4d& val);
bool fromReal(double val);
bool fromBoolean(bool val); bool fromBoolean(bool val);
bool fromInteger(int val); bool fromInteger(int32_t val);
bool fromInteger(uint32_t val);
bool fromLiteral(std::string_view val); bool fromLiteral(std::string_view val);
bool fromLiteral(std::wstring_view val); bool fromLiteral(std::wstring_view val);
bool fromLiteralToType(std::string_view val, bool setDefault = false); bool fromLiteralToType(std::string_view val);
bool fromLiteralToType(std::wstring_view val, bool setDefault = false); bool fromLiteralToType(std::wstring_view val);
bool isFloat() const { return m_type == EType::Float; } bool isVec2f() const { return m_type == EType::Vec2f; }
bool isBoolean() const { return m_type == EType::Boolean; } bool isVec2d() const { return m_type == EType::Vec2d; }
bool isInteger() const { return m_type == EType::Integer; } bool isVec3f() const { return m_type == EType::Vec3f; }
bool isLiteral() const { return m_type == EType::Literal; } bool isVec3d() const { return m_type == EType::Vec3d; }
bool isVec4f() const { return m_type == EType::Vec4f; } bool isVec4f() const { return m_type == EType::Vec4f; }
bool isVec4d() const { return m_type == EType::Vec4d; }
bool isFloat() const { return m_type == EType::Real; }
bool isBoolean() const { return m_type == EType::Boolean; }
bool isInteger() const { return m_type == EType::Signed || m_type == EType::Unsigned; }
bool isLiteral() const { return m_type == EType::Literal; }
bool isModified() const; bool isModified() const;
bool modificationRequiresRestart() const; bool modificationRequiresRestart() const;
bool isReadOnly() const; bool isReadOnly() const;
@ -94,10 +120,10 @@ public:
bool isHidden() const; bool isHidden() const;
bool isArchive() const; bool isArchive() const;
bool isInternalArchivable() const; bool isInternalArchivable() const;
bool isNoDeveloper() const;
bool isColor() const;
bool wasDeserialized() const; bool wasDeserialized() const;
bool hasDefaultValue() const; bool hasDefaultValue() const;
void clearModified();
void setModified();
EType type() const { return m_type; } EType type() const { return m_type; }
EFlags flags() const { return (m_unlocked ? m_oldFlags : m_flags); } EFlags flags() const { return (m_unlocked ? m_oldFlags : m_flags); }
@ -119,19 +145,24 @@ public:
void addListener(ListenerFunc func) { m_listeners.push_back(std::move(func)); } void addListener(ListenerFunc func) { m_listeners.push_back(std::move(func)); }
bool isValidInput(std::string_view input) const;
bool isValidInput(std::wstring_view input) const;
private: private:
CVar(std::string_view name, std::string_view help, EType type) : m_help(help), m_type(type) { m_name = name; }
void dispatch(); void dispatch();
EType m_type; void clearModified();
void setModified();
std::string m_help; std::string m_help;
EType m_type;
std::string m_defaultValue; std::string m_defaultValue;
EFlags m_flags; EFlags m_flags = EFlags::None;
EFlags m_oldFlags; EFlags m_oldFlags = EFlags::None;
bool m_unlocked = false; bool m_unlocked = false;
bool m_wasDeserialized = false; bool m_wasDeserialized = false;
CVarManager& m_mgr;
std::vector<ListenerFunc> m_listeners; std::vector<ListenerFunc> m_listeners;
bool safeToModify(EType type) const;
void init(EFlags flags, bool removeColor=true);
}; };
class CVarUnlocker { class CVarUnlocker {

View File

@ -1,6 +1,10 @@
#pragma once #pragma once
#include "CVarManager.hpp" #include <algorithm>
#include <cstdint>
#include <string>
#include "hecl/CVarManager.hpp"
#undef min #undef min
#undef max #undef max
@ -14,7 +18,7 @@ using namespace std::literals;
#elif defined(__APPLE__) #elif defined(__APPLE__)
#define DEFAULT_GRAPHICS_API "Metal"sv #define DEFAULT_GRAPHICS_API "Metal"sv
#else #else
#define DEFAULT_GRAPHICS_API "OpenGL"sv #define DEFAULT_GRAPHICS_API "Vulkan"sv
#endif #endif
struct CVarCommons { struct CVarCommons {
@ -43,13 +47,13 @@ struct CVarCommons {
void setGraphicsApi(std::string_view api) { m_graphicsApi->fromLiteral(api); } void setGraphicsApi(std::string_view api) { m_graphicsApi->fromLiteral(api); }
uint32_t getSamples() const { return std::max(uint32_t(1), uint32_t(m_drawSamples->toInteger())); } uint32_t getSamples() const { return std::max(1u, m_drawSamples->toUnsigned()); }
void setSamples(uint32_t v) { m_drawSamples->fromInteger(std::max(uint32_t(1), v)); } void setSamples(uint32_t v) { m_drawSamples->fromInteger(std::max(uint32_t(1), v)); }
uint32_t getAnisotropy() const { return std::max(uint32_t(1), uint32_t(m_texAnisotropy->toInteger())); } uint32_t getAnisotropy() const { return std::max(1u, uint32_t(m_texAnisotropy->toUnsigned())); }
void setAnisotropy(uint32_t v) { m_texAnisotropy->fromInteger(std::max(uint32_t(1), v)); } void setAnisotropy(uint32_t v) { m_texAnisotropy->fromInteger(std::max(1u, v)); }
bool getDeepColor() const { return m_deepColor->toBoolean(); } bool getDeepColor() const { return m_deepColor->toBoolean(); }

View File

@ -1,8 +1,11 @@
#pragma once #pragma once
#include <memory>
#include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "CVar.hpp"
#include "hecl/CVar.hpp"
#include "hecl/SystemChar.hpp" #include "hecl/SystemChar.hpp"
namespace hecl { namespace hecl {
@ -17,7 +20,7 @@ class CVarManager final {
using CVarContainer = DNACVAR::CVarContainer; using CVarContainer = DNACVAR::CVarContainer;
template <typename T> template <typename T>
CVar* _newCVar(std::string_view name, std::string_view help, const T& value, CVar::EFlags flags) { CVar* _newCVar(std::string_view name, std::string_view help, const T& value, CVar::EFlags flags) {
if (CVar* ret = registerCVar(std::make_unique<CVar>(name, value, help, flags, *this))) { if (CVar* ret = registerCVar(std::make_unique<CVar>(name, value, help, flags))) {
deserialize(ret); deserialize(ret);
return ret; return ret;
} }
@ -36,20 +39,44 @@ public:
CVarManager(hecl::Runtime::FileStoreManager& store, bool useBinary = false); CVarManager(hecl::Runtime::FileStoreManager& store, bool useBinary = false);
~CVarManager(); ~CVarManager();
CVar* newCVar(std::string_view name, std::string_view help, const atVec2f& value, CVar::EFlags flags) {
return _newCVar<atVec2f>(name, help, value, flags);
}
CVar* newCVar(std::string_view name, std::string_view help, const atVec2d& value, CVar::EFlags flags) {
return _newCVar<atVec2d>(name, help, value, flags);
}
CVar* newCVar(std::string_view name, std::string_view help, const atVec3f& value, CVar::EFlags flags) {
return _newCVar<atVec3f>(name, help, value, flags);
}
CVar* newCVar(std::string_view name, std::string_view help, const atVec3d& value, CVar::EFlags flags) {
return _newCVar<atVec3d>(name, help, value, flags);
}
CVar* newCVar(std::string_view name, std::string_view help, const atVec4f& value, CVar::EFlags flags) { CVar* newCVar(std::string_view name, std::string_view help, const atVec4f& value, CVar::EFlags flags) {
return _newCVar<atVec4f>(name, help, value, flags); return _newCVar<atVec4f>(name, help, value, flags);
} }
CVar* newCVar(std::string_view name, std::string_view help, const atVec4d& value, CVar::EFlags flags) {
return _newCVar<atVec4d>(name, help, value, flags);
}
CVar* newCVar(std::string_view name, std::string_view help, std::string_view value, CVar::EFlags flags) { CVar* newCVar(std::string_view name, std::string_view help, std::string_view value, CVar::EFlags flags) {
return _newCVar<std::string_view>(name, help, value, flags); return _newCVar<std::string_view>(name, help, value, flags);
} }
CVar* newCVar(std::string_view name, std::string_view help, bool value, CVar::EFlags flags) { CVar* newCVar(std::string_view name, std::string_view help, bool value, CVar::EFlags flags) {
return _newCVar<bool>(name, help, value, flags); return _newCVar<bool>(name, help, value, flags);
} }
// Float and double are internally identical, all floating point values are stored as `double`
CVar* newCVar(std::string_view name, std::string_view help, float value, CVar::EFlags flags) { CVar* newCVar(std::string_view name, std::string_view help, float value, CVar::EFlags flags) {
return _newCVar<float>(name, help, value, flags); return _newCVar<double>(name, help, static_cast<double>(value), flags);
} }
CVar* newCVar(std::string_view name, std::string_view help, int value, CVar::EFlags flags) { CVar* newCVar(std::string_view name, std::string_view help, double value, CVar::EFlags flags) {
return _newCVar<int>(name, help, value, flags); return _newCVar<double>(name, help, value, flags);
}
// Integer CVars can be seamlessly converted between either type, the distinction is to make usage absolutely clear
CVar* newCVar(std::string_view name, std::string_view help, int32_t value, CVar::EFlags flags) {
return _newCVar<int32_t>(name, help, value, flags);
}
CVar* newCVar(std::string_view name, std::string_view help, uint32_t value, CVar::EFlags flags) {
return _newCVar<uint32_t>(name, help, value, flags);
} }
CVar* registerCVar(std::unique_ptr<CVar>&& cvar); CVar* registerCVar(std::unique_ptr<CVar>&& cvar);
@ -63,13 +90,15 @@ public:
} }
std::vector<CVar*> archivedCVars() const; std::vector<CVar*> archivedCVars() const;
std::vector<CVar*> cvars(CVar::EFlags filter = CVar::EFlags::None) const; std::vector<CVar*> cvars(CVar::EFlags filter = CVar::EFlags::Any) const;
void deserialize(CVar* cvar); void deserialize(CVar* cvar);
void serialize(); void serialize();
static CVarManager* instance(); static CVarManager* instance();
void proc();
void list(class Console* con, const std::vector<std::string>& args); void list(class Console* con, const std::vector<std::string>& args);
void setCVar(class Console* con, const std::vector<std::string>& args); void setCVar(class Console* con, const std::vector<std::string>& args);
void getCVar(class Console* con, const std::vector<std::string>& args); void getCVar(class Console* con, const std::vector<std::string>& args);

View File

@ -1,15 +1,25 @@
#pragma once #pragma once
#include "hecl.hpp"
#include "Database.hpp"
#include "boo/ThreadLocalPtr.hpp"
#include "hecl/Blender/Token.hpp"
#include <list>
#include <thread>
#include <mutex>
#include <condition_variable> #include <condition_variable>
#include <cstddef>
#include <functional>
#include <list>
#include <memory>
#include <mutex>
#include <thread>
#include "hecl/Blender/Token.hpp"
#include "hecl/hecl.hpp"
#include "hecl/SystemChar.hpp"
#include <boo/ThreadLocalPtr.hpp>
namespace hecl::Database {
class IDataSpec;
}
namespace hecl { namespace hecl {
class MultiProgressPrinter;
extern int CpuCountOverride; extern int CpuCountOverride;
void SetCpuCountOverride(int argc, const SystemChar** argv); void SetCpuCountOverride(int argc, const SystemChar** argv);

View File

@ -1,9 +1,14 @@
#pragma once #pragma once
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
#include "boo/graphicsdev/GL.hpp" #include <cstddef>
#include "boo/graphicsdev/Vulkan.hpp" #include <memory>
#include "boo/graphicsdev/D3D.hpp" #include <utility>
#include "boo/graphicsdev/Metal.hpp"
#include <boo/graphicsdev/D3D.hpp>
#include <boo/graphicsdev/GL.hpp>
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <boo/graphicsdev/Metal.hpp>
#include <boo/graphicsdev/Vulkan.hpp>
namespace hecl { namespace hecl {

View File

@ -1,11 +1,21 @@
#pragma once #pragma once
#include <functional>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <functional>
#include "boo/IWindow.hpp" #include <boo/System.hpp>
#include "logvisor/logvisor.hpp" #include <logvisor/logvisor.hpp>
namespace boo {
class IWindow;
enum class EModifierKey;
enum class ESpecialKey;
struct IGraphicsCommandQueue;
} // namespace boo
namespace hecl { namespace hecl {
class CVarManager; class CVarManager;

View File

@ -3,17 +3,15 @@
#include <cassert> #include <cassert>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <cstdio>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <unordered_set>
#include <vector> #include <vector>
#include <logvisor/logvisor.hpp> #include "hecl/hecl.hpp"
#include "hecl.hpp" #include <logvisor/logvisor.hpp>
namespace hecl { namespace hecl {
class ClientProcess; class ClientProcess;

View File

@ -3,7 +3,9 @@
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>
#include <string> #include <string>
#include "athena/DNA.hpp"
#include <athena/DNA.hpp>
#include <logvisor/logvisor.hpp>
namespace hecl { namespace hecl {
@ -32,26 +34,26 @@ public:
constexpr FourCC& operator=(const FourCC&) noexcept = default; constexpr FourCC& operator=(const FourCC&) noexcept = default;
constexpr FourCC& operator=(FourCC&&) noexcept = default; constexpr FourCC& operator=(FourCC&&) noexcept = default;
constexpr bool operator==(const FourCC& other) const { return num == other.num; } constexpr bool operator==(const FourCC& other) const noexcept { return num == other.num; }
constexpr bool operator!=(const FourCC& other) const { return !operator==(other); } constexpr bool operator!=(const FourCC& other) const noexcept { return !operator==(other); }
constexpr bool operator==(const char* other) const { constexpr bool operator==(const char* other) const noexcept {
return other[0] == fcc[0] && other[1] == fcc[1] && other[2] == fcc[2] && other[3] == fcc[3]; return other[0] == fcc[0] && other[1] == fcc[1] && other[2] == fcc[2] && other[3] == fcc[3];
} }
constexpr bool operator!=(const char* other) const { return !operator==(other); } constexpr bool operator!=(const char* other) const noexcept { return !operator==(other); }
constexpr bool operator==(int32_t other) const { return num == uint32_t(other); } constexpr bool operator==(int32_t other) const noexcept { return num == uint32_t(other); }
constexpr bool operator!=(int32_t other) const { return !operator==(other); } constexpr bool operator!=(int32_t other) const noexcept { return !operator==(other); }
constexpr bool operator==(uint32_t other) const { return num == other; } constexpr bool operator==(uint32_t other) const noexcept { return num == other; }
constexpr bool operator!=(uint32_t other) const { return !operator==(other); } constexpr bool operator!=(uint32_t other) const noexcept { return !operator==(other); }
std::string toString() const { return std::string(std::begin(fcc), std::end(fcc)); } std::string toString() const { return std::string(std::begin(fcc), std::end(fcc)); }
constexpr uint32_t toUint32() const { return num; } constexpr uint32_t toUint32() const noexcept { return num; }
constexpr const char* getChars() const { return fcc; } constexpr const char* getChars() const noexcept { return fcc; }
constexpr char* getChars() { return fcc; } constexpr char* getChars() noexcept { return fcc; }
constexpr bool IsValid() const { return num != 0; } constexpr bool IsValid() const noexcept { return num != 0; }
}; };
#define FOURCC(chars) FourCC(SBIG(chars)) #define FOURCC(chars) FourCC(SBIG(chars))
using BigDNA = athena::io::DNA<athena::Big>; using BigDNA = athena::io::DNA<athena::Endian::Big>;
/** FourCC with DNA read/write */ /** FourCC with DNA read/write */
class DNAFourCC final : public BigDNA, public FourCC { class DNAFourCC final : public BigDNA, public FourCC {

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "hecl/hecl.hpp" #include <athena/DNA.hpp>
#include "athena/DNA.hpp"
namespace hecl { namespace hecl {
@ -12,7 +11,7 @@ enum class HMDLTopology : atUint32 {
#define HECL_HMDL_META_SZ 32 #define HECL_HMDL_META_SZ 32
struct HMDLMeta : athena::io::DNA<athena::Big> { struct HMDLMeta : athena::io::DNA<athena::Endian::Big> {
AT_DECL_DNA AT_DECL_DNA
Value<atUint32> magic = 'TACO'; Value<atUint32> magic = 'TACO';
Value<HMDLTopology> topology; Value<HMDLTopology> topology;

View File

@ -1,7 +1,18 @@
#pragma once #pragma once
#include "hecl.hpp" #include <cstdint>
#include <mutex>
#include <thread> #include <thread>
#include <vector>
#include "hecl/SystemChar.hpp"
#if _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <Windows.h>
#endif
namespace hecl { namespace hecl {

View File

@ -1,9 +1,16 @@
#pragma once #pragma once
#include <type_traits>
#include <cassert> #include <cassert>
#include <cstdint>
#include <memory>
#include <type_traits>
#include <unordered_map>
#include "hecl/hecl.hpp" #include "hecl/hecl.hpp"
#include "PipelineBase.hpp" #include "hecl/PipelineBase.hpp"
#include <boo/BooObject.hpp>
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
/* CMake-curated rep classes for the application */ /* CMake-curated rep classes for the application */
#include "ApplicationReps.hpp" #include "ApplicationReps.hpp"

View File

@ -1,5 +1,14 @@
#pragma once #pragma once
#include "Compilers.hpp"
#include <cstddef>
#include <cstdint>
#include <string_view>
#include <type_traits>
#include <vector>
#include "hecl/Compilers.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include "../extern/boo/xxhash/xxhash.h" #include "../extern/boo/xxhash/xxhash.h"
#define HECL_RUNTIME 1 #define HECL_RUNTIME 1

View File

@ -1,8 +1,12 @@
#pragma once #pragma once
#include "hecl.hpp" #include <cstddef>
#include "boo/graphicsdev/IGraphicsDataFactory.hpp" #include <memory>
#include <unordered_map>
#include "hecl/SystemChar.hpp"
#include <boo/BooObject.hpp>
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
namespace hecl { namespace hecl {
struct HMDLMeta; struct HMDLMeta;

View File

@ -1,7 +1,10 @@
#pragma once #pragma once
#include <variant>
#include <cassert> #include <cassert>
#include "athena/DNA.hpp" #include <type_traits>
#include <variant>
#include <athena/DNA.hpp>
/* /*
* The TypedVariant system is a type-safe union implementation capable of selecting * The TypedVariant system is a type-safe union implementation capable of selecting
@ -200,61 +203,66 @@ private:
}; };
#define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(...) \ #define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(...) \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::Read>(typename Read::StreamT & r) { \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::Read>( \
typename Read::StreamT & r) { \
EnumType variant_type = {}; \ EnumType variant_type = {}; \
Do<athena::io::DNA<athena::Big>::Read>(athena::io::PropId("variant_type"sv), variant_type, r); \ Do<athena::io::DNA<athena::Endian::Big>::Read>(athena::io::PropId("variant_type"sv), variant_type, r); \
static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \ static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \
visit([&](auto& var) { var.read(r); }); \ visit([&](auto& var) { var.read(r); }); \
} \ } \
\ \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::Write>(typename Write::StreamT & w) { \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::Write>( \
typename Write::StreamT & w) { \
visit([&](auto& var) { \ visit([&](auto& var) { \
using T = std::decay_t<decltype(var)>; \ using T = std::decay_t<decltype(var)>; \
EnumType variant_type = T::variant_type(); \ EnumType variant_type = T::variant_type(); \
Do<athena::io::DNA<athena::Big>::Write>(athena::io::PropId("variant_type"sv), variant_type, w); \ Do<athena::io::DNA<athena::Endian::Big>::Write>(athena::io::PropId("variant_type"sv), variant_type, w); \
var.write(w); \ var.write(w); \
}); \ }); \
} \ } \
\ \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::BinarySize>(typename BinarySize::StreamT & sz) { \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::BinarySize>( \
typename BinarySize::StreamT & sz) { \
visit([&](auto& var) { \ visit([&](auto& var) { \
using T = std::decay_t<decltype(var)>; \ using T = std::decay_t<decltype(var)>; \
EnumType variant_type = T::variant_type(); \ EnumType variant_type = T::variant_type(); \
Do<athena::io::DNA<athena::Big>::BinarySize>(athena::io::PropId("variant_type"sv), variant_type, sz); \ Do<athena::io::DNA<athena::Endian::Big>::BinarySize>(athena::io::PropId("variant_type"sv), variant_type, sz); \
var.binarySize(sz); \ var.binarySize(sz); \
}); \ }); \
} \ } \
template <> \ template <> \
inline std::string_view hecl::TypedVariantBigDNA<__VA_ARGS__>::DNAType() { \ inline std::string_view hecl::TypedVariantBigDNA<__VA_ARGS__>::DNAType() { \
return "hecl::TypedVariantBigDNA<" #__VA_ARGS__ ">"sv; \ return "hecl::TypedVariantBigDNA<" #__VA_ARGS__ ">"sv; \
} }
#define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA_YAML(...) \ #define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA_YAML(...) \
AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(__VA_ARGS__) \ AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(__VA_ARGS__) \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::ReadYaml>(typename ReadYaml::StreamT & r) { \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::ReadYaml>( \
typename ReadYaml::StreamT & r) { \
EnumType variant_type = {}; \ EnumType variant_type = {}; \
Do<athena::io::DNA<athena::Big>::ReadYaml>(athena::io::PropId("variant_type"sv), variant_type, r); \ Do<athena::io::DNA<athena::Endian::Big>::ReadYaml>(athena::io::PropId("variant_type"sv), variant_type, r); \
static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \ static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \
visit([&](auto& var) { var.read(r); }); \ visit([&](auto& var) { var.read(r); }); \
} \ } \
\ \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::WriteYaml>(typename WriteYaml::StreamT & w) { \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::WriteYaml>( \
typename WriteYaml::StreamT & w) { \
visit([&](auto& var) { \ visit([&](auto& var) { \
using T = std::decay_t<decltype(var)>; \ using T = std::decay_t<decltype(var)>; \
EnumType variant_type = T::variant_type(); \ EnumType variant_type = T::variant_type(); \
Do<athena::io::DNA<athena::Big>::WriteYaml>(athena::io::PropId("variant_type"sv), variant_type, w); \ Do<athena::io::DNA<athena::Endian::Big>::WriteYaml>(athena::io::PropId("variant_type"sv), variant_type, w); \
var.write(w); \ var.write(w); \
}); \ }); \
} }
} }

View File

@ -1,10 +1,16 @@
#pragma once #pragma once
#include <boo/boo.hpp>
#include <vector>
#include <cstdlib>
#include <atomic> #include <atomic>
#include "BitVector.hpp" #include <cstdint>
#include <cstdlib>
#include <memory>
#include <type_traits>
#include <vector>
#include "hecl/BitVector.hpp"
#include <boo/BooObject.hpp>
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
namespace hecl { namespace hecl {

View File

@ -1,10 +1,17 @@
#pragma once #pragma once
#include <boo/boo.hpp>
#include <vector>
#include <cstdlib>
#include <atomic> #include <atomic>
#include "BitVector.hpp" #include <cassert>
#include <cstdint>
#include <cstdlib>
#include <memory>
#include <type_traits>
#include <vector>
#include "hecl/BitVector.hpp"
#include <boo/BooObject.hpp>
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
namespace hecl { namespace hecl {

View File

@ -63,26 +63,27 @@ namespace blender {
enum class BlendType { None, Mesh, ColMesh, Armature, Actor, Area, enum class BlendType { None, Mesh, ColMesh, Armature, Actor, Area,
World, MapArea, MapUniverse, Frame, PathMesh }; World, MapArea, MapUniverse, Frame, PathMesh };
class ANIMOutStream;
class Connection; class Connection;
class Token;
class DataStream; class DataStream;
class PyOutStream; class PyOutStream;
class ANIMOutStream; class Token;
struct Mesh;
struct Material; struct Action;
struct Actor;
struct Armature;
struct Bone;
struct ColMesh; struct ColMesh;
struct World;
struct Light; struct Light;
struct MapArea; struct MapArea;
struct MapUniverse; struct MapUniverse;
struct Actor; struct Material;
struct Armature;
struct Action;
struct Bone;
struct PathMesh;
struct Matrix3f; struct Matrix3f;
struct Matrix4f; struct Matrix4f;
struct Mesh;
struct PathMesh;
struct PoolSkinIndex; struct PoolSkinIndex;
struct World;
extern class Token SharedBlenderToken; extern class Token SharedBlenderToken;
} // namespace blender } // namespace blender

View File

@ -13,10 +13,10 @@
#include <thread> #include <thread>
#include <tuple> #include <tuple>
#include <hecl/hecl.hpp>
#include <hecl/Database.hpp>
#include "hecl/Blender/Connection.hpp" #include "hecl/Blender/Connection.hpp"
#include "hecl/Blender/Token.hpp" #include "hecl/Blender/Token.hpp"
#include "hecl/Database.hpp"
#include "hecl/hecl.hpp"
#include "hecl/SteamFinder.hpp" #include "hecl/SteamFinder.hpp"
#include "MeshOptimizer.hpp" #include "MeshOptimizer.hpp"

View File

@ -2,6 +2,8 @@
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include <vector>
#include <athena/MemoryWriter.hpp> #include <athena/MemoryWriter.hpp>

View File

@ -1,7 +1,11 @@
#include "MeshOptimizer.hpp" #include "MeshOptimizer.hpp"
#include <numeric>
#include <algorithm>
#include <cfloat> #include <cfloat>
#include <climits>
#include <cmath> #include <cmath>
#include <numeric>
#include <unordered_set>
namespace hecl::blender { namespace hecl::blender {

View File

@ -1,6 +1,14 @@
#pragma once #pragma once
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <unordered_map>
#include <utility>
#include <vector>
#include "hecl/Blender/Connection.hpp" #include "hecl/Blender/Connection.hpp"
#include <unordered_set>
namespace hecl::blender { namespace hecl::blender {

View File

@ -1,5 +1,13 @@
#include "hecl/Blender/SDNARead.hpp" #include "hecl/Blender/SDNARead.hpp"
#include "athena/FileReader.hpp"
#include <cstring>
#include <string>
#include "hecl/hecl.hpp"
#include <athena/FileReader.hpp>
#include <athena/MemoryReader.hpp>
#include <zlib.h> #include <zlib.h>
namespace hecl::blender { namespace hecl::blender {
@ -69,7 +77,7 @@ SDNARead::SDNARead(SystemStringView path) {
atUint64 length = r.length(); atUint64 length = r.length();
char magicBuf[7]; char magicBuf[7];
r.readUBytesToBuf(magicBuf, 7); r.readUBytesToBuf(magicBuf, 7);
r.seek(0, athena::Begin); r.seek(0, athena::SeekOrigin::Begin);
if (strncmp(magicBuf, "BLENDER", 7)) { if (strncmp(magicBuf, "BLENDER", 7)) {
/* Try gzip decompression */ /* Try gzip decompression */
std::unique_ptr<uint8_t[]> compBuf(new uint8_t[4096]); std::unique_ptr<uint8_t[]> compBuf(new uint8_t[4096]);
@ -161,15 +169,15 @@ BlendType GetBlendType(SystemStringView path) {
r.enumerate( r.enumerate(
[idPropIdx, typeOffset, nameOffset, valOffset, &ret](const FileBlock& block, athena::io::MemoryReader& r) { [idPropIdx, typeOffset, nameOffset, valOffset, &ret](const FileBlock& block, athena::io::MemoryReader& r) {
if (block.type == FOURCC('DATA') && block.sdnaIdx == idPropIdx) { if (block.type == FOURCC('DATA') && block.sdnaIdx == idPropIdx) {
r.seek(typeOffset, athena::Begin); r.seek(typeOffset, athena::SeekOrigin::Begin);
if (r.readUByte() != 1) if (r.readUByte() != 1)
return true; return true;
r.seek(nameOffset, athena::Begin); r.seek(nameOffset, athena::SeekOrigin::Begin);
if (r.readString() != "hecl_type") if (r.readString() != "hecl_type")
return true; return true;
r.seek(valOffset, athena::Begin); r.seek(valOffset, athena::SeekOrigin::Begin);
ret = BlendType(r.readUint32Little()); ret = BlendType(r.readUint32Little());
return false; return false;
} }

View File

@ -1,10 +1,11 @@
#include "hecl/hecl.hpp" #include "hecl/CVar.hpp"
#include "hecl/CVar.hpp"
#include <sstream>
#include "hecl/CVarManager.hpp" #include "hecl/CVarManager.hpp"
#include "hecl/hecl.hpp"
#include <athena/Utility.hpp> #include <athena/Utility.hpp>
#include <algorithm>
#include <sstream>
namespace hecl { namespace hecl {
extern CVar* com_developer; extern CVar* com_developer;
@ -12,111 +13,70 @@ extern CVar* com_enableCheats;
using namespace std::literals; using namespace std::literals;
CVar::CVar(std::string_view name, std::string_view value, std::string_view help, EType type, EFlags flags, CVar::CVar(std::string_view name, std::string_view value, std::string_view help, CVar::EFlags flags)
CVarManager& parent) : CVar(name, help, EType::Literal) {
: m_mgr(parent) {
m_name = std::string(name);
m_value = std::string(value);
m_defaultValue = std::string(value);
m_help = help;
m_type = type;
m_flags = flags;
}
CVar::CVar(std::string_view name, std::string_view value, std::string_view help, CVar::EFlags flags,
CVarManager& parent)
: m_mgr(parent) {
m_flags = flags;
m_name = std::string(name);
m_help = help;
m_type = EType::Literal;
// Unlock the cvar for writing if readonly
unlock();
fromLiteral(value); fromLiteral(value);
m_defaultValue = m_value; init(flags);
// Lock the cvar
lock();
// Clear the modified flag, just incase lock didn't do it.
m_flags = flags;
} }
CVar::CVar(std::string_view name, const atVec4f& value, std::string_view help, EFlags flags, CVarManager& parent) CVar::CVar(std::string_view name, const atVec2f& value, std::string_view help, EFlags flags)
: m_mgr(parent) { : CVar(name, help, EType::Vec2f) {
m_name = std::string(name); fromVec2f(value);
m_help = help; init(flags);
m_type = EType::Vec4f; }
m_flags = flags;
// Unlock the cvar for writing if readonly CVar::CVar(std::string_view name, const atVec2d& value, std::string_view help, EFlags flags)
unlock(); : CVar(name, help, EType::Vec2d) {
fromVec2d(value);
init(flags);
}
CVar::CVar(std::string_view name, const atVec3f& value, std::string_view help, EFlags flags)
: CVar(name, help, EType::Vec3f) {
fromVec3f(value);
init(flags, false);
}
CVar::CVar(std::string_view name, const atVec3d& value, std::string_view help, EFlags flags)
: CVar(name, help, EType::Vec3d) {
fromVec3d(value);
init(flags, false);
}
CVar::CVar(std::string_view name, const atVec4f& value, std::string_view help, EFlags flags)
: CVar(name, help, EType::Vec4f) {
fromVec4f(value); fromVec4f(value);
m_defaultValue = m_value; init(flags, false);
// Lock the cvar
lock();
// Clear the modified flag, just incase lock didn't do it.
m_flags = flags;
} }
CVar::CVar(std::string_view name, float value, std::string_view help, EFlags flags, CVarManager& parent) CVar::CVar(std::string_view name, const atVec4d& value, std::string_view help, EFlags flags)
: m_mgr(parent) { : CVar(name, help, EType::Vec4d) {
m_name = std::string(name); fromVec4d(value);
m_help = help; init(flags, false);
m_type = EType::Float;
m_flags = flags;
// Unlock the cvar for writing if readonly
unlock();
fromFloat(value);
m_defaultValue = m_value;
// Lock the cvar
lock();
// Clear the modified flag, just incase lock didn't do it.
m_flags = flags;
} }
CVar::CVar(std::string_view name, bool value, std::string_view help, CVar::EFlags flags, CVarManager& parent) CVar::CVar(std::string_view name, double value, std::string_view help, EFlags flags) : CVar(name, help, EType::Real) {
: m_mgr(parent) { fromReal(value);
m_name = std::string(name); init(flags);
m_help = help; }
m_type = EType::Boolean;
m_flags = flags;
// Unlock the cvar for writing if readonly
unlock();
CVar::CVar(std::string_view name, bool value, std::string_view help, CVar::EFlags flags)
: CVar(name, help, EType::Boolean) {
fromBoolean(value); fromBoolean(value);
m_defaultValue = m_value; init(flags);
// Lock the cvar
lock();
// Clear the modified flag, just incase lock didn't do it.
m_flags = flags;
} }
CVar::CVar(std::string_view name, int value, std::string_view help, CVar::EFlags flags, CVarManager& parent) CVar::CVar(std::string_view name, int32_t value, std::string_view help, CVar::EFlags flags)
: m_mgr(parent) { : CVar(name, help, EType::Signed) {
m_name = std::string(name);
m_help = help;
m_type = EType::Integer;
m_flags = flags;
// Unlock the cvar for writing if readonly
unlock();
fromInteger(value); fromInteger(value);
m_defaultValue = m_value; init(flags);
}
// Lock the cvar CVar::CVar(std::string_view name, uint32_t value, std::string_view help, CVar::EFlags flags)
lock(); : CVar(name, help, EType::Unsigned) {
// Clear the modified flag, just incase lock didn't do it. fromInteger(value);
m_flags = flags; init(flags);
} }
std::string CVar::help() const { std::string CVar::help() const {
@ -124,6 +84,82 @@ std::string CVar::help() const {
(isReadOnly() ? " [ReadOnly]" : "")); (isReadOnly() ? " [ReadOnly]" : ""));
} }
atVec2f CVar::toVec2f(bool* isValid) const {
if (m_type != EType::Vec2f) {
if (isValid != nullptr)
*isValid = false;
return atVec2f{};
}
if (isValid != nullptr)
*isValid = true;
atVec2f vec{};
athena::simd_floats f;
std::sscanf(m_value.c_str(), "%g %g", &f[0], &f[1]);
vec.simd.copy_from(f);
return vec;
}
atVec2d CVar::toVec2d(bool* isValid) const {
if (m_type != EType::Vec2d) {
if (isValid != nullptr)
*isValid = false;
return atVec2d{};
}
if (isValid != nullptr)
*isValid = true;
atVec2d vec{};
athena::simd_doubles f;
std::sscanf(m_value.c_str(), "%lg %lg", &f[0], &f[1]);
vec.simd.copy_from(f);
return vec;
}
atVec3f CVar::toVec3f(bool* isValid) const {
if (m_type != EType::Vec3f) {
if (isValid != nullptr)
*isValid = false;
return atVec3f{};
}
if (isValid != nullptr)
*isValid = true;
atVec3f vec{};
athena::simd_floats f;
std::sscanf(m_value.c_str(), "%g %g %g", &f[0], &f[1], &f[2]);
vec.simd.copy_from(f);
return vec;
}
atVec3d CVar::toVec3d(bool* isValid) const {
if (m_type != EType::Vec3d) {
if (isValid != nullptr)
*isValid = false;
return atVec3d{};
}
if (isValid != nullptr)
*isValid = true;
atVec3d vec{};
athena::simd_doubles f;
std::sscanf(m_value.c_str(), "%lg %lg %lg", &f[0], &f[1], &f[2]);
vec.simd.copy_from(f);
return vec;
}
atVec4f CVar::toVec4f(bool* isValid) const { atVec4f CVar::toVec4f(bool* isValid) const {
if (m_type != EType::Vec4f) { if (m_type != EType::Vec4f) {
if (isValid != nullptr) if (isValid != nullptr)
@ -135,22 +171,44 @@ atVec4f CVar::toVec4f(bool* isValid) const {
if (isValid != nullptr) if (isValid != nullptr)
*isValid = true; *isValid = true;
atVec4f vec; atVec4f vec{};
athena::simd_floats f; athena::simd_floats f;
std::sscanf(m_value.c_str(), "%f %f %f %f", &f[0], &f[1], &f[2], &f[3]); std::sscanf(m_value.c_str(), "%g %g %g %g", &f[0], &f[1], &f[2], &f[3]);
vec.simd.copy_from(f); vec.simd.copy_from(f);
return vec; return vec;
} }
float CVar::toFloat(bool* isValid) const { atVec4d CVar::toVec4d(bool* isValid) const {
if (m_type != EType::Float) { if (m_type != EType::Vec4d) {
if (isValid != nullptr)
*isValid = false;
return atVec4d{};
}
if (isValid != nullptr)
*isValid = true;
atVec4d vec{};
athena::simd_doubles f;
std::sscanf(m_value.c_str(), "%lg %lg %lg %lg", &f[0], &f[1], &f[2], &f[3]);
vec.simd.copy_from(f);
return vec;
}
double CVar::toReal(bool* isValid) const {
if (m_type != EType::Real) {
if (isValid) if (isValid)
*isValid = false; *isValid = false;
return 0.0f; return 0.0f;
} }
return strtof(m_value.c_str(), nullptr); if (isValid != nullptr)
*isValid = true;
return strtod(m_value.c_str(), nullptr);
} }
bool CVar::toBoolean(bool* isValid) const { bool CVar::toBoolean(bool* isValid) const {
@ -161,36 +219,38 @@ bool CVar::toBoolean(bool* isValid) const {
return false; return false;
} }
// We don't want to modify the original value; if (isValid != nullptr)
std::string tmp = m_value;
athena::utility::tolower(tmp);
if (tmp == "yes" || tmp == "true" || tmp == "1") {
if (isValid)
*isValid = true; *isValid = true;
return true;
} else if (tmp == "no" || tmp == "false" || tmp == "0") {
if (isValid)
*isValid = true;
return false;
}
if (isValid) return athena::utility::parseBool(m_value);
*isValid = false;
return false;
} }
int CVar::toInteger(bool* isValid) const { int32_t CVar::toSigned(bool* isValid) const {
if (m_type != EType::Integer) { if (m_type != EType::Signed && m_type != EType::Unsigned) {
if (isValid) if (isValid)
*isValid = false; *isValid = false;
return 0; return 0;
} }
if (isValid != nullptr)
*isValid = true;
return strtol(m_value.c_str(), nullptr, 0); return strtol(m_value.c_str(), nullptr, 0);
} }
uint32_t CVar::toUnsigned(bool* isValid) const {
if (m_type != EType::Signed && m_type != EType::Unsigned) {
if (isValid)
*isValid = false;
return 0;
}
if (isValid != nullptr)
*isValid = true;
return strtoul(m_value.c_str(), nullptr, 0);
}
std::string CVar::toLiteral(bool* isValid) const { std::string CVar::toLiteral(bool* isValid) const {
if (m_type != EType::Literal && (com_developer && com_developer->toBoolean())) { if (m_type != EType::Literal && (com_developer && com_developer->toBoolean())) {
if (isValid != nullptr) if (isValid != nullptr)
@ -215,16 +275,48 @@ std::wstring CVar::toWideLiteral(bool* isValid) const {
return hecl::UTF8ToWide(m_value); return hecl::UTF8ToWide(m_value);
} }
bool CVar::fromVec2f(const atVec2f& val) {
if (!safeToModify(EType::Vec2f))
return false;
athena::simd_floats f(val.simd);
m_value.assign(fmt::format(fmt("{} {}"), f[0], f[1]));
m_flags |= EFlags::Modified;
return true;
}
bool CVar::fromVec2d(const atVec2d& val) {
if (!safeToModify(EType::Vec2d))
return false;
athena::simd_doubles f(val.simd);
m_value.assign(fmt::format(fmt("{} {}"), f[0], f[1]));
m_flags |= EFlags::Modified;
return true;
}
bool CVar::fromVec3f(const atVec3f& val) {
if (!safeToModify(EType::Vec3f))
return false;
athena::simd_floats f(val.simd);
m_value.assign(fmt::format(fmt("{} {} {}"), f[0], f[1], f[2]));
m_flags |= EFlags::Modified;
return true;
}
bool CVar::fromVec3d(const atVec3d& val) {
if (!safeToModify(EType::Vec3d))
return false;
athena::simd_doubles f(val.simd);
m_value.assign(fmt::format(fmt("{} {} {}"), f[0], f[1], f[2]));
m_flags |= EFlags::Modified;
return true;
}
bool CVar::fromVec4f(const atVec4f& val) { bool CVar::fromVec4f(const atVec4f& val) {
if (isCheat() && (com_developer && !com_developer->toBoolean() && !com_enableCheats->toBoolean())) if (!safeToModify(EType::Vec4f))
return false;
else if (isCheat())
return false;
if (m_type != EType::Vec4f)
return false;
if (isReadOnly() && (com_developer && !com_developer->toBoolean()))
return false; return false;
athena::simd_floats f(val.simd); athena::simd_floats f(val.simd);
@ -233,16 +325,18 @@ bool CVar::fromVec4f(const atVec4f& val) {
return true; return true;
} }
bool CVar::fromFloat(float val) { bool CVar::fromVec4d(const atVec4d& val) {
if (isCheat() && (com_developer && !com_developer->toBoolean() && !com_enableCheats->toBoolean())) if (!safeToModify(EType::Vec4d))
return false;
else if (isCheat())
return false; return false;
if (m_type != EType::Float) athena::simd_doubles f(val.simd);
return false; m_value.assign(fmt::format(fmt("{} {} {} {}"), f[0], f[1], f[2], f[3]));
m_flags |= EFlags::Modified;
return true;
}
if (isReadOnly() && (com_developer && !com_developer->toBoolean())) bool CVar::fromReal(double val) {
if (!safeToModify(EType::Real))
return false; return false;
m_value.assign(fmt::format(fmt("{}"), val)); m_value.assign(fmt::format(fmt("{}"), val));
@ -251,15 +345,7 @@ bool CVar::fromFloat(float val) {
} }
bool CVar::fromBoolean(bool val) { bool CVar::fromBoolean(bool val) {
if (isCheat() && (com_developer && !com_developer->toBoolean() && !com_enableCheats->toBoolean())) if (!safeToModify(EType::Boolean))
return false;
else if (isCheat())
return false;
if (m_type != EType::Boolean)
return false;
if (isReadOnly() && (com_developer && !com_developer->toBoolean()))
return false; return false;
if (val) if (val)
@ -271,33 +357,44 @@ bool CVar::fromBoolean(bool val) {
return true; return true;
} }
bool CVar::fromInteger(int val) { bool CVar::fromInteger(int32_t val) {
if (isCheat() && (com_developer && !com_developer->toBoolean() && !com_enableCheats->toBoolean())) if ((com_developer && com_enableCheats) && (!com_developer->toBoolean() || !com_enableCheats->toBoolean()) &&
return false; isCheat())
else if (isCheat())
return false; return false;
if (m_type != EType::Integer) // We'll accept both signed an unsigned input
if (m_type != EType::Signed && m_type != EType::Unsigned)
return false; return false;
if (isReadOnly() && (com_developer && !com_developer->toBoolean())) if (isReadOnly() && (com_developer && !com_developer->toBoolean()))
return false; return false;
m_value = fmt::format(fmt("{}"), val); // Properly format based on signedness
m_value = fmt::format(fmt("{}"), (m_type == EType::Signed ? val : static_cast<uint32_t>(val)));
setModified();
return true;
}
bool CVar::fromInteger(uint32_t val) {
if ((com_developer && com_enableCheats) && (!com_developer->toBoolean() || !com_enableCheats->toBoolean()) &&
isCheat())
return false;
// We'll accept both signed an unsigned input
if (m_type != EType::Signed && m_type != EType::Unsigned)
return false;
if (isReadOnly() && (com_developer && !com_developer->toBoolean()))
return false;
// Properly format based on signedness
m_value = fmt::format(fmt("{}"), (m_type == EType::Unsigned ? val : static_cast<int32_t>(val)));
setModified(); setModified();
return true; return true;
} }
bool CVar::fromLiteral(std::string_view val) { bool CVar::fromLiteral(std::string_view val) {
if (isCheat() && (com_developer && !com_developer->toBoolean() && !com_enableCheats->toBoolean())) if (!safeToModify(EType::Literal))
return false;
else if (isCheat())
return false;
if (m_type != EType::Literal)
return false;
if (isReadOnly() && (com_developer && !com_developer->toBoolean()))
return false; return false;
m_value.assign(val); m_value.assign(val);
@ -306,15 +403,7 @@ bool CVar::fromLiteral(std::string_view val) {
} }
bool CVar::fromLiteral(std::wstring_view val) { bool CVar::fromLiteral(std::wstring_view val) {
if (isCheat() && (com_developer && !com_developer->toBoolean() && !com_enableCheats->toBoolean())) if (!safeToModify(EType::Literal))
return false;
else if (isCheat())
return false;
if (m_type != EType::Literal)
return false;
if (isReadOnly() && (com_developer && !com_developer->toBoolean()))
return false; return false;
m_value.assign(hecl::WideToUTF8(val)); m_value.assign(hecl::WideToUTF8(val));
@ -322,94 +411,37 @@ bool CVar::fromLiteral(std::wstring_view val) {
return true; return true;
} }
bool CVar::fromLiteralToType(std::string_view val, bool setDefault) { bool CVar::fromLiteralToType(std::string_view val) {
switch (m_type) { if (!safeToModify(m_type) || !isValidInput(val))
case EType::Literal:
return fromLiteral(val);
case EType::Boolean: {
std::stringstream ss;
ss << std::boolalpha << val;
bool v;
ss >> v;
return fromBoolean(v);
}
case EType::Float: {
std::stringstream ss;
ss << val;
float v;
ss >> v;
return fromFloat(v);
}
case EType::Integer: {
std::stringstream ss;
ss << val;
int v;
ss >> v;
return fromInteger(v);
}
case EType::Vec4f: {
atVec4f vec;
athena::simd_floats f;
std::sscanf(val.data(), "%f %f %f %f", &f[0], &f[1], &f[2], &f[3]);
vec.simd.copy_from(f);
return fromVec4f(vec);
}
}
if (setDefault)
m_value = m_defaultValue;
return false; return false;
m_value = val;
setModified();
return true;
} }
bool CVar::fromLiteralToType(std::wstring_view val, bool setDefault) { bool CVar::fromLiteralToType(std::wstring_view val) {
switch (m_type) { return fromLiteralToType(hecl::WideToUTF8(val));
case EType::Literal:
return fromLiteral(val);
case EType::Boolean: {
std::wstringstream ss;
ss << std::boolalpha << val;
bool v;
ss >> v;
return fromBoolean(v);
}
case EType::Float: {
std::wstringstream ss;
ss << val;
float v;
ss >> v;
return fromFloat(v);
}
case EType::Integer: {
std::wstringstream ss;
ss << val;
int v;
ss >> v;
return fromInteger(v);
}
case EType::Vec4f: {
atVec4f vec;
athena::simd_floats f;
std::swscanf(val.data(), L"%f %f %f %f", &f[0], &f[1], &f[2], &f[3]);
vec.simd.copy_from(f);
return fromVec4f(vec);
}
}
if (setDefault)
m_value = m_defaultValue;
return false;
} }
bool CVar::isModified() const { return int(m_flags & EFlags::Modified) != 0; } bool CVar::isModified() const { return True(m_flags & EFlags::Modified); }
bool CVar::modificationRequiresRestart() const { return int(m_flags & EFlags::ModifyRestart) != 0; } bool CVar::modificationRequiresRestart() const { return True(m_flags & EFlags::ModifyRestart); }
bool CVar::isReadOnly() const { return int(m_flags & EFlags::ReadOnly) != 0; } bool CVar::isReadOnly() const { return True(m_flags & EFlags::ReadOnly); }
bool CVar::isCheat() const { return int(m_flags & EFlags::Cheat) != 0; } bool CVar::isCheat() const { return True(m_flags & EFlags::Cheat); }
bool CVar::isHidden() const { return int(m_flags & EFlags::Hidden) != 0; } bool CVar::isHidden() const { return True(m_flags & EFlags::Hidden); }
bool CVar::isArchive() const { return int(m_flags & EFlags::Archive) != 0; } bool CVar::isArchive() const { return True(m_flags & EFlags::Archive); }
bool CVar::isInternalArchivable() const { return int(m_flags & EFlags::InternalArchivable) != 0; } bool CVar::isInternalArchivable() const { return True(m_flags & EFlags::InternalArchivable); }
bool CVar::isColor() const {
return True(m_flags & EFlags::Color) &&
(m_type == EType::Vec3f || m_type == EType::Vec3d || m_type == EType::Vec3f || m_type == EType::Vec4d);
}
bool CVar::isNoDeveloper() const { return True(m_flags & EFlags::NoDeveloper); }
bool CVar::wasDeserialized() const { return m_wasDeserialized; } bool CVar::wasDeserialized() const { return m_wasDeserialized; }
@ -441,4 +473,85 @@ void CVar::dispatch() {
for (const ListenerFunc& listen : m_listeners) for (const ListenerFunc& listen : m_listeners)
listen(this); listen(this);
} }
bool isReal(std::string_view v) {
char* p;
std::strtod(v.data(), &p);
return *p == 0;
}
bool isReal(const std::vector<std::string>& v) {
for (auto& s : v) {
if (!isReal(s))
return false;
}
return true;
}
bool CVar::isValidInput(std::string_view input) const {
std::vector<std::string> parts = athena::utility::split(input, ' ');
char* p;
switch(m_type) {
case EType::Boolean: {
bool valid = false;
athena::utility::parseBool(input, &valid);
return valid;
}
case EType::Signed:
std::strtol(input.data(), &p, 0);
return p == nullptr;
case EType::Unsigned:
std::strtoul(input.data(), &p, 0);
return p == nullptr;
case EType::Real: {
bool size = parts.size() == 1;
bool ret = isReal(input);
return ret && size;
}
case EType::Literal:
return true;
case EType::Vec2f:
case EType::Vec2d:
return parts.size() == 2 && isReal(parts);
case EType::Vec3f:
case EType::Vec3d:
return parts.size() == 3 && isReal(parts);
case EType::Vec4f:
case EType::Vec4d:
return parts.size() == 4 && isReal(parts);
}
return false;
}
bool CVar::isValidInput(std::wstring_view input) const {
return isValidInput(hecl::WideToUTF8(input));
}
bool CVar::safeToModify(EType type) const {
// Are we NoDevelper?
if (isNoDeveloper())
return false;
// Are we a cheat?
if (isCheat() && (com_developer && com_enableCheats) &&
(!com_developer->toBoolean() || !com_enableCheats->toBoolean()))
return false;
// Are we read only?
if (isReadOnly() && (com_developer && !com_developer->toBoolean()))
return false;
return m_type == type;
}
void CVar::init(EFlags flags, bool removeColor) {
m_defaultValue = m_value;
m_flags = flags;
if (removeColor) {
// If the user specifies color, we don't want it
m_flags &= ~EFlags::Color;
}
}
} // namespace hecl } // namespace hecl

View File

@ -1,13 +1,16 @@
#include "hecl/CVarManager.hpp" #include "hecl/CVarManager.hpp"
#include "hecl/Console.hpp"
#include <athena/FileWriter.hpp>
#include <athena/Utility.hpp>
#include <hecl/Runtime.hpp>
#include <hecl/hecl.hpp>
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include <regex> #include <regex>
#include "hecl/Console.hpp"
#include "hecl/hecl.hpp"
#include "hecl/Runtime.hpp"
#include <athena/FileWriter.hpp>
#include <athena/Utility.hpp>
namespace hecl { namespace hecl {
CVar* com_developer = nullptr; CVar* com_developer = nullptr;
@ -22,7 +25,9 @@ static logvisor::Module CVarLog("CVarManager");
CVarManager::CVarManager(hecl::Runtime::FileStoreManager& store, bool useBinary) CVarManager::CVarManager(hecl::Runtime::FileStoreManager& store, bool useBinary)
: m_store(store), m_useBinary(useBinary) { : m_store(store), m_useBinary(useBinary) {
m_instance = this; m_instance = this;
com_configfile = newCVar("config", "File to store configuration", std::string("config"), CVar::EFlags::System); com_configfile =
newCVar("config", "File to store configuration", std::string("config"),
CVar::EFlags::System | CVar::EFlags::ReadOnly | CVar::EFlags::NoDeveloper | CVar::EFlags::Hidden);
com_developer = newCVar("developer", "Enables developer mode", false, com_developer = newCVar("developer", "Enables developer mode", false,
(CVar::EFlags::System | CVar::EFlags::ReadOnly | CVar::EFlags::InternalArchivable)); (CVar::EFlags::System | CVar::EFlags::ReadOnly | CVar::EFlags::InternalArchivable));
com_enableCheats = newCVar( com_enableCheats = newCVar(
@ -69,14 +74,15 @@ std::vector<CVar*> CVarManager::archivedCVars() const {
std::vector<CVar*> CVarManager::cvars(CVar::EFlags filter) const { std::vector<CVar*> CVarManager::cvars(CVar::EFlags filter) const {
std::vector<CVar*> ret; std::vector<CVar*> ret;
for (const auto& pair : m_cvars) for (const auto& pair : m_cvars)
if (filter == CVar::EFlags::None || (pair.second->flags() & filter) != 0) if (filter == CVar::EFlags::Any || True(pair.second->flags() & filter))
ret.push_back(pair.second.get()); ret.push_back(pair.second.get());
return ret; return ret;
} }
void CVarManager::deserialize(CVar* cvar) { void CVarManager::deserialize(CVar* cvar) {
if (!cvar) /* Make sure we're not trying to deserialize a CVar that is invalid or not exposed */
if (!cvar || (!cvar->isArchive() && !cvar->isInternalArchivable()))
return; return;
/* First let's check for a deferred value */ /* First let's check for a deferred value */
@ -90,9 +96,6 @@ void CVarManager::deserialize(CVar* cvar) {
} }
/* We were either unable to find a deferred value or got an invalid value */ /* We were either unable to find a deferred value or got an invalid value */
if (!cvar->isArchive() && !cvar->isInternalArchivable())
return;
#if _WIN32 #if _WIN32
hecl::SystemString filename = hecl::SystemString filename =
hecl::SystemString(m_store.getStoreRoot()) + _SYS_STR('/') + com_configfile->toWideLiteral(); hecl::SystemString(m_store.getStoreRoot()) + _SYS_STR('/') + com_configfile->toWideLiteral();
@ -119,10 +122,9 @@ void CVarManager::deserialize(CVar* cvar) {
DNACVAR::CVar& tmp = *serialized; DNACVAR::CVar& tmp = *serialized;
if (cvar->m_value != tmp.m_value) { if (cvar->m_value != tmp.m_value) {
cvar->unlock(); CVarUnlocker lc(cvar);
cvar->fromLiteralToType(tmp.m_value, true); cvar->fromLiteralToType(tmp.m_value);
cvar->m_wasDeserialized = true; cvar->m_wasDeserialized = true;
cvar->lock();
} }
} }
} }
@ -142,10 +144,9 @@ void CVarManager::deserialize(CVar* cvar) {
const std::unique_ptr<athena::io::YAMLNode>& tmp = serialized->second; const std::unique_ptr<athena::io::YAMLNode>& tmp = serialized->second;
if (cvar->m_value != tmp->m_scalarString) { if (cvar->m_value != tmp->m_scalarString) {
cvar->unlock(); CVarUnlocker lc(cvar);
cvar->fromLiteralToType(tmp->m_scalarString, true); cvar->fromLiteralToType(tmp->m_scalarString);
cvar->m_wasDeserialized = true; cvar->m_wasDeserialized = true;
cvar->lock();
} }
} }
} }
@ -326,5 +327,14 @@ void CVarManager::restoreDeveloper(bool oldDeveloper) {
CVarUnlocker unlock(com_developer); CVarUnlocker unlock(com_developer);
com_developer->fromBoolean(oldDeveloper); com_developer->fromBoolean(oldDeveloper);
} }
void CVarManager::proc() {
for (const auto& [name, cvar] : m_cvars) {
if (cvar->isModified() && !cvar->modificationRequiresRestart()) {
cvar->dispatch();
// Clear the modified flag now that we've informed everyone we've changed
cvar->clearModified();
}
}
}
} // namespace hecl } // namespace hecl

View File

@ -1,9 +1,14 @@
#include "hecl/ClientProcess.hpp" #include "hecl/ClientProcess.hpp"
#include "hecl/Database.hpp"
#include "athena/FileReader.hpp" #include <algorithm>
#include "hecl/Blender/Connection.hpp" #include "hecl/Blender/Connection.hpp"
#include "hecl/Database.hpp"
#include "hecl/MultiProgressPrinter.hpp" #include "hecl/MultiProgressPrinter.hpp"
#include "boo/IApplication.hpp"
#include <athena/FileReader.hpp>
#include <boo/IApplication.hpp>
#include <logvisor/logvisor.hpp>
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -63,7 +68,7 @@ void ClientProcess::BufferTransaction::run(blender::Token& btok) {
return; return;
} }
if (m_offset) if (m_offset)
r.seek(m_offset, athena::Begin); r.seek(m_offset, athena::SeekOrigin::Begin);
r.readBytesToBuf(m_targetBuf, m_maxLen); r.readBytesToBuf(m_targetBuf, m_maxLen);
m_complete = true; m_complete = true;
} }

View File

@ -1,4 +1,8 @@
#include "hecl/Compilers.hpp" #include "hecl/Compilers.hpp"
#include <cstring>
#include <utility>
#include <boo/graphicsdev/GLSLMacros.hpp> #include <boo/graphicsdev/GLSLMacros.hpp>
#include <logvisor/logvisor.hpp> #include <logvisor/logvisor.hpp>

View File

@ -1,12 +1,18 @@
#include <hecl/Console.hpp> #include <hecl/Console.hpp>
#include "hecl/Console.hpp" #include <cstdio>
#include "hecl/CVarManager.hpp" #include <functional>
#include <string>
#include <vector>
#include "hecl/CVar.hpp" #include "hecl/CVar.hpp"
#include "hecl/CVarManager.hpp"
#include "hecl/hecl.hpp" #include "hecl/hecl.hpp"
#include "boo/graphicsdev/IGraphicsCommandQueue.hpp"
#include "athena/Utility.hpp" #include <athena/Utility.hpp>
#include <boo/IWindow.hpp>
#include <boo/graphicsdev/IGraphicsCommandQueue.hpp>
#include <logvisor/logvisor.hpp>
namespace hecl { namespace hecl {
Console* Console::m_instance = nullptr; Console* Console::m_instance = nullptr;
@ -168,13 +174,11 @@ void Console::init(boo::IWindow* window) {
void Console::proc() { void Console::proc() {
if (m_conHeight->isModified()) { if (m_conHeight->isModified()) {
m_cachedConHeight = m_conHeight->toFloat(); m_cachedConHeight = m_conHeight->toReal();
m_conHeight->clearModified();
} }
if (m_conSpeed->isModified()) { if (m_conSpeed->isModified()) {
m_cachedConSpeed = m_conSpeed->toFloat(); m_cachedConSpeed = m_conSpeed->toReal();
m_conSpeed->clearModified();
} }
if (m_state == State::Opened) { if (m_state == State::Opened) {

View File

@ -1,5 +1,10 @@
#include "hecl/MultiProgressPrinter.hpp" #include "hecl/MultiProgressPrinter.hpp"
#include <algorithm>
#include <cstdio>
#include "hecl/hecl.hpp"
#define BOLD "\033[1m" #define BOLD "\033[1m"
#define NORMAL "\033[0m" #define NORMAL "\033[0m"
#define PREV_LINE "\r\033[{:d}A" #define PREV_LINE "\r\033[{:d}A"

View File

@ -1,5 +1,6 @@
#include "hecl/Pipeline.hpp" #include "hecl/Pipeline.hpp"
#include "athena/FileReader.hpp"
#include <athena/FileReader.hpp>
#include <zlib.h> #include <zlib.h>
namespace hecl { namespace hecl {

View File

@ -2,6 +2,7 @@
#include <cerrno> #include <cerrno>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <string>
#include <system_error> #include <system_error>
#if _WIN32 #if _WIN32
@ -9,11 +10,13 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "hecl/ClientProcess.hpp"
#include "hecl/Database.hpp" #include "hecl/Database.hpp"
#include "hecl/Blender/Connection.hpp" #include "hecl/Blender/Connection.hpp"
#include "hecl/ClientProcess.hpp"
#include "hecl/MultiProgressPrinter.hpp" #include "hecl/MultiProgressPrinter.hpp"
#include <logvisor/logvisor.hpp>
namespace hecl::Database { namespace hecl::Database {
logvisor::Module LogModule("hecl::Database"); logvisor::Module LogModule("hecl::Database");

View File

@ -1,7 +1,10 @@
#include "hecl/hecl.hpp" #include "hecl/hecl.hpp"
#include "hecl/Database.hpp"
#include <regex> #include <regex>
#include "hecl/Database.hpp"
#include "hecl/FourCC.hpp"
namespace hecl { namespace hecl {
static const SystemRegex regPATHCOMP(_SYS_STR("[/\\\\]*([^/\\\\]+)"), SystemRegex::ECMAScript | SystemRegex::optimize); static const SystemRegex regPATHCOMP(_SYS_STR("[/\\\\]*([^/\\\\]+)"), SystemRegex::ECMAScript | SystemRegex::optimize);
static const SystemRegex regDRIVELETTER(_SYS_STR("^([^/]*)/"), SystemRegex::ECMAScript | SystemRegex::optimize); static const SystemRegex regDRIVELETTER(_SYS_STR("^([^/]*)/"), SystemRegex::ECMAScript | SystemRegex::optimize);

View File

@ -1,5 +1,9 @@
#include "hecl/Runtime.hpp" #include "hecl/Runtime.hpp"
#include "logvisor/logvisor.hpp"
#include "hecl/hecl.hpp"
#include <logvisor/logvisor.hpp>
#if _WIN32 #if _WIN32
#include <ShlObj.h> #include <ShlObj.h>
#endif #endif

View File

@ -1,6 +1,9 @@
#include "hecl/HMDLMeta.hpp" #include "hecl/HMDLMeta.hpp"
#include "hecl/Runtime.hpp" #include "hecl/Runtime.hpp"
#include <athena/MemoryReader.hpp> #include <athena/MemoryReader.hpp>
#include <logvisor/logvisor.hpp>
namespace hecl::Runtime { namespace hecl::Runtime {
static logvisor::Module HMDL_Log("HMDL"); static logvisor::Module HMDL_Log("HMDL");

View File

@ -1,5 +1,5 @@
#include <logvisor/logvisor.hpp>
#include <utf8proc.h> #include <utf8proc.h>
#include "hecl/hecl.hpp"
namespace hecl { namespace hecl {
static logvisor::Module Log("hecl-wsconv"); static logvisor::Module Log("hecl-wsconv");