From a8fbfcb36199e5114c95479d690519135a57fb3a Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 1 Jul 2015 13:53:05 -1000 Subject: [PATCH] moved retro-specific stuff out of hecl --- hecl/dataspec/dataspec.cpp | 30 --------------------- hecl/dataspec/dataspec.pro | 29 -------------------- hecl/dataspec/hecl/DUMB.hpp | 40 --------------------------- hecl/dataspec/hecl/HMDL.hpp | 38 -------------------------- hecl/dataspec/hecl/MATR.hpp | 38 -------------------------- hecl/dataspec/hecl/STRG.hpp | 38 -------------------------- hecl/dataspec/hecl/TXTR.hpp | 49 --------------------------------- hecl/dataspec/hecl/hecl.cpp | 50 ---------------------------------- hecl/dataspec/hecl/hecl.pri | 2 -- hecl/dataspec/helpers.cpp | 51 ----------------------------------- hecl/dataspec/helpers.hpp | 17 ------------ hecl/dataspec/mp1/CMDL.hpp | 0 hecl/dataspec/mp1/MREA.hpp | 0 hecl/dataspec/mp1/mp1.cpp | 22 --------------- hecl/dataspec/mp1/mp1.pri | 6 ----- hecl/dataspec/mp2/CMDL.hpp | 0 hecl/dataspec/mp2/MREA.hpp | 0 hecl/dataspec/mp2/mp2.cpp | 22 --------------- hecl/dataspec/mp2/mp2.pri | 6 ----- hecl/dataspec/mp3/CMDL.hpp | 0 hecl/dataspec/mp3/MREA.hpp | 0 hecl/dataspec/mp3/mp3.cpp | 22 --------------- hecl/dataspec/mp3/mp3.pri | 6 ----- hecl/driver/ToolSpec.hpp | 22 +++++++-------- hecl/extern/RetroCommon | 2 +- hecl/extern/libSquish | 2 +- hecl/hecl.pro | 6 +++-- hecl/include/HECL.hpp | 1 + hecl/include/HECLDatabase.hpp | 26 +++++++++++++++--- hecl/lib/database/Project.cpp | 6 ++--- 30 files changed, 41 insertions(+), 490 deletions(-) delete mode 100644 hecl/dataspec/dataspec.cpp delete mode 100644 hecl/dataspec/dataspec.pro delete mode 100644 hecl/dataspec/hecl/DUMB.hpp delete mode 100644 hecl/dataspec/hecl/HMDL.hpp delete mode 100644 hecl/dataspec/hecl/MATR.hpp delete mode 100644 hecl/dataspec/hecl/STRG.hpp delete mode 100644 hecl/dataspec/hecl/TXTR.hpp delete mode 100644 hecl/dataspec/hecl/hecl.cpp delete mode 100644 hecl/dataspec/hecl/hecl.pri delete mode 100644 hecl/dataspec/helpers.cpp delete mode 100644 hecl/dataspec/helpers.hpp delete mode 100644 hecl/dataspec/mp1/CMDL.hpp delete mode 100644 hecl/dataspec/mp1/MREA.hpp delete mode 100644 hecl/dataspec/mp1/mp1.cpp delete mode 100644 hecl/dataspec/mp1/mp1.pri delete mode 100644 hecl/dataspec/mp2/CMDL.hpp delete mode 100644 hecl/dataspec/mp2/MREA.hpp delete mode 100644 hecl/dataspec/mp2/mp2.cpp delete mode 100644 hecl/dataspec/mp2/mp2.pri delete mode 100644 hecl/dataspec/mp3/CMDL.hpp delete mode 100644 hecl/dataspec/mp3/MREA.hpp delete mode 100644 hecl/dataspec/mp3/mp3.cpp delete mode 100644 hecl/dataspec/mp3/mp3.pri diff --git a/hecl/dataspec/dataspec.cpp b/hecl/dataspec/dataspec.cpp deleted file mode 100644 index 4e714af41..000000000 --- a/hecl/dataspec/dataspec.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "HECLDatabase.hpp" - -namespace HECL -{ -namespace Database -{ - -IDataSpec* NewDataSpec_little(); -IDataSpec* NewDataSpec_big(); -IDataSpec* NewDataSpec_revolution(); -IDataSpec* NewDataSpec_cafe(); - -IDataSpec* NewDataSpec_mp1(); -IDataSpec* NewDataSpec_mp2(); -IDataSpec* NewDataSpec_mp3(); - -const DataSpecEntry DATA_SPEC_REGISTRY[] = -{ - {_S("hecl-little"), _S("Targets little-endian PC apps using the HECL runtime"), NewDataSpec_little}, - {_S("hecl-big"), _S("Targets big-endian PC apps using the HECL runtime"), NewDataSpec_big}, - {_S("hecl-revolution"), _S("Targets Wii apps using the HECL runtime"), NewDataSpec_revolution}, - {_S("hecl-cafe"), _S("Targets Wii U apps using the HECL runtime"), NewDataSpec_cafe}, - {_S("mp1"), _S("Targets original Metroid Prime engine"), NewDataSpec_mp1}, - {_S("mp2"), _S("Targets original Metroid Prime 2 engine"), NewDataSpec_mp2}, - {_S("mp3"), _S("Targets original Metroid Prime 3 engine"), NewDataSpec_mp3}, - {} -}; - -} -} diff --git a/hecl/dataspec/dataspec.pro b/hecl/dataspec/dataspec.pro deleted file mode 100644 index edff6bc6c..000000000 --- a/hecl/dataspec/dataspec.pro +++ /dev/null @@ -1,29 +0,0 @@ -TEMPLATE = lib -CONFIG += staticlib -TARGET = hecl-dataspec -CONFIG -= Qt -QT = -unix:QMAKE_CXXFLAGS += -std=c++11 -unix:QMAKE_CFLAGS += -std=c99 -unix:LIBS += -std=c++11 -clang:QMAKE_CXXFLAGS += -stdlib=libc++ -clang:LIBS += -stdlib=libc++ -lc++abi - -INCLUDEPATH += $$PWD ../include ../extern \ -../extern/Athena/include -../extern/RetroCommon/include - -include(../extern/RetroCommon/RetroCommon.pri) - -include(hecl/hecl.pri) -include(mp1/mp1.pri) -include(mp2/mp2.pri) -include(mp3/mp3.pri) - -HEADERS += \ - helpers.hpp - -SOURCES += \ - helpers.cpp \ - dataspec.cpp - diff --git a/hecl/dataspec/hecl/DUMB.hpp b/hecl/dataspec/hecl/DUMB.hpp deleted file mode 100644 index 457391070..000000000 --- a/hecl/dataspec/hecl/DUMB.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef DUMB_HPP -#define DUMB_HPP - -#include "HECLDatabase.hpp" -#include "HECLRuntime.hpp" - -class CDUMBProject : public HECL::Database::ObjectBase -{ - using HECL::Database::ObjectBase::ObjectBase; - - bool _cookObject(FDataAppender dataAppender, - DataEndianness endianness, DataPlatform platform) - { - return true; - } - - void _gatherDeps(FDepAdder depAdder) - { - - } - -}; - -class CDUMBRuntime : public HECL::Runtime::ObjectBase -{ - using HECL::Runtime::ObjectBase::ObjectBase; - - bool _objectFinishedLoading(const void* data, size_t len) - { - return true; - } - - void _objectWillUnload() - { - - } - -}; - -#endif // DUMB_HPP diff --git a/hecl/dataspec/hecl/HMDL.hpp b/hecl/dataspec/hecl/HMDL.hpp deleted file mode 100644 index 9ca28086d..000000000 --- a/hecl/dataspec/hecl/HMDL.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef HMDL_HPP -#define HMDL_HPP - -#include "HECLDatabase.hpp" -#include "HECLRuntime.hpp" - -class CHMDLProject : public HECL::Database::ObjectBase -{ - using HECL::Database::ObjectBase::ObjectBase; - - bool _cookObject(FDataAppender dataAppender, - DataEndianness endianness, DataPlatform platform) - { - return true; - } - - void _gatherDeps(FDepAdder depAdder) - { - - } -}; - -class CHMDLRuntime : public HECL::Runtime::ObjectBase -{ - using HECL::Runtime::ObjectBase::ObjectBase; - - bool _objectFinishedLoading(const void* data, size_t len) - { - return true; - } - - void _objectWillUnload() - { - - } -}; - -#endif // HMDL_HPP diff --git a/hecl/dataspec/hecl/MATR.hpp b/hecl/dataspec/hecl/MATR.hpp deleted file mode 100644 index 7b682dc6c..000000000 --- a/hecl/dataspec/hecl/MATR.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef MATR_HPP -#define MATR_HPP - -#include "HECLDatabase.hpp" -#include "HECLRuntime.hpp" - -class CMATRProject : public HECL::Database::ObjectBase -{ - using HECL::Database::ObjectBase::ObjectBase; - - bool _cookObject(FDataAppender dataAppender, - DataEndianness endianness, DataPlatform platform) - { - return true; - } - - void _gatherDeps(FDepAdder depAdder) - { - - } -}; - -class CMATRRuntime : public HECL::Runtime::ObjectBase -{ - using HECL::Runtime::ObjectBase::ObjectBase; - - bool _objectFinishedLoading(const void* data, size_t len) - { - return true; - } - - void _objectWillUnload() - { - - } -}; - -#endif // MATR_HPP diff --git a/hecl/dataspec/hecl/STRG.hpp b/hecl/dataspec/hecl/STRG.hpp deleted file mode 100644 index d90b8f610..000000000 --- a/hecl/dataspec/hecl/STRG.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef STRG_HPP -#define STRG_HPP - -#include "HECLDatabase.hpp" -#include "HECLRuntime.hpp" - -class CSTRGProject : public HECL::Database::ObjectBase -{ - using HECL::Database::ObjectBase::ObjectBase; - - bool _cookObject(FDataAppender dataAppender, - DataEndianness endianness, DataPlatform platform) - { - return true; - } - - void _gatherDeps(FDepAdder depAdder) - { - - } -}; - -class CSTRGRuntime : public HECL::Runtime::ObjectBase -{ - using HECL::Runtime::ObjectBase::ObjectBase; - - bool _objectFinishedLoading(const void* data, size_t len) - { - return true; - } - - void _objectWillUnload() - { - - } -}; - -#endif // STRG_HPP diff --git a/hecl/dataspec/hecl/TXTR.hpp b/hecl/dataspec/hecl/TXTR.hpp deleted file mode 100644 index 943cdf49d..000000000 --- a/hecl/dataspec/hecl/TXTR.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef TXTR_HPP -#define TXTR_HPP - -#include "HECLDatabase.hpp" -#include "HECLRuntime.hpp" -#include "helpers.hpp" - -class CTXTRProject : public HECL::Database::ObjectBase -{ - using HECL::Database::ObjectBase::ObjectBase; - - bool _cookObject(FDataAppender dataAppender, - DataEndianness endianness, DataPlatform platform) - { - return true; - } - - void _gatherDeps(FDepAdder depAdder) - { - - } - -public: - static bool ClaimPath(const std::string& path, const std::string&) - { - if (!HECLHelpers::IsRegularFile(path)) - return false; - if (!HECLHelpers::ContainsMagic(path, "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 8)) - return false; - return true; - } -}; - -class CTXTRRuntime : public HECL::Runtime::ObjectBase -{ - using HECL::Runtime::ObjectBase::ObjectBase; - - bool _objectFinishedLoading(const void* data, size_t len) - { - return true; - } - - void _objectWillUnload() - { - - } -}; - -#endif // TXTR_HPP diff --git a/hecl/dataspec/hecl/hecl.cpp b/hecl/dataspec/hecl/hecl.cpp deleted file mode 100644 index 40d37cf1d..000000000 --- a/hecl/dataspec/hecl/hecl.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "HECLDatabase.hpp" - -namespace HECL -{ -namespace Database -{ - -class HECLBaseDataSpec : public IDataSpec -{ - -}; - -class HECLLittleDataSpec : public HECLBaseDataSpec -{ -}; - -class HECLBigDataSpec : public HECLBaseDataSpec -{ -}; - -class HECLRevolutionDataSpec : public HECLBaseDataSpec -{ -}; - -class HECLCafeDataSpec : public HECLBaseDataSpec -{ -}; - -IDataSpec* NewDataSpec_little() -{ - return new HECLLittleDataSpec(); -} - -IDataSpec* NewDataSpec_big() -{ - return new HECLBigDataSpec(); -} - -IDataSpec* NewDataSpec_revolution() -{ - return new HECLRevolutionDataSpec(); -} - -IDataSpec* NewDataSpec_cafe() -{ - return new HECLCafeDataSpec(); -} - -} -} diff --git a/hecl/dataspec/hecl/hecl.pri b/hecl/dataspec/hecl/hecl.pri deleted file mode 100644 index 965c4a673..000000000 --- a/hecl/dataspec/hecl/hecl.pri +++ /dev/null @@ -1,2 +0,0 @@ -SOURCES += \ - $$PWD/hecl.cpp diff --git a/hecl/dataspec/helpers.cpp b/hecl/dataspec/helpers.cpp deleted file mode 100644 index 1e76cd344..000000000 --- a/hecl/dataspec/helpers.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include "helpers.hpp" - -namespace HECLHelpers -{ - -bool IsRegularFile(const std::string& path) -{ - struct stat theStat; - if (stat(path.c_str(), &theStat)) - return false; - if (!S_ISREG(theStat.st_mode)) - return false; - return true; -} - -bool IsDirectoryFile(const std::string& path) -{ - struct stat theStat; - if (stat(path.c_str(), &theStat)) - return false; - if (!S_ISDIR(theStat.st_mode)) - return false; - return true; -} - -bool ContainsMagic(const std::string& path, const char* magicBuf, - size_t magicLen, size_t magicOff) -{ - if (!IsRegularFile(path)) - return false; - - FILE* fp = fopen(path.c_str(), "rb"); - if (!fp) - return false; - - char* readBuf[magicLen]; - fseek(fp, magicOff, SEEK_SET); - size_t readLen = fread(readBuf, 1, magicLen, fp); - fclose(fp); - - if (readLen < magicLen) - return false; - if (memcmp(readBuf, magicBuf, magicLen)) - return false; - return true; -} - -} diff --git a/hecl/dataspec/helpers.hpp b/hecl/dataspec/helpers.hpp deleted file mode 100644 index 48fce024c..000000000 --- a/hecl/dataspec/helpers.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef HELPERS_HPP -#define HELPERS_HPP - -#include - -namespace HECLHelpers -{ -bool IsRegularFile(const std::string& path); -bool IsDirectoryFile(const std::string& path); -bool ContainsMagic(const std::string& path, const char* magicBuf, - size_t magicLen, size_t magicOff=0); - -bool IsBlenderFile(const std::string& path); - -} - -#endif // HELPERS_HPP diff --git a/hecl/dataspec/mp1/CMDL.hpp b/hecl/dataspec/mp1/CMDL.hpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/hecl/dataspec/mp1/MREA.hpp b/hecl/dataspec/mp1/MREA.hpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/hecl/dataspec/mp1/mp1.cpp b/hecl/dataspec/mp1/mp1.cpp deleted file mode 100644 index 954b86acc..000000000 --- a/hecl/dataspec/mp1/mp1.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "HECLDatabase.hpp" - -#include "CMDL.hpp" -#include "MREA.hpp" - -namespace HECL -{ -namespace Database -{ - -class MP1DataSpec : public IDataSpec -{ - -}; - -IDataSpec* NewDataSpec_mp1() -{ - return new MP1DataSpec(); -} - -} -} diff --git a/hecl/dataspec/mp1/mp1.pri b/hecl/dataspec/mp1/mp1.pri deleted file mode 100644 index fbd40fca1..000000000 --- a/hecl/dataspec/mp1/mp1.pri +++ /dev/null @@ -1,6 +0,0 @@ -SOURCES += \ - $$PWD/mp1.cpp - -HEADERS += \ - $$PWD/MREA.hpp \ - $$PWD/CMDL.hpp diff --git a/hecl/dataspec/mp2/CMDL.hpp b/hecl/dataspec/mp2/CMDL.hpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/hecl/dataspec/mp2/MREA.hpp b/hecl/dataspec/mp2/MREA.hpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/hecl/dataspec/mp2/mp2.cpp b/hecl/dataspec/mp2/mp2.cpp deleted file mode 100644 index 14a610a71..000000000 --- a/hecl/dataspec/mp2/mp2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "HECLDatabase.hpp" - -#include "CMDL.hpp" -#include "MREA.hpp" - -namespace HECL -{ -namespace Database -{ - -class MP2DataSpec : public IDataSpec -{ - -}; - -IDataSpec* NewDataSpec_mp2() -{ - return new MP2DataSpec(); -} - -} -} diff --git a/hecl/dataspec/mp2/mp2.pri b/hecl/dataspec/mp2/mp2.pri deleted file mode 100644 index 11ac5182b..000000000 --- a/hecl/dataspec/mp2/mp2.pri +++ /dev/null @@ -1,6 +0,0 @@ -SOURCES += \ - $$PWD/mp2.cpp - -HEADERS += \ - $$PWD/MREA.hpp \ - $$PWD/CMDL.hpp diff --git a/hecl/dataspec/mp3/CMDL.hpp b/hecl/dataspec/mp3/CMDL.hpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/hecl/dataspec/mp3/MREA.hpp b/hecl/dataspec/mp3/MREA.hpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/hecl/dataspec/mp3/mp3.cpp b/hecl/dataspec/mp3/mp3.cpp deleted file mode 100644 index f60ac54f3..000000000 --- a/hecl/dataspec/mp3/mp3.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "HECLDatabase.hpp" - -#include "CMDL.hpp" -#include "MREA.hpp" - -namespace HECL -{ -namespace Database -{ - -class MP3DataSpec : public IDataSpec -{ - -}; - -IDataSpec* NewDataSpec_mp3() -{ - return new MP3DataSpec(); -} - -} -} diff --git a/hecl/dataspec/mp3/mp3.pri b/hecl/dataspec/mp3/mp3.pri deleted file mode 100644 index 502afb0ec..000000000 --- a/hecl/dataspec/mp3/mp3.pri +++ /dev/null @@ -1,6 +0,0 @@ -SOURCES += \ - $$PWD/mp3.cpp - -HEADERS += \ - $$PWD/MREA.hpp \ - $$PWD/CMDL.hpp diff --git a/hecl/driver/ToolSpec.hpp b/hecl/driver/ToolSpec.hpp index 790ec86cf..42c5be4a5 100644 --- a/hecl/driver/ToolSpec.hpp +++ b/hecl/driver/ToolSpec.hpp @@ -47,7 +47,7 @@ public: bool found = false; for (auto& spec : specs) { - if (!spec.first.name.compare(*it)) + if (!spec.first.m_name.compare(*it)) { found = true; break; @@ -90,15 +90,13 @@ public: { if (!m_info.project) { - for (const HECL::Database::DataSpecEntry* spec = HECL::Database::DATA_SPEC_REGISTRY; - spec->name.size(); - ++spec) + for (const HECL::Database::DataSpecEntry* spec : HECL::Database::DATA_SPEC_REGISTRY) { if (XTERM_COLOR) - HECL::Printf(_S("" BOLD CYAN "%s" NORMAL "\n"), spec->name.c_str()); + HECL::Printf(_S("" BOLD CYAN "%s" NORMAL "\n"), spec->m_name.c_str()); else - HECL::Printf(_S("%s\n"), spec->name.c_str()); - HECL::Printf(_S(" %s\n"), spec->desc.c_str()); + HECL::Printf(_S("%s\n"), spec->m_name.c_str()); + HECL::Printf(_S(" %s\n"), spec->m_desc.c_str()); } return 0; } @@ -109,9 +107,9 @@ public: for (auto& spec : specs) { if (XTERM_COLOR) - HECL::Printf(_S("" BOLD CYAN "%s" NORMAL ""), spec.first.name.c_str()); + HECL::Printf(_S("" BOLD CYAN "%s" NORMAL ""), spec.first.m_name.c_str()); else - HECL::Printf(_S("%s"), spec.first.name.c_str()); + HECL::Printf(_S("%s"), spec.first.m_name.c_str()); if (spec.second) { if (XTERM_COLOR) @@ -119,7 +117,7 @@ public: else HECL::Printf(_S(" [ENABLED]")); } - HECL::Printf(_S("\n %s\n"), spec.first.desc.c_str()); + HECL::Printf(_S("\n %s\n"), spec.first.m_desc.c_str()); } return 0; } @@ -133,9 +131,9 @@ public: HECL::ToLower(itName); for (auto& spec : specs) { - if (!spec.first.name.compare(itName)) + if (!spec.first.m_name.compare(itName)) { - opSpecs.push_back(spec.first.name); + opSpecs.push_back(spec.first.m_name); break; } } diff --git a/hecl/extern/RetroCommon b/hecl/extern/RetroCommon index af64e5539..1e7f39e4c 160000 --- a/hecl/extern/RetroCommon +++ b/hecl/extern/RetroCommon @@ -1 +1 @@ -Subproject commit af64e55395e2e262d2d25715e15c2518024d21f2 +Subproject commit 1e7f39e4c540b675f472fe0d60a2ed8dc8073634 diff --git a/hecl/extern/libSquish b/hecl/extern/libSquish index 7c6789543..1d3ed2763 160000 --- a/hecl/extern/libSquish +++ b/hecl/extern/libSquish @@ -1 +1 @@ -Subproject commit 7c67895430d88d4971e3197f9a4eeba3ba0f6d35 +Subproject commit 1d3ed2763636ef7d049644c7ddc7fb905e52e254 diff --git a/hecl/hecl.pro b/hecl/hecl.pro index 1ec2b4aec..ba9020dc5 100644 --- a/hecl/hecl.pro +++ b/hecl/hecl.pro @@ -20,13 +20,15 @@ HEADERS += \ SUBDIRS += \ extern/blowfish \ extern/libpng \ + extern/libSquish \ + extern/RetroCommon \ blender \ lib \ - dataspec \ driver driver.depends = extern/blowfish driver.depends = extern/libpng +driver.depends = extern/libSquish +driver.depends = extern/RetroCommon driver.depends = blender driver.depends = lib -driver.depends = dataspec diff --git a/hecl/include/HECL.hpp b/hecl/include/HECL.hpp index 2b3377fa7..edf94ff16 100644 --- a/hecl/include/HECL.hpp +++ b/hecl/include/HECL.hpp @@ -10,6 +10,7 @@ char* win_realpath(const char* name, char* restrict resolved); #include #include #include +#include #endif #include diff --git a/hecl/include/HECLDatabase.hpp b/hecl/include/HECLDatabase.hpp index 763862720..bc65ec36b 100644 --- a/hecl/include/HECLDatabase.hpp +++ b/hecl/include/HECLDatabase.hpp @@ -117,16 +117,34 @@ public: {(void)project;(void)info;} }; +/** + * @brief Pre-emptive indication of what the constructed DataSpec is used for + */ +enum DataSpecTool +{ + TOOL_EXTRACT, + TOOL_COOK, + TOOL_PACKAGE +}; + +extern std::vector DATA_SPEC_REGISTRY; + /** * @brief IDataSpec registry entry + * + * Auto-registers with data spec registry */ struct DataSpecEntry { - SystemString name; - SystemString desc; - std::function factory; + SystemString m_name; + SystemString m_desc; + std::function m_factory; + + DataSpecEntry(SystemString&& name, SystemString&& desc, + std::function&& factory) + : m_name(std::move(name)), m_desc(std::move(desc)), m_factory(std::move(factory)) + {DATA_SPEC_REGISTRY.push_back(this);} }; -extern const HECL::Database::DataSpecEntry DATA_SPEC_REGISTRY[]; /** * @brief Base object to subclass for integrating with key project operations diff --git a/hecl/lib/database/Project.cpp b/hecl/lib/database/Project.cpp index 2d656678b..4eb42d8e1 100644 --- a/hecl/lib/database/Project.cpp +++ b/hecl/lib/database/Project.cpp @@ -271,11 +271,9 @@ void Project::rescanDataSpecs() { m_compiledSpecs.clear(); m_specs.lockAndRead(); - for (const DataSpecEntry* spec = DATA_SPEC_REGISTRY; - spec->name.size(); - ++spec) + for (const DataSpecEntry* spec : DATA_SPEC_REGISTRY) { - SystemUTF8View specUTF8(spec->name); + SystemUTF8View specUTF8(spec->m_name); m_compiledSpecs.push_back({*spec, m_specs.checkForLine(specUTF8.utf8_str()) ? true : false}); } m_specs.unlockAndDiscard();