mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-04 12:35:52 +00:00
Merge branch 'master' of ssh://git.axiodl.com:6431/AxioDL/hecl
This commit is contained in:
commit
9bb45dae80
@ -260,7 +260,7 @@ public:
|
|||||||
std::vector<std::string>& lockAndRead();
|
std::vector<std::string>& lockAndRead();
|
||||||
void addLine(std::string_view line);
|
void addLine(std::string_view line);
|
||||||
void removeLine(std::string_view refLine);
|
void removeLine(std::string_view refLine);
|
||||||
bool checkForLine(std::string_view refLine);
|
bool checkForLine(std::string_view refLine) const;
|
||||||
void unlockAndDiscard();
|
void unlockAndDiscard();
|
||||||
bool unlockAndCommit();
|
bool unlockAndCommit();
|
||||||
};
|
};
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
constexpr DNAFourCC(const FourCC& other) noexcept : FourCC(other) {}
|
constexpr DNAFourCC(const FourCC& other) noexcept : FourCC(other) {}
|
||||||
constexpr DNAFourCC(const char* name) noexcept : FourCC(name) {}
|
constexpr DNAFourCC(const char* name) noexcept : FourCC(name) {}
|
||||||
constexpr DNAFourCC(uint32_t n) noexcept : FourCC(n) {}
|
constexpr DNAFourCC(uint32_t n) noexcept : FourCC(n) {}
|
||||||
constexpr DNAFourCC(athena::io::IStreamReader& r) { read(r); }
|
DNAFourCC(athena::io::IStreamReader& r) { read(r); }
|
||||||
AT_DECL_EXPLICIT_DNA_YAML
|
AT_DECL_EXPLICIT_DNA_YAML
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
|
@ -129,14 +129,14 @@ public:
|
|||||||
Token() = default;
|
Token() = default;
|
||||||
Token(const Token& other) = delete;
|
Token(const Token& other) = delete;
|
||||||
Token& operator=(const Token& other) = delete;
|
Token& operator=(const Token& other) = delete;
|
||||||
Token& operator=(Token&& other) {
|
Token& operator=(Token&& other) noexcept {
|
||||||
m_pool = other.m_pool;
|
m_pool = other.m_pool;
|
||||||
m_index = other.m_index;
|
m_index = other.m_index;
|
||||||
m_div = other.m_div;
|
m_div = other.m_div;
|
||||||
other.m_index = -1;
|
other.m_index = -1;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
Token(Token&& other) : m_pool(other.m_pool), m_index(other.m_index), m_div(other.m_div) { other.m_index = -1; }
|
Token(Token&& other) noexcept : m_pool(other.m_pool), m_index(other.m_index), m_div(other.m_div) { other.m_index = -1; }
|
||||||
|
|
||||||
~Token() {
|
~Token() {
|
||||||
if (m_index != -1) {
|
if (m_index != -1) {
|
||||||
|
@ -132,7 +132,7 @@ public:
|
|||||||
Token() = default;
|
Token() = default;
|
||||||
Token(const Token& other) = delete;
|
Token(const Token& other) = delete;
|
||||||
Token& operator=(const Token& other) = delete;
|
Token& operator=(const Token& other) = delete;
|
||||||
Token& operator=(Token&& other) {
|
Token& operator=(Token&& other) noexcept {
|
||||||
m_pool = other.m_pool;
|
m_pool = other.m_pool;
|
||||||
m_index = other.m_index;
|
m_index = other.m_index;
|
||||||
m_count = other.m_count;
|
m_count = other.m_count;
|
||||||
@ -140,7 +140,7 @@ public:
|
|||||||
other.m_index = -1;
|
other.m_index = -1;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
Token(Token&& other) : m_pool(other.m_pool), m_index(other.m_index), m_count(other.m_count), m_div(other.m_div) {
|
Token(Token&& other) noexcept : m_pool(other.m_pool), m_index(other.m_index), m_count(other.m_count), m_div(other.m_div) {
|
||||||
other.m_index = -1;
|
other.m_index = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,20 +485,20 @@ class Time final {
|
|||||||
time_t ts;
|
time_t ts;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Time() : ts(time(NULL)) {}
|
Time() : ts(std::time(nullptr)) {}
|
||||||
Time(time_t ti) : ts(ti) {}
|
constexpr Time(time_t ti) noexcept : ts{ti} {}
|
||||||
Time(const Time& other) { ts = other.ts; }
|
constexpr Time(const Time& other) noexcept : ts{other.ts} {}
|
||||||
time_t getTs() const { return ts; }
|
[[nodiscard]] constexpr time_t getTs() const { return ts; }
|
||||||
Time& operator=(const Time& other) {
|
constexpr Time& operator=(const Time& other) noexcept {
|
||||||
ts = other.ts;
|
ts = other.ts;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
bool operator==(const Time& other) const { return ts == other.ts; }
|
[[nodiscard]] constexpr bool operator==(const Time& other) const noexcept { return ts == other.ts; }
|
||||||
bool operator!=(const Time& other) const { return ts != other.ts; }
|
[[nodiscard]] constexpr bool operator!=(const Time& other) const noexcept { return ts != other.ts; }
|
||||||
bool operator<(const Time& other) const { return ts < other.ts; }
|
[[nodiscard]] constexpr bool operator<(const Time& other) const noexcept { return ts < other.ts; }
|
||||||
bool operator>(const Time& other) const { return ts > other.ts; }
|
[[nodiscard]] constexpr bool operator>(const Time& other) const noexcept { return ts > other.ts; }
|
||||||
bool operator<=(const Time& other) const { return ts <= other.ts; }
|
[[nodiscard]] constexpr bool operator<=(const Time& other) const noexcept { return ts <= other.ts; }
|
||||||
bool operator>=(const Time& other) const { return ts >= other.ts; }
|
[[nodiscard]] constexpr bool operator>=(const Time& other) const noexcept { return ts >= other.ts; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -60,24 +62,27 @@ std::vector<std::string>& Project::ConfigFile::lockAndRead() {
|
|||||||
mainString += std::string(readBuf, readSz);
|
mainString += std::string(readBuf, readSz);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string::const_iterator begin = mainString.begin();
|
auto begin = mainString.cbegin();
|
||||||
std::string::const_iterator end = mainString.begin();
|
auto end = mainString.cbegin();
|
||||||
|
|
||||||
m_lines.clear();
|
m_lines.clear();
|
||||||
while (end != mainString.end()) {
|
while (end != mainString.end()) {
|
||||||
std::string::const_iterator origEnd = end;
|
auto origEnd = end;
|
||||||
if (*end == '\0')
|
if (*end == '\0') {
|
||||||
break;
|
break;
|
||||||
else if (CheckNewLineAdvance(end)) {
|
}
|
||||||
if (begin != origEnd)
|
if (CheckNewLineAdvance(end)) {
|
||||||
m_lines.push_back(std::string(begin, origEnd));
|
if (begin != origEnd) {
|
||||||
|
m_lines.emplace_back(begin, origEnd);
|
||||||
|
}
|
||||||
begin = end;
|
begin = end;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
++end;
|
++end;
|
||||||
}
|
}
|
||||||
if (begin != end)
|
if (begin != end) {
|
||||||
m_lines.push_back(std::string(begin, end));
|
m_lines.emplace_back(begin, end);
|
||||||
|
}
|
||||||
|
|
||||||
return m_lines;
|
return m_lines;
|
||||||
}
|
}
|
||||||
@ -102,16 +107,13 @@ void Project::ConfigFile::removeLine(std::string_view refLine) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Project::ConfigFile::checkForLine(std::string_view refLine) {
|
bool Project::ConfigFile::checkForLine(std::string_view refLine) const {
|
||||||
if (!m_lockedFile) {
|
if (!m_lockedFile) {
|
||||||
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, fmt("Project::ConfigFile::lockAndRead not yet called"));
|
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, fmt("Project::ConfigFile::lockAndRead not yet called"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const std::string& line : m_lines)
|
return std::any_of(m_lines.cbegin(), m_lines.cend(), [&refLine](const auto& line) { return line == refLine; });
|
||||||
if (line == refLine)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::ConfigFile::unlockAndDiscard() {
|
void Project::ConfigFile::unlockAndDiscard() {
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
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 SystemString CanonRelPath(SystemStringView path) {
|
static SystemString CanonRelPath(SystemStringView path) {
|
||||||
/* Tokenize Path */
|
/* Tokenize Path */
|
||||||
|
@ -11,7 +11,7 @@ static logvisor::Module HMDL_Log("HMDL");
|
|||||||
HMDLData::HMDLData(boo::IGraphicsDataFactory::Context& ctx, const void* metaData, const void* vbo, const void* ibo) {
|
HMDLData::HMDLData(boo::IGraphicsDataFactory::Context& ctx, const void* metaData, const void* vbo, const void* ibo) {
|
||||||
HMDLMeta meta;
|
HMDLMeta meta;
|
||||||
{
|
{
|
||||||
athena::io::MemoryReader r((atUint8*)metaData, HECL_HMDL_META_SZ);
|
athena::io::MemoryReader r(metaData, HECL_HMDL_META_SZ);
|
||||||
meta.read(r);
|
meta.read(r);
|
||||||
}
|
}
|
||||||
if (meta.magic != 'TACO')
|
if (meta.magic != 'TACO')
|
||||||
@ -20,8 +20,8 @@ HMDLData::HMDLData(boo::IGraphicsDataFactory::Context& ctx, const void* metaData
|
|||||||
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, vbo, meta.vertStride, meta.vertCount);
|
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, vbo, meta.vertStride, meta.vertCount);
|
||||||
m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, ibo, 4, meta.indexCount);
|
m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, ibo, 4, meta.indexCount);
|
||||||
|
|
||||||
size_t elemCount = 2 + meta.colorCount + meta.uvCount + meta.weightCount;
|
const size_t elemCount = 2 + meta.colorCount + meta.uvCount + meta.weightCount;
|
||||||
m_vtxFmtData.reset(new boo::VertexElementDescriptor[elemCount]);
|
m_vtxFmtData = std::make_unique<boo::VertexElementDescriptor[]>(elemCount);
|
||||||
|
|
||||||
m_vtxFmtData[0].semantic = boo::VertexSemantic::Position3;
|
m_vtxFmtData[0].semantic = boo::VertexSemantic::Position3;
|
||||||
m_vtxFmtData[1].semantic = boo::VertexSemantic::Normal3;
|
m_vtxFmtData[1].semantic = boo::VertexSemantic::Normal3;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user